aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorianhin <ianhin>2006-06-19 22:17:20 +0000
committerianhin <ianhin>2006-06-19 22:17:20 +0000
commit93ac1e0cf4ce5b4e95e6a864aba3fee563a7a0be (patch)
treea67444d82675a7e2fd47e14b2cc97a02932f6140
parent7679bc5e4be0ef4b219c261f59e875c4897eb5c8 (diff)
Add the ability to specify extra information about a group
Tidy up qualifyGFName function slightly
-rw-r--r--Tools/CodeGen/KrancGroups.m24
1 files changed, 21 insertions, 3 deletions
diff --git a/Tools/CodeGen/KrancGroups.m b/Tools/CodeGen/KrancGroups.m
index a94a11e..7ddbda5 100644
--- a/Tools/CodeGen/KrancGroups.m
+++ b/Tools/CodeGen/KrancGroups.m
@@ -25,6 +25,7 @@
(****************************************************************************)
BeginPackage["sym`"];
+{Timelevels}
EndPackage[];
BeginPackage["KrancGroups`",
@@ -51,6 +52,8 @@ SetGroupVariables;
VerifyGroup;
VerifyGroupName;
SetGroupName;
+AddGroupExtra;
+GroupTimelevels;
Begin["`Private`"];
@@ -64,7 +67,7 @@ representation without other code having to be rewritten.
The extras can be any of the following:
Tags -> {tag1, tag2, ...}
-
+Timelevels -> x
*)
@@ -80,9 +83,12 @@ CreateGroup[name_, vars_, extras_] :=
VerifyList[vars];
VerifyList[extras];
g = Join[{name, vars}, extras];
- InfoMessage[Full, "Created group: ", g];
+ InfoMessage[InfoFull, "Created group: ", g];
Return[g]];
+AddGroupExtra[group_, extra_] :=
+ Append[group, extra];
+
VerifyGroup[group_] :=
Module[{},
@@ -95,6 +101,12 @@ VerifyGroupName[groupName_] :=
ThrowError["Not a group name:", groupName],
True];
+GroupTimelevels[g_] :=
+ Module[{extras},
+ extras = Drop[g, 2];
+ lookupDefault[extras, Timelevels, False]];
+
+
groupName[g_] := First[g];
@@ -219,7 +231,13 @@ containingGroups[vars_, groups_] :=
qualifyGFName[gfname_, allgroups_, defaultImp_] :=
If[StringQ@gfname && StringMatchQ[gfname, "*::*"],
gfname,
- implementationFromGroupName@qualifyGroupName[First@containingGroups[{gfname}, allgroups], defaultImp] <> "::" <>ToString@gfname
+
+ Module[{groupName, imp, newGFname},
+ groupName = First[containingGroups[{gfname}, allgroups]];
+ imp = implementationFromGroupName[qualifyGroupName[groupName, defaultImp]];
+ newGFname = imp <> "::" <> ToString[gfname];
+ newGFname
+]
];