Modify Generators to allow multiple specs
authorbdemsky <bdemsky>
Wed, 6 Sep 2006 21:36:32 +0000 (21:36 +0000)
committerbdemsky <bdemsky>
Wed, 6 Sep 2006 21:36:32 +0000 (21:36 +0000)
Repair/RepairCompiler/MCC/IR/RepairGenerator.java
Repair/RepairCompiler/MCC/IR/StructureGenerator.java

index 80400dc..8d095b6 100755 (executable)
@@ -568,7 +568,8 @@ public class RepairGenerator {
        craux.addDeclaration("struct RepairHash * ",repairtable.getSafeSymbol());
        craux.outputline(repairtable.getSafeSymbol()+"=0;");
        craux.outputline("initializestack(&highmark);");
-       craux.outputline("computesizes(thisvar);");
+       craux.outputline(name+"_statecomputesizes(thisvar, arsize, arnumelements);");
+       craux.outputline("computesizes();");
        craux.outputline(name+"_staterecomputesizes(thisvar);");
        craux.outputline("while (1)");
        craux.startblock();
index b3a6664..f464977 100755 (executable)
@@ -84,9 +84,10 @@ public class StructureGenerator {
 
     private void generatecomputesize() {
        int max=TypeDescriptor.counter;
-       cr.outputline("void computesizes(struct "+rg.name+"_state * obj) {");
+       cr.outputline("void computesizes() {");
         cr.outputline("int i;");
-       cr.outputline(rg.name+"_statecomputesizes(obj,arsize,arnumelements);");
+       //moved this to caller
+       //cr.outputline(rg.name+"_statecomputesizes(obj,arsize,arnumelements);");
        cr.outputline("for(i=0;i<"+max+";i++) {");
        cr.outputline("int bits=arsize[i];");
        cr.outputline("int bytes=bits>>3;");
@@ -97,6 +98,7 @@ public class StructureGenerator {
     }
 
     private void generateheader() {
+       int max=TypeDescriptor.counter;
        crhead.outputline("#include \""+rg.headername + "\"");
        crhead.outputline("int getfield(int type, int fieldindex);");
        crhead.outputline("int isArray(int type, int fieldindex);");
@@ -106,7 +108,9 @@ public class StructureGenerator {
        crhead.outputline("int sizeBytes(int type);");
        crhead.outputline("int getnumfields(int type);");
        crhead.outputline("bool issubtype(int subtype, int type);");
-       crhead.outputline("void computesizes(struct "+rg.name+"_state *);");
+       crhead.outputline("void computesizes();");
+       crhead.outputline("extern int arsize["+max+"];");
+       crhead.outputline("extern int* arnumelements["+max+"];");
     }