summaryrefslogtreecommitdiff
path: root/src/main/ActiveThorns.c
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-10-23 15:51:19 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-10-23 15:51:19 +0000
commit0fc40ed3db77a5da6f09caa9de68f731c930a6fb (patch)
treee7ff016638f34c2ee5a66780a4cbe072190285a0 /src/main/ActiveThorns.c
parent78b87ac6315ceaad35752eaa179c7d0e137ad8ab (diff)
Added a function which returns a list of required (=inherited+friends) implementations for a given implementation.
I don't like the function name too much, so it may change in the next couple of weeks uStringList *CCTK_ImplementationRequires(const char *imp) git-svn-id: http://svn.cactuscode.org/flesh/trunk@2425 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/ActiveThorns.c')
-rw-r--r--src/main/ActiveThorns.c57
1 files changed, 53 insertions, 4 deletions
diff --git a/src/main/ActiveThorns.c b/src/main/ActiveThorns.c
index e3192848..338775c1 100644
--- a/src/main/ActiveThorns.c
+++ b/src/main/ActiveThorns.c
@@ -1061,6 +1061,55 @@ const char *CCTK_CompiledImplementation(int tindex)
return ret_val;
}
+
+ /*@@
+ @routine CCTK_ImplementationRequires
+ @date Sat Oct 20 2001
+ @author Gabrielle Allen
+ @desc
+ Return the ancestors for an implementation
+ @enddesc
+ @calls
+ @calledby
+ @history
+
+ @endhistory
+
+ @returntype int
+ @returndesc
+ @endreturndesc
+@@*/
+
+uStringList *CCTK_ImplementationRequires(const char *imp)
+{
+ int i;
+ t_sktree *impnode;
+ struct IMPLEMENTATION *impdata;
+ uStringList *ancestors;
+ const char *addthorn=NULL;
+
+ impnode = SKTreeFindNode(implist, imp);
+ impdata = (struct IMPLEMENTATION *)(impnode->data);
+
+ ancestors = Util_StringListCreate(n_thorns);
+
+ /* Get ancestors */
+ for(i=0; impdata->ancestors[i]; i++)
+ {
+ addthorn = CCTK_ImplementationThorn(impdata->ancestors[i]);
+ Util_StringListAdd(ancestors,impdata->ancestors[i]);
+ }
+
+ /* Get friends */
+ for(i=0; impdata->friends[i]; i++)
+ {
+ addthorn = CCTK_ImplementationThorn(impdata->friends[i]);
+ Util_StringListAdd(ancestors,impdata->ancestors[i]);
+ }
+
+ return ancestors;
+}
+
/*@@
@routine CCTKi_ActivateThorns
@date Mon May 21 22:06:37 2001
@@ -1127,15 +1176,15 @@ int CCTKi_ActivateThorns(const char *activethornlist)
}
else if(! (this_imp = CCTK_ThornImplementation(token)))
{
- printf("Error: thorn %s doesn't exist\n", token);
+ printf("Error: Thorn %s not found\n", token);
n_errors++;
/* Give some more help */
if (CCTK_IsImplementationCompiled(token))
{
impthornlist = CCTK_ImpThornList(token);
- printf(" Implementation %s does exist\n",token);
- printf(" Provided by :");
+ printf(" However, implementation %s was found and is\n",token);
+ printf(" provided by thorn(s):");
SKTreeTraverseInorder(impthornlist,
JustPrintThornName, NULL);
printf("\n");
@@ -1294,7 +1343,7 @@ int CCTKi_ActivateThorns(const char *activethornlist)
}
-
+
/********************************************************************
********************* Local Routines *************************
********************************************************************/