Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.ASTORE


     */
    LocalVariableGen lg = mg.addLocalVariable("in",
                new ObjectType("java.io.BufferedReader"),
                null, null);
    int in = lg.getIndex();
    lg.setStart(il.append(new ASTORE(in))); // `i' valid from here

    /* Create local variable `name'
     */
    lg = mg.addLocalVariable("name", Type.STRING, null, null);
    int name = lg.getIndex();
    il.append(InstructionConstants.ACONST_NULL);
    lg.setStart(il.append(new ASTORE(name))); // `name' valid from here

    /* try { ...
     */
    InstructionHandle try_start =
      il.append(factory.createFieldAccess("java.lang.System", "out", p_stream,
            Constants.GETSTATIC));

    il.append(new PUSH(cp, "Please enter your name> "));
    il.append(factory.createInvoke("java.io.PrintStream", "print", Type.VOID,
           new Type[] { Type.STRING }, Constants.INVOKEVIRTUAL));
    il.append(new ALOAD(in));
    il.append(factory.createInvoke("java.io.BufferedReader", "readLine",
           Type.STRING, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
    il.append(new ASTORE(name));

    /* Upon normal execution we jump behind exception handler,
     * the target address is not known yet.
     */
    GOTO g = new GOTO(null);
View Full Code Here


  il.append(InstructionConstants.POP); pop(); // Remove last element on stack
  end = il.append(InstructionConstants.RETURN); // Use instruction constants, if possible

  // catch
  handler = il.append(new ASTORE(slot)); // save exception object
  il.append(new GETSTATIC(cp.addFieldref("java.lang.System", "err",
                 "Ljava/io/PrintStream;")));
  il.append(new ALOAD(slot)); push(2);
  il.append(new INVOKEVIRTUAL(cp.addMethodref("java.io.PrintStream",
            "println",
View Full Code Here

                    Util.getJCRefType(STRING_SIG),
                    il.getEnd());
                   
            // store the name into a variable first so _name.translate only needs to be called once 
            _name.translate(classGen, methodGen);
            il.append(new ASTORE(nameValue.getIndex()));
            il.append(new ALOAD(nameValue.getIndex()));
           
            // call checkQName if the name is an AVT
            final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkAttribQName",
                            "("
View Full Code Here

  _path.translate(classGen, methodGen); // iterator on stack....
        LocalVariableGen pathTemp
                = methodGen.addLocalVariable("parent_location_path_tmp1",
                                         Util.getJCRefType(NODE_ITERATOR_SIG),
                                         il.getEnd(), null);
        il.append(new ASTORE(pathTemp.getIndex()));

  _step.translate(classGen, methodGen);
        LocalVariableGen stepTemp
                = methodGen.addLocalVariable("parent_location_path_tmp2",
                                         Util.getJCRefType(NODE_ITERATOR_SIG),
                                         il.getEnd(), null);
        il.append(new ASTORE(stepTemp.getIndex()));

  // Create new StepIterator
  final int initSI = cpg.addMethodref(STEP_ITERATOR_CLASS,
              "<init>",
              "("
View Full Code Here

            null, null);
  field = cpg.addFieldref(NODE_COUNTER, "_iterator",
        ITERATOR_FIELD_SIG);
  il.append(ALOAD_0); // 'this' pointer on stack
  il.append(new GETFIELD(field));
  il.append(new ASTORE(local.getIndex()));
  matchGen.setIteratorIndex(local.getIndex());
 
  // Get NodeCounter._translet and store locally
  local = matchGen.addLocalVariable("translet",
          Util.getJCRefType(TRANSLET_SIG),
          null, null);
  field = cpg.addFieldref(NODE_COUNTER, "_translet",
        "Lorg/apache/xalan/xsltc/Translet;");
  il.append(ALOAD_0); // 'this' pointer on stack
  il.append(new GETFIELD(field));
  il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS)));
  il.append(new ASTORE(local.getIndex()));
  nodeCounterGen.setTransletIndex(local.getIndex());

  // Get NodeCounter._document and store locally
  local = matchGen.addLocalVariable("document",
            Util.getJCRefType(DOM_INTF_SIG),
            null, null);
  field = cpg.addFieldref(_className, "_document", DOM_INTF_SIG);
  il.append(ALOAD_0); // 'this' pointer on stack
  il.append(new GETFIELD(field));
  // Make sure we have the correct DOM type on the stack!!!
  il.append(new ASTORE(local.getIndex()));
  matchGen.setDomIndex(local.getIndex());
    }
View Full Code Here

            LocalVariableGen nodeIteratorTemp =
                methodGen.addLocalVariable("filter_expr_tmp1",
                                           Util.getJCRefType(NODE_ITERATOR_SIG),
                                           il.getEnd(), null);
            il.append(new ASTORE(nodeIteratorTemp.getIndex()));

            predicate.translate(classGen, methodGen);
            LocalVariableGen filterTemp =
                methodGen.addLocalVariable("filter_expr_tmp2",
                              Util.getJCRefType(CURRENT_NODE_LIST_FILTER_SIG),
                              il.getEnd(), null);
            il.append(new ASTORE(filterTemp.getIndex()));

            // Create a CurrentNodeListIterator
            il.append(new NEW(cpg.addClass(CURRENT_NODE_LIST_ITERATOR)));
            il.append(DUP);
           
View Full Code Here

              + NODE_SIG
              + TRANSLET_OUTPUT_SIG
              + ")" + STRING_SIG);
  il.append(new INVOKEINTERFACE(cpy, 3));
  il.append(DUP);
  il.append(new ASTORE(name.getIndex()));
  final BranchHandle ifBlock1 = il.append(new IFNULL(null));

  // Get the length of the node name and save for later
  il.append(new ALOAD(name.getIndex()));
  final int lengthMethod = cpg.addMethodref(STRING_CLASS,"length","()I");
View Full Code Here

            LocalVariableGen pathTemp =
               methodGen.addLocalVariable("filtered_absolute_location_path_tmp",
                                          Util.getJCRefType(NODE_ITERATOR_SIG),
                                          il.getEnd(), null);
      _path.translate(classGen, methodGen);
            il.append(new ASTORE(pathTemp.getIndex()));

      // Create new Dup Filter Iterator
      il.append(new NEW(cpg.addClass(DUP_FILTERED_ITERATOR)));
      il.append(DUP);
            il.append(new ALOAD(pathTemp.getIndex()));
View Full Code Here

      _path.translate(classGen, methodGen);
            LocalVariableGen relPathIterator
                    = methodGen.addLocalVariable("abs_location_path_tmp",
                                       Util.getJCRefType(NODE_ITERATOR_SIG),
                                       il.getEnd(), null);
            il.append(new ASTORE(relPathIterator.getIndex()));

      // Create new AbsoluteIterator
      il.append(new NEW(cpg.addClass(ABSOLUTE_ITERATOR)));
      il.append(DUP);
            il.append(new ALOAD(relPathIterator.getIndex()));
View Full Code Here

  final String className = classGen.getClassName();
  il.append(filterGen.loadTranslet());
  il.append(new CHECKCAST(cpg.addClass(className)));
  il.append(new GETFIELD(cpg.addFieldref(className,
                 DOM_FIELD, DOM_INTF_SIG)));
  il.append(new ASTORE(local.getIndex()));

  // Store the dom index in the test generator
  testGen.setDomIndex(local.getIndex());

  _exp.translate(filterGen, testGen);
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.ASTORE

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.