Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.compiler.util.MatchGenerator

Following code examples demonstrate how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.MatchGeneratorfrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.sun.org.apache.xalan.internal.xsltc.compiler.util.MatchGeneratorand various code implementation of this class.

    
    private void compileLocals(NodeCounterGenerator nodeCounterGen,
                               MatchGenerator matchGen,
                               InstructionList il)
    {
        int field;
        LocalVariableGen local;
        ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

        local = matchGen.addLocalVariable("iterator",
                                          Util.getJCRefType(NODE_ITERATOR_SIG),
                                          null, null);
        field = cpg.addFieldref(NODE_COUNTER, "_iterator",
                                ITERATOR_FIELD_SIG);
        il.append(new GETFIELD(field));
        local.setStart(il.append(new ASTORE(local.getIndex())));
        matchGen.setIteratorIndex(local.getIndex());

        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(new GETFIELD(field));
        il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS)));
        local.setStart(il.append(new ASTORE(local.getIndex())));
        nodeCounterGen.setTransletIndex(local.getIndex());

        local = matchGen.addLocalVariable("document",
                                          Util.getJCRefType(DOM_INTF_SIG),
                                          null, null);
        field = cpg.addFieldref(_className, "_document", DOM_INTF_SIG);
        il.append(new GETFIELD(field));
        local.setStart(il.append(new ASTORE(local.getIndex())));
        matchGen.setDomIndex(local.getIndex());
    } 


                                                  ClassNames[_level],
                                                  toString(),
                                                  ACC_PUBLIC | ACC_SUPER,
                                                  null,
                                                  classGen.getStylesheet());
        InstructionList il = null;
        ConstantPoolGen cpg = nodeCounterGen.getConstantPool();

        final int closureLen = (_closureVars == null) ? 0 :
            _closureVars.size();

        for (int i = 0; i < closureLen; i++) {
            VariableBase var =
                ((VariableRefBase) _closureVars.get(i)).getVariable();

            nodeCounterGen.addField(new Field(ACC_PUBLIC,
                                        cpg.addUtf8(var.getEscapedName()),
                                        cpg.addUtf8(var.getType().toSignature()),
                                        null, cpg.getConstantPool()));
        } 

Advertisement
Javadoc
@author Jacek Ambroziak @author Santiago Pericas-Geertsen
Advertisement