Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java?rev=1089584&view=auto ============================================================================== --- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java (added) +++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXAnnotationAdapter.java Wed Apr 6 19:11:34 2011 @@ -0,0 +1,218 @@ +/*** + * ASM XML Adapter + * Copyright (c) 2004, Eugene Kuleshov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.objectweb.asm.xml; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Type; +import org.xml.sax.ContentHandler; +import org.xml.sax.helpers.AttributesImpl; + +/** + * SAXAnnotationAdapter + * + * @author Eugene Kuleshov + */ +public class SAXAnnotationAdapter extends SAXAdapter implements + AnnotationVisitor +{ + private final String elementName; + + public SAXAnnotationAdapter( + final ContentHandler h, + final String elementName, + final int visible, + final String name, + final String desc) + { + this(h, elementName, visible, desc, name, -1); + } + + public SAXAnnotationAdapter( + final ContentHandler h, + final String elementName, + final int visible, + final int parameter, + final String desc) + { + this(h, elementName, visible, desc, null, parameter); + } + + private SAXAnnotationAdapter( + final ContentHandler h, + final String elementName, + final int visible, + final String desc, + final String name, + final int parameter) + { + super(h); + this.elementName = elementName; + + AttributesImpl att = new AttributesImpl(); + if (name != null) { + att.addAttribute("", "name", "name", "", name); + } + if (visible != 0) { + att.addAttribute("", "visible", "visible", "", visible > 0 + ? "true" + : "false"); + } + if (parameter != -1) { + att.addAttribute("", + "parameter", + "parameter", + "", + Integer.toString(parameter)); + } + if (desc != null) { + att.addAttribute("", "desc", "desc", "", desc); + } + + addStart(elementName, att); + } + + public void visit(final String name, final Object value) { + Class c = value.getClass(); + if (c.isArray()) { + AnnotationVisitor av = visitArray(name); + if (value instanceof byte[]) { + byte[] b = (byte[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Byte(b[i])); + } + + } else if (value instanceof char[]) { + char[] b = (char[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Character(b[i])); + } + + } else if (value instanceof short[]) { + short[] b = (short[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Short(b[i])); + } + + } else if (value instanceof boolean[]) { + boolean[] b = (boolean[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, Boolean.valueOf(b[i])); + } + + } else if (value instanceof int[]) { + int[] b = (int[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Integer(b[i])); + } + + } else if (value instanceof long[]) { + long[] b = (long[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Long(b[i])); + } + + } else if (value instanceof float[]) { + float[] b = (float[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Float(b[i])); + } + + } else if (value instanceof double[]) { + double[] b = (double[]) value; + for (int i = 0; i < b.length; i++) { + av.visit(null, new Double(b[i])); + } + + } + av.visitEnd(); + } else { + addValueElement("annotationValue", + name, + Type.getDescriptor(c), + value.toString()); + } + } + + public void visitEnum( + final String name, + final String desc, + final String value) + { + addValueElement("annotationValueEnum", name, desc, value); + } + + public AnnotationVisitor visitAnnotation( + final String name, + final String desc) + { + return new SAXAnnotationAdapter(getContentHandler(), + "annotationValueAnnotation", + 0, + name, + desc); + } + + public AnnotationVisitor visitArray(final String name) { + return new SAXAnnotationAdapter(getContentHandler(), + "annotationValueArray", + 0, + name, + null); + } + + public void visitEnd() { + addEnd(elementName); + } + + private void addValueElement( + final String element, + final String name, + final String desc, + final String value) + { + AttributesImpl att = new AttributesImpl(); + if (name != null) { + att.addAttribute("", "name", "name", "", name); + } + if (desc != null) { + att.addAttribute("", "desc", "desc", "", desc); + } + if (value != null) { + att.addAttribute("", + "value", + "value", + "", + SAXClassAdapter.encode(value)); + } + + addElement(element, att); + } + +}
Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXClassAdapter.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXClassAdapter.java?rev=1089584&view=auto ============================================================================== --- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXClassAdapter.java (added) +++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXClassAdapter.java Wed Apr 6 19:11:34 2011 @@ -0,0 +1,349 @@ +/*** + * ASM XML Adapter + * Copyright (c) 2004, Eugene Kuleshov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.objectweb.asm.xml; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.xml.sax.ContentHandler; +import org.xml.sax.helpers.AttributesImpl; + +/** + * A {@link org.objectweb.asm.ClassVisitor ClassVisitor} that generates SAX 2.0 + * events from the visited class. It can feed any kind of + * {@link org.xml.sax.ContentHandler ContentHandler}, e.g. XML serializer, XSLT + * or XQuery engines. + * + * @see org.objectweb.asm.xml.Processor + * @see org.objectweb.asm.xml.ASMContentHandler + * + * @author Eugene Kuleshov + */ +public final class SAXClassAdapter extends SAXAdapter implements ClassVisitor { + private final boolean singleDocument; + + /** + * Pseudo access flag used to distinguish class access flags. + */ + private static final int ACCESS_CLASS = 262144; + + /** + * Pseudo access flag used to distinguish field access flags. + */ + private static final int ACCESS_FIELD = 524288; + + /** + * Pseudo access flag used to distinguish inner class flags. + */ + private static final int ACCESS_INNER = 1048576; + + /** + * Constructs a new {@link SAXClassAdapter SAXClassAdapter} object. + * + * @param h content handler that will be used to send SAX 2.0 events. + * @param singleDocument if <tt>true</tt> adapter will not produce + * {@link ContentHandler#startDocument() startDocument()} and + * {@link ContentHandler#endDocument() endDocument()} events. + */ + public SAXClassAdapter(final ContentHandler h, boolean singleDocument) { + super(h); + this.singleDocument = singleDocument; + if (!singleDocument) { + addDocumentStart(); + } + } + + public void visitSource(final String source, final String debug) { + AttributesImpl att = new AttributesImpl(); + if (source != null) { + att.addAttribute("", "file", "file", "", encode(source)); + } + if (debug != null) { + att.addAttribute("", "debug", "debug", "", encode(debug)); + } + + addElement("source", att); + } + + public void visitOuterClass( + final String owner, + final String name, + final String desc) + { + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "owner", "owner", "", owner); + if (name != null) { + att.addAttribute("", "name", "name", "", name); + } + if (desc != null) { + att.addAttribute("", "desc", "desc", "", desc); + } + + addElement("outerclass", att); + } + + public AnnotationVisitor visitAnnotation( + final String desc, + final boolean visible) + { + return new SAXAnnotationAdapter(getContentHandler(), + "annotation", + visible ? 1 : -1, + null, + desc); + } + + public void visit( + final int version, + final int access, + final String name, + final String signature, + final String superName, + final String[] interfaces) + { + StringBuffer sb = new StringBuffer(); + appendAccess(access | ACCESS_CLASS, sb); + + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "access", "access", "", sb.toString()); + if (name != null) { + att.addAttribute("", "name", "name", "", name); + } + if (signature != null) { + att.addAttribute("", + "signature", + "signature", + "", + encode(signature)); + } + if (superName != null) { + att.addAttribute("", "parent", "parent", "", superName); + } + att.addAttribute("", + "major", + "major", + "", + Integer.toString(version & 0xFFFF)); + att.addAttribute("", + "minor", + "minor", + "", + Integer.toString(version >>> 16)); + addStart("class", att); + + addStart("interfaces", new AttributesImpl()); + if (interfaces != null && interfaces.length > 0) { + for (int i = 0; i < interfaces.length; i++) { + AttributesImpl att2 = new AttributesImpl(); + att2.addAttribute("", "name", "name", "", interfaces[i]); + addElement("interface", att2); + } + } + addEnd("interfaces"); + } + + public FieldVisitor visitField( + final int access, + final String name, + final String desc, + final String signature, + final Object value) + { + StringBuffer sb = new StringBuffer(); + appendAccess(access | ACCESS_FIELD, sb); + + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "access", "access", "", sb.toString()); + att.addAttribute("", "name", "name", "", name); + att.addAttribute("", "desc", "desc", "", desc); + if (signature != null) { + att.addAttribute("", + "signature", + "signature", + "", + encode(signature)); + } + if (value != null) { + att.addAttribute("", "value", "value", "", encode(value.toString())); + } + + return new SAXFieldAdapter(getContentHandler(), att); + } + + public MethodVisitor visitMethod( + final int access, + final String name, + final String desc, + final String signature, + final String[] exceptions) + { + StringBuffer sb = new StringBuffer(); + appendAccess(access, sb); + + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "access", "access", "", sb.toString()); + att.addAttribute("", "name", "name", "", name); + att.addAttribute("", "desc", "desc", "", desc); + if (signature != null) { + att.addAttribute("", "signature", "signature", "", signature); + } + addStart("method", att); + + addStart("exceptions", new AttributesImpl()); + if (exceptions != null && exceptions.length > 0) { + for (int i = 0; i < exceptions.length; i++) { + AttributesImpl att2 = new AttributesImpl(); + att2.addAttribute("", "name", "name", "", exceptions[i]); + addElement("exception", att2); + } + } + addEnd("exceptions"); + + return new SAXCodeAdapter(getContentHandler(), access); + } + + public final void visitInnerClass( + final String name, + final String outerName, + final String innerName, + final int access) + { + StringBuffer sb = new StringBuffer(); + appendAccess(access | ACCESS_INNER, sb); + + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "access", "access", "", sb.toString()); + if (name != null) { + att.addAttribute("", "name", "name", "", name); + } + if (outerName != null) { + att.addAttribute("", "outerName", "outerName", "", outerName); + } + if (innerName != null) { + att.addAttribute("", "innerName", "innerName", "", innerName); + } + addElement("innerclass", att); + } + + public final void visitEnd() { + addEnd("class"); + if (!singleDocument) { + addDocumentEnd(); + } + } + + static final String encode(final String s) { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c == '\\') { + sb.append("\\\\"); + } else if (c < 0x20 || c > 0x7f) { + sb.append("\\u"); + if (c < 0x10) { + sb.append("000"); + } else if (c < 0x100) { + sb.append("00"); + } else if (c < 0x1000) { + sb.append('0'); + } + sb.append(Integer.toString(c, 16)); + } else { + sb.append(c); + } + } + return sb.toString(); + } + + static void appendAccess(final int access, final StringBuffer sb) { + if ((access & Opcodes.ACC_PUBLIC) != 0) { + sb.append("public "); + } + if ((access & Opcodes.ACC_PRIVATE) != 0) { + sb.append("private "); + } + if ((access & Opcodes.ACC_PROTECTED) != 0) { + sb.append("protected "); + } + if ((access & Opcodes.ACC_FINAL) != 0) { + sb.append("final "); + } + if ((access & Opcodes.ACC_STATIC) != 0) { + sb.append("static "); + } + if ((access & Opcodes.ACC_SUPER) != 0) { + if ((access & ACCESS_CLASS) == 0) { + sb.append("synchronized "); + } else { + sb.append("super "); + } + } + if ((access & Opcodes.ACC_VOLATILE) != 0) { + if ((access & ACCESS_FIELD) == 0) { + sb.append("bridge "); + } else { + sb.append("volatile "); + } + } + if ((access & Opcodes.ACC_TRANSIENT) != 0) { + if ((access & ACCESS_FIELD) == 0) { + sb.append("varargs "); + } else { + sb.append("transient "); + } + } + if ((access & Opcodes.ACC_NATIVE) != 0) { + sb.append("native "); + } + if ((access & Opcodes.ACC_STRICT) != 0) { + sb.append("strict "); + } + if ((access & Opcodes.ACC_INTERFACE) != 0) { + sb.append("interface "); + } + if ((access & Opcodes.ACC_ABSTRACT) != 0) { + sb.append("abstract "); + } + if ((access & Opcodes.ACC_SYNTHETIC) != 0) { + sb.append("synthetic "); + } + if ((access & Opcodes.ACC_ANNOTATION) != 0) { + sb.append("annotation "); + } + if ((access & Opcodes.ACC_ENUM) != 0) { + sb.append("enum "); + } + if ((access & Opcodes.ACC_DEPRECATED) != 0) { + sb.append("deprecated "); + } + } +} Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXCodeAdapter.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXCodeAdapter.java?rev=1089584&view=auto ============================================================================== --- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXCodeAdapter.java (added) +++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXCodeAdapter.java Wed Apr 6 19:11:34 2011 @@ -0,0 +1,397 @@ +/*** + * ASM XML Adapter + * Copyright (c) 2004, Eugene Kuleshov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.objectweb.asm.xml; + +import java.util.HashMap; +import java.util.Map; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; +import org.objectweb.asm.Label; +import org.objectweb.asm.Type; +import org.objectweb.asm.util.AbstractVisitor; +import org.xml.sax.ContentHandler; +import org.xml.sax.helpers.AttributesImpl; + +/** + * A {@link MethodVisitor} that generates SAX 2.0 events from the visited + * method. + * + * @see org.objectweb.asm.xml.SAXClassAdapter + * @see org.objectweb.asm.xml.Processor + * + * @author Eugene Kuleshov + */ +public final class SAXCodeAdapter extends SAXAdapter implements MethodVisitor { + + static final String[] TYPES = { + "top", + "int", + "float", + "double", + "long", + "null", + "uninitializedThis" }; + + private final Map labelNames; + + /** + * Constructs a new {@link SAXCodeAdapter SAXCodeAdapter} object. + * + * @param h content handler that will be used to send SAX 2.0 events. + */ + public SAXCodeAdapter(final ContentHandler h, final int access) { + super(h); + labelNames = new HashMap(); + + if ((access & (Opcodes.ACC_ABSTRACT | Opcodes.ACC_INTERFACE | Opcodes.ACC_NATIVE)) == 0) + { + addStart("code", new AttributesImpl()); + } + } + + public final void visitCode() { + } + + public void visitFrame( + final int type, + final int nLocal, + final Object[] local, + final int nStack, + final Object[] stack) + { + AttributesImpl attrs = new AttributesImpl(); + switch (type) { + case Opcodes.F_NEW: + case Opcodes.F_FULL: + if (type == Opcodes.F_NEW) { + attrs.addAttribute("", "type", "type", "", "NEW"); + } else { + attrs.addAttribute("", "type", "type", "", "FULL"); + } + addStart("frame", attrs); + appendFrameTypes(true, nLocal, local); + appendFrameTypes(false, nStack, stack); + break; + case Opcodes.F_APPEND: + attrs.addAttribute("", "type", "type", "", "APPEND"); + addStart("frame", attrs); + appendFrameTypes(true, nLocal, local); + break; + case Opcodes.F_CHOP: + attrs.addAttribute("", "type", "type", "", "CHOP"); + attrs.addAttribute("", + "count", + "count", + "", + Integer.toString(nLocal)); + addStart("frame", attrs); + break; + case Opcodes.F_SAME: + attrs.addAttribute("", "type", "type", "", "SAME"); + addStart("frame", attrs); + break; + case Opcodes.F_SAME1: + attrs.addAttribute("", "type", "type", "", "SAME1"); + addStart("frame", attrs); + appendFrameTypes(false, 1, stack); + break; + } + addEnd("frame"); + } + + private void appendFrameTypes( + final boolean local, + final int n, + final Object[] types) + { + for (int i = 0; i < n; ++i) { + Object type = types[i]; + AttributesImpl attrs = new AttributesImpl(); + if (type instanceof String) { + attrs.addAttribute("", "type", "type", "", (String) type); + } else if (type instanceof Integer) { + attrs.addAttribute("", + "type", + "type", + "", + TYPES[((Integer) type).intValue()]); + } else { + attrs.addAttribute("", "type", "type", "", "uninitialized"); + attrs.addAttribute("", + "label", + "label", + "", + getLabel((Label) type)); + } + addElement(local ? "local" : "stack", attrs); + } + } + + public final void visitInsn(final int opcode) { + addElement(AbstractVisitor.OPCODES[opcode], new AttributesImpl()); + } + + public final void visitIntInsn(final int opcode, final int operand) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "value", "value", "", Integer.toString(operand)); + addElement(AbstractVisitor.OPCODES[opcode], attrs); + } + + public final void visitVarInsn(final int opcode, final int var) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "var", "var", "", Integer.toString(var)); + addElement(AbstractVisitor.OPCODES[opcode], attrs); + } + + public final void visitTypeInsn(final int opcode, final String type) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "desc", "desc", "", type); + addElement(AbstractVisitor.OPCODES[opcode], attrs); + } + + public final void visitFieldInsn( + final int opcode, + final String owner, + final String name, + final String desc) + { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "owner", "owner", "", owner); + attrs.addAttribute("", "name", "name", "", name); + attrs.addAttribute("", "desc", "desc", "", desc); + addElement(AbstractVisitor.OPCODES[opcode], attrs); + } + + public final void visitMethodInsn( + final int opcode, + final String owner, + final String name, + final String desc) + { + AttributesImpl attrs = new AttributesImpl(); + if (opcode != Opcodes.INVOKEDYNAMIC) { + attrs.addAttribute("", "owner", "owner", "", owner); + } + attrs.addAttribute("", "name", "name", "", name); + attrs.addAttribute("", "desc", "desc", "", desc); + addElement(AbstractVisitor.OPCODES[opcode], attrs); + } + + public final void visitJumpInsn(final int opcode, final Label label) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "label", "label", "", getLabel(label)); + addElement(AbstractVisitor.OPCODES[opcode], attrs); + } + + public final void visitLabel(final Label label) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "name", "name", "", getLabel(label)); + addElement("Label", attrs); + } + + public final void visitLdcInsn(final Object cst) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", + "cst", + "cst", + "", + SAXClassAdapter.encode(cst.toString())); + attrs.addAttribute("", + "desc", + "desc", + "", + Type.getDescriptor(cst.getClass())); + addElement(AbstractVisitor.OPCODES[Opcodes.LDC], attrs); + } + + public final void visitIincInsn(final int var, final int increment) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "var", "var", "", Integer.toString(var)); + attrs.addAttribute("", "inc", "inc", "", Integer.toString(increment)); + addElement(AbstractVisitor.OPCODES[Opcodes.IINC], attrs); + } + + public final void visitTableSwitchInsn( + final int min, + final int max, + final Label dflt, + final Label[] labels) + { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "min", "min", "", Integer.toString(min)); + attrs.addAttribute("", "max", "max", "", Integer.toString(max)); + attrs.addAttribute("", "dflt", "dflt", "", getLabel(dflt)); + String o = AbstractVisitor.OPCODES[Opcodes.TABLESWITCH]; + addStart(o, attrs); + for (int i = 0; i < labels.length; i++) { + AttributesImpl att2 = new AttributesImpl(); + att2.addAttribute("", "name", "name", "", getLabel(labels[i])); + addElement("label", att2); + } + addEnd(o); + } + + public final void visitLookupSwitchInsn( + final Label dflt, + final int[] keys, + final Label[] labels) + { + AttributesImpl att = new AttributesImpl(); + att.addAttribute("", "dflt", "dflt", "", getLabel(dflt)); + String o = AbstractVisitor.OPCODES[Opcodes.LOOKUPSWITCH]; + addStart(o, att); + for (int i = 0; i < labels.length; i++) { + AttributesImpl att2 = new AttributesImpl(); + att2.addAttribute("", "name", "name", "", getLabel(labels[i])); + att2.addAttribute("", "key", "key", "", Integer.toString(keys[i])); + addElement("label", att2); + } + addEnd(o); + } + + public final void visitMultiANewArrayInsn(final String desc, final int dims) + { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "desc", "desc", "", desc); + attrs.addAttribute("", "dims", "dims", "", Integer.toString(dims)); + addElement(AbstractVisitor.OPCODES[Opcodes.MULTIANEWARRAY], attrs); + } + + public final void visitTryCatchBlock( + final Label start, + final Label end, + final Label handler, + final String type) + { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "start", "start", "", getLabel(start)); + attrs.addAttribute("", "end", "end", "", getLabel(end)); + attrs.addAttribute("", "handler", "handler", "", getLabel(handler)); + if (type != null) { + attrs.addAttribute("", "type", "type", "", type); + } + addElement("TryCatch", attrs); + } + + public final void visitMaxs(final int maxStack, final int maxLocals) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", + "maxStack", + "maxStack", + "", + Integer.toString(maxStack)); + attrs.addAttribute("", + "maxLocals", + "maxLocals", + "", + Integer.toString(maxLocals)); + addElement("Max", attrs); + + addEnd("code"); + } + + public void visitLocalVariable( + final String name, + final String desc, + final String signature, + final Label start, + final Label end, + final int index) + { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "name", "name", "", name); + attrs.addAttribute("", "desc", "desc", "", desc); + if (signature != null) { + attrs.addAttribute("", + "signature", + "signature", + "", + SAXClassAdapter.encode(signature)); + } + attrs.addAttribute("", "start", "start", "", getLabel(start)); + attrs.addAttribute("", "end", "end", "", getLabel(end)); + attrs.addAttribute("", "var", "var", "", Integer.toString(index)); + addElement("LocalVar", attrs); + } + + public final void visitLineNumber(final int line, final Label start) { + AttributesImpl attrs = new AttributesImpl(); + attrs.addAttribute("", "line", "line", "", Integer.toString(line)); + attrs.addAttribute("", "start", "start", "", getLabel(start)); + addElement("LineNumber", attrs); + } + + public AnnotationVisitor visitAnnotationDefault() { + return new SAXAnnotationAdapter(getContentHandler(), + "annotationDefault", + 0, + null, + null); + } + + public AnnotationVisitor visitAnnotation( + final String desc, + final boolean visible) + { + return new SAXAnnotationAdapter(getContentHandler(), + "annotation", + visible ? 1 : -1, + null, + desc); + } + + public AnnotationVisitor visitParameterAnnotation( + final int parameter, + final String desc, + final boolean visible) + { + return new SAXAnnotationAdapter(getContentHandler(), + "parameterAnnotation", + visible ? 1 : -1, + parameter, + desc); + } + + public void visitEnd() { + addEnd("method"); + } + + private final String getLabel(final Label label) { + String name = (String) labelNames.get(label); + if (name == null) { + name = Integer.toString(labelNames.size()); + labelNames.put(label, name); + } + return name; + } + +} Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXFieldAdapter.java URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXFieldAdapter.java?rev=1089584&view=auto ============================================================================== --- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXFieldAdapter.java (added) +++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/SAXFieldAdapter.java Wed Apr 6 19:11:34 2011 @@ -0,0 +1,63 @@ +/*** + * ASM XML Adapter + * Copyright (c) 2004, Eugene Kuleshov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.objectweb.asm.xml; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.FieldVisitor; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; + +/** + * SAXFieldAdapter + * + * @author Eugene Kuleshov + */ +public class SAXFieldAdapter extends SAXAdapter implements FieldVisitor { + + public SAXFieldAdapter(final ContentHandler h, final Attributes att) { + super(h); + addStart("field", att); + } + + public AnnotationVisitor visitAnnotation( + final String desc, + final boolean visible) + { + return new SAXAnnotationAdapter(getContentHandler(), + "annotation", + visible ? 1 : -1, + null, + desc); + } + + public void visitEnd() { + addEnd("field"); + } +} Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/asm-xml.dtd URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/asm-xml.dtd?rev=1089584&view=auto ============================================================================== --- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/asm-xml.dtd (added) +++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/asm-xml.dtd Wed Apr 6 19:11:34 2011 @@ -0,0 +1,343 @@ +<!-- + ASM XML Adapter + Copyright (c) 2004, Eugene Kuleshov + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. +--> + +<!-- + This DTD must be used to create XML documents to be processed by + org.objectweb.asm.xml.ASMContentHandler +--> + +<!-- + Root element used to aggregate multiple classes into single document. +--> +<!ELEMENT classes ( class+ )> + +<!-- + Root element for a single class. +--> +<!ELEMENT class ( interfaces, ( field | innerclass | method )*)> +<!ATTLIST class access CDATA #REQUIRED> +<!ATTLIST class name CDATA #REQUIRED> +<!ATTLIST class parent CDATA #REQUIRED> +<!ATTLIST class major CDATA #REQUIRED> +<!ATTLIST class minor CDATA #REQUIRED> +<!ATTLIST class source CDATA #IMPLIED> + +<!ELEMENT interfaces ( interface* )> +<!ELEMENT interface EMPTY> +<!ATTLIST interface name CDATA #REQUIRED> + +<!ELEMENT field EMPTY> +<!ATTLIST field access CDATA #REQUIRED> +<!ATTLIST field desc CDATA #REQUIRED> +<!ATTLIST field name CDATA #REQUIRED> +<!-- + All characters out of interval 0x20 to 0x7f (inclusive) must + be encoded (\uXXXX) and character '\' must be replaced by "\\" +--> +<!ATTLIST field value CDATA #IMPLIED> + +<!ELEMENT innerclass EMPTY> +<!ATTLIST innerclass access CDATA #REQUIRED> +<!ATTLIST innerclass innerName CDATA #IMPLIED> +<!ATTLIST innerclass name CDATA #REQUIRED> +<!ATTLIST innerclass outerName CDATA #IMPLIED> + +<!-- + Root element for method definition. +--> +<!ELEMENT method ( exceptions, code? )> +<!ATTLIST method access CDATA #REQUIRED> +<!ATTLIST method desc CDATA #REQUIRED> +<!ATTLIST method name CDATA #REQUIRED> + +<!ELEMENT exceptions ( exception* )> +<!ELEMENT exception EMPTY> +<!ATTLIST exception name CDATA #REQUIRED> + +<!-- + code element contains bytecode instructions and definitions for labels, line numbers, try/catch and max +--> +<!ELEMENT code (( AALOAD | AASTORE | ACONST_NULL | ALOAD | ANEWARRAY | ARETURN | ARRAYLENGTH | ASTORE | ATHROW | BALOAD | BASTORE | BIPUSH | CALOAD | CASTORE | CHECKCAST | D2F | D2I | D2L | DADD | DALOAD | DASTORE | DCMPG | DCMPL | DCONST_0 | DCONST_1 | DDIV | DLOAD | DMUL | DNEG | DREM | DRETURN | DSTORE | DSUB | DUP | DUP2 | DUP2_X1 | DUP2_X2 | DUP_X1 | DUP_X2 | F2D | F2I | F2L | FADD | FALOAD | FASTORE | FCMPG | FCMPL | FCONST_0 | FCONST_1 | FCONST_2 | FDIV | FLOAD | FMUL | FNEG | FRETURN | FSTORE | FSUB | GETFIELD | GETSTATIC | GOTO | I2B | I2C | I2D | I2F | I2L | I2S | IADD | IALOAD | IAND | IASTORE | ICONST_0 | ICONST_1 | ICONST_2 | ICONST_3 | ICONST_4 | ICONST_5 | ICONST_M1 | IDIV | IFEQ | IFGE | IFGT | IFLE | IFLT | IFNE | IFNONNULL | IFNULL | IF_ACMPEQ | IF_ACMPNE | IF_ICMPEQ | IF_ICMPGE | IF_ICMPGT | IF_ICMPLE | IF_ICMPLT | IF_ICMPNE | IINC | ILOAD | IMUL | INEG | INSTANCEOF | INVOKEINTERFACE | INVOKESPECIAL | INVOKESTATIC | INVOKEVIRTUAL | IOR | IREM | IRETURN | I SHL | ISHR | ISTORE | ISUB | IUSHR | IXOR | JSR | L2D | L2F | L2I | LADD | LALOAD | LAND | LASTORE | LCMP | LCONST_0 | LCONST_1 | LDC | LDIV | LLOAD | LMUL | LNEG | LOOKUPSWITCH | LOR | LREM | LRETURN | LSHL | LSHR | LSTORE | LSUB | LUSHR | LXOR | MONITORENTER | MONITOREXIT | MULTIANEWARRAY | NEW | NEWARRAY | NOP | POP | POP2 | PUTFIELD | PUTSTATIC | RET | RETURN | SALOAD | SASTORE | SIPUSH | TABLESWITCH | Label | LineNumber | TryCatch )*, Max)> + +<!ELEMENT Label EMPTY> +<!ATTLIST Label name CDATA #REQUIRED> + +<!ELEMENT TryCatch EMPTY> +<!ATTLIST TryCatch end CDATA #REQUIRED> +<!ATTLIST TryCatch handler CDATA #REQUIRED> +<!ATTLIST TryCatch start CDATA #REQUIRED> +<!ATTLIST TryCatch type CDATA #IMPLIED> + +<!ELEMENT LineNumber EMPTY> +<!ATTLIST LineNumber line CDATA #REQUIRED> +<!ATTLIST LineNumber start CDATA #REQUIRED> + +<!ELEMENT Max EMPTY> +<!ATTLIST Max maxLocals CDATA #REQUIRED> +<!ATTLIST Max maxStack CDATA #REQUIRED> + +<!ELEMENT AALOAD EMPTY> +<!ELEMENT AASTORE EMPTY> +<!ELEMENT ACONST_NULL EMPTY> +<!ELEMENT ALOAD EMPTY> +<!ATTLIST ALOAD var CDATA #REQUIRED> +<!ELEMENT ANEWARRAY EMPTY> +<!ATTLIST ANEWARRAY desc CDATA #REQUIRED> +<!ELEMENT ARETURN EMPTY> +<!ELEMENT ARRAYLENGTH EMPTY> +<!ELEMENT ASTORE EMPTY> +<!ATTLIST ASTORE var CDATA #REQUIRED> +<!ELEMENT ATHROW EMPTY> +<!ELEMENT BALOAD EMPTY> +<!ELEMENT BASTORE EMPTY> +<!ELEMENT BIPUSH EMPTY> +<!ATTLIST BIPUSH value CDATA #REQUIRED> +<!ELEMENT CALOAD EMPTY> +<!ELEMENT CASTORE EMPTY> +<!ELEMENT CHECKCAST EMPTY> +<!ATTLIST CHECKCAST desc CDATA #REQUIRED> +<!ELEMENT D2F EMPTY> +<!ELEMENT D2I EMPTY> +<!ELEMENT D2L EMPTY> +<!ELEMENT DADD EMPTY> +<!ELEMENT DALOAD EMPTY> +<!ELEMENT DASTORE EMPTY> +<!ELEMENT DCMPG EMPTY> +<!ELEMENT DCMPL EMPTY> +<!ELEMENT DCONST_0 EMPTY> +<!ELEMENT DCONST_1 EMPTY> +<!ELEMENT DDIV EMPTY> +<!ELEMENT DLOAD EMPTY> +<!ATTLIST DLOAD var CDATA #REQUIRED> +<!ELEMENT DMUL EMPTY> +<!ELEMENT DNEG EMPTY> +<!ELEMENT DREM EMPTY> +<!ELEMENT DRETURN EMPTY> +<!ELEMENT DSTORE EMPTY> +<!ATTLIST DSTORE var CDATA #REQUIRED> +<!ELEMENT DSUB EMPTY> +<!ELEMENT DUP EMPTY> +<!ELEMENT DUP2 EMPTY> +<!ELEMENT DUP2_X1 EMPTY> +<!ELEMENT DUP2_X2 EMPTY> +<!ELEMENT DUP_X1 EMPTY> +<!ELEMENT DUP_X2 EMPTY> +<!ELEMENT F2D EMPTY> +<!ELEMENT F2I EMPTY> +<!ELEMENT F2L EMPTY> +<!ELEMENT FADD EMPTY> +<!ELEMENT FALOAD EMPTY> +<!ELEMENT FASTORE EMPTY> +<!ELEMENT FCMPG EMPTY> +<!ELEMENT FCMPL EMPTY> +<!ELEMENT FCONST_0 EMPTY> +<!ELEMENT FCONST_1 EMPTY> +<!ELEMENT FCONST_2 EMPTY> +<!ELEMENT FDIV EMPTY> +<!ELEMENT FLOAD EMPTY> +<!ATTLIST FLOAD var CDATA #REQUIRED> +<!ELEMENT FMUL EMPTY> +<!ELEMENT FNEG EMPTY> +<!ELEMENT FRETURN EMPTY> +<!ELEMENT FSTORE EMPTY> +<!ATTLIST FSTORE var CDATA #REQUIRED> +<!ELEMENT FSUB EMPTY> +<!ELEMENT GETFIELD EMPTY> +<!ATTLIST GETFIELD desc CDATA #REQUIRED> +<!ATTLIST GETFIELD name CDATA #REQUIRED> +<!ATTLIST GETFIELD owner CDATA #REQUIRED> +<!ELEMENT GETSTATIC EMPTY> +<!ATTLIST GETSTATIC desc CDATA #REQUIRED> +<!ATTLIST GETSTATIC name CDATA #REQUIRED> +<!ATTLIST GETSTATIC owner CDATA #REQUIRED> +<!ELEMENT GOTO EMPTY> +<!ATTLIST GOTO label CDATA #REQUIRED> +<!ELEMENT I2B EMPTY> +<!ELEMENT I2C EMPTY> +<!ELEMENT I2D EMPTY> +<!ELEMENT I2F EMPTY> +<!ELEMENT I2L EMPTY> +<!ELEMENT I2S EMPTY> +<!ELEMENT IADD EMPTY> +<!ELEMENT IALOAD EMPTY> +<!ELEMENT IAND EMPTY> +<!ELEMENT IASTORE EMPTY> +<!ELEMENT ICONST_0 EMPTY> +<!ELEMENT ICONST_1 EMPTY> +<!ELEMENT ICONST_2 EMPTY> +<!ELEMENT ICONST_3 EMPTY> +<!ELEMENT ICONST_4 EMPTY> +<!ELEMENT ICONST_5 EMPTY> +<!ELEMENT ICONST_M1 EMPTY> +<!ELEMENT IDIV EMPTY> +<!ELEMENT IFEQ EMPTY> +<!ATTLIST IFEQ label CDATA #REQUIRED> +<!ELEMENT IFGE EMPTY> +<!ATTLIST IFGE label CDATA #REQUIRED> +<!ELEMENT IFGT EMPTY> +<!ATTLIST IFGT label CDATA #REQUIRED> +<!ELEMENT IFLE EMPTY> +<!ATTLIST IFLE label CDATA #REQUIRED> +<!ELEMENT IFLT EMPTY> +<!ATTLIST IFLT label CDATA #REQUIRED> +<!ELEMENT IFNE EMPTY> +<!ATTLIST IFNE label CDATA #REQUIRED> +<!ELEMENT IFNONNULL EMPTY> +<!ATTLIST IFNONNULL label CDATA #REQUIRED> +<!ELEMENT IFNULL EMPTY> +<!ATTLIST IFNULL label CDATA #REQUIRED> +<!ELEMENT IF_ACMPEQ EMPTY> +<!ATTLIST IF_ACMPEQ label CDATA #REQUIRED> +<!ELEMENT IF_ACMPNE EMPTY> +<!ATTLIST IF_ACMPNE label CDATA #REQUIRED> +<!ELEMENT IF_ICMPEQ EMPTY> +<!ATTLIST IF_ICMPEQ label CDATA #REQUIRED> +<!ELEMENT IF_ICMPGE EMPTY> +<!ATTLIST IF_ICMPGE label CDATA #REQUIRED> +<!ELEMENT IF_ICMPGT EMPTY> +<!ATTLIST IF_ICMPGT label CDATA #REQUIRED> +<!ELEMENT IF_ICMPLE EMPTY> +<!ATTLIST IF_ICMPLE label CDATA #REQUIRED> +<!ELEMENT IF_ICMPLT EMPTY> +<!ATTLIST IF_ICMPLT label CDATA #REQUIRED> +<!ELEMENT IF_ICMPNE EMPTY> +<!ATTLIST IF_ICMPNE label CDATA #REQUIRED> +<!ELEMENT IINC EMPTY> +<!ATTLIST IINC inc CDATA #REQUIRED> +<!ATTLIST IINC var CDATA #REQUIRED> +<!ELEMENT ILOAD EMPTY> +<!ATTLIST ILOAD var CDATA #REQUIRED> +<!ELEMENT IMUL EMPTY> +<!ELEMENT INEG EMPTY> +<!ELEMENT INSTANCEOF EMPTY> +<!ATTLIST INSTANCEOF desc CDATA #REQUIRED> +<!ELEMENT INVOKEINTERFACE EMPTY> +<!ATTLIST INVOKEINTERFACE desc CDATA #REQUIRED> +<!ATTLIST INVOKEINTERFACE name CDATA #REQUIRED> +<!ATTLIST INVOKEINTERFACE owner CDATA #REQUIRED> +<!ELEMENT INVOKESPECIAL EMPTY> +<!ATTLIST INVOKESPECIAL desc CDATA #REQUIRED> +<!ATTLIST INVOKESPECIAL name CDATA #REQUIRED> +<!ATTLIST INVOKESPECIAL owner CDATA #REQUIRED> +<!ELEMENT INVOKESTATIC EMPTY> +<!ATTLIST INVOKESTATIC desc CDATA #REQUIRED> +<!ATTLIST INVOKESTATIC name CDATA #REQUIRED> +<!ATTLIST INVOKESTATIC owner CDATA #REQUIRED> +<!ELEMENT INVOKEVIRTUAL EMPTY> +<!ATTLIST INVOKEVIRTUAL desc CDATA #REQUIRED> +<!ATTLIST INVOKEVIRTUAL name CDATA #REQUIRED> +<!ATTLIST INVOKEVIRTUAL owner CDATA #REQUIRED> +<!ELEMENT INVOKEDYNAMIC EMPTY> +<!ATTLIST INVOKEDYNAMIC desc CDATA #REQUIRED> +<!ATTLIST INVOKEDYNAMIC name CDATA #REQUIRED> +<!ELEMENT IOR EMPTY> +<!ELEMENT IREM EMPTY> +<!ELEMENT IRETURN EMPTY> +<!ELEMENT ISHL EMPTY> +<!ELEMENT ISHR EMPTY> +<!ELEMENT ISTORE EMPTY> +<!ATTLIST ISTORE var CDATA #REQUIRED> +<!ELEMENT ISUB EMPTY> +<!ELEMENT IUSHR EMPTY> +<!ELEMENT IXOR EMPTY> +<!ELEMENT JSR EMPTY> +<!ATTLIST JSR label CDATA #REQUIRED> +<!ELEMENT L2D EMPTY> +<!ELEMENT L2F EMPTY> +<!ELEMENT L2I EMPTY> +<!ELEMENT LADD EMPTY> +<!ELEMENT LALOAD EMPTY> +<!ELEMENT LAND EMPTY> +<!ELEMENT LASTORE EMPTY> +<!ELEMENT LCMP EMPTY> +<!ELEMENT LCONST_0 EMPTY> +<!ELEMENT LCONST_1 EMPTY> +<!ELEMENT LDC EMPTY> +<!-- + All characters out of interval 0x20 to 0x7f (inclusive) must + be encoded (\uXXXX) and character '\' must be replaced by "\\" +--> +<!ATTLIST LDC cst CDATA #REQUIRED> +<!ATTLIST LDC desc CDATA #REQUIRED> +<!ELEMENT LDIV EMPTY> +<!ELEMENT LLOAD EMPTY> +<!ATTLIST LLOAD var CDATA #REQUIRED> +<!ELEMENT LMUL EMPTY> +<!ELEMENT LNEG EMPTY> +<!ELEMENT LOR EMPTY> +<!ELEMENT LREM EMPTY> +<!ELEMENT LRETURN EMPTY> +<!ELEMENT LSHL EMPTY> +<!ELEMENT LSHR EMPTY> +<!ELEMENT LSTORE EMPTY> +<!ATTLIST LSTORE var CDATA #REQUIRED> +<!ELEMENT LSUB EMPTY> +<!ELEMENT LUSHR EMPTY> +<!ELEMENT LXOR EMPTY> +<!ELEMENT MONITORENTER EMPTY> +<!ELEMENT MONITOREXIT EMPTY> +<!ELEMENT MULTIANEWARRAY EMPTY> +<!ATTLIST MULTIANEWARRAY desc CDATA #REQUIRED> +<!ATTLIST MULTIANEWARRAY dims CDATA #REQUIRED> +<!ELEMENT NEW EMPTY> +<!ATTLIST NEW desc CDATA #REQUIRED> +<!ELEMENT NEWARRAY EMPTY> +<!ATTLIST NEWARRAY value CDATA #REQUIRED> +<!ELEMENT NOP EMPTY> +<!ELEMENT POP EMPTY> +<!ELEMENT POP2 EMPTY> +<!ELEMENT PUTFIELD EMPTY> +<!ATTLIST PUTFIELD desc CDATA #REQUIRED> +<!ATTLIST PUTFIELD name CDATA #REQUIRED> +<!ATTLIST PUTFIELD owner CDATA #REQUIRED> +<!ELEMENT PUTSTATIC EMPTY> +<!ATTLIST PUTSTATIC desc CDATA #REQUIRED> +<!ATTLIST PUTSTATIC name CDATA #REQUIRED> +<!ATTLIST PUTSTATIC owner CDATA #REQUIRED> +<!ELEMENT RET EMPTY> +<!ATTLIST RET var CDATA #REQUIRED> +<!ELEMENT RETURN EMPTY> +<!ELEMENT SALOAD EMPTY> +<!ELEMENT SASTORE EMPTY> +<!ELEMENT SIPUSH EMPTY> +<!ATTLIST SIPUSH value CDATA #REQUIRED> + +<!ELEMENT LOOKUPSWITCH ( label+ )> +<!ATTLIST LOOKUPSWITCH dflt CDATA #REQUIRED> + +<!ELEMENT TABLESWITCH ( label+ )> +<!ATTLIST TABLESWITCH dflt CDATA #REQUIRED> +<!ATTLIST TABLESWITCH max CDATA #REQUIRED> +<!ATTLIST TABLESWITCH min CDATA #REQUIRED> + +<!ELEMENT label EMPTY> +<!ATTLIST label key CDATA #IMPLIED> +<!ATTLIST label name CDATA #REQUIRED> + Added: tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/package.html URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/package.html?rev=1089584&view=auto ============================================================================== --- tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/package.html (added) +++ tapestry/tapestry5/trunk/plastic/src/external/java/org/objectweb/asm/xml/package.html Wed Apr 6 19:11:34 2011 @@ -0,0 +1,96 @@ +<html> +<!-- + * ASM XML Adapter + * Copyright (c) 2004, Eugene Kuleshov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. +--> +<body> +Provides <a href="http://sax.sourceforge.net/">SAX 2.0</a> adapters for ASM +visitors to convert classes to and from XML. +These adapters can be chained with other SAX compliant content handlers and +filters, eg. XSLT or XQuery engines. This package is bundled as +a separate <tt>asm-xml.jar</tt> library and requires <tt>asm.jar</tt>. +<p> +<tt>ASMContentHandler</tt> and <tt>SAXClassAdapter/SAXCodeAdapter</tt> +are using <a href="asm-xml.dtd">asm-xml.dtd</a>. +Here is the example of bytecode to bytecode XSLT transformation. + +<pre> + SAXTransformerFactory saxtf = ( SAXTransformerFactory) TransformerFactory.newInstance(); + Templates templates = saxtf.newTemplates( xsltSource); + + TransformerHandler handler = saxtf.newTransformerHandler( templates); + handler.setResult( new SAXResult( new ASMContentHandler( outputStream, computeMax))); + + ClassReader cr = new ClassReader( bytecode); + cr.accept( new SAXClassAdapter( handler, cr.getVersion(), false), false); +</pre> + +See JAXP and SAX documentation for more detils. + +<p> +There are few illustrations of the bytecode transformation with XSLT in +examples directory. The following XSLT procesors has been tested. + +<blockquote> +<table border="1" cellspacing="0" cellpadding="3"> +<tr> +<th>Engine</td> +<th>javax.xml.transform.TransformerFactory property</td> +</tr> + +<tr> +<td>jd.xslt</td> +<td>jd.xml.xslt.trax.TransformerFactoryImpl</td> +</tr> + +<tr> +<td>Saxon</td> +<td>net.sf.saxon.TransformerFactoryImpl</td> +</tr> + +<tr> +<td>Caucho</td> +<td>com.caucho.xsl.Xsl</td> +</tr> + +<tr> +<td>Xalan interpeter</td> +<td>org.apache.xalan.processor.TransformerFactory</td> +</tr> + +<tr> +<td>Xalan xsltc</td> +<td>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</td> +</tr> +</table> +</blockquote> + +@since ASM 1.4.3 + +</body> +</html>
