edits
[cdsspec-compiler.git] / src / edu / uci / eecs / codeGenerator / CodeGeneratorUtils.java
index d02fa4f..abcb45c 100644 (file)
@@ -776,10 +776,15 @@ public class CodeGeneratorUtils {
                                + SpecNaming.CopyState.toUpperCase() + ", " + "(void*) _"
                                + SpecNaming.CopyState.toLowerCase() + "),", 2));
                // new NamedFunction(_Print_str, PRINT_STATE, (void*) _print),
-               code.addLine(TabbedLine("new " + SpecNaming.NamedFunction + "("
+               line = "new " + SpecNaming.NamedFunction + "("
                                + SpecNaming.AppendStr(SpecNaming.PrintState) + ", "
-                               + SpecNaming.PrintStateType + ", " + "(void*) _"
-                               + SpecNaming.PrintState.toLowerCase() + "),", 2));
+                               + SpecNaming.PrintStateType + ", " + "(void*)";
+               if (globalConstruct.printState.isEmpty()) {
+                       line = line + SpecNaming.NullFunc + "),";
+               } else {
+                       line = line + "_" + SpecNaming.PrintState.toLowerCase() + "),";
+               }
+               code.addLine(TabbedLine(line, 2));
                // commuteRules, CommuteRuleSize);
                code.addLine(TabbedLine(SpecNaming.CommutativityRuleInst + ", "
                                + SpecNaming.CommutativityRuleSizeInst + ");", 2));
@@ -862,7 +867,7 @@ public class CodeGeneratorUtils {
                                                                + SpecNaming.PrintValue) + ", "
                                                + SpecNaming.PrintValueType + ", (void*) ";
                                if (construct.print.isEmpty()) {
-                                       line = line + SpecNaming.NullFunc + "),";
+                                       line = line + SpecNaming.NullFunc + ")";
                                } else {
                                        line = line + "_" + name + "_" + SpecNaming.PrintValue
                                                        + ")";