diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-13 16:33:45 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2013-09-13 16:33:45 +0200 |
commit | 9ec08a2c201a8b67fb5d095f665e86ef80a16bea (patch) | |
tree | a2e147825a6ed0b2f694ef3d853229f9902aecaf /Tools/CodeGen/ParamCheck.m | |
parent | 39ed843346a337c4e1e8687f9f802a34367108ba (diff) |
Move parameter checking code processing from KrancThorn.m to ParamCheck.m
Diffstat (limited to 'Tools/CodeGen/ParamCheck.m')
-rw-r--r-- | Tools/CodeGen/ParamCheck.m | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Tools/CodeGen/ParamCheck.m b/Tools/CodeGen/ParamCheck.m index 551c433..ac6ab22 100644 --- a/Tools/CodeGen/ParamCheck.m +++ b/Tools/CodeGen/ParamCheck.m @@ -19,10 +19,11 @@ *) BeginPackage["ParamCheck`", {"Errors`", "Helpers`", "Kranc`", "CodeGenCactus`", - "CodeGenC`", "CodeGen`", "CodeGenKranc`"}]; + "CodeGenC`", "CodeGen`", "CodeGenKranc`", "Code`", "Object`"}]; ParameterCheckSource; ParameterCheckSchedule; +ParamCheckProcessCode; Begin["`Private`"]; @@ -81,6 +82,20 @@ DefFn[checkCondition[{cond_, error_String}] := renderbool[cond], {"CCTK_WARN(CCTK_WARN_ABORT, ", StringDrop[Stringify[error],-1], ");\n"}]]]; +Options[ParamCheckProcessCode] = ThornOptions; + +DefFn[ + ParamCheckProcessCode[cIn_Code, opts:OptionsPattern[]] := + Module[ + {c = cIn}, + If[Length[OptionValue[ParameterConditions]] > 0, + c = AppendObjectField[ + c, "Sources", + {Filename -> "ParamCheck.cc", + Contents -> ParameterCheckSource[GetObjectField[c, "Name"], + OptionValue[ParameterConditions]]}]]; + c]]; + End[]; EndPackage[]; |