diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-01-13 22:48:03 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-01-13 22:48:03 +0000 |
commit | 8dc3521fe981b2eb6815c44bc9649dd62a5848dc (patch) | |
tree | c3829f481a658c72de463c6635019890579ad2e2 /src/main/InitialiseDataStructures.c | |
parent | 1e947263c8f387494c2b97f1820a82e06a711f30 (diff) |
Further work on parameters.
Will now read in and parse parameters.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@51 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/InitialiseDataStructures.c')
-rw-r--r-- | src/main/InitialiseDataStructures.c | 83 |
1 files changed, 81 insertions, 2 deletions
diff --git a/src/main/InitialiseDataStructures.c b/src/main/InitialiseDataStructures.c index 49716d9b..dfe254e3 100644 --- a/src/main/InitialiseDataStructures.c +++ b/src/main/InitialiseDataStructures.c @@ -15,6 +15,8 @@ #define TEST_THORNREGISTRATION #ifdef TEST_THORNREGISTRATION +int test_startup(); +int test_rfr_init(cGH *); int test_param_init(); int test_param_set(const char *, const char *); int test_param_get(const char *, void **); @@ -23,7 +25,7 @@ int test_protected_group_setup(cGH *); int test_public_group_setup(cGH *); -static t_thorndata thorndata[] = {"test", "test", test_param_init, test_param_set, test_param_get, test_private_group_setup, test_protected_group_setup, test_public_group_setup}; +static t_thorndata thorndata[] = {"test", "test", test_startup, test_rfr_init, test_param_init, test_param_set, test_param_get, test_private_group_setup, test_protected_group_setup, test_public_group_setup}; static int n_thorns=1; @@ -50,15 +52,92 @@ int InitialiseDataStructures(tFleshConfig *ConfigData) #ifdef TEST_THORNREGISTRATION +static struct +{ + int test_int; + double test_double; + char test_keyword[20]; +} test_params = {1,1.5,"alpha"}; + +int test_startup() +{ +} + +int test_rfr_init(cGH *GH) +{ +} + int test_param_init() { } int test_param_set(const char *param, const char *value) { + char temp[1001]; + char *test; + int p; + + if(!strcmp(param, "test_int")) + { + test_params.test_int = atoi(value); + } + + if(!strcmp(param, "test_double")) + { + strncpy(temp, value, 1000); + + for (p=0;p<strlen(temp);p++) + if (temp[p] == 'E' || temp[p] == 'd' || temp[p] == 'D') + temp[p] = 'e'; + test_params.test_double = atof(temp); + } + + if(!strcmp(param, "test_keyword")) + { + if(!strcmp(value,"alpha")|| + !strcmp(value,"beta")) + { + strcpy(test_params.test_keyword, value); + } + } + } -int test_param_get(const char *name, void **value) + +int test_param_get(const char *param, void **value) { + int retval; + + int *temp_int; + double *temp_double; + char *temp_char; + + retval = 0; + if(!strcmp(param, "test_int")) + { + temp_int = (int *)malloc(sizeof(int)); + *temp_int = test_params.test_int; + *value = (void *)temp_int; + retval = 1; + } + + if(!strcmp(param, "test_double")) + { + temp_double = (double *)malloc(sizeof(double)); + *temp_double = test_params.test_double; + *value = (void *)temp_double; + retval = 2; + } + + if(!strcmp(param, "test_keyword")) + { + temp_char = (char *)malloc(strlen((test_params.test_keyword)+1)*sizeof(char)); + strcpy(temp_char, test_params.test_keyword); + *value = (void *)temp_char; + retval = 3; + } + + return retval; + } int test_private_group_setup(cGH *GH) { |