From: <cg...@us...> - 2008-10-20 01:41:40
|
Revision: 5477 http://jython.svn.sourceforge.net/jython/?rev=5477&view=rev Author: cgroves Date: 2008-10-20 01:41:32 +0000 (Mon, 20 Oct 2008) Log Message: ----------- Move BaseTypeBuilder out of TypeExposer so the compile time bits of the exposing system can be excluded from jython.jar Modified Paths: -------------- trunk/jython/build.xml trunk/jython/src/org/python/expose/generate/TypeExposer.java Added Paths: ----------- trunk/jython/src/org/python/expose/BaseTypeBuilder.java Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2008-10-20 01:40:25 UTC (rev 5476) +++ trunk/jython/build.xml 2008-10-20 01:41:32 UTC (rev 5477) @@ -558,7 +558,7 @@ <jar destfile="${dist.dir}/jython.jar" duplicate="fail"> <nameunion> <fileset dir="${exposed.dir}"/> - <fileset dir="${compile.dir}"/> + <fileset dir="${compile.dir}" excludes="org/python/expose/generate/**"/> </nameunion> <fileset dir="${jarjar.dir}"> <include name="org/python/objectweb/asm/ClassReader.class" /> Added: trunk/jython/src/org/python/expose/BaseTypeBuilder.java =================================================================== --- trunk/jython/src/org/python/expose/BaseTypeBuilder.java (rev 0) +++ trunk/jython/src/org/python/expose/BaseTypeBuilder.java 2008-10-20 01:41:32 UTC (rev 5477) @@ -0,0 +1,67 @@ +package org.python.expose; + +import org.python.core.PyBuiltinMethod; +import org.python.core.PyDataDescr; +import org.python.core.PyMethodDescr; +import org.python.core.PyNewWrapper; +import org.python.core.PyObject; +import org.python.core.PyStringMap; +import org.python.core.PyType; + +public class BaseTypeBuilder implements TypeBuilder { + + private PyNewWrapper newWrapper; + + private PyBuiltinMethod[] meths; + + private PyDataDescr[] descrs; + + private Class typeClass; + + private Class baseClass; + + private String name; + + public BaseTypeBuilder(String name, + Class typeClass, + Class baseClass, + PyBuiltinMethod[] meths, + PyDataDescr[] descrs, + PyNewWrapper newWrapper) { + this.typeClass = typeClass; + this.baseClass = baseClass; + this.name = name; + this.descrs = descrs; + this.meths = meths; + this.newWrapper = newWrapper; + } + + public PyObject getDict(PyType type) { + PyObject dict = new PyStringMap(); + for(PyBuiltinMethod func : meths) { + PyMethodDescr pmd = func.makeDescriptor(type); + dict.__setitem__(pmd.getName(), pmd); + } + for(PyDataDescr descr : descrs) { + descr.setType(type); + dict.__setitem__(descr.getName(), descr); + } + if(newWrapper != null) { + dict.__setitem__("__new__", newWrapper); + newWrapper.setWrappedType(type); + } + return dict; + } + + public String getName() { + return name; + } + + public Class getTypeClass() { + return typeClass; + } + + public Class getBase() { + return baseClass; + } +} \ No newline at end of file Modified: trunk/jython/src/org/python/expose/generate/TypeExposer.java =================================================================== --- trunk/jython/src/org/python/expose/generate/TypeExposer.java 2008-10-20 01:40:25 UTC (rev 5476) +++ trunk/jython/src/org/python/expose/generate/TypeExposer.java 2008-10-20 01:41:32 UTC (rev 5477) @@ -6,13 +6,7 @@ import org.python.objectweb.asm.Type; import org.python.core.BytecodeLoader; -import org.python.core.PyBuiltinMethod; -import org.python.core.PyDataDescr; -import org.python.core.PyMethodDescr; -import org.python.core.PyNewWrapper; -import org.python.core.PyObject; -import org.python.core.PyStringMap; -import org.python.core.PyType; +import org.python.expose.BaseTypeBuilder; import org.python.expose.ExposedType; import org.python.expose.TypeBuilder; @@ -144,62 +138,4 @@ superConstructor(STRING, CLASS, CLASS, ABUILTIN_METHOD, ADATA_DESCR, PYNEWWRAPPER); endConstructor(); } - - protected static class BaseTypeBuilder implements TypeBuilder { - - private PyNewWrapper newWrapper; - - private PyBuiltinMethod[] meths; - - private PyDataDescr[] descrs; - - private Class typeClass; - - private Class baseClass; - - private String name; - - public BaseTypeBuilder(String name, - Class typeClass, - Class baseClass, - PyBuiltinMethod[] meths, - PyDataDescr[] descrs, - PyNewWrapper newWrapper) { - this.typeClass = typeClass; - this.baseClass = baseClass; - this.name = name; - this.descrs = descrs; - this.meths = meths; - this.newWrapper = newWrapper; - } - - public PyObject getDict(PyType type) { - PyObject dict = new PyStringMap(); - for(PyBuiltinMethod func : meths) { - PyMethodDescr pmd = func.makeDescriptor(type); - dict.__setitem__(pmd.getName(), pmd); - } - for(PyDataDescr descr : descrs) { - descr.setType(type); - dict.__setitem__(descr.getName(), descr); - } - if(newWrapper != null) { - dict.__setitem__("__new__", newWrapper); - newWrapper.setWrappedType(type); - } - return dict; - } - - public String getName() { - return name; - } - - public Class getTypeClass() { - return typeClass; - } - - public Class getBase() { - return baseClass; - } - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |