com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util Java Examples
The following examples show how to use
com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplyImports.java From hottub with GNU General Public License v2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } }
Example #2
Source File: ApplyImports.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } }
Example #3
Source File: Copy.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void parseContents(Parser parser) { final String useSets = getAttribute("use-attribute-sets"); if (useSets.length() > 0) { if (!Util.isValidQNames(useSets)) { ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, useSets, this); parser.reportError(Constants.ERROR, err); } _useSets = new UseAttributeSets(useSets, parser); } parseChildren(parser); }
Example #4
Source File: WithParam.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * This code generates a sequence of bytecodes that call the * addParameter() method in AbstractTranslet. The method call will add * (or update) the parameter frame with the new parameter value. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Translate the value and put it on the stack if (_doParameterOptimization) { translateValue(classGen, methodGen); return; } // Make name acceptable for use as field name in class String name = Util.escape(getEscapedName()); // Load reference to the translet (method is in AbstractTranslet) il.append(classGen.loadTranslet()); // Load the name of the parameter il.append(new PUSH(cpg, name)); // TODO: namespace ? // Generete the value of the parameter (use value in 'select' by def.) translateValue(classGen, methodGen); // Mark this parameter value is not being the default value il.append(new PUSH(cpg, false)); // Pass the parameter to the template il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, ADD_PARAMETER, ADD_PARAMETER_SIG))); il.append(POP); // cleanup stack }
Example #5
Source File: Stylesheet.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Add a static field */ private void addStaticField(ClassGenerator classGen, String type, String name) { final FieldGen fgen = new FieldGen(ACC_PROTECTED|ACC_STATIC, Util.getJCRefType(type), name, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
Example #6
Source File: UnsupportedElement.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Displays the contents of this element */ public void display(int indent) { indent(indent); Util.println("Unsupported element = " + _qname.getNamespace() + ":" + _qname.getLocalPart()); displayContents(indent + IndentIncrement); }
Example #7
Source File: When.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("When"); indent(indent + IndentIncrement); System.out.print("test "); Util.println(_test.toString()); displayContents(indent + IndentIncrement); }
Example #8
Source File: Stylesheet.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private void addDOMField(ClassGenerator classGen) { final FieldGen fgen = new FieldGen(ACC_PUBLIC, Util.getJCRefType(DOM_INTF_SIG), DOM_FIELD, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
Example #9
Source File: Choose.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Display the element contents (a lot of when's and an otherwise) */ public void display(int indent) { indent(indent); Util.println("Choose"); indent(indent + IndentIncrement); displayContents(indent + IndentIncrement); }
Example #10
Source File: ApplyTemplates.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } }
Example #11
Source File: WithParam.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * This code generates a sequence of bytecodes that call the * addParameter() method in AbstractTranslet. The method call will add * (or update) the parameter frame with the new parameter value. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Translate the value and put it on the stack if (_doParameterOptimization) { translateValue(classGen, methodGen); return; } // Make name acceptable for use as field name in class String name = Util.escape(getEscapedName()); // Load reference to the translet (method is in AbstractTranslet) il.append(classGen.loadTranslet()); // Load the name of the parameter il.append(new PUSH(cpg, name)); // TODO: namespace ? // Generete the value of the parameter (use value in 'select' by def.) translateValue(classGen, methodGen); // Mark this parameter value is not being the default value il.append(new PUSH(cpg, false)); // Pass the parameter to the template il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, ADD_PARAMETER, ADD_PARAMETER_SIG))); il.append(POP); // cleanup stack }
Example #12
Source File: XSLTC.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Set the class name for the generated translet. This class name is * overridden if multiple stylesheets are compiled in one go using the * compile(Vector urls) method. * @param className The name to assign to the translet class */ public void setClassName(String className) { final String base = Util.baseName(className); final String noext = Util.noExtName(base); String name = Util.toJavaName(noext); if (_packageName == null) _className = name; else _className = _packageName + '.' + name; }
Example #13
Source File: ApplyTemplates.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); Util.println("select " + _select.toString()); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } }
Example #14
Source File: FunctionAvailableCall.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Reports on whether the function specified in the argument to * xslt function 'function-available' was found. */ public boolean getResult() { if (_nameOfFunct == null) { return false; } if (isInternalNamespace()) { final Parser parser = getParser(); _isFunctionAvailable = parser.functionSupported(Util.getLocalName(_nameOfFunct)); } return _isFunctionAvailable; }
Example #15
Source File: XSLTC.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Set the class name for the generated translet. This class name is * overridden if multiple stylesheets are compiled in one go using the * compile(List urls) method. * @param className The name to assign to the translet class */ public void setClassName(String className) { final String base = Util.baseName(className); final String noext = Util.noExtName(base); String name = Util.toJavaName(noext); if (_packageName == null) _className = name; else _className = _packageName + '.' + name; }
Example #16
Source File: Stylesheet.java From Bytecoder with Apache License 2.0 | 5 votes |
private void addDOMField(ClassGenerator classGen) { final FieldGen fgen = new FieldGen(ACC_PUBLIC, Util.getJCRefType(DOM_INTF_SIG), DOM_FIELD, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
Example #17
Source File: WithParam.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * This code generates a sequence of bytecodes that call the * addParameter() method in AbstractTranslet. The method call will add * (or update) the parameter frame with the new parameter value. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Translate the value and put it on the stack if (_doParameterOptimization) { translateValue(classGen, methodGen); return; } // Make name acceptable for use as field name in class String name = Util.escape(getEscapedName()); // Load reference to the translet (method is in AbstractTranslet) il.append(classGen.loadTranslet()); // Load the name of the parameter il.append(new PUSH(cpg, name)); // TODO: namespace ? // Generete the value of the parameter (use value in 'select' by def.) translateValue(classGen, methodGen); // Mark this parameter value is not being the default value il.append(new PUSH(cpg, false)); // Pass the parameter to the template il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS, ADD_PARAMETER, ADD_PARAMETER_SIG))); il.append(POP); // cleanup stack }
Example #18
Source File: If.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Display the contents of this element */ public void display(int indent) { indent(indent); Util.println("If"); indent(indent + IndentIncrement); System.out.print("test "); Util.println(_test.toString()); displayContents(indent + IndentIncrement); }
Example #19
Source File: SyntaxTreeNode.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected void addAttribute(String qname, String value) { int index = _attributes.getIndex(qname); if (index != -1) { _attributes.setAttribute(index, "", Util.getLocalName(qname), qname, "CDATA", value); } else { _attributes.addAttribute("", Util.getLocalName(qname), qname, "CDATA", value); } }
Example #20
Source File: ApplyImports.java From Bytecoder with Apache License 2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("ApplyTemplates"); indent(indent + IndentIncrement); if (_modeName != null) { indent(indent + IndentIncrement); Util.println("mode " + _modeName); } }
Example #21
Source File: When.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void display(int indent) { indent(indent); Util.println("When"); indent(indent + IndentIncrement); System.out.print("test "); Util.println(_test.toString()); displayContents(indent + IndentIncrement); }
Example #22
Source File: XSLTC.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Set the class name for the generated translet. This class name is * overridden if multiple stylesheets are compiled in one go using the * compile(Vector urls) method. * @param className The name to assign to the translet class */ public void setClassName(String className) { final String base = Util.baseName(className); final String noext = Util.noExtName(base); String name = Util.toJavaName(noext); if (_packageName == null) _className = name; else _className = _packageName + '.' + name; }
Example #23
Source File: Stylesheet.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Add a static field */ private void addStaticField(ClassGenerator classGen, String type, String name) { final FieldGen fgen = new FieldGen(ACC_PROTECTED|ACC_STATIC, Util.getJCRefType(type), name, classGen.getConstantPool()); classGen.addField(fgen.getField()); }
Example #24
Source File: VariableBase.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Set the name of the variable or paremeter. Escape all special chars. */ public void setName(QName name) { _name = name; _escapedName = Util.escape(name.getStringRep()); }
Example #25
Source File: CallTemplate.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void display(int indent) { indent(indent); System.out.print("CallTemplate"); Util.println(" name " + _name); displayContents(indent + IndentIncrement); }
Example #26
Source File: LiteralElement.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Displays the contents of this literal element */ public void display(int indent) { indent(indent); Util.println("LiteralElement name = " + _name); displayContents(indent + IndentIncrement); }
Example #27
Source File: Number.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * This method compiles code that is common to matchesFrom() and * matchesCount() in the auxillary class. */ private void compileLocals(NodeCounterGenerator nodeCounterGen, MatchGenerator matchGen, InstructionList il) { int field; LocalVariableGen local; ConstantPoolGen cpg = nodeCounterGen.getConstantPool(); // Get NodeCounter._iterator and store locally local = matchGen.addLocalVariable("iterator", Util.getJCRefType(NODE_ITERATOR_SIG), null, null); field = cpg.addFieldref(NODE_COUNTER, "_iterator", ITERATOR_FIELD_SIG); il.append(ALOAD_0); // 'this' pointer on stack il.append(new GETFIELD(field)); local.setStart(il.append(new ASTORE(local.getIndex()))); matchGen.setIteratorIndex(local.getIndex()); // Get NodeCounter._translet and store locally local = matchGen.addLocalVariable("translet", Util.getJCRefType(TRANSLET_SIG), null, null); field = cpg.addFieldref(NODE_COUNTER, "_translet", "Lcom/sun/org/apache/xalan/internal/xsltc/Translet;"); il.append(ALOAD_0); // 'this' pointer on stack il.append(new GETFIELD(field)); il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS))); local.setStart(il.append(new ASTORE(local.getIndex()))); nodeCounterGen.setTransletIndex(local.getIndex()); // Get NodeCounter._document and store locally local = matchGen.addLocalVariable("document", Util.getJCRefType(DOM_INTF_SIG), null, null); field = cpg.addFieldref(_className, "_document", DOM_INTF_SIG); il.append(ALOAD_0); // 'this' pointer on stack il.append(new GETFIELD(field)); // Make sure we have the correct DOM type on the stack!!! local.setStart(il.append(new ASTORE(local.getIndex()))); matchGen.setDomIndex(local.getIndex()); }
Example #28
Source File: WithParam.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Set the name of the variable or paremeter. Escape all special chars. */ public void setName(QName name) { _name = name; _escapedName = Util.escape(name.getStringRep()); }
Example #29
Source File: XslElement.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * At runtime the compilation of xsl:element results in code that: (i) * evaluates the avt for the name, (ii) checks for a prefix in the name * (iii) generates a new prefix and create a new qname when necessary * (iv) calls startElement() on the handler (v) looks up a uri in the XML * when the prefix is not known at compile time (vi) calls namespace() * on the handler (vii) evaluates the contents (viii) calls endElement(). */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Optimize translation if element name is a literal if (_isLiteralName) { translateLiteral(classGen, methodGen); return; } if (!_ignore) { // if the qname is an AVT, then the qname has to be checked at runtime if it is a valid qname LocalVariableGen nameValue = methodGen.addLocalVariable2("nameValue", Util.getJCRefType(STRING_SIG), null); // store the name into a variable first so _name.translate only needs to be called once _name.translate(classGen, methodGen); nameValue.setStart(il.append(new ASTORE(nameValue.getIndex()))); il.append(new ALOAD(nameValue.getIndex())); // call checkQName if the name is an AVT final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkQName", "(" +STRING_SIG +")V"); il.append(new INVOKESTATIC(check)); // Push handler for call to endElement() il.append(methodGen.loadHandler()); // load name value again nameValue.setEnd(il.append(new ALOAD(nameValue.getIndex()))); if (_namespace != null) { _namespace.translate(classGen, methodGen); } else { il.append(ACONST_NULL); } // Push additional arguments il.append(methodGen.loadHandler()); il.append(methodGen.loadDOM()); il.append(methodGen.loadCurrentNode()); // Invoke BasisLibrary.startXslElemCheckQName() il.append(new INVOKESTATIC( cpg.addMethodref(BASIS_LIBRARY_CLASS, "startXslElement", "(" + STRING_SIG + STRING_SIG + TRANSLET_OUTPUT_SIG + DOM_INTF_SIG + "I)" + STRING_SIG))); } translateContents(classGen, methodGen); if (!_ignore) { il.append(methodGen.endElement()); } }
Example #30
Source File: TransletOutput.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Displays the contents of this <xsltc:output> element. */ public void display(int indent) { indent(indent); Util.println("TransletOutput: " + _filename); }