DNFFlagAtom dfa=(DNFFlagAtom)term.get(k);
FlagDescriptor fd=dfa.getFlag();
boolean negated=dfa.getNegated();
- int flagid=((Integer)flags.get(fd)).intValue();
+ int flagid=1<<((Integer)flags.get(fd)).intValue();
andmask|=flagid;
if (!negated)
checkmask|=flagid;
}
- output.print(andmask+", "+checkmask);
+ output.print("0x"+Integer.toHexString(andmask)+", 0x"+Integer.toHexString(checkmask));
}
output.println("};");
FlagDescriptor fd=(FlagDescriptor)superflagit.next();
Integer number=(Integer)superflags.get(fd);
flags.put(fd, number);
- if (number.intValue()>max)
- max=number.intValue();
+ if ((number.intValue()+1)>max)
+ max=number.intValue()+1;
}
}
while(flagit.hasNext()) {
FlagDescriptor fd=(FlagDescriptor)flagit.next();
if (sp==null||!sp.getFlagTable().contains(fd.getSymbol()))
- flags.put(fd, new Integer(++max));
+ flags.put(fd, new Integer(max++));
}
}
}
/* Output class structure */
classdefout.println("struct "+cn.getSafeSymbol()+" {");
classdefout.println(" int type;");
+ if (cn.hasFlags())
+ classdefout.println(" int flag;");
printClassStruct(cn, classdefout);
classdefout.println("};\n");
output.print(")");
}
- public void generateFlatFlagActionNode(FlatMethod fm, FlatFlagActionNode ffann, PrintWriter output) {
- output.print("/* FlatFlagActionNode will go here */");
-
+ public void generateFlatFlagActionNode(FlatMethod fm, FlatFlagActionNode ffan, PrintWriter output) {
+ output.println("/* FlatFlagActionNode */");
+ Hashtable flagandtable=new Hashtable();
+ Hashtable flagortable=new Hashtable();
+
+
+ Iterator flagsit=ffan.getTempFlagPairs();
+ while(flagsit.hasNext()) {
+ TempFlagPair tfp=(TempFlagPair)flagsit.next();
+ TempDescriptor temp=tfp.getTemp();
+ Hashtable flagtable=(Hashtable)flagorder.get(temp.getType().getClassDesc());
+ FlagDescriptor flag=tfp.getFlag();
+ int flagid=1<<((Integer)flagtable.get(flag)).intValue();
+ boolean flagstatus=ffan.getFlagChange(tfp);
+ if (flagstatus) {
+ int mask=0;
+ if (flagortable.containsKey(temp)) {
+ mask=((Integer)flagortable.get(temp)).intValue();
+ }
+ mask|=flagid;
+ flagortable.put(temp,new Integer(mask));
+ } else {
+ int mask=0xFFFFFFFF;
+ if (flagandtable.containsKey(temp)) {
+ mask=((Integer)flagandtable.get(temp)).intValue();
+ }
+ mask&=(0xFFFFFFFF^flagid);
+ flagandtable.put(temp,new Integer(mask));
+ }
+ }
+ Iterator orit=flagortable.keySet().iterator();
+ while(orit.hasNext()) {
+ TempDescriptor temp=(TempDescriptor)orit.next();
+ int ormask=((Integer)flagortable.get(temp)).intValue();
+ output.println("flagor("+generateTemp(fm, temp)+", 0x"+Integer.toHexString(ormask)+");");
+ }
+ Iterator andit=flagandtable.keySet().iterator();
+ while(andit.hasNext()) {
+ TempDescriptor temp=(TempDescriptor)andit.next();
+ int andmask=((Integer)flagandtable.get(temp)).intValue();
+ output.println("flagand("+generateTemp(fm, temp)+", 0x"+Integer.toHexString(andmask)+");");
+ }
}
}
int i;
/* Allocate startup object */
struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(STARTUPTYPE);
+ /* Set flag */
+ flagor(startupobject,1);
/* Build array of strings */
struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc);
for(i=0;i<argc;i++) {
int length=strlen(argv[i]);
struct ___String___ *newstring=NewString(argv[i],length);
- ((void **)(((char *)& stringarray->___length___)+sizeof(int)))[i]=newstring;
+ ((void **)(((char *)& stringarray->___length___)+sizeof(int)))[i]=newstring;
}
+ processtasks();
+}
+void flagor(void * ptr, int ormask) {
+ ((int *)ptr)[1]|=ormask;
+}
+void flagand(void * ptr, int andmask) {
+ ((int *)ptr)[1]&=andmask;
}
+
+void processtasks();
#endif
int ___Object______hashcode____(struct ___Object___ * ___this___) {