diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-09-18 20:33:12 +0200 |
---|---|---|
committer | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-09-18 20:33:12 +0200 |
commit | 13dc2616b9714bddc37412bc6254fff9bc058216 (patch) | |
tree | 7fa1aa9e1de473ed1a22b5ff005abf7d70fe2b14 /Tools/CodeGen/CodeGen.m | |
parent | 56010c9f6a19d38a6a3a1f8b97576b561f064565 (diff) |
CodeGen.m: Make SwitchStatement public and improve formatting
Diffstat (limited to 'Tools/CodeGen/CodeGen.m')
-rw-r--r-- | Tools/CodeGen/CodeGen.m | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Tools/CodeGen/CodeGen.m b/Tools/CodeGen/CodeGen.m index fa35d45..127ee81 100644 --- a/Tools/CodeGen/CodeGen.m +++ b/Tools/CodeGen/CodeGen.m @@ -136,6 +136,7 @@ Quote::usage = "Quote[x] returns x surrounded by quotes"; DataType::usage = "DataType[] returns a string for the grid function data type (e.g. CCTK_REAL)"; SetDataType::usage = "SetDataType[type] sets a string for the grid function data type (e.g. CCTK_REAL)"; Conditional; +SwitchStatement; Begin["`Private`"]; @@ -685,13 +686,13 @@ GenericGridLoopUsingLoopControl[functionName_, block_, vectorise_] := switchOptions[{value_, block_}] := { - "case ", value, ":\n", block, "break;\n" + "case ", value, ":\n", indentBlock[{block,"break;\n"}] } SwitchStatement[var_, pairs__] := { "switch(", var, ")\n", - CBlock[{Map[switchOptions, {pairs}]}] + CBlock[{Riffle[Map[switchOptions, {pairs}],"\n"]}] } |