< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/AttributeSetMethodGenerator.java

Print this page


   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
  23 


  35 
  36     protected static final int CURRENT_INDEX  = 4;
  37     private static final int PARAM_START_INDEX = 5;
  38 
  39     private static final String[] argNames = new String[4];
  40     private static final com.sun.org.apache.bcel.internal.generic.Type[] argTypes =
  41         new com.sun.org.apache.bcel.internal.generic.Type[4];
  42 
  43     static {
  44         argTypes[0] = Util.getJCRefType(DOM_INTF_SIG);
  45         argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG);
  46         argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG);
  47         argTypes[3] = com.sun.org.apache.bcel.internal.generic.Type.INT;
  48         argNames[0] = DOCUMENT_PNAME;
  49         argNames[1] = ITERATOR_PNAME;
  50         argNames[2] = TRANSLET_OUTPUT_PNAME;
  51         argNames[3] = NODE_PNAME;
  52     }
  53 
  54    public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
  55         super(com.sun.org.apache.bcel.internal.Constants.ACC_PRIVATE,
  56               com.sun.org.apache.bcel.internal.generic.Type.VOID,
  57               argTypes, argNames, methodName,
  58               classGen.getClassName(),
  59               new InstructionList(),
  60               classGen.getConstantPool());
  61    }
  62 
  63     public int getLocalIndex(String name) {
  64         if (name.equals("current")) {
  65             return CURRENT_INDEX;
  66         }
  67         return super.getLocalIndex(name);
  68     }
  69 
  70     public Instruction loadParameter(int index) {
  71         return new ALOAD(index + PARAM_START_INDEX);
  72     }
  73 
  74     public Instruction storeParameter(int index) {
  75         return new ASTORE(index + PARAM_START_INDEX);
   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
  22 


  34 
  35     protected static final int CURRENT_INDEX  = 4;
  36     private static final int PARAM_START_INDEX = 5;
  37 
  38     private static final String[] argNames = new String[4];
  39     private static final com.sun.org.apache.bcel.internal.generic.Type[] argTypes =
  40         new com.sun.org.apache.bcel.internal.generic.Type[4];
  41 
  42     static {
  43         argTypes[0] = Util.getJCRefType(DOM_INTF_SIG);
  44         argTypes[1] = Util.getJCRefType(NODE_ITERATOR_SIG);
  45         argTypes[2] = Util.getJCRefType(TRANSLET_OUTPUT_SIG);
  46         argTypes[3] = com.sun.org.apache.bcel.internal.generic.Type.INT;
  47         argNames[0] = DOCUMENT_PNAME;
  48         argNames[1] = ITERATOR_PNAME;
  49         argNames[2] = TRANSLET_OUTPUT_PNAME;
  50         argNames[3] = NODE_PNAME;
  51     }
  52 
  53    public AttributeSetMethodGenerator(String methodName, ClassGenerator classGen) {
  54         super(com.sun.org.apache.bcel.internal.Const.ACC_PRIVATE,
  55               com.sun.org.apache.bcel.internal.generic.Type.VOID,
  56               argTypes, argNames, methodName,
  57               classGen.getClassName(),
  58               new InstructionList(),
  59               classGen.getConstantPool());
  60    }
  61 
  62     public int getLocalIndex(String name) {
  63         if (name.equals("current")) {
  64             return CURRENT_INDEX;
  65         }
  66         return super.getLocalIndex(name);
  67     }
  68 
  69     public Instruction loadParameter(int index) {
  70         return new ALOAD(index + PARAM_START_INDEX);
  71     }
  72 
  73     public Instruction storeParameter(int index) {
  74         return new ASTORE(index + PARAM_START_INDEX);
< prev index next >