Refine search
/** * 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)); } }
/** * Expects a double on the stack and pushes a boxed double. Boxed * double are represented by an instance of <code>java.lang.Double</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(DOUBLE_CLASS))); il.append(DUP_X2); il.append(DUP_X2); il.append(POP); il.append(new INVOKESPECIAL(cpg.addMethodref(DOUBLE_CLASS, "<init>", "(D)V"))); }
/** * 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)); }
/** * Expects an integer on the stack and pushes a boxed integer. * Boxed integers are represented by an instance of * <code>java.lang.Integer</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(INTEGER_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new INVOKESPECIAL(cpg.addMethodref(INTEGER_CLASS, "<init>", "(I)V"))); }
/** * Expects a node on the stack and pushes a boxed node. Boxed nodes * are represented by an instance of <code>org.apache.xalan.xsltc.dom.Node</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(RUNTIME_NODE_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new PUSH(cpg, _type)); il.append(new INVOKESPECIAL(cpg.addMethodref(RUNTIME_NODE_CLASS, "<init>", "(II)V"))); }
/** * 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)); } }
/** * Create a constructor for the new class. Updates the reference to the * collator in the super calls only when the stylesheet specifies a new * language in xsl:sort. */ private static MethodGenerator compileInit(Vector sortObjects, NodeSortRecordGenerator sortRecord, ConstantPoolGen cpg, String className) { final InstructionList il = new InstructionList(); final MethodGenerator init = new MethodGenerator(ACC_PUBLIC, org.apache.bcel.generic.Type.VOID, null, null, "<init>", className, il, cpg); // Call the constructor in the NodeSortRecord superclass il.append(ALOAD_0); il.append(new INVOKESPECIAL(cpg.addMethodref(NODE_SORT_RECORD, "<init>", "()V"))); il.append(RETURN); return init; }
/** * Expects an integer on the stack and pushes its string value by calling * <code>Integer.toString(int i)</code>. * * @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(); il.append(DUP); final BranchHandle ifNull = il.append(new IFNULL(null)); il.append(new INVOKEVIRTUAL(cpg.addMethodref(_javaClassName, "toString", "()" + STRING_SIG))); final BranchHandle gotobh = il.append(new GOTO(null)); ifNull.setTarget(il.append(POP)); il.append(new PUSH(cpg, "")); gotobh.setTarget(il.append(NOP)); }
/** * Expects a boolean on the stack and pushes a boxed boolean. * Boxed booleans are represented by an instance of * <code>java.lang.Boolean</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ReferenceType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new NEW(cpg.addClass(BOOLEAN_CLASS))); il.append(DUP_X1); il.append(SWAP); il.append(new INVOKESPECIAL(cpg.addMethodref(BOOLEAN_CLASS, "<init>", "(Z)V"))); }
il.append(classGen.loadTranslet()); il.append(new PUSH(cpg, EMPTYSTRING)); il.append(new NEW(cpg.addClass(DFS_CLASS))); il.append(DUP); il.append(new GETSTATIC(cpg.addFieldref(LOCALE_CLASS, "US", LOCALE_SIG))); il.append(new INVOKESPECIAL(init)); int nan = cpg.addMethodref(DFS_CLASS, "setNaN", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "NaN")); il.append(new INVOKEVIRTUAL(nan)); int inf = cpg.addMethodref(DFS_CLASS, "setInfinity", "(Ljava/lang/String;)V"); il.append(DUP); il.append(new PUSH(cpg, "Infinity")); il.append(new INVOKEVIRTUAL(inf)); final int put = cpg.addMethodref(TRANSLET_CLASS, "addDecimalFormat", "("+STRING_SIG+DFS_SIG+")V"); il.append(new INVOKEVIRTUAL(put));
/** * Expects a node on the stack and pushes a singleton node-set. Singleton * iterators are already started after construction. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeSetType type) { ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); // Create a new instance of SingletonIterator il.append(new NEW(cpg.addClass(SINGLETON_ITERATOR))); il.append(DUP_X1); il.append(SWAP); final int init = cpg.addMethodref(SINGLETON_ITERATOR, "<init>", "(" + NODE_SIG +")V"); il.append(new INVOKESPECIAL(init)); }
/** * Translates reference into object of internal type <code>type</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final int current = methodGen.getLocalIndex("current"); ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); // If no current, conversion is a top-level if (current < 0) { il.append(new PUSH(cpg, DTM.ROOT_NODE)); // push root node } else { il.append(new ILOAD(current)); } il.append(methodGen.loadDOM()); final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS, "stringF", "(" + OBJECT_SIG + NODE_SIG + DOM_INTF_SIG + ")" + STRING_SIG); il.append(new INVOKESTATIC(stringF)); }
/** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(BOOLEAN_CLASS))); il.append(new INVOKEVIRTUAL(cpg.addMethodref(BOOLEAN_CLASS, BOOLEAN_VALUE, BOOLEAN_VALUE_SIG))); }
final int getKeyIndex = cpg.addMethodref(TRANSLET_CLASS, "getKeyIndex", "(Ljava/lang/String;)"+ final int lookupId = cpg.addMethodref(KEY_INDEX_CLASS, "containsID", "(ILjava/lang/Object;)I"); final int lookupKey = cpg.addMethodref(KEY_INDEX_CLASS, "containsKey", "(ILjava/lang/Object;)I"); il.append(classGen.loadTranslet()); il.append(new PUSH(cpg,_index)); il.append(new INVOKEVIRTUAL(getKeyIndex)); il.append(SWAP); il.append(new PUSH(cpg,_value)); if (this instanceof IdPattern) il.append(new INVOKEVIRTUAL(lookupId)); il.append(new INVOKEVIRTUAL(lookupKey)); _trueList.add(il.append(new IFNE(null))); _falseList.add(il.append(new GOTO(null)));
/** * 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(), "")); }
/** * Translates an object of this type to its unboxed representation. */ public void translateUnBox(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new CHECKCAST(cpg.addClass(DOUBLE_CLASS))); il.append(new INVOKEVIRTUAL(cpg.addMethodref(DOUBLE_CLASS, DOUBLE_VALUE, DOUBLE_VALUE_SIG))); }
il.append(methodGen.loadHandler()); il.append(new PUSH(cpg,false)); il.append(new INVOKEINTERFACE(setEscaping,2)); final int characters = cpg.addMethodref(TRANSLET_CLASS, CHARACTERSW, CHARACTERSW_SIG); il.append(classGen.loadTranslet()); _select.translate(classGen, methodGen); il.append(methodGen.loadHandler()); il.append(new INVOKEVIRTUAL(characters)); } else { final int characters = cpg.addInterfaceMethodref(DOM_INTF, CHARACTERS_SIG); il.append(methodGen.loadDOM()); _select.translate(classGen, methodGen); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE(characters, 3)); il.append(methodGen.loadHandler()); il.append(SWAP); il.append(new INVOKEINTERFACE(setEscaping,2)); il.append(POP);