aboutsummaryrefslogtreecommitdiff
path: root/src/Server.c
diff options
context:
space:
mode:
authorgoodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-20 20:33:37 +0000
committergoodale <goodale@1faa4e14-9dd3-4be0-9f0e-ffe519881164>2000-09-20 20:33:37 +0000
commita6c41c514585e34820beaa0161e74cb95b51bf8f (patch)
tree3b39b46224698e6960188732b6f10ccc59bb77b5 /src/Server.c
parent062b28b59d87914417ecae8e96b28437e69d8159 (diff)
Bug fixes for the until expression stuff.
Added numbers, iteration count and simulation time to items allowed in an expression - so can do iteration+40 < time*100 to stop the simulation when this condition becomes true, should you want to 8-) Tom git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@69 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/Server.c')
-rw-r--r--src/Server.c57
1 files changed, 36 insertions, 21 deletions
diff --git a/src/Server.c b/src/Server.c
index 7364259..e9da4a0 100644
--- a/src/Server.c
+++ b/src/Server.c
@@ -23,6 +23,7 @@
#include "httpd.h"
+#include "http_Steer.h"
#include "http_Expression.h"
static char *rcsid = "$Header$";
@@ -553,7 +554,7 @@ static int StatusUntilExpression(cGH *cctkGH)
int new_times_set;
int retval;
- const char *value;
+ const char **value;
int type;
char *copy;
@@ -564,14 +565,13 @@ 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);
+ 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(*value);
}
if(parsed_expression && strlen(parsed_expression) > 0 && cctkGH)
@@ -621,25 +621,40 @@ static double evaluator(const char *expression, void *data)
varindex = CCTK_VarIndex(expression);
- vartype = CCTK_VarTypeI(varindex);
-
- pointer = CCTK_VarDataPtrI(cctkGH, 0, varindex);
+ if(varindex > -1)
+ {
+ vartype = CCTK_VarTypeI(varindex);
- switch(vartype)
+ pointer = CCTK_VarDataPtrI(cctkGH, 0, varindex);
+
+ switch(vartype)
+ {
+ case CCTK_VARIABLE_CHAR :
+ retval = *((CCTK_CHAR *)pointer);
+ break;
+ case CCTK_VARIABLE_INT :
+ retval = *((CCTK_INT *)pointer);
+ break;
+ case CCTK_VARIABLE_REAL :
+ retval = *((CCTK_REAL *)pointer);
+ break;
+ default :
+ fprintf(stderr, "Unsupported variable type %d\n", vartype);
+ retval = 0;
+ }
+ }
+ else if(CCTK_Equals(expression,"time"))
+ {
+ retval = cctkGH->cctk_time;
+ }
+ else if(CCTK_Equals(expression,"iteration"))
{
- case CCTK_VARIABLE_CHAR :
- retval = *((CCTK_CHAR *)pointer);
- break;
- case CCTK_VARIABLE_INT :
- retval = *((CCTK_INT *)pointer);
- break;
- case CCTK_VARIABLE_REAL :
- retval = *((CCTK_REAL *)pointer);
- break;
- default :
- fprintf(stderr, "Unsupported variable type %d\n", vartype);
- retval = 0;
- }
+ retval = cctkGH->cctk_iteration;
+ }
+ else
+ {
+ retval = strtod(expression,NULL);
+ }
return retval;
}