From 13dc2616b9714bddc37412bc6254fff9bc058216 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Sun, 18 Sep 2011 20:33:12 +0200 Subject: CodeGen.m: Make SwitchStatement public and improve formatting --- Tools/CodeGen/CodeGen.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Tools') 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"]}] } -- cgit v1.2.3