public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } }
/** * Translate this attribute value into JVM bytecodes that pushes the * attribute value onto the JVM's stack. * @param classGen BCEL Java class generator * @param methodGen BCEL Java method generator */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } }
/** * Translates a void into a string by pushing the empty string ''. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(classGen.getConstantPool(), "")); }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, _value)); } }
/** * Calls to 'element-available' are resolved at compile time since * the namespaces declared in the stylsheet are not available at run * time. Consequently, arguments to this function must be literals. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final boolean result = getResult(); methodGen.getInstructionList().append(new PUSH(cpg, result)); } }
/** * Calls to 'function-available' are resolved at compile time since * the namespaces declared in the stylsheet are not available at run * time. Consequently, arguments to this function must be literals. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); methodGen.getInstructionList().append(new PUSH(cpg, getResult())); }
/** * Translate code to call the BasisLibrary.unallowed_extensionF(String) * method. */ private void translateUnallowedExtension(ConstantPoolGen cpg, InstructionList il) { int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unallowed_extension_functionF", "(Ljava/lang/String;)V"); il.append(new PUSH(cpg, _fname.toString())); il.append(new INVOKESTATIC(index)); } }
/** * Translate the fallback element (if any). */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (_fallbacks != null) { int count = _fallbacks.size(); for (int i = 0; i < count; i++) { Fallback fallback = (Fallback)_fallbacks.elementAt(i); fallback.translate(classGen, methodGen); } } // We only go into the else block in forward-compatibility mode, when // the unsupported element has no fallback. else { // If the unsupported element does not have any fallback child, then // at runtime, a runtime error should be raised when the unsupported // element is instantiated. Otherwise, no error is thrown. ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); final int unsupportedElem = cpg.addMethodref(BASIS_LIBRARY_CLASS, "unsupported_ElementF", "(" + STRING_SIG + "Z)V"); il.append(new PUSH(cpg, getQName().toString())); il.append(new PUSH(cpg, _isExtension)); il.append(new INVOKESTATIC(unsupportedElem)); } } }
/** * Generates code that loads the array that will contain the character * data represented by this Text node, followed by the offset of the * data from the start of the array, and then the length of the data. * * The pre-condition to calling this method is that * canLoadAsArrayOffsetLength() returns true. * @see #canLoadArrayOffsetLength() */ public void loadAsArrayOffsetLength(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final XSLTC xsltc = classGen.getParser().getXSLTC(); // The XSLTC object keeps track of character data // that is to be stored in char arrays. final int offset = xsltc.addCharacterData(_text); final int length = _text.length(); String charDataFieldName = STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1); il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(), charDataFieldName, STATIC_CHAR_DATA_FIELD_SIG))); il.append(new PUSH(cpg, offset)); il.append(new PUSH(cpg, _text.length())); } }
/** * Expects a boolean on the stack and pushes a string. If the value on the * stack is zero, then the string 'false' is pushed. Otherwise, the string * 'true' is pushed. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final BranchHandle falsec = il.append(new IFEQ(null)); il.append(new PUSH(cpg, "true")); final BranchHandle truec = il.append(new GOTO(null)); falsec.setTarget(il.append(new PUSH(cpg, "false"))); truec.setTarget(il.append(NOP)); }
/** * Translates an external (primitive) Java type into a string. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateFrom */ public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen, Class clazz) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); if (clazz.getName().equals("java.lang.String")) { // same internal representation, convert null to "" il.append(DUP); final BranchHandle ifNonNull = il.append(new IFNONNULL(null)); il.append(POP); il.append(new PUSH(cpg, "")); ifNonNull.setTarget(il.append(NOP)); } else { ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR, toString(), clazz.getName()); classGen.getParser().reportError(Constants.FATAL, err); } }
/** * Compile the value of the parameter, which is either in an expression in * a 'select' attribute, or in the with-param element's body */ public void translateValue(ClassGenerator classGen, MethodGenerator methodGen) { // Compile expression is 'select' attribute if present if (_select != null) { _select.translate(classGen, methodGen); _select.startIterator(classGen, methodGen); } // If not, compile result tree from parameter body if present. else if (hasContents()) { compileResultTree(classGen, methodGen); } // If neither are present then store empty string in parameter slot else { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new PUSH(cpg, Constants.EMPTYSTRING)); } }
field = cpg.addFieldref(TRANSLET_CLASS, "_version", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _version)); il.append(new PUTFIELD(field)); field = cpg.addFieldref(TRANSLET_CLASS, "_method", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _method)); il.append(new PUTFIELD(field)); field = cpg.addFieldref(TRANSLET_CLASS, "_encoding", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _encoding)); il.append(new PUTFIELD(field)); field = cpg.addFieldref(TRANSLET_CLASS, "_omitHeader", "Z"); il.append(DUP); il.append(new PUSH(cpg, _omitHeader)); il.append(new PUTFIELD(field)); field = cpg.addFieldref(TRANSLET_CLASS, "_standalone", STRING_SIG); il.append(DUP); il.append(new PUSH(cpg, _standalone)); il.append(new PUTFIELD(field)); il.append(new PUSH(cpg, _doctypeSystem)); il.append(new PUTFIELD(field)); field = cpg.addFieldref(TRANSLET_CLASS,"_doctypePublic",STRING_SIG); il.append(DUP);
il.append(new PUSH(cpg, _name.toString())); "setNaN", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "NaN")); il.append(new INVOKEVIRTUAL(nan)); "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "Infinity")); il.append(new INVOKEVIRTUAL(inf)); "setNaN", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, value)); il.append(new INVOKEVIRTUAL(method)); valid = false; "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, value)); il.append(new INVOKEVIRTUAL(method)); valid = false; il.append(new PUSH(cpg, value.charAt(0))); il.append(new INVOKEVIRTUAL(method));
il.append(new PUSH(cpg, size)); il.append(new ANEWARRAY(cpg.addClass(STRING))); int namesArrayRef = cpg.addFieldref(_className, staticConst.markChunkStart(); il.append(new GETSTATIC(namesArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, name)); il.append(AASTORE); staticConst.markChunkEnd(); il.append(new PUSH(cpg, size)); il.append(new ANEWARRAY(cpg.addClass(STRING))); int urisArrayRef = cpg.addFieldref(_className, staticConst.markChunkStart(); il.append(new GETSTATIC(urisArrayRef)); il.append(new PUSH(cpg, i)); il.append(new PUSH(cpg, uri)); il.append(AASTORE); staticConst.markChunkEnd(); il.append(new PUSH(cpg, size)); il.append(new NEWARRAY(BasicType.INT)); int typesArrayRef = cpg.addFieldref(_className, staticConst.markChunkStart(); il.append(new GETSTATIC(typesArrayRef)); il.append(new PUSH(cpg, i));