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();
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;");
}
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);");
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+"];");
}