generate_call();
generate_start();
generate_rules();
- generate_print();
+ if (!Compiler.REPAIR) {
+ generate_print();
+ }
generate_checks();
generate_teardown();
CodeWriter crhead = new StandardCodeWriter(this.outputhead);
int count=0;
CodeWriter crhead = new StandardCodeWriter(outputhead);
CodeWriter craux = new StandardCodeWriter(outputaux);
+ RelationDescriptor.prefix = "model->";
+ SetDescriptor.prefix = "model->";
/* Rewrite globals */
};
cr.outputline("void "+name+"_state::computesizes(int *sizearray,int **numele) {");
+ cr.outputline("int maybe=0;");
for(int i=0;i<max;i++) {
TypeDescriptor td=tdarray[i];
Expr size=td.getSizeExpr();
}
}
}
+ cr.outputline("if (maybe) printf(\"BAD ERROR\");");
cr.outputline("}");
}
public SymbolTable getSymbolTable() { return st; }
};
cr.outputline("void "+name+"_state::recomputesizes() {");
+ cr.outputline("int maybe=0;");
for(int i=0;i<max;i++) {
TypeDescriptor td=tdarray[i];
Expr size=td.getSizeExpr();
}
}
}
+ cr.outputline("if (maybe) printf(\"BAD ERROR\");");
cr.outputline("}");
}
SetDescriptor sd=termination.sources.relgetSourceSet(rd,!ep.inverted());
VarDescriptor iterator=VarDescriptor.makeNew("iterator");
cr.outputline(sd.getType().getGenerateType().getSafeSymbol() +" "+newobject.getSafeSymbol()+";");
- cr.outputline("for("+iterator.getSafeSymbol()+"="+sd.getSafeSymbol()+"_hash->iterator();"+iterator.getSafeSymbol()+".hasNext();)");
+ cr.outputline("SimpleIterator "+iterator.getSafeSymbol()+";");
+ cr.outputline("for("+sd.getSafeSymbol()+"_hash->iterator("+ iterator.getSafeSymbol() +");"+iterator.getSafeSymbol()+".hasNext();)");
cr.startblock();
if (ep.inverted()) {
- cr.outputline("if !"+rd.getSafeSymbol()+"_hashinv->contains("+iterator.getSafeSymbol()+"->key(),"+otherside.getSafeSymbol()+")");
+ cr.outputline("if (!"+rd.getSafeSymbol()+"_hashinv->contains("+iterator.getSafeSymbol()+".key(),"+otherside.getSafeSymbol()+"))");
} else {
- cr.outputline("if !"+rd.getSafeSymbol()+"_hash->contains("+otherside.getSafeSymbol()+","+iterator.getSafeSymbol()+"->key())");
+ cr.outputline("if (!"+rd.getSafeSymbol()+"_hash->contains("+otherside.getSafeSymbol()+","+iterator.getSafeSymbol()+".key()))");
}
cr.outputline(newobject.getSafeSymbol()+"="+iterator.getSafeSymbol()+".key();");
- cr.outputline(iterator.getSafeSymbol()+"->next();");
+ cr.outputline(iterator.getSafeSymbol()+".next();");
cr.endblock();
} else if (termination.sources.relallocSource(rd,!ep.inverted())) {
/* Allocation Source*/
SetDescriptor sourcesd=termination.sources.getSourceSet(sd);
VarDescriptor iterator=VarDescriptor.makeNew("iterator");
cr.outputline(sourcesd.getType().getGenerateType().getSafeSymbol() +" "+newobject.getSafeSymbol()+";");
- cr.outputline("for("+iterator.getSafeSymbol()+"="+sourcesd.getSafeSymbol()+"_hash->iterator();"+iterator.getSafeSymbol()+".hasNext();)");
+ cr.outputline("SimpleIterator "+iterator.getSafeSymbol()+";");
+ cr.outputline("for("+sourcesd.getSafeSymbol()+"_hash->iterator("+iterator.getSafeSymbol()+");"+iterator.getSafeSymbol()+".hasNext();)");
cr.startblock();
- cr.outputline("if !"+sd.getSafeSymbol()+"_hash->contains("+iterator.getSafeSymbol()+"->key())");
+ cr.outputline("if (!"+sd.getSafeSymbol()+"_hash->contains("+iterator.getSafeSymbol()+".key()))");
cr.outputline(newobject.getSafeSymbol()+"="+iterator.getSafeSymbol()+".key();");
- cr.outputline(iterator.getSafeSymbol()+"->next();");
+ cr.outputline(iterator.getSafeSymbol()+".next();");
cr.endblock();
} else if (termination.sources.allocSource(sd)) {
/* Allocation Source*/
public boolean setSource(SetDescriptor sd) {
if (sd.getSymbol().equals("InodeBitmapBlock"))
return true;
+ if (sd.getSymbol().equals("InodeTableBlock"))
+ return true;
+ if (sd.getSymbol().equals("RootDirectoryInode"))
+ return true;
return false;
}
public SetDescriptor getSourceSet(SetDescriptor sd) {
if (sd.getSymbol().equals("InodeBitmapBlock"))
return (SetDescriptor)state.stSets.get("FreeBlock");
+ if (sd.getSymbol().equals("InodeTableBlock"))
+ return (SetDescriptor)state.stSets.get("FreeBlock");
+ if (sd.getSymbol().equals("RootDirectoryInode"))
+ return (SetDescriptor)state.stSets.get("FreeInode");
return null;
}
+
public void generateSourceAlloc(CodeWriter cr,VarDescriptor vd, SetDescriptor sd) {
TypeDescriptor td=sd.getType();
Expr e=td.getSizeExpr();