} else if (t instanceof StructureTypeDescriptor) {
StructureTypeDescriptor type = (StructureTypeDescriptor) t;
- TypeDescriptor subtype = type.getSubType();
+ TypeDescriptor subtype = type.getSuperType();
// check that the subtype is valid
if (subtype instanceof MissingTypeDescriptor) {
er.report(null, "Undefined subtype '" + subtype.getSymbol() + "'");
ok = false;
} else {
- type.setSubType(newtype);
+ type.setSuperType(newtype);
}
}
} else if (t instanceof StructureTypeDescriptor) {
StructureTypeDescriptor type = (StructureTypeDescriptor)t;
- TypeDescriptor subtype = type.getSubType();
+ TypeDescriptor subtype = type.getSuperType();
Iterator fields = type.getFields();
while (fields.hasNext()) {
}
/* lookup the type to get the type descriptor */
- type.setSubType(lookupType(subtype, CREATE_MISSING));
+ type.setSuperType(lookupType(subtype, CREATE_MISSING));
}
// set the current type so that the recursive parses on the labels
Hashtable fields = new Hashtable(); /* fast lookups */
Vector fieldlist = new Vector(); /* ordering information */
Hashtable labels = new Hashtable();
+ int idnum;
+ static int counter=0;
+
+ public int getId() {
+ return idnum;
+ }
public StructureTypeDescriptor(String name) {
super(name);
+ idnum=counter++;
}
public TypeDescriptor getGenerateType() {
}
public Expr getOffsetExpr(FieldDescriptor field) {
-
+ /* Fix sizeof calculations */
+ if ((field==null)&&(subtype!=null))
+ return subtype.getOFfsetExpr(field);
+
boolean aligned=true;
Expr size = new IntegerLiteralExpr(0);
labels.put(ld.getSymbol(), ld);
}
- public TypeDescriptor getSubType() {
+ public TypeDescriptor getSuperType() {
return subtype;
}
- public void setSubType(TypeDescriptor td) {
+ public void setSuperType(TypeDescriptor td) {
subtype = td;
}