Skip to content

Commit

Permalink
make sure cpp header is only included once
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbackrack committed Sep 30, 2012
1 parent 9307e9f commit f07a7ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/scala/Cpp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ class CppBackend extends Backend {

if (isGenHarness)
genHarness(c, base_name, c.name);
out_h.write("#ifndef __" + c.name + "__\n");
out_h.write("#define __" + c.name + "__\n\n");
out_h.write("#include \"emulator.h\"\n\n");
out_h.write("class " + c.name + "_t : public mod_t {\n");
out_h.write(" public:\n");
Expand All @@ -533,7 +535,8 @@ class CppBackend extends Backend {
out_h.write(" void print ( FILE* f );\n");
out_h.write(" bool scan ( FILE* f );\n");
out_h.write(" void dump ( FILE* f, int t );\n");
out_h.write("};\n");
out_h.write("};\n\n");
out_h.write("#endif\n");
out_h.close();

out_c.write("#include \"" + c.name + ".h\"\n");
Expand Down

0 comments on commit f07a7ac

Please sign in to comment.