Methods Summary |
---|
public void | addNewEntryCallback(int bucket, java.lang.Object neww)
int value;
String next = (String)getNext((String)neww);
if (next == null) {
value = bucket + getSize();
} else {
value = getKey(next) + getSize();
}
setKey(neww, value);
|
public void | declareUString(CCodeWriter out, java.lang.String name)
|
public int | getNameKey(java.lang.String string)
return getKey(string);
|
public java.lang.String | getUString(int key)
String thisKey = Integer.toHexString(key + 0x10000).substring(1);
return "&AllUTFStrings.U" + thisKey;
|
public java.lang.String | getUString(java.lang.String string)
if (string == null) return "NULL";
return getUString(getKey(string));
|
long | hash(java.lang.Object x)
String str = (String)x;
return stringHash(str);
|
java.lang.Object | tableChain(CCodeWriter out, int bucket, java.lang.Object[] list)
return list.length == 0 ? null : list[0];
|
void | tableEntry(CCodeWriter out, int bucket, java.lang.Object token)
out.print(getUString((String)token));
|
void | writeTable(CCodeWriter out, java.lang.String tableName)
Vector all = new Vector();
BitSet seenSizes = new BitSet();
for (int i = 0; i < TABLE_SIZE; i++) {
for ( String entry = (String)getFirst(i);
entry != null;
entry = (String)getNext(entry)) {
String keyFilled =
Integer.toHexString(getNameKey(entry)+0x10000).substring(1);
all.add(new String[]{entry, keyFilled});
seenSizes.set(entry.length());
}
}
for (int i = 0; i < seenSizes.size(); i++) {
if (seenSizes.get(i)) {
out.println("DECLARE_USTRING_STRUCT(" + i + ");");
}
}
Collections.sort(all, new Comparator() {
public int compare(Object o1, Object o2) {
String[] pair1 = (String[])o1;
String[] pair2 = (String[])o2;
int key1 = getNameKey(pair1[0]);
int key2 = getNameKey(pair2[0]);
return key1 - key2;
}
});
out.println();
out.println();
out.println("static CONST struct AllUTFStrings_Struct {");
for (Enumeration e = all.elements(); e.hasMoreElements(); ) {
String[] pair = (String[])e.nextElement();
String entry = pair[0];
String key = pair[1];
out.println("\tstruct UTF_Hash_Entry_" + entry.length() +
" U" + key + ";");
}
out.println("} AllUTFStrings = {");
for (Enumeration e = all.elements(); e.hasMoreElements(); ) {
String[] pair = (String[])e.nextElement();
String entry = pair[0];
String key = pair[1];
String nextEntryName = getUString((String)getNext(entry));
out.print("\tUSTRING(" + key + ", " + nextEntryName + ", " +
entry.length() + ", ");
out.printSafeString(entry);
out.print("),");
try {
if (entry.charAt(0) < 20) {
String s = classTable.decodeMethodSignature(entry);
out.print(" /* ");
out.print(s);
out.print(" */");
}
} catch (RuntimeException ex) { }
out.println();
}
out.println("};\n");
super.writeTable(out, tableName);
|