Package com.sun.org.apache.bcel.internal.generic

Examples of com.sun.org.apache.bcel.internal.generic.PUSH


    }

    public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
        final ConstantPoolGen cpg = classGen.getConstantPool();
        final InstructionList il = methodGen.getInstructionList();
        il.append(new PUSH(cpg, _value));
    }
View Full Code Here


        final BranchHandle nextNode = il.append(new GOTO(null));
        final InstructionHandle loop = il.append(NOP);

        // Prepare to call buildKeyIndex(String name, int node, String value);
        il.append(classGen.loadTranslet());
        il.append(new PUSH(cpg, _name.toString()));
        parentNode.setEnd(il.append(new ILOAD(parentNode.getIndex())));

        // Now get the node value and push it on the parameter stack
        il.append(methodGen.loadDOM());
        il.append(methodGen.loadCurrentNode());
        il.append(new INVOKEINTERFACE(getNodeValue, 2));

        // Finally do the call to add an entry in the index for this key.
        il.append(new INVOKEVIRTUAL(buildKeyIndex));

        il.append(classGen.loadTranslet());
        il.append(new PUSH(cpg, getName()));
        il.append(methodGen.loadDOM());
        il.append(new INVOKEVIRTUAL(keyDom));

        nextNode.setTarget(il.append(methodGen.loadIterator()));
        il.append(methodGen.nextNode());
View Full Code Here

        il.append(methodGen.loadCurrentNode());
        il.append(methodGen.loadIterator());

        // Get an iterator for all nodes in the DOM
        il.append(methodGen.loadDOM());
        il.append(new PUSH(cpg,Axis.DESCENDANT));
        il.append(new INVOKEINTERFACE(git, 2));

        // Reset the iterator to start with the root node
        il.append(methodGen.loadCurrentNode());
        il.append(methodGen.setStartNode());
        il.append(methodGen.storeIterator());

        // Loop for traversing all nodes in the DOM
        final BranchHandle nextNode = il.append(new GOTO(null));
        final InstructionHandle loop = il.append(NOP);

        // Check if the current node matches the pattern in "match"
        il.append(methodGen.loadCurrentNode());
        _match.translate(classGen, methodGen);
        _match.synthesize(classGen, methodGen); // Leaves 0 or 1 on stack
        final BranchHandle skipNode = il.append(new IFEQ(null));

        // If this is a node-set we must go through each node in the set
        if (_useType instanceof NodeSetType) {
            // Pass current node as parameter (we're indexing on that node)
            il.append(methodGen.loadCurrentNode());
            traverseNodeSet(classGen, methodGen, key);
        }
        else {
            il.append(classGen.loadTranslet());
            il.append(DUP);
            il.append(new PUSH(cpg, _name.toString()));
            il.append(DUP_X1);
            il.append(methodGen.loadCurrentNode());
            _use.translate(classGen, methodGen);
            il.append(new INVOKEVIRTUAL(key));
View Full Code Here

            _arg2.translate(classGen, methodGen);
            _arg2.startIterator(classGen, methodGen);
        }

        // Feck the rest of the parameters on the stack
        il.append(new PUSH(cpg, getStylesheet().getSystemId()));
        il.append(classGen.loadTranslet());
        il.append(DUP);
        il.append(new GETFIELD(domField));
        il.append(new INVOKESTATIC(docIdx));
    }
View Full Code Here

        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());
View Full Code Here

            il.append(DUP2);
            il.append(methodGen.startElement());

            if (_namespace != null) {
                il.append(methodGen.loadHandler());
                il.append(new PUSH(cpg, _prefix));
                _namespace.translate(classGen,methodGen);
                il.append(methodGen.namespace());
            }
        }
View Full Code Here

            _exp.translate(classGen, methodGen);
        }
        else if (isNodeValueTest() && (getParent() instanceof Step)) {
            _value.translate(classGen, methodGen);
            il.append(new CHECKCAST(cpg.addClass(STRING_CLASS)));
            il.append(new PUSH(cpg, ((EqualityExpr)_exp).getOp()));
        }
        else {
            translateFilter(classGen, methodGen);
        }
    }
View Full Code Here

        // Only update _version field if set and different from default
        if ((_version != null) && (!_version.equals(XML_VERSION))) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_version", STRING_SIG);
            il.append(DUP);
            il.append(new PUSH(cpg, _version));
            il.append(new PUTFIELD(field));
        }

        // Only update _method field if "method" attribute used
        if (_method != null) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_method", STRING_SIG);
            il.append(DUP);
            il.append(new PUSH(cpg, _method));
            il.append(new PUTFIELD(field));
        }

        // Only update if _encoding field is "encoding" attribute used
        if (_encoding != null) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_encoding", STRING_SIG);
            il.append(DUP);
            il.append(new PUSH(cpg, _encoding));
            il.append(new PUTFIELD(field));
        }

        // Only update if "omit-xml-declaration" used and set to 'yes'
        if (_omitHeader) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_omitHeader", "Z");
            il.append(DUP);
            il.append(new PUSH(cpg, _omitHeader));
            il.append(new PUTFIELD(field));
        }

        // Add 'standalone' decaration to output - use text as is
        if (_standalone != null) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_standalone", STRING_SIG);
            il.append(DUP);
            il.append(new PUSH(cpg, _standalone));
            il.append(new PUTFIELD(field));
        }

        // Set system/public doctype only if both are set
        field = cpg.addFieldref(TRANSLET_CLASS,"_doctypeSystem",STRING_SIG);
        il.append(DUP);
        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, _doctypePublic));
        il.append(new PUTFIELD(field));

        // Add 'medye-type' decaration to output - if used
        if (_mediaType != null) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_mediaType", STRING_SIG);
            il.append(DUP);
            il.append(new PUSH(cpg, _mediaType));
            il.append(new PUTFIELD(field));
        }

        // Compile code to set output indentation on/off
        if (_indent) {
            field = cpg.addFieldref(TRANSLET_CLASS, "_indent", "Z");
            il.append(DUP);
            il.append(new PUSH(cpg, _indent));
            il.append(new PUTFIELD(field));
        }

        //Compile code to set indent amount.
        if(_indentamount != null && !_indentamount.equals(EMPTYSTRING)){
            field = cpg.addFieldref(TRANSLET_CLASS, "_indentamount", "I");
            il.append(DUP);
            il.append(new PUSH(cpg, Integer.parseInt(_indentamount)));
            il.append(new PUTFIELD(field));
        }

        // Forward to the translet any elements that should be output as CDATA
        if (_cdata != null) {
            int index = cpg.addMethodref(TRANSLET_CLASS,
                                         "addCdataElement",
                                         "(Ljava/lang/String;)V");

            StringTokenizer tokens = new StringTokenizer(_cdata);
            while (tokens.hasMoreTokens()) {
                il.append(DUP);
                il.append(new PUSH(cpg, tokens.nextToken()));
                il.append(new INVOKEVIRTUAL(index));
            }
        }
        il.append(POP); // Cleanup - pop last translet reference off stack
    }
View Full Code Here

        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));
    }
View Full Code Here

            // Create new instance of DOM class (with RTF_INITIAL_SIZE nodes)
            il.append(methodGen.loadDOM());
            int index = cpg.addInterfaceMethodref(DOM_INTF,
                                 "getResultTreeFrag",
                                 "(IZ)" + DOM_INTF_SIG);
            il.append(new PUSH(cpg, RTF_INITIAL_SIZE));
            il.append(new PUSH(cpg, false));
            il.append(new INVOKEINTERFACE(index,3));
            il.append(DUP);

            // Store new DOM into a local variable
            newDom = methodGen.addLocalVariable("rt_to_reference_dom",
View Full Code Here

TOP

Related Classes of com.sun.org.apache.bcel.internal.generic.PUSH

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.