rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
readDataChunk ();
{ readDataChunk(); }
private void readDataChunk () throws SAXException, IOException { int count; // See if we have any overflow (filterCR sets for CR at end) if (readBufferOverflow > -1) { readBuffer [0] = (char) readBufferOverflow; readBufferOverflow = -1; readBufferPos = 1; sawCR = true; } else { readBufferPos = 0; sawCR = false; } // input from a character stream. if (sourceType == INPUT_READER) { count = reader.read (readBuffer, readBufferPos, READ_BUFFER_MAX - readBufferPos); if (count < 0) readBufferLength = readBufferPos; else readBufferLength = readBufferPos + count; if (readBufferLength > 0) filterCR (count >= 0); sawCR = false; return; } // Read as many bytes as possible into the raw buffer. count = is.read (rawReadBuffer, 0, READ_BUFFER_MAX); // Dispatch to an encoding-specific reader method to populate // the readBuffer. In most parser speed profiles, these routines // show up at the top of the CPU usage chart. if (count > 0) { switch (encoding) { // one byte builtins case ENCODING_ASCII: copyIso8859_1ReadBuffer (count, (char) 0x0080); break; case ENCODING_UTF_8: copyUtf8ReadBuffer (count); break; case ENCODING_ISO_8859_1: copyIso8859_1ReadBuffer (count, (char) 0); break; // two byte builtins case ENCODING_UCS_2_12: copyUcs2ReadBuffer (count, 8, 0); break; case ENCODING_UCS_2_21: copyUcs2ReadBuffer (count, 0, 8); break; // four byte builtins case ENCODING_UCS_4_1234: copyUcs4ReadBuffer (count, 24, 16, 8, 0); break; case ENCODING_UCS_4_4321: copyUcs4ReadBuffer (count, 0, 8, 16, 24); break; case ENCODING_UCS_4_2143: copyUcs4ReadBuffer (count, 16, 24, 0, 8); break; case ENCODING_UCS_4_3412: copyUcs4ReadBuffer (count, 8, 0, 24, 16); break; } } else readBufferLength = readBufferPos; readBufferPos = 0; // Filter out all carriage returns if we've seen any // (including any saved from a previous read) if (sawCR) { filterCR (count >= 0); sawCR = false; // must actively report EOF, lest some CRs get lost. if (readBufferLength == 0 && count >= 0) readDataChunk (); } if (count > 0) currentByteCount += count; }
}
private void readDataChunk () throws SAXException, IOException { int count; // See if we have any overflow (filterCR sets for CR at end) if (readBufferOverflow > -1) { readBuffer [0] = (char) readBufferOverflow; readBufferOverflow = -1; readBufferPos = 1; sawCR = true; } else { readBufferPos = 0; sawCR = false; } // input from a character stream. if (sourceType == INPUT_READER) { count = reader.read (readBuffer, readBufferPos, READ_BUFFER_MAX - readBufferPos); if (count < 0) readBufferLength = readBufferPos; else readBufferLength = readBufferPos + count; if (readBufferLength > 0) filterCR (count >= 0); sawCR = false; return; } // Read as many bytes as possible into the raw buffer. count = is.read (rawReadBuffer, 0, READ_BUFFER_MAX); // Dispatch to an encoding-specific reader method to populate // the readBuffer. In most parser speed profiles, these routines // show up at the top of the CPU usage chart. if (count > 0) { switch (encoding) { // one byte builtins case ENCODING_ASCII: copyIso8859_1ReadBuffer (count, (char) 0x0080); break; case ENCODING_UTF_8: copyUtf8ReadBuffer (count); break; case ENCODING_ISO_8859_1: copyIso8859_1ReadBuffer (count, (char) 0); break; // two byte builtins case ENCODING_UCS_2_12: copyUcs2ReadBuffer (count, 8, 0); break; case ENCODING_UCS_2_21: copyUcs2ReadBuffer (count, 0, 8); break; // four byte builtins case ENCODING_UCS_4_1234: copyUcs4ReadBuffer (count, 24, 16, 8, 0); break; case ENCODING_UCS_4_4321: copyUcs4ReadBuffer (count, 0, 8, 16, 24); break; case ENCODING_UCS_4_2143: copyUcs4ReadBuffer (count, 16, 24, 0, 8); break; case ENCODING_UCS_4_3412: copyUcs4ReadBuffer (count, 8, 0, 24, 16); break; } } else readBufferLength = readBufferPos; readBufferPos = 0; // Filter out all carriage returns if we've seen any // (including any saved from a previous read) if (sawCR) { filterCR (count >= 0); sawCR = false; // must actively report EOF, lest some CRs get lost. if (readBufferLength == 0 && count >= 0) readDataChunk (); } if (count > 0) currentByteCount += count; }
private String[] readExternalIds (boolean inNotation, boolean isSubset)
private ExternalIdentifiers readExternalIds(boolean inNotation, boolean isSubset)
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
String ids[] = new String [3];
ExternalIdentifiers ids = new ExternalIdentifiers();
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags);
if (tryRead("PUBLIC")) { requireWhitespace(); ids.publicId = readLiteral(LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace(); c = readCh(); unread(c); if (c == '"' || c == '\'') { ids.systemId = readLiteral(flags);
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
} else { requireWhitespace (); ids [1] = readLiteral (flags);
} else { requireWhitespace(); ids.systemId = readLiteral(flags);
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i);
for (int i = 0; i < ids.publicId.length(); i++) { c = ids.publicId.charAt(i);
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1)
} if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf(c) != -1) {
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
error ("illegal PUBLIC id character U+" + Integer.toHexString (c));
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
} else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]);
error("illegal PUBLIC id character U+" + Integer.toHexString(c)); } } else if (tryRead("SYSTEM")) { requireWhitespace(); ids.systemId = readLiteral(flags); } else if (!isSubset) { error("missing SYSTEM or PUBLIC keyword");
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
return ids;
if (ids.systemId != null) { if (ids.systemId.indexOf('#') != -1) { handler.verror("SYSTEM id has a URI fragment: " + ids.systemId); } ids.baseUri = handler.getSystemId(); if (ids.baseUri == null && uriWarnings) { handler.warn("No base URI; hope URI is absolute: " + ids.systemId); }
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
return ids; }
private String[] readExternalIds (boolean inNotation, boolean isSubset) throws Exception { char c; String ids[] = new String [3]; int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; if (tryRead ("PUBLIC")) { requireWhitespace (); ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); if (inNotation) { skipWhitespace (); c = readCh (); unread (c); if (c == '"' || c == '\'') { ids [1] = readLiteral (flags); } } else { requireWhitespace (); ids [1] = readLiteral (flags); } for (int i = 0; i < ids [0].length (); i++) { c = ids [0].charAt (i); if (c >= 'a' && c <= 'z') continue; if (c >= 'A' && c <= 'Z') continue; if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) continue; error ("illegal PUBLIC id character U+" + Integer.toHexString (c)); } } else if (tryRead ("SYSTEM")) { requireWhitespace (); ids [1] = readLiteral (flags); } else if (!isSubset) error ("missing SYSTEM or PUBLIC keyword"); if (ids [1] != null) { if (ids [1].indexOf ('#') != -1) handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); ids [2] = handler.getSystemId (); if (ids [2] == null) handler.warn ("No base URI; hope URI is absolute: " + ids [1]); } return ids; }
char ourBuf [] = readBuffer;
char[] ourBuf = readBuffer;
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;"))
if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef(false); if (String.valueOf(readBuffer).equals("&#38;")) {
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
} else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';');
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
c = readCh ();
} c = readCh();
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
error ("attribute values may not contain '<'");
{ error("attribute values may not contain '<'"); }
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
dataBufferAppend (c); c = readCh ();
dataBufferAppend(c); c = readCh(); }
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
} catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ());
catch (EOFException e) { error("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character(delim).toString());
private String readLiteral (int flags) throws SAXException, IOException { char delim, c; int startLine = line; boolean saved = expandPE; boolean savedReport = doReport; // Find the first delimiter. delim = readCh (); if (delim != '"' && delim != '\'') { error ("expected '\"' or \"'\"", delim, null); return null; } inLiteral = true; if ((flags & LIT_DISABLE_PE) != 0) expandPE = false; doReport = false; // Each level of input source has its own buffer; remember // ours, so we won't read the ending delimiter from any // other input source, regardless of entity processing. char ourBuf [] = readBuffer; // Read the literal. try { c = readCh (); boolean ampRead = false;loop: while (! (c == delim && readBuffer == ourBuf)) { switch (c) { // attributes and public ids are normalized // in almost the same ways case '\n': case '\r': if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) c = ' '; break; case '\t': if ((flags & LIT_ATTRIBUTE) != 0) c = ' '; break; case '&': c = readCh (); // Char refs are expanded immediately, except for // all the cases where it's deferred. if (c == '#') { if ((flags & LIT_DISABLE_CREF) != 0) { dataBufferAppend ('&'); break; } parseCharRef (false /* Do not do flushDataBuffer */); // exotic WFness risk: this is an entity literal, // dataBuffer [dataBufferPos - 1] == '&', and // following chars are a _partial_ entity/char ref // It looks like an entity ref ... } else { unread (c); // Expand it? if ((flags & LIT_ENTITY_REF) > 0) { parseEntityRef (false); if (String.valueOf (readBuffer).equals("&#38;")) ampRead = true; //Is it just data? } else if ((flags & LIT_DISABLE_EREF) != 0) { dataBufferAppend ('&'); // OK, it will be an entity ref -- expanded later. } else { String name = readNmtoken (true); require (';'); dataBufferAppend ('&'); dataBufferAppend (name); dataBufferAppend (';'); } } c = readCh (); continue loop; case '<': // and why? Perhaps so "&foo;" expands the same // inside and outside an attribute? if ((flags & LIT_ATTRIBUTE) != 0) error ("attribute values may not contain '<'"); break; // We don't worry about case '%' and PE refs, readCh does. default: break; } dataBufferAppend (c); c = readCh (); } } catch (EOFException e) { error ("end of input while looking for delimiter (started on line " + startLine + ')', null, new Character (delim).toString ()); } inLiteral = false; expandPE = saved; doReport = savedReport; // Normalise whitespace if necessary. if ((flags & LIT_NORMALIZE) > 0) { dataBufferNormalize (); } // Return the value. return dataBufferToString (); }
error ("name expected", readBuffer [i], null);
{ error("name expected", readBuffer[i], null); }
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
error ("Not a name start character, U+" + Integer.toHexString (c));
{ error("Not a name start character, U+" + Integer.toHexString(c)); }
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c)
{ error("Not a name start character, U+" + Integer.toHexString(c)); } } else if (!Character.isUnicodeIdentifierPart(c)
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
&& !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c));
&& !isExtender(c)) { error("Not a name character, U+" + Integer.toHexString(c)); }
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
&& !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos);
&& !Character.isUnicodeIdentifierStart(nameBuffer[0]) && ":_".indexOf(nameBuffer[0]) == -1) { error("Not a name start character, U+" + Integer.toHexString(nameBuffer[0])); } String s = intern(nameBuffer, 0, nameBufferPos);
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
&& !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c));
&& !Character.isUnicodeIdentifierPart(c) && ":-_.".indexOf(c) == -1 && !isExtender(c)) { error("Not a name character, U+" + Integer.toHexString(c)); }
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
nameBuffer [nameBufferPos++] = c;
} nameBuffer[nameBufferPos++] = c;
private String readNmtoken (boolean isName) throws SAXException, IOException { char c; if (USE_CHEATS) {loop: for (int i = readBufferPos; i < readBufferLength; i++) { c = readBuffer [i]; switch (c) { case '%': if (expandPE) break loop; // else fall through... // What may legitimately come AFTER a name/nmtoken? case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\r': case '\n': case ';': case '/': int start = readBufferPos; if (i == start) error ("name expected", readBuffer [i], null); readBufferPos = i; return intern (readBuffer, start, i - start); default:// FIXME ... per IBM's OASIS test submission, these:// ? U+06dd // Combining U+309B //these switches are kind of ugly but at least we won't //have to go over the whole lits for each char if (isName && i == readBufferPos){ char c2 = (char) (c & 0x00f0); switch (c & 0xff00){ //starting with 01 case 0x0100: switch (c2){ case 0x0030: if (c == 0x0132 || c == 0x0133 || c == 0x013f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x0140 || c == 0x0149) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00c0: if (c == 0x01c4 || c == 0x01cc) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00f0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x01f1 || c == 0x01f3) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x017f) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; //starting with 11 case 0x1100: switch (c2){ case 0x0000: if (c == 0x1104 || c == 0x1108 || c == 0x110a || c == 0x110d) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0030: if (c == 0x113b || c == 0x113f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0040: if (c == 0x1141 || c == 0x114d || c == 0x114f ) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0050: if (c == 0x1151 || c == 0x1156) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x0060: if (c == 0x1162 || c == 0x1164 || c == 0x1166 || c == 0x116b || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; case 0x00b0: if (c == 0x11b6 || c == 0x11b9 || c == 0x11bb || c == 0x116f) error ("Not a name start character, U+" + Integer.toHexString (c)); break; default: if (c == 0x1174 || c == 0x119f || c == 0x11ac || c == 0x11c3 || c == 0x11f1) error ("Not a name start character, U+" + Integer.toHexString (c)); } break; default: if (c == 0x0e46 || c == 0x1011 || c == 0x212f || c == 0x0587 || c == 0x0230 ) error ("Not a name start character, U+" + Integer.toHexString (c)); } } // punt on exact tests from Appendix A; approximate // them using the Unicode ID start/part rules if (i == readBufferPos && isName) { if (!Character.isUnicodeIdentifierStart (c) && c != ':' && c != '_') error ("Not a name start character, U+" + Integer.toHexString (c)); } else if (!Character.isUnicodeIdentifierPart (c) && c != '-' && c != ':' && c != '_' && c != '.' && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); } } } nameBufferPos = 0; // Read the first character.loop: while (true) { c = readCh (); switch (c) { case '%': case '<': case '>': case '&': case ',': case '|': case '*': case '+': case '?': case ')': case '=': case '\'': case '"': case '[': case ' ': case '\t': case '\n': case '\r': case ';': case '/': unread (c); if (nameBufferPos == 0) { error ("name expected"); } // punt on exact tests from Appendix A, but approximate them if (isName && !Character.isUnicodeIdentifierStart ( nameBuffer [0]) && ":_".indexOf (nameBuffer [0]) == -1) error ("Not a name start character, U+" + Integer.toHexString (nameBuffer [0])); String s = intern (nameBuffer, 0, nameBufferPos); nameBufferPos = 0; return s; default: // punt on exact tests from Appendix A, but approximate them if ((nameBufferPos != 0 || !isName) && !Character.isUnicodeIdentifierPart (c) && ":-_.".indexOf (c) == -1 && !isExtender (c)) error ("Not a name character, U+" + Integer.toHexString (c)); if (nameBufferPos >= nameBuffer.length) nameBuffer = (char[]) extendArray (nameBuffer, nameBuffer.length, nameBufferPos); nameBuffer [nameBufferPos++] = c; } } }
int length = delim.length (); char ch [];
int length = delim.length(); char[] ch;
private void require (String delim) throws SAXException, IOException { int length = delim.length (); char ch []; if (length < dataBuffer.length) { ch = dataBuffer; delim.getChars (0, length, ch, 0); } else ch = delim.toCharArray (); if (USE_CHEATS && length <= (readBufferLength - readBufferPos)) { int offset = readBufferPos; for (int i = 0; i < length; i++, offset++) if (ch [i] != readBuffer [offset]) error ("required string", null, delim); readBufferPos = offset; } else { for (int i = 0; i < length; i++) require (ch [i]); } }
delim.getChars (0, length, ch, 0); } else ch = delim.toCharArray ();
delim.getChars(0, length, ch, 0); } else { ch = delim.toCharArray(); }
private void require (String delim) throws SAXException, IOException { int length = delim.length (); char ch []; if (length < dataBuffer.length) { ch = dataBuffer; delim.getChars (0, length, ch, 0); } else ch = delim.toCharArray (); if (USE_CHEATS && length <= (readBufferLength - readBufferPos)) { int offset = readBufferPos; for (int i = 0; i < length; i++, offset++) if (ch [i] != readBuffer [offset]) error ("required string", null, delim); readBufferPos = offset; } else { for (int i = 0; i < length; i++) require (ch [i]); } }
if (ch [i] != readBuffer [offset])
{ if (ch[i] != readBuffer[offset]) {
private void require (String delim) throws SAXException, IOException { int length = delim.length (); char ch []; if (length < dataBuffer.length) { ch = dataBuffer; delim.getChars (0, length, ch, 0); } else ch = delim.toCharArray (); if (USE_CHEATS && length <= (readBufferLength - readBufferPos)) { int offset = readBufferPos; for (int i = 0; i < length; i++, offset++) if (ch [i] != readBuffer [offset]) error ("required string", null, delim); readBufferPos = offset; } else { for (int i = 0; i < length; i++) require (ch [i]); } }
require (ch [i]);
{ require(ch[i]); }
private void require (String delim) throws SAXException, IOException { int length = delim.length (); char ch []; if (length < dataBuffer.length) { ch = dataBuffer; delim.getChars (0, length, ch, 0); } else ch = delim.toCharArray (); if (USE_CHEATS && length <= (readBufferLength - readBufferPos)) { int offset = readBufferPos; for (int i = 0; i < length; i++, offset++) if (ch [i] != readBuffer [offset]) error ("required string", null, delim); readBufferPos = offset; } else { for (int i = 0; i < length; i++) require (ch [i]); } }
Hashtable attlist;
HashMap attlist;
private void setAttribute (String elName, String name, String type, String enumeration, String value, int valueType) throws Exception { Hashtable attlist; if (skippedPE) return; // Create a new hashtable if necessary. attlist = getElementAttributes (elName); if (attlist == null) attlist = new Hashtable (); // ignore multiple attribute declarations! if (attlist.get (name) != null) { // warn ... return; } else { Object attribute [] = new Object [5]; attribute [0] = type; attribute [1] = value; attribute [2] = new Integer (valueType); attribute [3] = enumeration; attribute [4] = null; attlist.put (name, attribute); // save; but don't overwrite any existing <!ELEMENT ...> setElement (elName, CONTENT_UNDECLARED, null, attlist); } }
attlist = new Hashtable ();
{ attlist = new HashMap(); }
private void setAttribute (String elName, String name, String type, String enumeration, String value, int valueType) throws Exception { Hashtable attlist; if (skippedPE) return; // Create a new hashtable if necessary. attlist = getElementAttributes (elName); if (attlist == null) attlist = new Hashtable (); // ignore multiple attribute declarations! if (attlist.get (name) != null) { // warn ... return; } else { Object attribute [] = new Object [5]; attribute [0] = type; attribute [1] = value; attribute [2] = new Integer (valueType); attribute [3] = enumeration; attribute [4] = null; attlist.put (name, attribute); // save; but don't overwrite any existing <!ELEMENT ...> setElement (elName, CONTENT_UNDECLARED, null, attlist); } }
} else { Object attribute [] = new Object [5]; attribute [0] = type; attribute [1] = value; attribute [2] = new Integer (valueType); attribute [3] = enumeration; attribute [4] = null; attlist.put (name, attribute);
} else { AttributeDecl attribute = new AttributeDecl(); attribute.type = type; attribute.value = value; attribute.valueType = valueType; attribute.enumeration = enumeration; attlist.put(name, attribute);
private void setAttribute (String elName, String name, String type, String enumeration, String value, int valueType) throws Exception { Hashtable attlist; if (skippedPE) return; // Create a new hashtable if necessary. attlist = getElementAttributes (elName); if (attlist == null) attlist = new Hashtable (); // ignore multiple attribute declarations! if (attlist.get (name) != null) { // warn ... return; } else { Object attribute [] = new Object [5]; attribute [0] = type; attribute [1] = value; attribute [2] = new Integer (valueType); attribute [3] = enumeration; attribute [4] = null; attlist.put (name, attribute); // save; but don't overwrite any existing <!ELEMENT ...> setElement (elName, CONTENT_UNDECLARED, null, attlist); } }
private void setElement ( String name, int contentType, String contentModel, Hashtable attributes ) throws SAXException
private void setElement(String name, int contentType, String contentModel, HashMap attributes) throws SAXException
private void setElement ( String name, int contentType, String contentModel, Hashtable attributes ) throws SAXException { if (skippedPE) return; Object element [] = (Object []) elementInfo.get (name); // first <!ELEMENT ...> or <!ATTLIST ...> for this type? if (element == null) { element = new Object [3]; element [0] = new Integer (contentType); element [1] = contentModel; element [2] = attributes; elementInfo.put (name, element); return; } // <!ELEMENT ...> declaration? if (contentType != CONTENT_UNDECLARED) { // ... following an associated <!ATTLIST ...> if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { element [0] = new Integer (contentType); element [1] = contentModel; } else // VC: Unique Element Type Declaration handler.verror ("multiple declarations for element type: " + name); } // first <!ATTLIST ...>, before <!ELEMENT ...> ? else if (attributes != null) element [2] = attributes; }
Object element [] = (Object []) elementInfo.get (name);
ElementDecl element = (ElementDecl) elementInfo.get(name);
private void setElement ( String name, int contentType, String contentModel, Hashtable attributes ) throws SAXException { if (skippedPE) return; Object element [] = (Object []) elementInfo.get (name); // first <!ELEMENT ...> or <!ATTLIST ...> for this type? if (element == null) { element = new Object [3]; element [0] = new Integer (contentType); element [1] = contentModel; element [2] = attributes; elementInfo.put (name, element); return; } // <!ELEMENT ...> declaration? if (contentType != CONTENT_UNDECLARED) { // ... following an associated <!ATTLIST ...> if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { element [0] = new Integer (contentType); element [1] = contentModel; } else // VC: Unique Element Type Declaration handler.verror ("multiple declarations for element type: " + name); } // first <!ATTLIST ...>, before <!ELEMENT ...> ? else if (attributes != null) element [2] = attributes; }
if (element == null) { element = new Object [3]; element [0] = new Integer (contentType); element [1] = contentModel; element [2] = attributes; elementInfo.put (name, element);
if (element == null) { element = new ElementDecl(); element.contentType = contentType; element.contentModel = contentModel; element.attributes = attributes; elementInfo.put(name, element);
private void setElement ( String name, int contentType, String contentModel, Hashtable attributes ) throws SAXException { if (skippedPE) return; Object element [] = (Object []) elementInfo.get (name); // first <!ELEMENT ...> or <!ATTLIST ...> for this type? if (element == null) { element = new Object [3]; element [0] = new Integer (contentType); element [1] = contentModel; element [2] = attributes; elementInfo.put (name, element); return; } // <!ELEMENT ...> declaration? if (contentType != CONTENT_UNDECLARED) { // ... following an associated <!ATTLIST ...> if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { element [0] = new Integer (contentType); element [1] = contentModel; } else // VC: Unique Element Type Declaration handler.verror ("multiple declarations for element type: " + name); } // first <!ATTLIST ...>, before <!ELEMENT ...> ? else if (attributes != null) element [2] = attributes; }
if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { element [0] = new Integer (contentType); element [1] = contentModel; } else
if (element.contentType == CONTENT_UNDECLARED) { element.contentType = contentType; element.contentModel = contentModel; } else {
private void setElement ( String name, int contentType, String contentModel, Hashtable attributes ) throws SAXException { if (skippedPE) return; Object element [] = (Object []) elementInfo.get (name); // first <!ELEMENT ...> or <!ATTLIST ...> for this type? if (element == null) { element = new Object [3]; element [0] = new Integer (contentType); element [1] = contentModel; element [2] = attributes; elementInfo.put (name, element); return; } // <!ELEMENT ...> declaration? if (contentType != CONTENT_UNDECLARED) { // ... following an associated <!ATTLIST ...> if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { element [0] = new Integer (contentType); element [1] = contentModel; } else // VC: Unique Element Type Declaration handler.verror ("multiple declarations for element type: " + name); } // first <!ATTLIST ...>, before <!ELEMENT ...> ? else if (attributes != null) element [2] = attributes; }
element [2] = attributes;
{ element.attributes = attributes; }
private void setElement ( String name, int contentType, String contentModel, Hashtable attributes ) throws SAXException { if (skippedPE) return; Object element [] = (Object []) elementInfo.get (name); // first <!ELEMENT ...> or <!ATTLIST ...> for this type? if (element == null) { element = new Object [3]; element [0] = new Integer (contentType); element [1] = contentModel; element [2] = attributes; elementInfo.put (name, element); return; } // <!ELEMENT ...> declaration? if (contentType != CONTENT_UNDECLARED) { // ... following an associated <!ATTLIST ...> if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { element [0] = new Integer (contentType); element [1] = contentModel; } else // VC: Unique Element Type Declaration handler.verror ("multiple declarations for element type: " + name); } // first <!ATTLIST ...>, before <!ELEMENT ...> ? else if (attributes != null) element [2] = attributes; }
private void setExternalEntity (String eName, int eClass, String ids [], String nName)
private void setExternalEntity(String eName, int eClass, ExternalIdentifiers ids, String nName)
private void setExternalEntity (String eName, int eClass, String ids [], String nName) { if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (eClass); entity [1] = ids;// FIXME: shrink!! [2] no longer used, [4] irrelevant given [0] entity [4] = nName; entityInfo.put (eName, entity); } }
if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (eClass); entity [1] = ids; entity [4] = nName; entityInfo.put (eName, entity);
if (entityInfo.get(eName) == null) { EntityInfo entity = new EntityInfo(); entity.type = eClass; entity.ids = ids; entity.notationName = nName; entityInfo.put(eName, entity);
private void setExternalEntity (String eName, int eClass, String ids [], String nName) { if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (eClass); entity [1] = ids;// FIXME: shrink!! [2] no longer used, [4] irrelevant given [0] entity [4] = nName; entityInfo.put (eName, entity); } }
if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (ENTITY_INTERNAL); entity [3] = value; entityInfo.put (eName, entity);
if (entityInfo.get(eName) == null) { EntityInfo entity = new EntityInfo(); entity.type = ENTITY_INTERNAL; entity.value = value; entityInfo.put(eName, entity);
private void setInternalEntity (String eName, String value) throws SAXException { if (skippedPE) return; if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (ENTITY_INTERNAL);// FIXME: shrink!! [2] useless entity [3] = value; entityInfo.put (eName, entity); } if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { if ("lt" == eName || "gt" == eName || "quot" == eName || "apos" == eName || "amp" == eName) return; } else { if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) || "apos".equals(eName) || "amp".equals(eName)) return; } handler.getDeclHandler () .internalEntityDecl (eName, value); }
if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) {
if (handler.stringInterning) {
private void setInternalEntity (String eName, String value) throws SAXException { if (skippedPE) return; if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (ENTITY_INTERNAL);// FIXME: shrink!! [2] useless entity [3] = value; entityInfo.put (eName, entity); } if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { if ("lt" == eName || "gt" == eName || "quot" == eName || "apos" == eName || "amp" == eName) return; } else { if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) || "apos".equals(eName) || "amp".equals(eName)) return; } handler.getDeclHandler () .internalEntityDecl (eName, value); }
} else {
} } else {
private void setInternalEntity (String eName, String value) throws SAXException { if (skippedPE) return; if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (ENTITY_INTERNAL);// FIXME: shrink!! [2] useless entity [3] = value; entityInfo.put (eName, entity); } if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { if ("lt" == eName || "gt" == eName || "quot" == eName || "apos" == eName || "amp" == eName) return; } else { if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) || "apos".equals(eName) || "amp".equals(eName)) return; } handler.getDeclHandler () .internalEntityDecl (eName, value); }
handler.getDeclHandler () .internalEntityDecl (eName, value);
private void setInternalEntity (String eName, String value) throws SAXException { if (skippedPE) return; if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (ENTITY_INTERNAL);// FIXME: shrink!! [2] useless entity [3] = value; entityInfo.put (eName, entity); } if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { if ("lt" == eName || "gt" == eName || "quot" == eName || "apos" == eName || "amp" == eName) return; } else { if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) || "apos".equals(eName) || "amp".equals(eName)) return; } handler.getDeclHandler () .internalEntityDecl (eName, value); }
handler.getDeclHandler().internalEntityDecl(eName, value); }
private void setInternalEntity (String eName, String value) throws SAXException { if (skippedPE) return; if (entityInfo.get (eName) == null) { Object entity[] = new Object [5]; entity [0] = new Integer (ENTITY_INTERNAL);// FIXME: shrink!! [2] useless entity [3] = value; entityInfo.put (eName, entity); } if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { if ("lt" == eName || "gt" == eName || "quot" == eName || "apos" == eName || "amp" == eName) return; } else { if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) || "apos".equals(eName) || "amp".equals(eName)) return; } handler.getDeclHandler () .internalEntityDecl (eName, value); }
private void setNotation (String nname, String ids [])
private void setNotation(String nname, ExternalIdentifiers ids)
private void setNotation (String nname, String ids []) throws SAXException { if (skippedPE) return; handler.notationDecl (nname, ids); if (notationInfo.get (nname) == null) notationInfo.put (nname, nname); else // VC: Unique Notation Name handler.verror ("Duplicate notation name decl: " + nname); }
handler.notationDecl (nname, ids); if (notationInfo.get (nname) == null) notationInfo.put (nname, nname);
handler.notationDecl(nname, ids.publicId, ids.systemId, ids.baseUri); if (notationInfo.get(nname) == null) { notationInfo.put(nname, nname); }
private void setNotation (String nname, String ids []) throws SAXException { if (skippedPE) return; handler.notationDecl (nname, ids); if (notationInfo.get (nname) == null) notationInfo.put (nname, nname); else // VC: Unique Notation Name handler.verror ("Duplicate notation name decl: " + nname); }
handler.verror ("Duplicate notation name decl: " + nname);
handler.verror("Duplicate notation name decl: " + nname); }
private void setNotation (String nname, String ids []) throws SAXException { if (skippedPE) return; handler.notationDecl (nname, ids); if (notationInfo.get (nname) == null) notationInfo.put (nname, nname); else // VC: Unique Notation Name handler.verror ("Duplicate notation name decl: " + nname); }
if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) { if (!(encodingName.equals ("ISO-10646-UCS-2") || encodingName.equals ("UTF-16") || encodingName.equals ("UTF-16BE") || encodingName.equals ("UTF-16LE"))) error ("unsupported Unicode encoding", encodingName, "UTF-16");
if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) { if (!(encodingName.equals("ISO-10646-UCS-2") || encodingName.equals("UTF-16") || encodingName.equals("UTF-16BE") || encodingName.equals("UTF-16LE"))) { error("unsupported Unicode encoding", encodingName, "UTF-16"); }
private void setupDecoding (String encodingName) throws SAXException, IOException { encodingName = encodingName.toUpperCase (); // ENCODING_EXTERNAL indicates an encoding that wasn't // autodetected ... we can use builtin decoders, or // ones from the JVM (InputStreamReader). // Otherwise we can only tweak what was autodetected, and // only for single byte (ASCII derived) builtin encodings. // ASCII-derived encodings if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL) { if (encodingName.equals ("ISO-8859-1") || encodingName.equals ("8859_1") || encodingName.equals ("ISO8859_1") ) { encoding = ENCODING_ISO_8859_1; return; } else if (encodingName.equals ("US-ASCII") || encodingName.equals ("ASCII")) { encoding = ENCODING_ASCII; return; } else if (encodingName.equals ("UTF-8") || encodingName.equals ("UTF8")) { encoding = ENCODING_UTF_8; return; } else if (encoding != ENCODING_EXTERNAL) { // used to start with a new reader ... throw new UnsupportedEncodingException (encodingName); } // else fallthrough ... // it's ASCII-ish and something other than a builtin } // Unicode and such if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) { if (!(encodingName.equals ("ISO-10646-UCS-2") || encodingName.equals ("UTF-16") || encodingName.equals ("UTF-16BE") || encodingName.equals ("UTF-16LE"))) error ("unsupported Unicode encoding", encodingName, "UTF-16"); return; } // four byte encodings if (encoding == ENCODING_UCS_4_1234 || encoding == ENCODING_UCS_4_4321 || encoding == ENCODING_UCS_4_2143 || encoding == ENCODING_UCS_4_3412) { // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists if (!encodingName.equals ("ISO-10646-UCS-4")) error ("unsupported 32-bit encoding", encodingName, "ISO-10646-UCS-4"); return; } // assert encoding == ENCODING_EXTERNAL // if (encoding != ENCODING_EXTERNAL) // throw new RuntimeException ("encoding = " + encoding); if (encodingName.equals ("UTF-16BE")) { encoding = ENCODING_UCS_2_12; return; } if (encodingName.equals ("UTF-16LE")) { encoding = ENCODING_UCS_2_21; return; } // We couldn't use the builtin decoders at all. But we can try to // create a reader, since we haven't messed up buffering. Tweak // the encoding name if necessary. if (encodingName.equals ("UTF-16") || encodingName.equals ("ISO-10646-UCS-2")) encodingName = "Unicode"; // Ignoring all the EBCDIC aliases here reader = new InputStreamReader (is, encodingName); sourceType = INPUT_READER; }
if (!encodingName.equals ("ISO-10646-UCS-4")) error ("unsupported 32-bit encoding", encodingName,
if (!encodingName.equals("ISO-10646-UCS-4")) { error("unsupported 32-bit encoding", encodingName,
private void setupDecoding (String encodingName) throws SAXException, IOException { encodingName = encodingName.toUpperCase (); // ENCODING_EXTERNAL indicates an encoding that wasn't // autodetected ... we can use builtin decoders, or // ones from the JVM (InputStreamReader). // Otherwise we can only tweak what was autodetected, and // only for single byte (ASCII derived) builtin encodings. // ASCII-derived encodings if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL) { if (encodingName.equals ("ISO-8859-1") || encodingName.equals ("8859_1") || encodingName.equals ("ISO8859_1") ) { encoding = ENCODING_ISO_8859_1; return; } else if (encodingName.equals ("US-ASCII") || encodingName.equals ("ASCII")) { encoding = ENCODING_ASCII; return; } else if (encodingName.equals ("UTF-8") || encodingName.equals ("UTF8")) { encoding = ENCODING_UTF_8; return; } else if (encoding != ENCODING_EXTERNAL) { // used to start with a new reader ... throw new UnsupportedEncodingException (encodingName); } // else fallthrough ... // it's ASCII-ish and something other than a builtin } // Unicode and such if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) { if (!(encodingName.equals ("ISO-10646-UCS-2") || encodingName.equals ("UTF-16") || encodingName.equals ("UTF-16BE") || encodingName.equals ("UTF-16LE"))) error ("unsupported Unicode encoding", encodingName, "UTF-16"); return; } // four byte encodings if (encoding == ENCODING_UCS_4_1234 || encoding == ENCODING_UCS_4_4321 || encoding == ENCODING_UCS_4_2143 || encoding == ENCODING_UCS_4_3412) { // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists if (!encodingName.equals ("ISO-10646-UCS-4")) error ("unsupported 32-bit encoding", encodingName, "ISO-10646-UCS-4"); return; } // assert encoding == ENCODING_EXTERNAL // if (encoding != ENCODING_EXTERNAL) // throw new RuntimeException ("encoding = " + encoding); if (encodingName.equals ("UTF-16BE")) { encoding = ENCODING_UCS_2_12; return; } if (encodingName.equals ("UTF-16LE")) { encoding = ENCODING_UCS_2_21; return; } // We couldn't use the builtin decoders at all. But we can try to // create a reader, since we haven't messed up buffering. Tweak // the encoding name if necessary. if (encodingName.equals ("UTF-16") || encodingName.equals ("ISO-10646-UCS-2")) encodingName = "Unicode"; // Ignoring all the EBCDIC aliases here reader = new InputStreamReader (is, encodingName); sourceType = INPUT_READER; }
if (encodingName.equals ("UTF-16") || encodingName.equals ("ISO-10646-UCS-2"))
if (encodingName.equals("UTF-16") || encodingName.equals("ISO-10646-UCS-2")) {
private void setupDecoding (String encodingName) throws SAXException, IOException { encodingName = encodingName.toUpperCase (); // ENCODING_EXTERNAL indicates an encoding that wasn't // autodetected ... we can use builtin decoders, or // ones from the JVM (InputStreamReader). // Otherwise we can only tweak what was autodetected, and // only for single byte (ASCII derived) builtin encodings. // ASCII-derived encodings if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL) { if (encodingName.equals ("ISO-8859-1") || encodingName.equals ("8859_1") || encodingName.equals ("ISO8859_1") ) { encoding = ENCODING_ISO_8859_1; return; } else if (encodingName.equals ("US-ASCII") || encodingName.equals ("ASCII")) { encoding = ENCODING_ASCII; return; } else if (encodingName.equals ("UTF-8") || encodingName.equals ("UTF8")) { encoding = ENCODING_UTF_8; return; } else if (encoding != ENCODING_EXTERNAL) { // used to start with a new reader ... throw new UnsupportedEncodingException (encodingName); } // else fallthrough ... // it's ASCII-ish and something other than a builtin } // Unicode and such if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) { if (!(encodingName.equals ("ISO-10646-UCS-2") || encodingName.equals ("UTF-16") || encodingName.equals ("UTF-16BE") || encodingName.equals ("UTF-16LE"))) error ("unsupported Unicode encoding", encodingName, "UTF-16"); return; } // four byte encodings if (encoding == ENCODING_UCS_4_1234 || encoding == ENCODING_UCS_4_4321 || encoding == ENCODING_UCS_4_2143 || encoding == ENCODING_UCS_4_3412) { // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists if (!encodingName.equals ("ISO-10646-UCS-4")) error ("unsupported 32-bit encoding", encodingName, "ISO-10646-UCS-4"); return; } // assert encoding == ENCODING_EXTERNAL // if (encoding != ENCODING_EXTERNAL) // throw new RuntimeException ("encoding = " + encoding); if (encodingName.equals ("UTF-16BE")) { encoding = ENCODING_UCS_2_12; return; } if (encodingName.equals ("UTF-16LE")) { encoding = ENCODING_UCS_2_21; return; } // We couldn't use the builtin decoders at all. But we can try to // create a reader, since we haven't messed up buffering. Tweak // the encoding name if necessary. if (encodingName.equals ("UTF-16") || encodingName.equals ("ISO-10646-UCS-2")) encodingName = "Unicode"; // Ignoring all the EBCDIC aliases here reader = new InputStreamReader (is, encodingName); sourceType = INPUT_READER; }
private static boolean tryEncoding ( byte sig[], byte b1, byte b2, byte b3, byte b4)
private static boolean tryEncoding(byte[] sig, byte b1, byte b2, byte b3, byte b4)
private static boolean tryEncoding ( byte sig[], byte b1, byte b2, byte b3, byte b4) { return (sig [0] == b1 && sig [1] == b2 && sig [2] == b3 && sig [3] == b4); }
if (tryRead ("<?xml")) { if (tryWhitespace ()) { if (inputStack.size () > 0) { return parseTextDecl (ignoreEncoding); } else { return parseXMLDecl (ignoreEncoding);
if (tryRead("<?xml")) { if (tryWhitespace()) { if (inputStack.size() > 0) { return parseTextDecl(ignoreEncoding); } else { return parseXMLDecl(ignoreEncoding); }
private String tryEncodingDecl (boolean ignoreEncoding) throws SAXException, IOException { // Read the XML/text declaration. if (tryRead ("<?xml")) { if (tryWhitespace ()) { if (inputStack.size () > 0) { return parseTextDecl (ignoreEncoding); } else { return parseXMLDecl (ignoreEncoding); } } else { // <?xml-stylesheet ...?> or similar unread ('l'); unread ('m'); unread ('x'); unread ('?'); unread ('<'); } } return null; }
} else {
else {
private String tryEncodingDecl (boolean ignoreEncoding) throws SAXException, IOException { // Read the XML/text declaration. if (tryRead ("<?xml")) { if (tryWhitespace ()) { if (inputStack.size () > 0) { return parseTextDecl (ignoreEncoding); } else { return parseXMLDecl (ignoreEncoding); } } else { // <?xml-stylesheet ...?> or similar unread ('l'); unread ('m'); unread ('x'); unread ('?'); unread ('<'); } } return null; }
while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';':
while (true) { c = readCh(); if (c == ';') {
private void tryReadCharRef () throws SAXException, IOException { int value = 0; char c; if (tryRead ('x')) {loop1: while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';': break loop1; default: error ("illegal character in character reference", c, null); break loop1; } value *= 16; value += n; } } else {loop2: while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } } // check for character refs being legal XML if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value)); // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: if (value > 0x0010ffff) { // too big for surrogate error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); } }
default: error ("illegal character in character reference", c, null);
} else { int n = Character.digit(c, 16); if (n == -1) { error("illegal character in character reference", c, null);
private void tryReadCharRef () throws SAXException, IOException { int value = 0; char c; if (tryRead ('x')) {loop1: while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';': break loop1; default: error ("illegal character in character reference", c, null); break loop1; } value *= 16; value += n; } } else {loop2: while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } } // check for character refs being legal XML if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value)); // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: if (value > 0x0010ffff) { // too big for surrogate error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); } }
} else {
} } else {
private void tryReadCharRef () throws SAXException, IOException { int value = 0; char c; if (tryRead ('x')) {loop1: while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';': break loop1; default: error ("illegal character in character reference", c, null); break loop1; } value *= 16; value += n; } } else {loop2: while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } } // check for character refs being legal XML if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value)); // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: if (value > 0x0010ffff) { // too big for surrogate error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); } }
while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';':
while (true) { c = readCh(); if (c == ';') {
private void tryReadCharRef () throws SAXException, IOException { int value = 0; char c; if (tryRead ('x')) {loop1: while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';': break loop1; default: error ("illegal character in character reference", c, null); break loop1; } value *= 16; value += n; } } else {loop2: while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } } // check for character refs being legal XML if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value)); // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: if (value > 0x0010ffff) { // too big for surrogate error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); } }
default: error ("illegal character in character reference", c, null);
} else { int n = Character.digit(c, 10); if (n == -1) { error("illegal character in character reference", c, null);
private void tryReadCharRef () throws SAXException, IOException { int value = 0; char c; if (tryRead ('x')) {loop1: while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';': break loop1; default: error ("illegal character in character reference", c, null); break loop1; } value *= 16; value += n; } } else {loop2: while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } } // check for character refs being legal XML if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value)); // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: if (value > 0x0010ffff) { // too big for surrogate error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); } }
error ("illegal XML character reference U+" + Integer.toHexString (value));
{ error("illegal XML character reference U+" + Integer.toHexString(value)); }
private void tryReadCharRef () throws SAXException, IOException { int value = 0; char c; if (tryRead ('x')) {loop1: while (true) { c = readCh (); int n; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': n = c - '0'; break; case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': n = (c - 'a') + 10; break; case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': n = (c - 'A') + 10; break; case ';': break loop1; default: error ("illegal character in character reference", c, null); break loop1; } value *= 16; value += n; } } else {loop2: while (true) { c = readCh (); switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': value *= 10; value += c - '0'; break; case ';': break loop2; default: error ("illegal character in character reference", c, null); break loop2; } } } // check for character refs being legal XML if ((value < 0x0020 && ! (value == '\n' || value == '\t' || value == '\r')) || (value >= 0xD800 && value <= 0xDFFF) || value == 0xFFFE || value == 0xFFFF || value > 0x0010ffff) error ("illegal XML character reference U+" + Integer.toHexString (value)); // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: if (value > 0x0010ffff) { // too big for surrogate error ("character reference " + value + " is too large for UTF-16", new Integer (value).toString (), null); } }
ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this, object_key); connectDelegate(object_key, delegate);
ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this, object_key); create_and_connect(object_key, a_servant._all_interfaces(this, object_key)[0], delegate);
public byte[] activate_object(Servant a_servant) throws ServantAlreadyActive, WrongPolicy { checkDiscarding(); required(ServantRetentionPolicyValue.RETAIN); required(IdAssignmentPolicyValue.SYSTEM_ID); AOM.Obj exists = aom.findServant(a_servant); if (exists != null) { if (exists.isDeactiveted()) { // If exists but deactivated, activate and return // the existing key. exists.setDeactivated(false); incarnate(exists, exists.key, a_servant, false); return exists.key; } else if (applies(IdUniquenessPolicyValue.UNIQUE_ID)) throw new ServantAlreadyActive(); // It multiple ids are allowed, exit block allowing repetetive // activations. } byte[] object_key = AOM.getFreeId(); ServantDelegateImpl delegate = new ServantDelegateImpl(a_servant, this, object_key); connectDelegate(object_key, delegate); return object_key; }
refTemplate = new RefTemplate();
public gnuPOA(gnuPOA a_parent, String a_name, POAManager a_manager, Policy[] a_policies, ORB_1_4 an_orb ) throws InvalidPolicy { // Add default policies. Policy[] all_policies = StandardPolicies.withDefault(a_policies); name = a_name; parent = a_parent; m_orb = an_orb; if (a_manager != null) m_manager = a_manager; else m_manager = new gnuPOAManager(); if (m_manager instanceof gnuPOAManager) { gnuPOAManager g = (gnuPOAManager) m_manager; g.addPoa(this); } m_policies = new HashSet(all_policies.length); s_policies = new Policy[ all_policies.length ]; for (int i = 0; i < s_policies.length; i++) { s_policies [ i ] = all_policies [ i ].copy(); m_policies.add(((AccessiblePolicy) s_policies [ i ]).getValue()); } retain_servant = applies(ServantRetentionPolicyValue.RETAIN); validatePolicies(a_policies); }
ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant, this, object_key); connectDelegate(object_key, delegate);
ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant, this, object_key); create_and_connect(object_key, the_Servant._all_interfaces(this, object_key)[0], delegate);
public org.omg.CORBA.Object servant_to_reference(Servant the_Servant) throws ServantNotActive, WrongPolicy { required(ServantRetentionPolicyValue.RETAIN); AOM.Obj exists = null; if (!applies(IdUniquenessPolicyValue.MULTIPLE_ID)) exists = aom.findServant(the_Servant); if (exists != null) { if (exists.isDeactiveted()) { if (applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION)) { checkDiscarding(); exists.setDeactivated(false); incarnate(exists, exists.key, the_Servant, false); } else throw new ServantNotActive(); } else return exists.object; } if (exists == null && applies(ImplicitActivationPolicyValue.IMPLICIT_ACTIVATION) ) { checkDiscarding(); byte[] object_key = AOM.getFreeId(); ServantDelegateImpl delegate = new ServantDelegateImpl(the_Servant, this, object_key); connectDelegate(object_key, delegate); return delegate.object; } else throw new ServantNotActive(); }
AttributeNode(TemplateNode children, TemplateNode next, TemplateNode name,
AttributeNode(TemplateNode name,
AttributeNode(TemplateNode children, TemplateNode next, TemplateNode name, TemplateNode namespace, Node source) { super(children, next); this.name = name; this.namespace = namespace; this.source = source; }
super(children, next);
AttributeNode(TemplateNode children, TemplateNode next, TemplateNode name, TemplateNode namespace, Node source) { super(children, next); this.name = name; this.namespace = namespace; this.source = source; }
return new AttributeNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet), name.clone(stylesheet),
TemplateNode ret = new AttributeNode(name.clone(stylesheet),
TemplateNode clone(Stylesheet stylesheet) { return new AttributeNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet), name.clone(stylesheet), (namespace == null) ? null : namespace.clone(stylesheet), source); }
if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret;
TemplateNode clone(Stylesheet stylesheet) { return new AttributeNode((children == null) ? null : children.clone(stylesheet), (next == null) ? null : next.clone(stylesheet), name.clone(stylesheet), (namespace == null) ? null : namespace.clone(stylesheet), source); }
boolean corbaname; ArrayList alt_addr = new ArrayList(); int major = 1; int minor = 0; String host; int port = DEFAULT_PORT; String key; StringTokenizer st = new StringTokenizer(corbaloc, ":@/.,#", true); t = new String[st.countTokens()]; for (int i = 0; i < t.length; i++) { t[i] = st.nextToken(); } p = 0; if (t[p].startsWith(pxCORBANAME)) corbaname = true; else if (t[p].equalsIgnoreCase(pxCORBALOC)) corbaname = false; else if (t[p].equalsIgnoreCase(pxIOR)) { IOR ior = IOR.parse(corbaloc); return orb.ior_to_object(ior); } else throw new DATA_CONVERSION("Unsupported protocol: '" + t[p] + "'"); p++; if (!t[p++].equals(":")) throw new BAD_PARAM("Syntax (':' expected after name prefix)"); if (t[p].equals(RIR)) { p++; if (!t[p++].equals(":")) throw new BAD_PARAM("':' expected after 'rir'"); key = readKey("/"); Object object; try { object = orb.resolve_initial_references(key); return corbaname ? resolve(object) : object; } catch (InvalidName e) { throw new BAD_PARAM("Unknown initial reference '" + key + "'"); } } else if (t[p].equals(IIOP) || t[p].equals(":")) { IOR ior = new IOR(); Addresses: do { if (t[p].equals(":")) { p++; } else { p++; if (!t[p++].equals(":")) throw new BAD_PARAM("':' expected after 'iiop'"); if (t[p + 1].equals(".")) if (t[p + 3].equals("@")) { try { major = Integer.parseInt(t[p++]); } catch (NumberFormatException e) { throw new BAD_PARAM("Major version number '" + t[p - 1] + "'"); } p++; try { minor = Integer.parseInt(t[p++]); } catch (NumberFormatException e) { throw new BAD_PARAM("Major version number '" + t[p - 1] + "'"); } p++; } } ior.Internet.version = new Version(major, minor); StringBuffer bhost = new StringBuffer(corbaloc.length()); while (!t[p].equals(":") && !t[p].equals("/") && !t[p].equals(",")) bhost.append(t[p++]); host = bhost.toString(); ior.Internet.host = host; if (t[p].equals(":")) { p++; try { port = Integer.parseInt(t[p++]); } catch (NumberFormatException e) { throw new BAD_PARAM("Invalid port '" + t[p - 1] + "'"); } } ior.Internet.port = port; ior.Id = ""; if (t[p].equals(",")) p++; else break Addresses; } while (true); key = readKey("/"); ior.key = key.getBytes(); org.omg.CORBA.Object object = orb.ior_to_object(ior); return corbaname ? resolve(object) : object; } else throw new DATA_CONVERSION("Unsupported protocol '" + t[p] + "'");
return corbaloc(corbaloc, orb, 0);
public synchronized org.omg.CORBA.Object corbaloc(String corbaloc, OrbFunctional orb) throws BAD_PARAM { boolean corbaname; // The alternative addresses, if given. ArrayList alt_addr = new ArrayList(); // The version numbers with default values. int major = 1; int minor = 0; // The host address. String host; // The port. int port = DEFAULT_PORT; // The object key as string. String key; StringTokenizer st = new StringTokenizer(corbaloc, ":@/.,#", true); t = new String[st.countTokens()]; for (int i = 0; i < t.length; i++) { t[i] = st.nextToken(); } p = 0; if (t[p].startsWith(pxCORBANAME)) corbaname = true; else if (t[p].equalsIgnoreCase(pxCORBALOC)) corbaname = false; else if (t[p].equalsIgnoreCase(pxIOR)) { IOR ior = IOR.parse(corbaloc); return orb.ior_to_object(ior); } else throw new DATA_CONVERSION("Unsupported protocol: '" + t[p] + "'"); p++; if (!t[p++].equals(":")) throw new BAD_PARAM("Syntax (':' expected after name prefix)"); // Check for rir: if (t[p].equals(RIR)) { p++; if (!t[p++].equals(":")) throw new BAD_PARAM("':' expected after 'rir'"); key = readKey("/"); Object object; try { object = orb.resolve_initial_references(key); return corbaname ? resolve(object) : object; } catch (InvalidName e) { throw new BAD_PARAM("Unknown initial reference '" + key + "'"); } } else // Check for iiop. if (t[p].equals(IIOP) || t[p].equals(":")) { IOR ior = new IOR(); Addresses: do { // Read addresses. if (t[p].equals(":")) { p++; } else { p++; if (!t[p++].equals(":")) throw new BAD_PARAM("':' expected after 'iiop'"); // Check if version is present. if (t[p + 1].equals(".")) if (t[p + 3].equals("@")) { // Version info present. try { major = Integer.parseInt(t[p++]); } catch (NumberFormatException e) { throw new BAD_PARAM("Major version number '" + t[p - 1] + "'"); } p++; // '.' at this point. try { minor = Integer.parseInt(t[p++]); } catch (NumberFormatException e) { throw new BAD_PARAM("Major version number '" + t[p - 1] + "'"); } p++; // '@' at this point. } } ior.Internet.version = new Version(major, minor); // Then host data goes till '/' or ':'. StringBuffer bhost = new StringBuffer(corbaloc.length()); while (!t[p].equals(":") && !t[p].equals("/") && !t[p].equals(",")) bhost.append(t[p++]); host = bhost.toString(); ior.Internet.host = host; if (t[p].equals(":")) { // Port specified. p++; try { port = Integer.parseInt(t[p++]); } catch (NumberFormatException e) { throw new BAD_PARAM("Invalid port '" + t[p - 1] + "'"); } } ior.Internet.port = port; // Id is not listed. ior.Id = ""; if (t[p].equals(",")) p++; else break Addresses; } while (true); key = readKey("/"); ior.key = key.getBytes(); org.omg.CORBA.Object object = orb.ior_to_object(ior); return corbaname ? resolve(object) : object; } else throw new DATA_CONVERSION("Unsupported protocol '" + t[p] + "'"); }
fireTableDataChanged();
newRowsAdded(new TableModelEvent( this, dataVector.size(), dataVector.size(), -1, TableModelEvent.INSERT) );
public void addRow(Vector rowData) { dataVector.add(rowData); fireTableDataChanged(); }
return columnIdentifiers.size();
return (columnIdentifiers == null ? 0 : columnIdentifiers.size());
public int getColumnCount() { return columnIdentifiers.size(); }
if (columnIdentifiers == null || column >= getColumnCount()) { return super.getColumnName(column);
String result = ""; if (columnIdentifiers == null) result = super.getColumnName(column); else { if (column < getColumnCount()) { Object id = columnIdentifiers.get(column); if (id != null) result = id.toString(); else result = super.getColumnName(column);
public String getColumnName(int column) { // Check for Column if (columnIdentifiers == null || column >= getColumnCount()) { return super.getColumnName(column); } // Return Column name return (String) columnIdentifiers.get(column); }
return (String) columnIdentifiers.get(column);
} return result;
public String getColumnName(int column) { // Check for Column if (columnIdentifiers == null || column >= getColumnCount()) { return super.getColumnName(column); } // Return Column name return (String) columnIdentifiers.get(column); }
fireTableDataChanged();
fireTableRowsInserted(row,row);
public void insertRow(int row, Vector rowData) { dataVector.add(row, rowData); fireTableDataChanged(); }
for (int index = 0; index < (endIndex - startIndex); index++) { Vector vector = (Vector) dataVector.remove(startIndex); dataVector.add(toIndex, vector);
Vector removed = new Vector(); for (int i = endIndex; i >= startIndex; i--) { removed.add(this.dataVector.remove(i)); } for (int i = 0; i <= endIndex - startIndex; i++) { dataVector.insertElementAt(removed.get(i), toIndex);
public void moveRow(int startIndex, int endIndex, int toIndex) { for (int index = 0; index < (endIndex - startIndex); index++) { Vector vector = (Vector) dataVector.remove(startIndex); dataVector.add(toIndex, vector); } fireTableDataChanged(); }
fireTableDataChanged();
fireTableRowsDeleted(row,row);
public void removeRow(int row) { dataVector.remove(row); fireTableDataChanged(); }
if (columnIdentifiers != null)
public void setColumnCount(int columnCount) { for (int i = 0; i < dataVector.size(); ++i) { ((Vector) dataVector.get(i)).setSize(columnCount); } columnIdentifiers.setSize(columnCount); fireTableDataChanged(); }
setColumnCount(columnIdentifiers.size());
setColumnCount((columnIdentifiers == null ? 0 : columnIdentifiers.size()));
public void setColumnIdentifiers(Vector columnIdentifiers) { this.columnIdentifiers = columnIdentifiers; setColumnCount(columnIdentifiers.size()); }
fireTableDataChanged();
fireTableRowsDeleted(rowCount,existingRowCount-1); } else { int rowsToAdd = rowCount - existingRowCount; for (int i = 0; i < rowsToAdd; i++) { Vector tmp = new Vector(); tmp.setSize(columnIdentifiers.size()); dataVector.add(tmp); } fireTableRowsInserted(existingRowCount,rowCount-1); }
public void setRowCount(int rowCount) { dataVector.setSize(rowCount); fireTableDataChanged(); }
fireTableDataChanged();
fireTableCellUpdated(row,column);
public void setValueAt(Object value, int row, int column) { ((Vector) dataVector.get(row)).set(column, value); fireTableDataChanged(); }
constLocals.remove(index);
public final void visit_iinc(int index, int incValue) { final int ebpOfs = stackFrame.getEbpOffset(typeSizeInfo, index); // pin down other references to this local vstack.loadLocal(eContext, ebpOfs); if (incValue == 1) { os.writeINC(BITS32, helper.BP, ebpOfs); } else { os.writeADD(BITS32, helper.BP, ebpOfs, incValue); } }
eContext, JvmType.INT, false);
eContext, JvmType.INT, true);
public final void visit_instanceof(VmConstClass classRef) { // Resolve the classRef classRef.resolve(loader); // Prepare final X86RegisterPool pool = eContext.getGPRPool(); final VmType<?> resolvedType = classRef.getResolvedVmClass(); if (resolvedType.isInterface() || resolvedType.isArray()) { // It is an interface, do it the hard way // Load reference final RefItem ref = vstack.popRef(); ref.load(eContext); final GPR refr = ref.getRegister(); // Allocate tmp registers final GPR classr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); final GPR cntr = (GPR) L1AHelper.requestRegister(eContext, JvmType.INT, false); final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); final Label curInstrLabel = getCurInstrLabel(); /* Objectref is already on the stack */ writeResolveAndLoadClassToReg(classRef, classr); helper.writeClassInitialize(curInstrLabel, classr, resolvedType); final Label trueLabel = new Label(curInstrLabel + "io-true"); final Label endLabel = new Label(curInstrLabel + "io-end"); /* Is instanceof? */ instanceOf(refr, classr, tmpr, cntr, trueLabel, false); final IntItem result = (IntItem) L1AHelper.requestWordRegister(eContext, JvmType.INT, false); final GPR resultr = result.getRegister(); /* Not instanceof */ // TODO: use setcc instead of jumps os.writeXOR(resultr, resultr); os.writeJMP(endLabel); os.setObjectRef(trueLabel); os.writeMOV_Const(resultr, 1); // Push result os.setObjectRef(endLabel); ref.release(eContext); vstack.push(result); // Release pool.release(classr); pool.release(tmpr); pool.release(cntr); } else { // It is a class, do the fast way // Load reference final RefItem ref = vstack.popRef(); ref.load(eContext); final GPR refr = ref.getRegister(); // Allocate tmp registers final GPR tmpr = (GPR) L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); final IntItem result = (IntItem) L1AHelper.requestWordRegister( eContext, JvmType.INT, false); // Is instanceof instanceOfClass(refr, (VmClassType<?>) classRef.getResolvedVmClass(), tmpr, result.getRegister(), null, false); // Push result vstack.push(result); // Release ref.release(eContext); pool.release(tmpr); } }
public final void writeClassInitialize(Label curInstrLabel, GPR classReg, VmType<?> cls) { if (!cls.isInitialized()) { os.writeTEST(BITS32, classReg, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(curInstrLabel + "$$after-classinit-ex"); os.writeJCC(afterInit, X86Constants.JNZ); if (os.isCode32()) { os.writePUSHA(); } else { os.writePUSH(X86Register.RAX); os.writePUSH(X86Register.RBX); os.writePUSH(X86Register.RCX); os.writePUSH(X86Register.RDX); os.writePUSH(X86Register.RSI); os.writePUSH(X86Register.R8); os.writePUSH(X86Register.R9); os.writePUSH(X86Register.R10); os.writePUSH(X86Register.R11); os.writePUSH(X86Register.R13); os.writePUSH(X86Register.R14); os.writePUSH(X86Register.R15);
public final boolean writeClassInitialize(VmMethod method) { if (method.isStatic() && !method.isInitializer()) { final VmType<?> cls = method.getDeclaringClass(); if (!cls.isInitialized()) { final GPR aax = this.AAX; final int size = os.getMode().getSize(); os.writePUSH(aax); final int typeOfs = getSharedStaticsOffset(method .getDeclaringClass()); os.writeMOV(size, aax, STATICS, typeOfs); os.writeTEST(BITS32, aax, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(method.getMangledName() + "$$after-classinit"); os.writeJCC(afterInit, X86Constants.JNZ); os.writePUSH(aax); invokeJavaMethod(entryPoints.getVmTypeInitialize()); os.setObjectRef(afterInit); os.writePOP(aax); return true;
public final void writeClassInitialize(Label curInstrLabel, GPR classReg, VmType<?> cls) { if (!cls.isInitialized()) { // Test declaringClass.modifiers os.writeTEST(BITS32, classReg, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(curInstrLabel + "$$after-classinit-ex"); os.writeJCC(afterInit, X86Constants.JNZ); if (os.isCode32()) { os.writePUSHA(); } else { os.writePUSH(X86Register.RAX); os.writePUSH(X86Register.RBX); os.writePUSH(X86Register.RCX); os.writePUSH(X86Register.RDX); os.writePUSH(X86Register.RSI); os.writePUSH(X86Register.R8); os.writePUSH(X86Register.R9); os.writePUSH(X86Register.R10); os.writePUSH(X86Register.R11); // R12 contains processor and is preserved os.writePUSH(X86Register.R13); os.writePUSH(X86Register.R14); os.writePUSH(X86Register.R15); } // Call cls.initialize os.writePUSH(classReg); invokeJavaMethod(entryPoints.getVmTypeInitialize()); if (os.isCode32()) { os.writePOPA(); } else { os.writePOP(X86Register.R15); os.writePOP(X86Register.R14); os.writePOP(X86Register.R13); // R12 contains processor and is preserved os.writePOP(X86Register.R11); os.writePOP(X86Register.R10); os.writePOP(X86Register.R9); os.writePOP(X86Register.R8); os.writePOP(X86Register.RSI); os.writePOP(X86Register.RDX); os.writePOP(X86Register.RCX); os.writePOP(X86Register.RBX); os.writePOP(X86Register.RAX); } // Set label os.setObjectRef(afterInit); } }
os.writePUSH(classReg); invokeJavaMethod(entryPoints.getVmTypeInitialize()); if (os.isCode32()) { os.writePOPA(); } else { os.writePOP(X86Register.R15); os.writePOP(X86Register.R14); os.writePOP(X86Register.R13); os.writePOP(X86Register.R11); os.writePOP(X86Register.R10); os.writePOP(X86Register.R9); os.writePOP(X86Register.R8); os.writePOP(X86Register.RSI); os.writePOP(X86Register.RDX); os.writePOP(X86Register.RCX); os.writePOP(X86Register.RBX); os.writePOP(X86Register.RAX); } os.setObjectRef(afterInit);
public final void writeClassInitialize(Label curInstrLabel, GPR classReg, VmType<?> cls) { if (!cls.isInitialized()) { // Test declaringClass.modifiers os.writeTEST(BITS32, classReg, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(curInstrLabel + "$$after-classinit-ex"); os.writeJCC(afterInit, X86Constants.JNZ); if (os.isCode32()) { os.writePUSHA(); } else { os.writePUSH(X86Register.RAX); os.writePUSH(X86Register.RBX); os.writePUSH(X86Register.RCX); os.writePUSH(X86Register.RDX); os.writePUSH(X86Register.RSI); os.writePUSH(X86Register.R8); os.writePUSH(X86Register.R9); os.writePUSH(X86Register.R10); os.writePUSH(X86Register.R11); // R12 contains processor and is preserved os.writePUSH(X86Register.R13); os.writePUSH(X86Register.R14); os.writePUSH(X86Register.R15); } // Call cls.initialize os.writePUSH(classReg); invokeJavaMethod(entryPoints.getVmTypeInitialize()); if (os.isCode32()) { os.writePOPA(); } else { os.writePOP(X86Register.R15); os.writePOP(X86Register.R14); os.writePOP(X86Register.R13); // R12 contains processor and is preserved os.writePOP(X86Register.R11); os.writePOP(X86Register.R10); os.writePOP(X86Register.R9); os.writePOP(X86Register.R8); os.writePOP(X86Register.RSI); os.writePOP(X86Register.RDX); os.writePOP(X86Register.RCX); os.writePOP(X86Register.RBX); os.writePOP(X86Register.RAX); } // Set label os.setObjectRef(afterInit); } }
return false;
public final void writeClassInitialize(Label curInstrLabel, GPR classReg, VmType<?> cls) { if (!cls.isInitialized()) { // Test declaringClass.modifiers os.writeTEST(BITS32, classReg, entryPoints.getVmTypeState() .getOffset(), VmTypeState.ST_INITIALIZED); final Label afterInit = new Label(curInstrLabel + "$$after-classinit-ex"); os.writeJCC(afterInit, X86Constants.JNZ); if (os.isCode32()) { os.writePUSHA(); } else { os.writePUSH(X86Register.RAX); os.writePUSH(X86Register.RBX); os.writePUSH(X86Register.RCX); os.writePUSH(X86Register.RDX); os.writePUSH(X86Register.RSI); os.writePUSH(X86Register.R8); os.writePUSH(X86Register.R9); os.writePUSH(X86Register.R10); os.writePUSH(X86Register.R11); // R12 contains processor and is preserved os.writePUSH(X86Register.R13); os.writePUSH(X86Register.R14); os.writePUSH(X86Register.R15); } // Call cls.initialize os.writePUSH(classReg); invokeJavaMethod(entryPoints.getVmTypeInitialize()); if (os.isCode32()) { os.writePOPA(); } else { os.writePOP(X86Register.R15); os.writePOP(X86Register.R14); os.writePOP(X86Register.R13); // R12 contains processor and is preserved os.writePOP(X86Register.R11); os.writePOP(X86Register.R10); os.writePOP(X86Register.R9); os.writePOP(X86Register.R8); os.writePOP(X86Register.RSI); os.writePOP(X86Register.RDX); os.writePOP(X86Register.RCX); os.writePOP(X86Register.RBX); os.writePOP(X86Register.RAX); } // Set label os.setObjectRef(afterInit); } }
public final void writeGetStaticsEntry64(Label curInstrLabel, GPR64 dstReg, VmSharedStaticsEntry entry) {
public final void writeGetStaticsEntry64(Label curInstrLabel, GPR lsbDst, GPR msbReg, VmSharedStaticsEntry entry) {
public final void writeGetStaticsEntry64(Label curInstrLabel, GPR64 dstReg, VmSharedStaticsEntry entry) { writeLoadSTATICS(curInstrLabel, "gs64", true); os .writeMOV(BITS64, dstReg, this.STATICS, getSharedStaticsOffset(entry)); }
os .writeMOV(BITS64, dstReg, this.STATICS, getSharedStaticsOffset(entry));
final int staticsOfs = getSharedStaticsOffset(entry); os.writeMOV(INTSIZE, msbReg, this.STATICS, staticsOfs + 4); os.writeMOV(INTSIZE, lsbDst, this.STATICS, staticsOfs + 0);
public final void writeGetStaticsEntry64(Label curInstrLabel, GPR64 dstReg, VmSharedStaticsEntry entry) { writeLoadSTATICS(curInstrLabel, "gs64", true); os .writeMOV(BITS64, dstReg, this.STATICS, getSharedStaticsOffset(entry)); }
public final void writePutStaticsEntry64(Label curInstrLabel, GPR64 srcReg, VmSharedStaticsEntry entry) {
public final void writePutStaticsEntry64(Label curInstrLabel, GPR lsbSrc, GPR msbSrc, VmSharedStaticsEntry entry) {
public final void writePutStaticsEntry64(Label curInstrLabel, GPR64 srcReg, VmSharedStaticsEntry entry) { writeLoadSTATICS(curInstrLabel, "ps64", true); os .writeMOV(BITS64, this.STATICS, getSharedStaticsOffset(entry), srcReg); }
os .writeMOV(BITS64, this.STATICS, getSharedStaticsOffset(entry), srcReg);
final int staticsOfs = getSharedStaticsOffset(entry); os.writeMOV(BITS32, this.STATICS, staticsOfs + 4, msbSrc); os.writeMOV(BITS32, this.STATICS, staticsOfs + 0, lsbSrc);
public final void writePutStaticsEntry64(Label curInstrLabel, GPR64 srcReg, VmSharedStaticsEntry entry) { writeLoadSTATICS(curInstrLabel, "ps64", true); os .writeMOV(BITS64, this.STATICS, getSharedStaticsOffset(entry), srcReg); }
requestRegister(EAX, val); requestRegister(EDX, val);
L1AHelper.requestRegister(eContext, EAX, val); L1AHelper.requestRegister(eContext, EDX, val);
private final void dwreturn(int jvmType) { final DoubleWordItem val = (DoubleWordItem) vstack.pop(jvmType); // Return value must be in EAX:EDX if (!(val.uses(EAX) && val.uses(EDX))) { if (val.uses(EAX) || val.uses(EDX)) { val.push(eContext); } requestRegister(EAX, val); requestRegister(EDX, val); val.loadTo(eContext, EAX, EDX); } // Release val.release(eContext); // Do actual return visit_return(); }
requestRegister(ECX, shift);
L1AHelper.requestRegister(eContext, ECX, shift);
private final void ishift(int operation) { final IntItem shift = vstack.popInt(); final boolean isconst = shift.isConstant(); if (!isconst) { requestRegister(ECX, shift); shift.loadTo(eContext, ECX); } // Pop & load final IntItem val = vstack.popInt(); val.loadIf(eContext, ~Item.Kind.LOCAL); if (val.isLocal()) { final int fpOffset = val.getOffsetToFP(); if (isconst) { final int offset = shift.getValue(); os.writeShift(operation, FP, fpOffset, offset); } else { os.writeShift_CL(operation, FP, fpOffset); } } else { final Register valr = val.getRegister(); if (isconst) { final int offset = shift.getValue(); os.writeShift(operation, valr, offset); } else { os.writeShift_CL(operation, valr); } } // Release shift.release(eContext); // Push result vstack.push(val); }
requestRegister(EAX);
L1AHelper.requestRegister(eContext, EAX);
public final void visit_anewarray(VmConstClass classRef) { // Claim EAX, we're going to use it later requestRegister(EAX); // Request tmp register final Register classr = requestRegister(JvmType.INT, false); // Pop final IntItem cnt = vstack.popInt(); // Load the count value cnt.load(eContext); final Register cntr = cnt.getRegister(); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); // Release EAX so it can be used by invokeJavaMethod releaseRegister(EAX); stackFrame.writePushMethodRef(); os.writePUSH(classr); /* Class */ os.writePUSH(cntr); /* Count */ invokeJavaMethod(context.getAnewarrayMethod()); /* Result is already push on the stack */ // Release cnt.release(eContext); releaseRegister(classr); }
final Register classr = requestRegister(JvmType.INT, false);
final Register classr = L1AHelper.requestRegister(eContext, JvmType.INT, false);
public final void visit_anewarray(VmConstClass classRef) { // Claim EAX, we're going to use it later requestRegister(EAX); // Request tmp register final Register classr = requestRegister(JvmType.INT, false); // Pop final IntItem cnt = vstack.popInt(); // Load the count value cnt.load(eContext); final Register cntr = cnt.getRegister(); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); // Release EAX so it can be used by invokeJavaMethod releaseRegister(EAX); stackFrame.writePushMethodRef(); os.writePUSH(classr); /* Class */ os.writePUSH(cntr); /* Count */ invokeJavaMethod(context.getAnewarrayMethod()); /* Result is already push on the stack */ // Release cnt.release(eContext); releaseRegister(classr); }
releaseRegister(EAX);
L1AHelper.releaseRegister(eContext, EAX);
public final void visit_anewarray(VmConstClass classRef) { // Claim EAX, we're going to use it later requestRegister(EAX); // Request tmp register final Register classr = requestRegister(JvmType.INT, false); // Pop final IntItem cnt = vstack.popInt(); // Load the count value cnt.load(eContext); final Register cntr = cnt.getRegister(); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); // Release EAX so it can be used by invokeJavaMethod releaseRegister(EAX); stackFrame.writePushMethodRef(); os.writePUSH(classr); /* Class */ os.writePUSH(cntr); /* Count */ invokeJavaMethod(context.getAnewarrayMethod()); /* Result is already push on the stack */ // Release cnt.release(eContext); releaseRegister(classr); }
releaseRegister(classr);
L1AHelper.releaseRegister(eContext, classr);
public final void visit_anewarray(VmConstClass classRef) { // Claim EAX, we're going to use it later requestRegister(EAX); // Request tmp register final Register classr = requestRegister(JvmType.INT, false); // Pop final IntItem cnt = vstack.popInt(); // Load the count value cnt.load(eContext); final Register cntr = cnt.getRegister(); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); // Release EAX so it can be used by invokeJavaMethod releaseRegister(EAX); stackFrame.writePushMethodRef(); os.writePUSH(classr); /* Class */ os.writePUSH(cntr); /* Count */ invokeJavaMethod(context.getAnewarrayMethod()); /* Result is already push on the stack */ // Release cnt.release(eContext); releaseRegister(classr); }
final IntItem result = (IntItem) requestWordRegister(JvmType.INT, false);
final IntItem result = (IntItem) L1AHelper.requestWordRegister( eContext, JvmType.INT, false);
public final void visit_arraylength() { final RefItem ref = vstack.popRef(); final IntItem result = (IntItem) requestWordRegister(JvmType.INT, false); // Load ref.load(eContext); final Register refr = ref.getRegister(); final Register resultr = result.getRegister(); // Get length os.writeMOV(INTSIZE, resultr, refr, arrayLengthOffset); // Release ref.release(eContext); // Push result vstack.push(result); }
requestRegister(EAX, ref);
L1AHelper.requestRegister(eContext, EAX, ref);
public final void visit_athrow() { final RefItem ref = vstack.popRef(); // Exception must be in EAX if (!ref.uses(EAX)) { requestRegister(EAX, ref); ref.loadTo(eContext, EAX); } // Jump helper.writeJumpTableCALL(X86JumpTable.VM_ATHROW_OFS); // Release ref.release(eContext); }
requestRegister(ECX); requestRegister(EAX);
L1AHelper.requestRegister(eContext, ECX); L1AHelper.requestRegister(eContext, EAX);
public final void visit_checkcast(VmConstClass classRef) { // Pre-claim ECX requestRegister(ECX); requestRegister(EAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final Register refr = ref.getRegister(); final Register classr = EAX; final Register tmpr = requestRegister(JvmType.INT, false); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); final Label okLabel = new Label(this.curInstrLabel + "cc-ok"); /* Is objectref null? */ os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); /* Is instanceof? */ instanceOf(refr, classr, tmpr, okLabel, true); /* Not instanceof */ // Release temp registers here, so invokeJavaMethod can use it releaseRegister(ECX); releaseRegister(classr); releaseRegister(tmpr); // Call SoftByteCodes.systemException os.writePUSH(SoftByteCodes.EX_CLASSCAST); os.writePUSH(0); invokeJavaMethod(context.getSystemExceptionMethod()); final RefItem exi = vstack.popRef(); assertCondition(exi.uses(EAX), "item must be in eax"); exi.release(eContext); /* Exception in EAX, throw it */ helper.writeJumpTableCALL(X86JumpTable.VM_ATHROW_OFS); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); }
final Register tmpr = requestRegister(JvmType.INT, false);
final Register tmpr = L1AHelper.requestRegister(eContext, JvmType.INT, false);
public final void visit_checkcast(VmConstClass classRef) { // Pre-claim ECX requestRegister(ECX); requestRegister(EAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final Register refr = ref.getRegister(); final Register classr = EAX; final Register tmpr = requestRegister(JvmType.INT, false); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); final Label okLabel = new Label(this.curInstrLabel + "cc-ok"); /* Is objectref null? */ os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); /* Is instanceof? */ instanceOf(refr, classr, tmpr, okLabel, true); /* Not instanceof */ // Release temp registers here, so invokeJavaMethod can use it releaseRegister(ECX); releaseRegister(classr); releaseRegister(tmpr); // Call SoftByteCodes.systemException os.writePUSH(SoftByteCodes.EX_CLASSCAST); os.writePUSH(0); invokeJavaMethod(context.getSystemExceptionMethod()); final RefItem exi = vstack.popRef(); assertCondition(exi.uses(EAX), "item must be in eax"); exi.release(eContext); /* Exception in EAX, throw it */ helper.writeJumpTableCALL(X86JumpTable.VM_ATHROW_OFS); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); }
releaseRegister(ECX); releaseRegister(classr); releaseRegister(tmpr);
L1AHelper.releaseRegister(eContext, ECX); L1AHelper.releaseRegister(eContext, classr); L1AHelper.releaseRegister(eContext, tmpr);
public final void visit_checkcast(VmConstClass classRef) { // Pre-claim ECX requestRegister(ECX); requestRegister(EAX); // check that top item is a reference final RefItem ref = vstack.popRef(); // Load the ref ref.load(eContext); final Register refr = ref.getRegister(); final Register classr = EAX; final Register tmpr = requestRegister(JvmType.INT, false); // Resolve the class writeResolveAndLoadClassToReg(classRef, classr); final Label okLabel = new Label(this.curInstrLabel + "cc-ok"); /* Is objectref null? */ os.writeTEST(refr, refr); os.writeJCC(okLabel, X86Constants.JZ); /* Is instanceof? */ instanceOf(refr, classr, tmpr, okLabel, true); /* Not instanceof */ // Release temp registers here, so invokeJavaMethod can use it releaseRegister(ECX); releaseRegister(classr); releaseRegister(tmpr); // Call SoftByteCodes.systemException os.writePUSH(SoftByteCodes.EX_CLASSCAST); os.writePUSH(0); invokeJavaMethod(context.getSystemExceptionMethod()); final RefItem exi = vstack.popRef(); assertCondition(exi.uses(EAX), "item must be in eax"); exi.release(eContext); /* Exception in EAX, throw it */ helper.writeJumpTableCALL(X86JumpTable.VM_ATHROW_OFS); /* Normal exit */ os.setObjectRef(okLabel); // Leave ref on stack vstack.push(ref); }
final WordItem iw = requestWordRegister(type, false);
final WordItem iw = L1AHelper.requestWordRegister(eContext, type, false);
public final void visit_getfield(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final VmField field = fieldRef.getResolvedVmField(); if (field.isStatic()) { throw new IncompatibleClassChangeError( "getfield called on static field " + fieldRef.getName()); } final VmInstanceField inf = (VmInstanceField) field; final int fieldOffset = inf.getOffset(); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final boolean isfloat = JvmType.isFloat(type); // Pop & load final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // get field final Item result; if (!fieldRef.isWide()) { if (isfloat) { result = FloatItem.createFPUStack(); os.writeFLD32(refr, fieldOffset); vstack.fpuStack.push(result); } else { final WordItem iw = requestWordRegister(type, false); os.writeMOV(INTSIZE, iw.getRegister(), refr, fieldOffset); result = iw; } } else { if (isfloat) { result = DoubleItem.createFPUStack(); os.writeFLD64(refr, fieldOffset); vstack.fpuStack.push(result); } else { final DoubleWordItem idw = requestDoubleWordRegisters(type); final Register lsb = idw.getLsbRegister(); final Register msb = idw.getMsbRegister(); os.writeMOV(INTSIZE, lsb, refr, fieldOffset + LSB); os.writeMOV(INTSIZE, msb, refr, fieldOffset + MSB); result = idw; } } // Release ref.release(eContext); // Push result vstack.push(result); }