com.sun.org.apache.xalan.internal.xsltc.compiler.Constants Java Examples

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.compiler.Constants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RealType.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a real. Expects a java
 * object on the stack and pushes a real (i.e., a double).
 */
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
                          Class clazz) {
    InstructionList il = methodGen.getInstructionList();

    if (clazz == Character.TYPE || clazz == Byte.TYPE ||
        clazz == Short.TYPE || clazz == Integer.TYPE) {
        il.append(I2D);
    }
    else if (clazz == Long.TYPE) {
        il.append(L2D);
    }
    else if (clazz == Float.TYPE) {
        il.append(F2D);
    }
    else if (clazz == Double.TYPE) {
        il.append(NOP);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #2
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #3
Source File: BooleanType.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Translates a real into an object of internal type <code>type</code>. The
 * translation to int is undefined since booleans are always converted to
 * reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #4
Source File: StringType.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a string.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
 */
public void translateFrom(ClassGenerator classGen,
    MethodGenerator methodGen, Class clazz)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (clazz.getName().equals("java.lang.String")) {
        // same internal representation, convert null to ""
        il.append(DUP);
        final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
        il.append(POP);
        il.append(new PUSH(cpg, ""));
        ifNonNull.setTarget(il.append(NOP));
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #5
Source File: TransformerFactoryImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #6
Source File: BooleanType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates a real into an object of internal type <code>type</code>. The
 * translation to int is undefined since booleans are always converted to
 * reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #7
Source File: StringType.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a string.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
 */
public void translateFrom(ClassGenerator classGen,
    MethodGenerator methodGen, Class clazz)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (clazz.getName().equals("java.lang.String")) {
        // same internal representation, convert null to ""
        il.append(DUP);
        final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
        il.append(POP);
        il.append(new PUSH(cpg, ""));
        ifNonNull.setTarget(il.append(NOP));
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #8
Source File: StringType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a string.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
 */
public void translateFrom(ClassGenerator classGen,
    MethodGenerator methodGen, Class clazz)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (clazz.getName().equals("java.lang.String")) {
        // same internal representation, convert null to ""
        il.append(DUP);
        final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
        il.append(POP);
        il.append(new PUSH(cpg, ""));
        ifNonNull.setTarget(il.append(NOP));
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #9
Source File: StringType.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Translates a string into an object of internal type <code>type</code>.
 * The translation to int is undefined since strings are always converted
 * to reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else if (type == Type.ObjectString) {
        // NOP -> same representation
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #10
Source File: StringType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates a string into an object of internal type <code>type</code>.
 * The translation to int is undefined since strings are always converted
 * to reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else if (type == Type.ObjectString) {
        // NOP -> same representation
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #11
Source File: BooleanType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an internal boolean into an external (Java) boolean.
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Class clazz) {
    if (clazz == java.lang.Boolean.TYPE) {
        methodGen.getInstructionList().append(NOP);
    }
    // Is Boolean <: clazz? I.e. clazz in { Boolean, Object }
    else if (clazz.isAssignableFrom(java.lang.Boolean.class)) {
        translateTo(classGen, methodGen, Type.Reference);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #12
Source File: BooleanType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an internal boolean into an external (Java) boolean.
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Class clazz) {
    if (clazz == java.lang.Boolean.TYPE) {
        methodGen.getInstructionList().append(NOP);
    }
    // Is Boolean <: clazz? I.e. clazz in { Boolean, Object }
    else if (clazz.isAssignableFrom(java.lang.Boolean.class)) {
        translateTo(classGen, methodGen, Type.Reference);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #13
Source File: IntType.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Translates an integer into an object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        final Type type) {
    if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #14
Source File: CompareGenerator.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
 
Example #15
Source File: RealType.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a real. Expects a java
 * object on the stack and pushes a real (i.e., a double).
 */
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
                          Class clazz) {
    InstructionList il = methodGen.getInstructionList();

    if (clazz == Character.TYPE || clazz == Byte.TYPE ||
        clazz == Short.TYPE || clazz == Integer.TYPE) {
        il.append(I2D);
    }
    else if (clazz == Long.TYPE) {
        il.append(L2D);
    }
    else if (clazz == Float.TYPE) {
        il.append(F2D);
    }
    else if (clazz == Double.TYPE) {
        il.append(NOP);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #16
Source File: TransformerFactoryImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #17
Source File: IntType.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an integer into an object of internal type <code>type</code>.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        final Type type) {
    if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #18
Source File: BooleanType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates a real into an object of internal type <code>type</code>. The
 * translation to int is undefined since booleans are always converted to
 * reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #19
Source File: RealType.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a real. Expects a java
 * object on the stack and pushes a real (i.e., a double).
 */
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
                          Class clazz) {
    InstructionList il = methodGen.getInstructionList();

    if (clazz == Character.TYPE || clazz == Byte.TYPE ||
        clazz == Short.TYPE || clazz == Integer.TYPE) {
        il.append(I2D);
    }
    else if (clazz == Long.TYPE) {
        il.append(L2D);
    }
    else if (clazz == Float.TYPE) {
        il.append(F2D);
    }
    else if (clazz == Double.TYPE) {
        il.append(NOP);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #20
Source File: CompareGenerator.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
 
Example #21
Source File: BooleanType.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Translates a real into an object of internal type <code>type</code>. The
 * translation to int is undefined since booleans are always converted to
 * reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #22
Source File: StringType.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Translates an external (primitive) Java type into a string.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
 */
public void translateFrom(ClassGenerator classGen,
    MethodGenerator methodGen, Class clazz)
{
    final ConstantPoolGen cpg = classGen.getConstantPool();
    final InstructionList il = methodGen.getInstructionList();

    if (clazz.getName().equals("java.lang.String")) {
        // same internal representation, convert null to ""
        il.append(DUP);
        final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
        il.append(POP);
        il.append(new PUSH(cpg, ""));
        ifNonNull.setTarget(il.append(NOP));
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), clazz.getName());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #23
Source File: CompareGenerator.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
 
Example #24
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * This method implements XSLTC's SourceLoader interface. It is used to
 * glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
 *
 * @param href The URI of the document to load
 * @param context The URI of the currently loaded document
 * @param xsltc The compiler that resuests the document
 * @return An InputSource with the loaded document
 */
@Override
public InputSource loadSource(String href, String context, XSLTC xsltc) {
    try {
        if (_uriResolver != null) {
            final Source source = _uriResolver.resolve(href, context);
            if (source != null) {
                return Util.getInputSource(xsltc, source);
            }
        }
    }
    catch (TransformerException e) {
        // should catch it when the resolver explicitly throws the exception
        final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
        xsltc.getParser().reportError(Constants.FATAL, msg);
    }

    return null;
}
 
Example #25
Source File: CompareGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public CompareGenerator(int access_flags, Type return_type,
                        Type[] arg_types, String[] arg_names,
                        String method_name, String class_name,
                        InstructionList il, ConstantPoolGen cp) {
    super(access_flags, return_type, arg_types, arg_names, method_name,
          class_name, il, cp);

    _iloadCurrent = new ILOAD(CURRENT_INDEX);
    _istoreCurrent = new ISTORE(CURRENT_INDEX);
    _aloadDom = new ALOAD(DOM_INDEX);
    _iloadLast = new ILOAD(LAST_INDEX);

    LocalVariableGen iterator =
        addLocalVariable("iterator",
                         Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
                         null, null);
    ITERATOR_INDEX = iterator.getIndex();
    _aloadIterator = new ALOAD(ITERATOR_INDEX);
    _astoreIterator = new ASTORE(ITERATOR_INDEX);
    il.append(new ACONST_NULL());
    il.append(storeIterator());
}
 
Example #26
Source File: ObjectType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates an object of this type to the external (Java) type denoted
 * by <code>clazz</code>. This method is used to translate parameters
 * when external functions are called.
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Class clazz) {
    if (clazz.isAssignableFrom(_clazz))
        methodGen.getInstructionList().append(NOP);
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                           toString(), clazz.getClass().toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #27
Source File: ReferenceType.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a reference to an object of internal type <code>type</code>.
 * The translation to int is undefined since references
 * are always converted to reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.NodeSet) {
        translateTo(classGen, methodGen, (NodeSetType) type);
    }
    else if (type == Type.Node) {
        translateTo(classGen, methodGen, (NodeType) type);
    }
    else if (type == Type.ResultTree) {
        translateTo(classGen, methodGen, (ResultTreeType) type);
    }
    else if (type == Type.Object) {
        translateTo(classGen, methodGen, (ObjectType) type);
    }
    else if (type == Type.Reference ) {
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR, type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #28
Source File: ReferenceType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a reference to an object of internal type <code>type</code>.
 * The translation to int is undefined since references
 * are always converted to reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.NodeSet) {
        translateTo(classGen, methodGen, (NodeSetType) type);
    }
    else if (type == Type.Node) {
        translateTo(classGen, methodGen, (NodeType) type);
    }
    else if (type == Type.ResultTree) {
        translateTo(classGen, methodGen, (ResultTreeType) type);
    }
    else if (type == Type.Object) {
        translateTo(classGen, methodGen, (ObjectType) type);
    }
    else if (type == Type.Reference ) {
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR, type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}
 
Example #29
Source File: ClassGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ClassGenerator(String class_name, String super_class_name,
                      String file_name,
                      int access_flags, String[] interfaces,
                      Stylesheet stylesheet) {
    super(class_name, super_class_name, file_name,
          access_flags, interfaces);
    _stylesheet = stylesheet;
    _parser = stylesheet.getParser();
    _aloadTranslet = new ALOAD(TRANSLET_INDEX);

    if (stylesheet.isMultiDocument()) {
        _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM";
        _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/MultiDOM;";
    }
    else {
        _domClass = "com.sun.org.apache.xalan.internal.xsltc.dom.DOMAdapter";
        _domClassSig = "Lcom/sun/org/apache/xalan/internal/xsltc/dom/DOMAdapter;";
    }
    _applyTemplatesSig = "("
        + Constants.DOM_INTF_SIG
        + Constants.NODE_ITERATOR_SIG
        + Constants.TRANSLET_OUTPUT_SIG
        + ")V";

_applyTemplatesSigForImport = "("
    + Constants.DOM_INTF_SIG
    + Constants.NODE_ITERATOR_SIG
    + Constants.TRANSLET_OUTPUT_SIG
    + Constants.NODE_FIELD_SIG
    + ")V";
}
 
Example #30
Source File: NodeSetType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a node-set into an object of internal type
 * <code>type</code>. The translation to int is undefined
 * since node-sets are always converted to
 * reals in arithmetic expressions.
 *
 * @see     com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
 */
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
                        Type type) {
    if (type == Type.String) {
        translateTo(classGen, methodGen, (StringType) type);
    }
    else if (type == Type.Boolean) {
        translateTo(classGen, methodGen, (BooleanType) type);
    }
    else if (type == Type.Real) {
        translateTo(classGen, methodGen, (RealType) type);
    }
    else if (type == Type.Node) {
        translateTo(classGen, methodGen, (NodeType) type);
    }
    else if (type == Type.Reference) {
        translateTo(classGen, methodGen, (ReferenceType) type);
    }
    else if (type == Type.Object) {
        translateTo(classGen, methodGen, (ObjectType) type);
    }
    else {
        ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
                                    toString(), type.toString());
        classGen.getParser().reportError(Constants.FATAL, err);
    }
}