Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.PUSH


      // Handle elements="ns:*" type rule
      if (rule.getStrength() == RULE_NAMESPACE) {
    il.append(new ALOAD(paramDom));
    il.append(new ILOAD(paramCurrent));
    il.append(new INVOKEINTERFACE(gns,2));
    il.append(new PUSH(cpg, rule.getNamespace()));
    il.append(new INVOKEVIRTUAL(strcmp));
    il.append(ICONST_0);

    if (rule.getAction() == STRIP_SPACE) {
        strip[sCount++] = il.append(new IF_ICMPEQ(null));
    }
    else {
        preserve[pCount++] = il.append(new IF_ICMPEQ(null));
    }
      }
      // Handle elements="ns:el" type rule
      else if (rule.getStrength() == RULE_ELEMENT) {
    // Create the QName for the element
    final Parser parser = classGen.getParser();
    QName qname;
    if (rule.getNamespace() != Constants.EMPTYSTRING )
        qname = parser.getQName(rule.getNamespace(), null,
              rule.getElement());
    else
        qname = parser.getQName(rule.getElement());

    // Register the element.
    final int elementType = xsltc.registerElement(qname);
    il.append(new ILOAD(paramType));
    il.append(new PUSH(cpg, elementType));

    // Compare current node type with wanted element type
    if (rule.getAction() == STRIP_SPACE)
        strip[sCount++] = il.append(new IF_ICMPEQ(null));
    else
View Full Code Here


   
    public void translateLang(ClassGenerator classGen,
                   MethodGenerator methodGen) {
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();
    il.append(new PUSH(cpg, _lang)); // bug! see 26869
    }
View Full Code Here

      final int children = cpg.addInterfaceMethodref(DOM_INTF,
                 "getAxisIterator",
                 "(I)"+
                 NODE_ITERATOR_SIG);
      il.append(methodGen.loadDOM());
      il.append(new PUSH(cpg, Axis.CHILD));
      il.append(new INVOKEINTERFACE(children, 2));
  }
  else {
      nodeSet.translate(classGen, methodGen);
  }
View Full Code Here

  // Compile code that initializes the static _sortOrder
        LocalVariableGen sortOrderTemp
                 = methodGen.addLocalVariable("sort_order_tmp",
                                      Util.getJCRefType("[" + STRING_SIG),
                                      null, null);
  il.append(new PUSH(cpg, nsorts));
  il.append(new ANEWARRAY(cpg.addClass(STRING)));
  for (int level = 0; level < nsorts; level++) {
      final Sort sort = (Sort)sortObjects.elementAt(level);
      il.append(DUP);
      il.append(new PUSH(cpg, level));
      sort.translateSortOrder(classGen, methodGen);
      il.append(AASTORE);
  }
        sortOrderTemp.setStart(il.append(new ASTORE(sortOrderTemp.getIndex())));

        LocalVariableGen sortTypeTemp
                 = methodGen.addLocalVariable("sort_type_tmp",
                                      Util.getJCRefType("[" + STRING_SIG),
                                      null, null);
  il.append(new PUSH(cpg, nsorts));
  il.append(new ANEWARRAY(cpg.addClass(STRING)));
  for (int level = 0; level < nsorts; level++) {
      final Sort sort = (Sort)sortObjects.elementAt(level);
      il.append(DUP);
      il.append(new PUSH(cpg, level));
      sort.translateSortType(classGen, methodGen);
      il.append(AASTORE);
  }
        sortTypeTemp.setStart(il.append(new ASTORE(sortTypeTemp.getIndex())));

        LocalVariableGen sortLangTemp
                 = methodGen.addLocalVariable("sort_lang_tmp",
                                      Util.getJCRefType("[" + STRING_SIG),
                                      null, null);
        il.append(new PUSH(cpg, nsorts));
        il.append(new ANEWARRAY(cpg.addClass(STRING)));
        for (int level = 0; level < nsorts; level++) {
              final Sort sort = (Sort)sortObjects.elementAt(level);
              il.append(DUP);
              il.append(new PUSH(cpg, level));
              sort.translateLang(classGen, methodGen);
              il.append(AASTORE);
        }
        sortLangTemp.setStart(il.append(new ASTORE(sortLangTemp.getIndex())));

        LocalVariableGen sortCaseOrderTemp
                 = methodGen.addLocalVariable("sort_case_order_tmp",
                                      Util.getJCRefType("[" + STRING_SIG),
                                      null, null);
        il.append(new PUSH(cpg, nsorts));
        il.append(new ANEWARRAY(cpg.addClass(STRING)));
        for (int level = 0; level < nsorts; level++) {
            final Sort sort = (Sort)sortObjects.elementAt(level);
            il.append(DUP);
            il.append(new PUSH(cpg, level));
            sort.translateCaseOrder(classGen, methodGen);
            il.append(AASTORE);
        }
        sortCaseOrderTemp.setStart(
                il.append(new ASTORE(sortCaseOrderTemp.getIndex())));
 
  il.append(new NEW(cpg.addClass(sortRecordFactoryClass)));
  il.append(DUP);
  il.append(methodGen.loadDOM());
  il.append(new PUSH(cpg, sortRecordClass));
  il.append(classGen.loadTranslet());

        sortOrderTemp.setEnd(il.append(new ALOAD(sortOrderTemp.getIndex())));
        sortTypeTemp.setEnd(il.append(new ALOAD(sortTypeTemp.getIndex())));
        sortLangTemp.setEnd(il.append(new ALOAD(sortLangTemp.getIndex())));
View Full Code Here

                 "(I)"+NODE_SIG);              

  // Call getKeyIndex in AbstractTranslet with the name of the key
  // to get the index for this key (which is also a node iterator).
  il.append(classGen.loadTranslet());
  il.append(new PUSH(cpg,_index));
  il.append(new INVOKEVIRTUAL(getKeyIndex));
 
  // Now use the value in the second argument to determine what nodes
  // the iterator should return.
  il.append(SWAP);
  il.append(new PUSH(cpg,_value));
  if (this instanceof IdPattern)
  {
      il.append(new INVOKEVIRTUAL(lookupId));
  }
  else
View Full Code Here

                "getExpandedTypeID",
                                                          "(I)I");
      il.append(methodGen.loadDOM());
      il.append(methodGen.loadCurrentNode());
      il.append(new INVOKEINTERFACE(getType, 2));
      il.append(new PUSH(cpg, DTM.PROCESSING_INSTRUCTION_NODE));
      _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

  final InstructionList il = methodGen.getInstructionList();
  final int nArgs = argumentCount();
 
  switch (nArgs) {
  case 0:
      il.append(new PUSH(cpg, EMPTYSTRING));
      break;
     
  case 1:
      argument().translate(classGen, methodGen);
      break;
View Full Code Here

  }
  // If neither are present then store empty string in variable
  else {
      final ConstantPoolGen cpg = classGen.getConstantPool();
      final InstructionList il = methodGen.getInstructionList();
      il.append(new PUSH(cpg, Constants.EMPTYSTRING));
  }
    }
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.