summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-07-04 23:41:24 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-07-04 23:41:24 +0000
commit287abd55c7e41b10718810c7dec8b3bf939d8cf6 (patch)
tree4eb755d86c94c05c4c40328f94909fbb55ddd4f8 /src
parent794d6731bfea7f0631cda58a8a8f084f2d9195b8 (diff)
The ActiveThorns parameter now works.
Note that this means the testsuites now need to be changed to include the parameter. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@648 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src')
-rw-r--r--src/main/ActiveThorns.c36
-rw-r--r--src/main/InitialiseDataStructures.c2
-rw-r--r--src/main/SetParams.c9
3 files changed, 30 insertions, 17 deletions
diff --git a/src/main/ActiveThorns.c b/src/main/ActiveThorns.c
index 64f0d331..00db62c3 100644
--- a/src/main/ActiveThorns.c
+++ b/src/main/ActiveThorns.c
@@ -17,8 +17,10 @@
static char *rcsid = "$Header$";
+/* Local routine */
static int CCTKi_RegisterImp(const char *name, const char *thorn);
+/* Structures used to store data */
struct THORN
{
int active;
@@ -59,10 +61,13 @@ int CCTK_RegisterThorn(const char *name, const char *imp)
printf("Registering thorn %s, which provides %s\n", name, imp);
+ /* Does the thorn already exist ? */
node = SKTreeFindNode(thornlist, name);
if(!node)
{
+
+ /* Create the structure to hold thorn info. */
thorn = (struct THORN *)malloc(sizeof(struct THORN));
if(thorn)
@@ -71,15 +76,19 @@ int CCTK_RegisterThorn(const char *name, const char *imp)
if(thorn->implementation)
{
+ /* Fill out data for the thorn. */
strcpy(thorn->implementation, imp);
thorn->active = 0;
+ /* Store the data in the tree */
temp = SKTreeStoreData(thornlist, thornlist, name, thorn);
if(!thornlist) thornlist = temp;
if(temp)
{
+
+ /* Register the implementation */
CCTKi_RegisterImp(imp, name);
retval = 0;
@@ -104,9 +113,6 @@ int CCTK_RegisterThorn(const char *name, const char *imp)
retval = -1;
}
-
- printf("Registration retval is %d\n", retval);
-
return retval;
}
@@ -132,17 +138,19 @@ static int CCTKi_RegisterImp(const char *name, const char *thorn)
struct IMPLEMENTATION *imp;
- printf("Registering implementation %s\n", name);
-
+ /* Does the implementation already exist ? */
node = SKTreeFindNode(implist, name);
if(!node)
{
+ /* Create the structure to hold info about it. */
imp = (struct IMPLEMENTATION *)malloc(sizeof(struct IMPLEMENTATION));
if(imp)
{
imp->active = 0;
+
+ /* Store the info in the tree. */
temp = SKTreeStoreData(implist, implist, name, imp);
if(!implist) implist = temp;
@@ -166,8 +174,6 @@ static int CCTKi_RegisterImp(const char *name, const char *thorn)
retval = -1;
}
- printf("Registration retval is %d\n", retval);
-
return retval;
}
@@ -196,14 +202,16 @@ int CCTK_ActivateThorn(const char *name)
struct THORN *thorn;
struct IMPLEMENTATION *imp;
- printf("Activating thorn %s\n", name);
+ printf("Activating thorn %s...", name);
+ /* Find the thorn */
thornnode = SKTreeFindNode(thornlist, name);
if(thornnode)
{
thorn = (struct THORN *)(thornnode->data);
+ /* Find the implementation */
impnode = SKTreeFindNode(implist, thorn->implementation);
if(impnode)
@@ -214,21 +222,21 @@ int CCTK_ActivateThorn(const char *name)
{
if(!imp->active)
{
-
- printf("Active thorn %s -> imp %s\n", name, thorn->implementation);
+ /* Activate the thorn. */
+ printf("Success -> active implementation %s\n", name, thorn->implementation);
thorn->active = 1;
imp->active = 1;
retval = 0;
}
else
{
- printf("Implementation %s already active\n", thorn->implementation);
+ printf("Failure -> Implementation %s already active\n", thorn->implementation);
retval = -4;
}
}
else
{
- printf("Thorn %s already active\n", name);
+ printf("Failure -> Thorn %s already active\n", name);
retval = -3;
}
}
@@ -240,7 +248,7 @@ int CCTK_ActivateThorn(const char *name)
}
else
{
- printf("Tried to activate non-existent thorn %s\n", name);
+ printf("Failure -> non-existent thorn.\n");
retval = -1;
}
@@ -270,6 +278,7 @@ int CCTK_IsThornActive(const char *name)
struct THORN *thorn;
+ /* Find the thorn */
node = SKTreeFindNode(thornlist, name);
retval = 0;
@@ -309,6 +318,7 @@ int CCTK_IsImplementationActive(const char *name)
struct IMPLEMENTATION *imp;
+ /* Find the implementation */
node = SKTreeFindNode(implist, name);
retval = 0;
diff --git a/src/main/InitialiseDataStructures.c b/src/main/InitialiseDataStructures.c
index 06de67af..fb416ada 100644
--- a/src/main/InitialiseDataStructures.c
+++ b/src/main/InitialiseDataStructures.c
@@ -12,6 +12,7 @@
#include <string.h>
#include "flesh.h"
+#include "ActiveThorns.h"
static char *rcsid = "$Id$";
@@ -49,6 +50,7 @@ int InitialiseDataStructures(tFleshConfig *ConfigData)
CCTK_BindingsVariablesInitialise();
CCTK_BindingsScheduleInitialise();
+ CCTK_ActivateThorn("Cactus");
return 0;
}
diff --git a/src/main/SetParams.c b/src/main/SetParams.c
index 297b66d8..4cf65490 100644
--- a/src/main/SetParams.c
+++ b/src/main/SetParams.c
@@ -31,9 +31,11 @@ int CCTK_SetParameter(const char *parameter, const char *value)
char thornname[101];
const char *position;
int length;
-
+ int n_errors;
+
if(CCTK_Equals(parameter, "ActiveThorns"))
{
+ n_errors = 0;
position = value;
while(*position)
@@ -47,10 +49,9 @@ int CCTK_SetParameter(const char *parameter, const char *value)
}
thornname[length] = '\0';
- CCTK_ActivateThorn(thornname);
- if(position) position++;
+ n_errors += CCTK_ActivateThorn(thornname) != 0;
+ if(*position) position++;
}
- CCTK_ActivateThorn("Cactus");
}
else
{