summaryrefslogtreecommitdiff
path: root/src/main/ActiveThorns.c
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-08-26 15:34:20 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>1999-08-26 15:34:20 +0000
commit5e90d4682484a0b9cbc232d0005bcda3895f6c9f (patch)
treed14c7ec57f48fd431663326f9c7b55900846aa47 /src/main/ActiveThorns.c
parent9a643dc37c6334abd06d70688d2e1494c435bbf2 (diff)
New parameter stuff.
Now a non-active thorn's extensions to parameters shouldn't be valid, range checking is now done, even for strings, which must conform to a regular expression. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@859 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ActiveThorns.c')
-rw-r--r--src/main/ActiveThorns.c110
1 files changed, 106 insertions, 4 deletions
diff --git a/src/main/ActiveThorns.c b/src/main/ActiveThorns.c
index 3793b537..943958e3 100644
--- a/src/main/ActiveThorns.c
+++ b/src/main/ActiveThorns.c
@@ -11,13 +11,12 @@
#include <stdlib.h>
#include <string.h>
-#include "cctk_ActiveThorns.h"
#include "SKBinTree.h"
+#include "cctk_ActiveThorns.h"
static char *rcsid = "$Header$";
-
/* Local routine */
static int CCTK_RegisterImp(const char *name, const char *thorn);
@@ -39,6 +38,8 @@ struct IMPLEMENTATION
static t_sktree *thornlist = NULL;
static t_sktree *implist = NULL;
+static int n_thorns = 0;
+static int n_imps = 0;
/*@@
@routine CCTKi_RegisterThorn
@@ -62,14 +63,14 @@ int CCTKi_RegisterThorn(const char *name, const char *imp)
struct THORN *thorn;
- printf("Registering thorn %s, which provides %s\n", name, imp);
+ /* printf("Registering thorn %s, which provides %s\n", name, imp);*/
/* Does the thorn already exist ? */
node = SKTreeFindNode(thornlist, name);
if(!node)
{
-
+ n_thorns++;
/* Create the structure to hold thorn info. */
thorn = (struct THORN *)malloc(sizeof(struct THORN));
@@ -146,6 +147,8 @@ static int CCTK_RegisterImp(const char *name, const char *thorn)
if(!node)
{
+ n_imps++;
+
/* Create the structure to hold info about it. */
imp = (struct IMPLEMENTATION *)malloc(sizeof(struct IMPLEMENTATION));
@@ -425,3 +428,102 @@ int CCTKi_ListImplementations(FILE *file, const char *format, int active)
return retval;
}
+
+int CCTK_ImpList(int active, char ***list, int *n_implementations)
+{
+ int retval;
+ t_sktree *node;
+
+ struct IMPLEMENTATION *imp;
+
+ retval = 0;
+
+
+ *list = (char **)malloc(n_imps*sizeof(char *));
+
+ for(node= SKTreeFindFirst(implist), *n_implementations = 0;
+ node;
+ node = node->next, retval++)
+ {
+ imp = (struct IMPLEMENTATION *)(node->data);
+
+ if(imp->active || !active)
+ {
+ (*list)[*n_implementations] = (char *) malloc(strlen(node->key)+1);
+ strcpy((*list)[*n_implementations], node->key);
+ (*n_implementations)++;
+ }
+ }
+
+ return retval;
+}
+
+const char *CCTK_ActivatingThorn(const char *name)
+{
+ const char *retval;
+
+ t_sktree *node;
+
+ struct IMPLEMENTATION *imp;
+
+ /* Find the implementation */
+ node = SKTreeFindNode(implist, name);
+
+ retval = NULL;
+
+ if(node)
+ {
+ imp = (struct IMPLEMENTATION *)(node->data);
+
+ if(imp->active)
+ {
+ retval = imp->activating_thorn;
+ }
+ }
+
+ return retval;
+}
+
+
+
+ /*@@
+ @routine CCTK_ImpThornList
+ @date Tue Jul 27 09:15:58 1999
+ @author Tom Goodale
+ @desc
+ Return the thorns for an implementation.
+ For now return an sktree - FIXME
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+@@*/
+t_sktree *CCTK_ImpThornList(const char *name)
+{
+ t_sktree *retval;
+
+ t_sktree *node;
+
+ struct IMPLEMENTATION *imp;
+
+
+ /* Find the implementation */
+ node = SKTreeFindNode(implist, name);
+
+
+ if(node)
+ {
+ imp = (struct IMPLEMENTATION *)(node->data);
+
+ retval = imp->thornlist;
+ }
+ else
+ {
+ retval = NULL;
+ }
+
+ return retval;
+}