Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.PUSH


                //                name, stylesheetNode, ancestorsArray,
                //                prefixURIsIndexArray, prefixURIPairsArray,
                //                !ignoreDefaultNamespace)
                String transletClassName = getXSLTC().getClassName();
                il.append(DUP);
                il.append(new PUSH(cpg, getNodeIDForStylesheetNSLookup()));
                il.append(new GETSTATIC(cpg.addFieldref(
                                             transletClassName,
                                             STATIC_NS_ANCESTORS_ARRAY_FIELD,
                                             NS_ANCESTORS_INDEX_SIG)));
                il.append(new GETSTATIC(cpg.addFieldref(
View Full Code Here


 
  il.append(methodGen.loadDOM());
  int index = cpg.addInterfaceMethodref(DOM_INTF,
         "getResultTreeFrag",
         "(IIZ)" + DOM_INTF_SIG);
  il.append(new PUSH(cpg, RTF_INITIAL_SIZE));
  il.append(new PUSH(cpg, rtfType));
  il.append(new PUSH(cpg, stylesheet.callsNodeset()));
  il.append(new INVOKEINTERFACE(index,4));
 
  il.append(DUP);

  // Overwrite old handler with DOM handler
View Full Code Here

      final int getType = cpg.addInterfaceMethodref(DOM_INTF,
                "getType", "(I)I");
      il.append(methodGen.loadDOM());
      il.append(methodGen.loadCurrentNode());
      il.append(new INVOKEINTERFACE(getType, 2));
      il.append(new PUSH(cpg, DOM.PROCESSING_INSTRUCTION));
      _falseList.add(il.append(new IF_ICMPEQ(null)));
  }

  // Load the requested processing instruction name
  il.append(new PUSH(cpg, _name));
  // Load the current processing instruction's name
  il.append(methodGen.loadDOM());
  il.append(methodGen.loadCurrentNode());
  il.append(new INVOKEINTERFACE(gname, 2));
  // Compare the two strings
View Full Code Here

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

  // Load reference to the translet (method is in AbstractTranslet)
  il.append(classGen.loadTranslet());

  // Load the name of the parameter
  il.append(new PUSH(cpg, name)); // TODO: namespace ?
  // Generete the value of the parameter (use value in 'select' by def.)
  translateValue(classGen, methodGen);
  // Mark this parameter value is not being the default value
  il.append(new PUSH(cpg, false));
  // Pass the parameter to the template
  il.append(new INVOKEVIRTUAL(cpg.addMethodref(TRANSLET_CLASS,
                 ADD_PARAMETER,
                 ADD_PARAMETER_SIG)));
  il.append(POP); // cleanup stack
View Full Code Here

                 "<init>", "()V")));

  // Put the names array into the translet - used for dom/translet mapping
  final Vector names = getXSLTC().getNamesIndex();
  il.append(classGen.loadTranslet());
  il.append(new PUSH(cpg, names.size()));
  il.append(new ANEWARRAY(cpg.addClass(STRING)));   

  for (int i = 0; i < names.size(); i++) {
      final String name = (String)names.elementAt(i);
      il.append(DUP);
      il.append(new PUSH(cpg, i));
      il.append(new PUSH(cpg, name));
      il.append(AASTORE);
  }
  il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS,
                 NAMES_INDEX,
                 NAMES_INDEX_SIG)));

  // Put the namespace names array into the translet
  final Vector namespaces = getXSLTC().getNamespaceIndex();
  il.append(classGen.loadTranslet());
  il.append(new PUSH(cpg, namespaces.size()));
  il.append(new ANEWARRAY(cpg.addClass(STRING)));   

  for (int i = 0; i < namespaces.size(); i++) {
      final String ns = (String)namespaces.elementAt(i);
      il.append(DUP);
      il.append(new PUSH(cpg, i));
      il.append(new PUSH(cpg, ns));
      il.append(AASTORE);
  }
  il.append(new PUTFIELD(cpg.addFieldref(TRANSLET_CLASS,
                 NAMESPACE_INDEX,
                 NAMESPACE_INDEX_SIG)));
View Full Code Here

  final int setFilter = cpg.addInterfaceMethodref(DOM_INTF,
             "setFilter",
             "(Lorg/apache/xalan/xsltc/StripFilter;)V");

  il.append(new PUSH(cpg, DOM.ROOTNODE));
  il.append(new ISTORE(current.getIndex()));

  // Resolve any forward referenes and translate global variables/params
  _globals = resolveReferences(_globals);
  final int count = _globals.size();
View Full Code Here

 
  //store to _dom variable
  il.append(new PUTFIELD(domField));

  // continue with globals initialization
  il.append(new PUSH(cpg, DOM.ROOTNODE));
  il.append(new ISTORE(current.getIndex()));

  // Transfer the output settings to the output post-processor
  il.append(classGen.loadTranslet());
  il.append(transf.loadHandler());
  final int index = cpg.addMethodref(TRANSLET_CLASS,
             "transferOutputSettings",
             "("+OUTPUT_HANDLER_SIG+")V");
  il.append(new INVOKEVIRTUAL(index));

  // Compile buildKeys -- TODO: omit if not needed
  final String keySig = compileBuildKeys(classGen);
  final int    keyIdx = cpg.addMethodref(getClassName(),
                 "buildKeys", keySig);
  il.append(classGen.loadTranslet());     // The 'this' pointer
  il.append(classGen.loadTranslet());
  il.append(new GETFIELD(domField));      // The DOM reference
  il.append(transf.loadIterator());       // Not really used, but...
  il.append(transf.loadHandler());        // The output handler
  il.append(new PUSH(cpg, DOM.ROOTNODE)); // Start with the root node
  il.append(new INVOKEVIRTUAL(keyIdx));

  // Look for top-level elements that need handling
  final Enumeration toplevel = elements();
  if ((_globals.size() > 0) || (toplevel.hasMoreElements())) {
View Full Code Here

 
  // Compile def. target for switch statement if key has multiple levels
  if (levels > 1) {
      // Append the default target - it will _NEVER_ be reached
      InstructionHandle defaultTarget =
    il.append(new PUSH(cpg, EMPTYSTRING));
      il.insert(tblswitch,new TABLESWITCH(match, target, defaultTarget));
      il.append(ARETURN);
  }

  return extractMethod;
View Full Code Here

        _allAttributesUnique = checkAttributesUnique();

  // Compile code to emit element start tag
  il.append(methodGen.loadHandler());
 
  il.append(new PUSH(cpg, _name));
  il.append(DUP2);     // duplicate these 2 args for endElement
  il.append(methodGen.startElement());

  // The value of an attribute may depend on a (sibling) variable
        int j=0;
        while (j < elementCount())  {
            final SyntaxTreeNode item = (SyntaxTreeNode) elementAt(j);
            if (item instanceof Variable) {
                item.translate(classGen, methodGen);
            }
            j++;
        }

  // Compile code to emit namespace attributes
  if (_accessedPrefixes != null) {
      boolean declaresDefaultNS = false;
      Enumeration e = _accessedPrefixes.keys();

      while (e.hasMoreElements()) {
    final String prefix = (String)e.nextElement();
    final String uri = (String)_accessedPrefixes.get(prefix);

    if (uri != Constants.EMPTYSTRING ||
      prefix != Constants.EMPTYSTRING)
    {
        if (prefix == Constants.EMPTYSTRING) {
      declaresDefaultNS = true;
        }
        il.append(methodGen.loadHandler());
        il.append(new PUSH(cpg,prefix));
        il.append(new PUSH(cpg,uri));
        il.append(methodGen.namespace());
    }
      }

      /*
       * If our XslElement parent redeclares the default NS, and this
       * element doesn't, it must be redeclared one more time.
       */
      if (!declaresDefaultNS && (_parent instanceof XslElement)
        && ((XslElement) _parent).declaresDefaultNS())
      {
    il.append(methodGen.loadHandler());
    il.append(new PUSH(cpg, Constants.EMPTYSTRING));
    il.append(new PUSH(cpg, Constants.EMPTYSTRING));
    il.append(methodGen.namespace());
      }
  }

  // Output all attributes
View Full Code Here

TOP

Related Classes of org.apache.bcel.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.