/** * Expects a real on the stack and pushes a truncated integer value * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, IntType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "realToInt","(D)I"))); }
/** * Expects a real on the stack and pushes its string value by calling * <code>Double.toString(double d)</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(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "realToString", "(D)" + STRING_SIG))); }
/** * Casts a reference into a ResultTree. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, ResultTreeType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToResultTree", "(" + OBJECT_SIG + ")" + DOM_INTF_SIG); il.append(new INVOKESTATIC(index)); }
/** * 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(new INVOKESTATIC(cpg.addMethodref(INTEGER_CLASS, "toString", "(I)" + STRING_SIG))); }
/** * Translates a string into a real by calling stringToReal() from the * basis library. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, STRING_TO_REAL, STRING_TO_REAL_SIG))); }
/** * Translates a reference to an object of internal type <code>type</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, BooleanType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "booleanF", "(" + OBJECT_SIG + ")Z"); il.append(new INVOKESTATIC(index)); }
/** * 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)); } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { argument().translate(classGen, methodGen); methodGen.getInstructionList() .append(new INVOKESTATIC(classGen.getConstantPool() .addMethodref(MATH_CLASS, "floor", "(D)D"))); } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Get two copies of the argument on the stack argument().translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "roundF", "(D)D"))); } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); argument(0).translate(classGen, methodGen); il.append(new INVOKESTATIC(cpg.addMethodref(MATH_CLASS, "ceil", "(D)D"))); } }
/** * Translates a reference into an object of internal type <code>type</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, RealType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); il.append(methodGen.loadDOM()); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "numberF", "(" + OBJECT_SIG + DOM_INTF_SIG + ")D"); 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)); } } }
/** * Casts a reference into a NodeIterator. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, NodeSetType type) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "referenceToNodeSet", "(" + OBJECT_SIG + ")" + NODE_ITERATOR_SIG); il.append(new INVOKESTATIC(index)); // Reset this iterator index = cpg.addInterfaceMethodref(NODE_ITERATOR, RESET, RESET_SIG); il.append(new INVOKEINTERFACE(index, 1)); }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (argumentCount() == 0) { il.append(methodGen.loadContextNode()); } else { // one argument argument().translate(classGen, methodGen); } final ConstantPoolGen cpg = classGen.getConstantPool(); il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS, "generate_idF", // reuse signature GET_NODE_NAME_SIG))); } }
/** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Returns the name of a node in the DOM final int getNodeName = cpg.addInterfaceMethodref(DOM_INTF, "getNodeName", "(I)"+STRING_SIG); final int getLocalName = cpg.addMethodref(BASIS_LIBRARY_CLASS, "getLocalName", "(Ljava/lang/String;)"+ "Ljava/lang/String;"); super.translate(classGen, methodGen); il.append(new INVOKEINTERFACE(getNodeName, 2)); il.append(new INVOKESTATIC(getLocalName)); } }
/** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS, "testLanguage", "("+STRING_SIG+DOM_INTF_SIG+"I)Z"); _lang.translate(classGen,methodGen); il.append(methodGen.loadDOM()); if (classGen instanceof FilterGenerator) il.append(new ILOAD(1)); else il.append(methodGen.loadContextNode()); il.append(new INVOKESTATIC(tst)); } }
/** * 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)); }
il.append(new INVOKESTATIC(fn3arg));
il.append(new INVOKESTATIC(cpg.addMethodref (BASIS_LIBRARY_CLASS, "referenceToNodeSet",
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { if (hasNodeSetArgs() || hasReferenceArgs()) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); // Call compare() from the BasisLibrary _left.translate(classGen, methodGen); _left.startIterator(classGen, methodGen); _right.translate(classGen, methodGen); _right.startIterator(classGen, methodGen); il.append(new PUSH(cpg, _op)); il.append(methodGen.loadDOM()); int index = cpg.addMethodref(BASIS_LIBRARY_CLASS, "compare", "(" + _left.getType().toSignature() + _right.getType().toSignature() + "I" + DOM_INTF_SIG + ")Z"); il.append(new INVOKESTATIC(index)); } else { translateDesynthesized(classGen, methodGen); synthesize(classGen, methodGen); } }