aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2001-09-20 21:48:03 +0000
committertradke <tradke@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2001-09-20 21:48:03 +0000
commit64783aa042ccb906c1bd2d8394fc64278b0aea2b (patch)
tree22378b6e3f48dc92397c2112eb186b9c0721ac67
parent44b3f0be9b857bd6bf4a72a4837ccc85682037cd (diff)
gcc compiler warnings fixed.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@134 1faa4e14-9dd3-4be0-9f0e-ffe519881164
-rw-r--r--src/Parameters.c2
-rw-r--r--src/Server.c120
-rw-r--r--src/Startup.c6
-rw-r--r--src/http_Expression.h2
4 files changed, 34 insertions, 96 deletions
diff --git a/src/Parameters.c b/src/Parameters.c
index 643f7b1..6312e05 100644
--- a/src/Parameters.c
+++ b/src/Parameters.c
@@ -473,7 +473,7 @@ static int ThornParameterPage(cGH *cctkGH, httpRequest *request, void *data)
{
/* Steerable boolean */
param_bool =
- *((CCTK_INT *)CCTK_ParameterGet(pData->name,thorn,&param_type));
+ *((const CCTK_INT *)CCTK_ParameterGet(pData->name,thorn,&param_type));
sprintf(message,
"%s<TR>\n"
"<TD ALIGN=LEFT VALIGN=CENTER>"
diff --git a/src/Server.c b/src/Server.c
index cb6cf7e..53f170d 100644
--- a/src/Server.c
+++ b/src/Server.c
@@ -18,6 +18,7 @@
#include "cctk_Groups.h"
#include "cctk_GroupsOnGH.h"
#include "cctk_Parameter.h"
+#include "cctk_Parameters.h"
#include "util_Hash.h"
#include "util_String.h"
@@ -48,9 +49,9 @@ typedef struct
static httpPage *CreatePageData(int (*function)(cGH *,httpRequest *, void *), void *data);
static httpPage *FindPage(char *path, char **residual);
-static int StatusUntilIt(cGH *cctkGH);
-static int StatusUntilTime(cGH *cctkGH);
-static int StatusUntilExpression(cGH *cctkGH);
+static int StatusUntilIt (const cGH *cctkGH);
+static int StatusUntilTime (const cGH *cctkGH);
+static int StatusUntilExpression (cGH *cctkGH);
static double evaluator(const char *name, void *data);
@@ -227,42 +228,18 @@ int HTTP_RegisterPage(const char *path, int (*function)(cGH *, httpRequest *, vo
@@*/
int HTTP_UpdateState(cGH *cctkGH, httpState *state)
{
- int type;
- CCTK_INT *value;
- int pause_selected;
- int until_it_selected;
- int until_time_selected;
- int until_expression_selected;
+ DECLARE_CCTK_PARAMETERS
int stepping;
-
static int steering = 1;
static int last_steered = -1;
- value = (CCTK_INT *)CCTK_ParameterGet("single_step",CCTK_THORNSTRING, &type);
-
- stepping = *value;
-
- value = (CCTK_INT *)CCTK_ParameterGet("pause",CCTK_THORNSTRING, &type);
-
- pause_selected = *value;
-
- value = (CCTK_INT *)CCTK_ParameterGet("until_it_active",CCTK_THORNSTRING, &type);
-
- until_it_selected = *value;
-
- value = (CCTK_INT *)CCTK_ParameterGet("until_time_active",CCTK_THORNSTRING, &type);
-
- until_time_selected = *value;
-
- value = (CCTK_INT *)CCTK_ParameterGet("until_expression_active",CCTK_THORNSTRING, &type);
-
- until_expression_selected = *value;
+ stepping = single_step;
state->paused = (! stepping) &&
- (pause_selected || (cctkGH &&
- ((until_it_selected && StatusUntilIt(cctkGH)) ||
- (until_time_selected && StatusUntilTime(cctkGH)) ||
- (until_expression_selected && StatusUntilExpression(cctkGH)))));
+ (pause || (cctkGH &&
+ ((until_it_active && StatusUntilIt(cctkGH)) ||
+ (until_time_active && StatusUntilTime(cctkGH)) ||
+ (until_expression_active && StatusUntilExpression(cctkGH)))));
/* If single step is selected, need to reset the parameter to force a pause
* next time.
@@ -272,15 +249,12 @@ int HTTP_UpdateState(cGH *cctkGH, httpState *state)
HTTP_SteerQueue(CCTK_THORNSTRING, "single_step", "no");
}
-
if(cctkGH && ! state->paused)
{
if(steering)
{
- value = (CCTK_INT *)CCTK_ParameterGet("steering_frequency",CCTK_THORNSTRING, &type);
-
- if(*value > 0 &&
- *value+last_steered <= cctkGH->cctk_iteration)
+ if(steering_frequency > 0 &&
+ steering_frequency+last_steered <= cctkGH->cctk_iteration)
{
/* Time to steer */
state->steer = 1;
@@ -291,7 +265,7 @@ int HTTP_UpdateState(cGH *cctkGH, httpState *state)
state->steer = 0;
}
- if(*value <= 0)
+ if(steering_frequency <= 0)
{
/* Once steering is switched off, can't restart it ! */
steering = 0;
@@ -303,21 +277,11 @@ int HTTP_UpdateState(cGH *cctkGH, httpState *state)
state->steer = 1;
}
-
- value = (CCTK_INT *)CCTK_ParameterGet("terminate",CCTK_THORNSTRING, &type);
-
- state->terminate = *value;
-
+ state->terminate = terminate;
if(!state->paused)
{
-
- value = (CCTK_INT *)CCTK_ParameterGet("timeout_seconds",CCTK_THORNSTRING, &type);
-
- state->timeout_seconds = *value;
-
- value = (CCTK_INT *)CCTK_ParameterGet("timeout_useconds",CCTK_THORNSTRING, &type);
-
- state->timeout_useconds = *value;
+ state->timeout_seconds = timeout_seconds;
+ state->timeout_useconds = timeout_useconds;
}
else
{
@@ -483,26 +447,15 @@ static httpPage *FindPage(char *path, char **residual)
@endhistory
@@*/
-static int StatusUntilIt(cGH *cctkGH)
+static int StatusUntilIt (const cGH *cctkGH)
{
- int retval;
- CCTK_INT *value;
- int type;
+ DECLARE_CCTK_PARAMETERS
- value = (CCTK_INT *)CCTK_ParameterGet("until_it",CCTK_THORNSTRING, &type);
- if(cctkGH && *value <= cctkGH->cctk_iteration)
- {
- retval = 1;
- }
- else
- {
- retval = 0;
- }
-
- return retval;
+ return (cctkGH && until_it <= cctkGH->cctk_iteration);
}
+
/*@@
@routine StatusUntilTime
@date Tue Sep 19 23:00:16 2000
@@ -517,26 +470,15 @@ static int StatusUntilIt(cGH *cctkGH)
@endhistory
@@*/
-static int StatusUntilTime(cGH *cctkGH)
+static int StatusUntilTime (const cGH *cctkGH)
{
- int retval;
- CCTK_REAL *value;
- int type;
+ DECLARE_CCTK_PARAMETERS
- value = (CCTK_REAL *)CCTK_ParameterGet("until_time",CCTK_THORNSTRING, &type);
- if(cctkGH && *value <= cctkGH->cctk_time)
- {
- retval = 1;
- }
- else
- {
- retval = 0;
- }
-
- return retval;
+ return (cctkGH && until_time <= cctkGH->cctk_time);
}
+
/*@@
@routine StatusUntilExpression
@date Tue Sep 19 23:00:47 2000
@@ -551,18 +493,16 @@ static int StatusUntilTime(cGH *cctkGH)
@endhistory
@@*/
-static int StatusUntilExpression(cGH *cctkGH)
+static int StatusUntilExpression (cGH *cctkGH)
{
+ DECLARE_CCTK_PARAMETERS
static char *parsed_expression = NULL;
static int times_set = -1;
-
int new_times_set;
int retval;
-
- const char **value;
- int type;
char *copy;
+
/* See if we need to parse the expression again. */
new_times_set = CCTK_ParameterQueryTimesSet("until_expression",
CCTK_THORNSTRING);
@@ -570,13 +510,11 @@ static int StatusUntilExpression(cGH *cctkGH)
if(new_times_set > times_set)
{
times_set = new_times_set;
- value = (const char **)CCTK_ParameterGet("until_expression",CCTK_THORNSTRING, &type);
-
if(parsed_expression)
{
free(parsed_expression);
}
- parsed_expression = HTTP_ExpressionParse(*value);
+ parsed_expression = HTTP_ExpressionParse(until_expression);
}
if(parsed_expression && strlen(parsed_expression) > 0 && cctkGH)
@@ -585,7 +523,7 @@ static int StatusUntilExpression(cGH *cctkGH)
copy = Util_Strdup(parsed_expression);
/* Evaluate the expression */
- retval = HTTP_ExpressionEvaluate(copy, evaluator, (void *)cctkGH);
+ retval = HTTP_ExpressionEvaluate(copy, evaluator, cctkGH);
/* Free the copy */
free(copy);
diff --git a/src/Startup.c b/src/Startup.c
index d87805e..f29037a 100644
--- a/src/Startup.c
+++ b/src/Startup.c
@@ -252,7 +252,7 @@ int HTTP_Shutdown(void)
#ifdef CCTK_PTHREADS
static void * HTTP_Thread(void *cctkGH)
{
- CCTK_INT *terminate;
+ CCTK_INT terminate;
int type;
do
@@ -260,9 +260,9 @@ static void * HTTP_Thread(void *cctkGH)
/* Only poll for a few seconds in case we are terminated */
HTTP_Poll((cGH *)cctkGH, 10, 0);
- terminate = (CCTK_INT *)CCTK_ParameterGet("terminate",CCTK_THORNSTRING, &type);
+ terminate = *(const CCTK_INT *)CCTK_ParameterGet("terminate",CCTK_THORNSTRING, &type);
- } while(! *terminate);
+ } while(! terminate);
return NULL;
}
diff --git a/src/http_Expression.h b/src/http_Expression.h
index 6c7b7c7..57c3a72 100644
--- a/src/http_Expression.h
+++ b/src/http_Expression.h
@@ -19,7 +19,7 @@ extern "C"
char *HTTP_ExpressionParse(const char *expression);
double HTTP_ExpressionEvaluate(char *buffer,
- double (*eval)(const char *, void *),
+ double (eval)(const char *, void *),
void *data);
#ifdef __cplusplus