X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Repair%2FRepairCompiler%2FMCC%2FIR%2FRepairGenerator.java;h=2ece34467b8c1b6f41db3b85f6ff185d1c424198;hb=978b41331e71cf87272999f73a0c532b624fb156;hp=b0bd167a9adc5dd283532d69ed4141c4c1b75f05;hpb=6b4e661ac124c90449eb81b34b444fad9dd3fb26;p=repair.git diff --git a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java index b0bd167..2ece344 100755 --- a/Repair/RepairCompiler/MCC/IR/RepairGenerator.java +++ b/Repair/RepairCompiler/MCC/IR/RepairGenerator.java @@ -303,6 +303,7 @@ public class RepairGenerator { private void generate_stateobject() { CodeWriter crhead = new StandardCodeWriter(outputhead); + CodeWriter craux = new StandardCodeWriter(outputaux); crhead.outputline("struct "+name+"_state {"); Iterator globals=state.stGlobals.descriptors(); while (globals.hasNext()) { @@ -310,6 +311,18 @@ public class RepairGenerator { crhead.outputline(vd.getType().getGenerateType().getSafeSymbol()+" "+vd.getSafeSymbol()+";"); } crhead.outputline("};"); + crhead.outputline("struct "+name+"_state * allocate"+name+"_state();"); + craux.outputline("struct "+name+"_state * allocate"+name+"_state()"); + craux.startblock(); + craux.outputline("return (struct "+name+"_state *) malloc(sizeof(struct "+name+"_state));"); + craux.endblock(); + + crhead.outputline("void free"+name+"_state(struct "+name+"_state *);"); + craux.outputline("void free"+name+"_state(struct "+name+"_state * thisvar)"); + craux.startblock(); + craux.outputline("free(thisvar);"); + craux.endblock(); + crhead.outputline("void "+name+"_statecomputesizes(struct "+name+"_state * ,int *,int **);"); crhead.outputline("void "+name+"_staterecomputesizes(struct "+name+"_state *);"); } @@ -435,7 +448,7 @@ public class RepairGenerator { } } } - craux.outputline("struct "+ name+"* "+name+"()"); + craux.outputline("struct "+ name+"* allocate"+name+"()"); craux.startblock(); craux.outputline("/* creating hashtables */");