Index: jython/ACKNOWLEDGMENTS =================================================================== RCS file: /cvsroot/jython/jython/ACKNOWLEDGMENTS,v retrieving revision 2.30 diff -u -r2.30 ACKNOWLEDGMENTS --- jython/ACKNOWLEDGMENTS 27 Jan 2004 12:56:54 -0000 2.30 +++ jython/ACKNOWLEDGMENTS 10 Jun 2005 09:39:58 -0000 @@ -66,7 +66,7 @@ Nathan Franzen Aleks Totic Randolph Brown - + Local Variables: mode: indented-text indent-tabs-mode: nil Index: jython/Demo/applet/Converter.py =================================================================== RCS file: /cvsroot/jython/jython/Demo/applet/Converter.py,v retrieving revision 1.2 diff -u -r1.2 Converter.py --- jython/Demo/applet/Converter.py 16 Sep 1999 22:09:43 -0000 1.2 +++ jython/Demo/applet/Converter.py 10 Jun 2005 09:39:58 -0000 @@ -19,7 +19,7 @@ ] - + class SimpleBorder: def paint(self, g): g.drawRect(0,0,self.size.width-1, self.size.height-1) @@ -28,7 +28,7 @@ return awt.Insets(5,5,5,5) - + class Converter(Applet, SimpleBorder): def init(self, unitSets=basicUnits): self.setLayout(awt.GridLayout(2,0,5,5)) @@ -47,7 +47,7 @@ panel.setValue(multiplier/panel.getMultiplier()*value) - + class ConversionPanel(awt.Panel, SimpleBorder, ActionListener, AdjustmentListener, ItemListener): max, block = 10000, 100 @@ -107,7 +107,7 @@ self.slider.value = int(f) - + if __name__ == '__main__': import pawt pawt.test(Converter()) Index: jython/Demo/applet/CoordinatesDemo.py =================================================================== RCS file: /cvsroot/jython/jython/Demo/applet/CoordinatesDemo.py,v retrieving revision 1.3 diff -u -r1.3 CoordinatesDemo.py --- jython/Demo/applet/CoordinatesDemo.py 16 Sep 1999 22:09:43 -0000 1.3 +++ jython/Demo/applet/CoordinatesDemo.py 10 Jun 2005 09:39:58 -0000 @@ -7,7 +7,7 @@ from java import applet, awt from pawt import GridBag - + class CoordinatesDemo(applet.Applet): def init(self): bag = GridBag(self) @@ -23,7 +23,7 @@ self.label.text = text % (point.x, point.y) - + class FramedArea(awt.Panel): def __init__(self, controller): self.background = awt.Color.lightGray @@ -42,7 +42,7 @@ g.draw3DRect(3, 3, d.width-7, d.height-7, 1) - + class CoordinateArea(awt.Canvas): def __init__(self, controller): self.mousePressed = self.push @@ -63,7 +63,7 @@ g.fillRect(self.point.x-1, self.point.y-1, 2, 2) - + if __name__ == '__main__': import pawt pawt.test(CoordinatesDemo(), size=(300, 200)) Index: jython/Demo/swing/ObjectTree.py =================================================================== RCS file: /cvsroot/jython/jython/Demo/swing/ObjectTree.py,v retrieving revision 1.2 diff -u -r1.2 ObjectTree.py --- jython/Demo/swing/ObjectTree.py 16 Sep 1999 22:10:32 -0000 1.2 +++ jython/Demo/swing/ObjectTree.py 10 Jun 2005 09:39:59 -0000 @@ -12,7 +12,7 @@ BuiltinFunctionType, BuiltinMethodType) - + class PyEnumeration(java.util.Enumeration): def __init__(self, seq): self.seq = seq @@ -26,7 +26,7 @@ return self.seq[self.index-1] - + def classattrs(c, attrs): for base in c.__bases__: classattrs(base, attrs) @@ -51,7 +51,7 @@ return r - + class ObjectNode(swing.tree.TreeNode): def __init__(self, parent, name, object): self.myparent = parent @@ -113,7 +113,7 @@ return self.name+' = '+shortrepr(self.object) - + if __name__ == '__main__': class foo: bar=99 Index: jython/Misc/Release.py =================================================================== RCS file: /cvsroot/jython/jython/Misc/Release.py,v retrieving revision 2.6 diff -u -r2.6 Release.py --- jython/Misc/Release.py 22 Jan 2000 00:14:34 -0000 2.6 +++ jython/Misc/Release.py 10 Jun 2005 09:40:00 -0000 @@ -63,7 +63,7 @@ sys.exit(status) - + # CVS related commands and other utils def cvsdo(cvscmd, indir=None): @@ -118,7 +118,7 @@ rmdir_ex(dir) - + # preparations def make_jpython_jar(withoro=1, jarname='jpython.jar'): @@ -220,7 +220,7 @@ make_pylib_jar() - + def prep_distro(tagname): # This function creates a directory image that the Jshield installer gets # ponted at. Jshield then gloms everything under this directory into the @@ -254,7 +254,7 @@ unlink_ex('export/mkisj.bat') - + def bump_isj(tagname): infile = 'dist/jpython.isj' outfile = infile + '.new' @@ -319,7 +319,7 @@ i = i + 1 - + def do_build(tagname): table = string.maketrans('', '') tagname = tagname.translate(table, '.') @@ -361,7 +361,7 @@ unlink_ex(PYLIB) - + def main(): try: opts, args = getopt.getopt( Index: jython/Tools/jythonc/ImportName.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/ImportName.py,v retrieving revision 2.7 diff -u -r2.7 ImportName.py --- jython/Tools/jythonc/ImportName.py 30 May 2002 16:21:38 -0000 2.7 +++ jython/Tools/jythonc/ImportName.py 10 Jun 2005 09:40:00 -0000 @@ -9,7 +9,7 @@ from util import lookup - + def wrapJava(mod): if isinstance(mod, PyModule): return Module(mod) @@ -68,7 +68,7 @@ def getDepends(self): return [] - + class Namespace: def __init__(self, mod): if hasattr(mod, '__name__'): @@ -93,7 +93,7 @@ return map(lookupName, self.mod.__depends__) - + from util import reportPublicPlainClasses class Package(Namespace): _classes = {} @@ -108,12 +108,12 @@ return self._classes.get(self.name, None) - + class Class(Namespace): pass - + class Module(Namespace): def __init__(self, mod=None, name=None, file=None, path=None): Namespace.__init__(self, mod) @@ -140,7 +140,7 @@ def __repr__(self): return "Module(%s, %s, %s)" % (self.name, self.file, self.path) - + class JavaClass(Namespace): def __init__(self, mod): Namespace.__init__(self, mod) @@ -176,7 +176,7 @@ base.addEvents(attrs, events, source) - + if __name__ == '__main__': import sys print sys.path Index: jython/Tools/jythonc/JavaCall.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/JavaCall.py,v retrieving revision 2.3 diff -u -r2.3 JavaCall.py --- jython/Tools/jythonc/JavaCall.py 26 Nov 2001 15:21:08 -0000 2.3 +++ jython/Tools/jythonc/JavaCall.py 10 Jun 2005 09:40:00 -0000 @@ -4,7 +4,7 @@ import jast - + funcs = {} def call(func, this, args=None): if not funcs.has_key(func): @@ -18,7 +18,7 @@ return jf.invoke(this, args) - + class Signature: def __init__(self, name, inTypes, retType, isStatic=0, isPyArgs=0, isConstructor=0): @@ -69,7 +69,7 @@ return '(%s)->%s' % (COMMASPACE.join(r), self.retType.name) - + class JavaFunction: def __init__(self, reflectedFunction): self.name = reflectedFunction.__name__ @@ -126,7 +126,7 @@ raise TypeError, repr(args)+' args do not match: '+repr(self) - + if __name__ == '__main__': f = JavaFunction(org.python.core.PyObject._add) print f Index: jython/Tools/jythonc/Object.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/Object.py,v retrieving revision 2.8 diff -u -r2.8 Object.py --- jython/Tools/jythonc/Object.py 22 Feb 2005 04:19:29 -0000 2.8 +++ jython/Tools/jythonc/Object.py 10 Jun 2005 09:40:01 -0000 @@ -3,7 +3,7 @@ import org, java - + def makeAnys(args): ret = [] for arg in args: @@ -11,7 +11,7 @@ return ret - + def PyObjectArray(args): aargs = makeAnys(args) return Object( @@ -23,7 +23,7 @@ jast.StringArray(args), findType(java.lang.Class.forName("[Ljava.lang.String;"))) - + class DelegateMethod: def __init__(self, method, code): self.method = method @@ -32,7 +32,7 @@ def __call__(self, *args): return apply(self.method, (self.code, )+args) - + class Object: def __init__(self, code, value): self.code = code @@ -65,7 +65,7 @@ import JavaCall - + class JavaObject: def __init__(self, javaclass): self.javaclass = javaclass @@ -89,7 +89,7 @@ return code - + class JavaInteger(JavaObject): def __init__(self): JavaObject.__init__(self, java.lang.Integer.TYPE) @@ -98,7 +98,7 @@ return jast.InvokeStatic('Py', 'newInteger', [code]) - + class JavaString(JavaObject): def __init__(self): JavaObject.__init__(self, java.lang.String) @@ -107,7 +107,7 @@ return jast.InvokeStatic('Py', 'newString', [code]) - + PyObject_as_java_class = org.python.core.PyJavaClass.lookup(org.python.core.PyObject) # xxx temporary fix @@ -294,7 +294,7 @@ frame.freetemp(self.value) - + types = {} def findType(type): if types.has_key(type): @@ -315,13 +315,13 @@ return ret - + Generic = findType(org.python.core.PyObject) IntType = findType(java.lang.Integer.TYPE) StringType = findType(java.lang.String) - + if __name__ == '__main__': foo = Object(jast.Identifier("foo"), Generic) one = Object(jast.IntegerConstant(1), IntType) Index: jython/Tools/jythonc/ObjectFactory.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/ObjectFactory.py,v retrieving revision 2.14 diff -u -r2.14 ObjectFactory.py --- jython/Tools/jythonc/ObjectFactory.py 30 May 2002 16:20:13 -0000 2.14 +++ jython/Tools/jythonc/ObjectFactory.py 10 Jun 2005 09:40:02 -0000 @@ -4,7 +4,7 @@ from Object import Object, PyObject, Generic from org.python.parser import ast - + def makeAnys(args): ret = [] for arg in args: @@ -12,7 +12,7 @@ return ret - + def PyObjectArray(args): aargs = makeAnys(args) return jast.FilledArray("PyObject", aargs) @@ -20,7 +20,7 @@ import SrcGenCompiler - + class ObjectFactory: def __init__(self, parent=None): self.parent = parent @@ -115,12 +115,12 @@ options = self.parent.options, className = className) - + class FixedObject(PyObject): pass - + class PyConstant(FixedObject): def __init__(self, value): self.value = value @@ -129,7 +129,7 @@ return jast.Comment(str(self.value)) - + class PyFunction(FixedObject): def __init__(self, factory, name, def_compiler,scope, body, doc=None): self.name = name @@ -170,7 +170,7 @@ return self.pycode - + class PyClass(FixedObject): def __init__(self, factory, name, bases, def_compiler, scope, body, doc=None): self.name = name @@ -299,7 +299,7 @@ return self.getattr(code, name).call(args, keyargs) - + data = """ x=1+1 #import pawt Index: jython/Tools/jythonc/PythonModule.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/PythonModule.py,v retrieving revision 2.21 diff -u -r2.21 PythonModule.py --- jython/Tools/jythonc/PythonModule.py 29 Oct 2002 14:22:44 -0000 2.21 +++ jython/Tools/jythonc/PythonModule.py 10 Jun 2005 09:40:02 -0000 @@ -11,7 +11,7 @@ from org.python.core.PyTableCode import CO_OPTIMIZED,CO_NESTED from org.python.compiler import Future - + """ class foo class py -- what gets imported by jpython @@ -29,7 +29,7 @@ jast.Return(jast.GetStaticAttribute('Py', 'None'))]) - + from java.lang.Character import isJavaIdentifierPart def legalJavaName(name): letters = [] @@ -44,7 +44,7 @@ return EMPTYSTRING.join(letters) - + def StringArrayOrNull(strs): if strs: @@ -224,7 +224,7 @@ return jast.Class(self.name, self.modifier, self.superclass, self.interfaces, body) - + defaultProxyProps = { "python.options.showJavaExceptions": "true", "python.modules.builtin": "exceptions:org.python.core.exceptions", @@ -235,7 +235,7 @@ } - + class PythonModule: def getclassname(self, name): if self.package is not None: @@ -472,7 +472,7 @@ sf.dump(directory) return os.path.join(directory, self.name+'.java') - + if __name__ == '__main__': pm = PythonModule("baz") pm.packages = ['java.lang', 'java.awt'] Index: jython/Tools/jythonc/SrcGenCompiler.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/SrcGenCompiler.py,v retrieving revision 2.4 diff -u -r2.4 SrcGenCompiler.py --- jython/Tools/jythonc/SrcGenCompiler.py 10 Nov 2003 19:11:50 -0000 2.4 +++ jython/Tools/jythonc/SrcGenCompiler.py 10 Jun 2005 09:40:05 -0000 @@ -19,7 +19,7 @@ return n.value.s return None - + class LocalFrame: def __init__(self, compiler, scope=None): @@ -221,7 +221,7 @@ return decs - + class GlobalFrame(LocalFrame): def __init__(self, compiler): LocalFrame.__init__(self, compiler) @@ -238,7 +238,7 @@ self.fast_locals = 1 self.opt_globals = not scope.exec and not scope.from_import_star - + class SrcGenCompiler(Visitor, CompilationContext): def __init__(self, module, factory, parent=None, frameCtr=None, scope=None, options=None, className=None): Index: jython/Tools/jythonc/compile.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/compile.py,v retrieving revision 2.22 diff -u -r2.22 compile.py --- jython/Tools/jythonc/compile.py 30 May 2002 16:20:13 -0000 2.22 +++ jython/Tools/jythonc/compile.py 10 Jun 2005 09:40:06 -0000 @@ -19,7 +19,7 @@ from java.lang import * - + def getdata(filename): fp = open(filename, "r") data = fp.read() @@ -63,7 +63,7 @@ return sigs - + primitives = {'void' : Void.TYPE, 'int' : Integer.TYPE, 'byte' : Byte.TYPE, @@ -75,7 +75,7 @@ 'char' : Character.TYPE, } - + def insistJavaClass(c): jc = getJavaClass(c) if jc is None and isinstance(c, StringType): @@ -85,7 +85,7 @@ return jc - + primNames = {'void' : 'V', 'int' : 'I', 'byte' : 'B', @@ -97,7 +97,7 @@ 'char' : 'C' } - + ##def makeArrayName(c): ## if c.endswith("[]"): ## return "["+makeArrayName(c[:-2]) @@ -130,10 +130,10 @@ return None - - + + def printNames(heading, dict): items = dict.items() if len(items) == 0: @@ -155,7 +155,7 @@ print ' %s used in %s' % (key, COMMA.join(value)) - + class Compiler: # TBD: Bad! But this modules dicts must be available from deep in # ObjectFactory. @@ -438,7 +438,7 @@ return done.values() - + from java.io import * def writefile(filename, instream): @@ -460,7 +460,7 @@ c.dump(outdir) return c.files, c.javaclasses - + if __name__ == '__main__': import sys filenames = sys.argv[1:] Index: jython/Tools/jythonc/depend.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/depend.py,v retrieving revision 2.8 diff -u -r2.8 depend.py --- jython/Tools/jythonc/depend.py 26 Nov 2001 15:21:09 -0000 2.8 +++ jython/Tools/jythonc/depend.py 10 Jun 2005 09:40:06 -0000 @@ -8,7 +8,7 @@ from java.util.zip import ZipFile - + def fix(n): DOT = '.' return DOT.join(n.split('/')) @@ -38,7 +38,7 @@ return 1, None - + def dependencies(file): data = io.DataInputStream(file) @@ -112,12 +112,12 @@ return filter(defaultFilter, names.keys()) - + def defaultFilter(name): return not (name[:5] == 'java.' or name[:16] == 'org.python.core.') - + from org.python.core import PyJavaPackage from util import lookup, getzip from util import openResource @@ -168,7 +168,7 @@ def getZipName(self): return self.name[1:] - + ##class ZipEntry: ## def __init__(self, filename, classname): ## self.filename = filename @@ -183,7 +183,7 @@ ## entry = zf.getEntry(zfilename) ## return zf.getInputStream(entry) ## -## +## ##class DirEntry: ## def __init__(self, dirname, classname): ## self.dirname = dirname @@ -197,7 +197,7 @@ ## fullname = os.path.join(self.dirname, lastname+'.class') ## return io.FileInputStream(fullname) - + def depends(name): if name[0] == '/': return ResourceEntry(name), [] @@ -207,7 +207,7 @@ ip.close() return ze, ret - + if __name__ == '__main__': #print getFile('org.python.modules.strop') #print getFile('java.lang.String') Index: jython/Tools/jythonc/jar.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/jar.py,v retrieving revision 2.7 diff -u -r2.7 jar.py --- jython/Tools/jythonc/jar.py 26 Nov 2001 15:21:09 -0000 2.7 +++ jython/Tools/jythonc/jar.py 10 Jun 2005 09:40:06 -0000 @@ -12,7 +12,7 @@ SLASH = '/' - + def copy(instream, outstream): data = jarray.zeros(1024*4, 'b') while 1: @@ -24,7 +24,7 @@ outstream.write(data, 0, n) - + class JavaArchive: def __init__(self, packages=[]): self.files = [] @@ -163,7 +163,7 @@ ## instream.close() - + if __name__ == '__main__': root = "c:\\jpython\\tools\\jpythonc2" ja = JavaArchive() Index: jython/Tools/jythonc/javac.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/javac.py,v retrieving revision 2.14 diff -u -r2.14 javac.py --- jython/Tools/jythonc/javac.py 26 Nov 2001 15:21:09 -0000 2.14 +++ jython/Tools/jythonc/javac.py 10 Jun 2005 09:40:06 -0000 @@ -5,7 +5,7 @@ runtime = java.lang.Runtime.getRuntime() - + def dumpStream(stream, txtarr): array = jarray.zeros( 1024, 'b' ) while 1: @@ -15,7 +15,7 @@ txtarr.append(array[:len].tostring()) - + def findDefaultJavac(): jhome = System.getProperty("java.home") if jhome is None: @@ -31,7 +31,7 @@ return cpath - + import sys def compile(files, javac=None, cpathopt="-classpath", cpath=None, options=None, sourcedir=None): @@ -107,7 +107,7 @@ return (proc.exitValue(), "".join(procout), "".join(procerr)) - + if __name__ == '__main__': files = ["c:\\jpython\\tools\\jpythonc2\\test\\ButtonDemo.java", "c:\\jpython\\tools\\jpythonc2\\test\\pawt.java",] Index: jython/Tools/jythonc/main.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/main.py,v retrieving revision 2.15 diff -u -r2.15 main.py --- jython/Tools/jythonc/main.py 22 Feb 2005 04:19:29 -0000 2.15 +++ jython/Tools/jythonc/main.py 10 Jun 2005 09:40:07 -0000 @@ -70,7 +70,7 @@ from compile import Compiler - + # Standard usage message printing def usage(errcode, msg=''): print __doc__ % globals() @@ -165,7 +165,7 @@ return options - + def addCore(extraPackages): skiplist = [ 'org.python.core.parser', #'org.python.core.BytecodeLoader', @@ -178,7 +178,7 @@ extraPackages.append(('org.python.'+name, [])) - + mainclass = basepath = None def doCompile(opts): @@ -222,7 +222,7 @@ return comp - + def copyclass(jc, fromdir, todir): import jar from java.io import FileInputStream, FileOutputStream @@ -240,7 +240,7 @@ ostream.close() - + def writeResults(comp, opts): global mainclass global basepath Index: jython/Tools/jythonc/proxies.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/proxies.py,v retrieving revision 2.16 diff -u -r2.16 proxies.py --- jython/Tools/jythonc/proxies.py 26 Nov 2001 15:21:09 -0000 2.16 +++ jython/Tools/jythonc/proxies.py 10 Jun 2005 09:40:08 -0000 @@ -10,7 +10,7 @@ import org, java - + def aget(dict, key, default): if dict.has_key(key): return dict[key] @@ -19,7 +19,7 @@ dict[key] = ret return ret - + #Utility functions for converting between java and python types def typeName(cls): if Class.isArray(cls): @@ -33,7 +33,7 @@ return cls.__name__ - + def nullReturn(ret): if ret == Void.TYPE: return jast.Return() @@ -50,7 +50,7 @@ return jast.Return(value) - + def makeReturn(code, ret): if ret == Void.TYPE: return code @@ -65,7 +65,7 @@ return jast.Return(r) - + def makeObject(code, c): if c in [Integer.TYPE, Byte.TYPE, Short.TYPE, Long.TYPE]: mname = "newInteger" @@ -80,7 +80,7 @@ return jast.InvokeStatic("Py", mname, [code]) - + def filterThrows(throws): ret = [] for throwc in throws: @@ -89,7 +89,7 @@ return ret - + def wrapThrows(stmt, throws, retType): if len(throws) == 0: return stmt catches = [] @@ -111,7 +111,7 @@ return jast.TryCatches(jast.Block([stmt]), catches) - + class JavaProxy: def __init__(self, name, supername, bases, methods, module=None, issuperproxy = 1): @@ -569,7 +569,7 @@ return ret - + if __name__ == '__main__': import java methods = [("init", None, None), Index: jython/Tools/jythonc/jast/Modifier.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/jast/Modifier.py,v retrieving revision 2.2 diff -u -r2.2 Modifier.py --- jython/Tools/jythonc/jast/Modifier.py 26 Nov 2001 15:21:09 -0000 2.2 +++ jython/Tools/jythonc/jast/Modifier.py 10 Jun 2005 09:40:08 -0000 @@ -40,7 +40,7 @@ return SPACE.join(text) - + if __name__ == '__main__': m0 = Modifier(0) m1 = Modifier(public=1, final=1) Index: jython/Tools/jythonc/jast/Output.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/jast/Output.py,v retrieving revision 2.2 diff -u -r2.2 Output.py --- jython/Tools/jythonc/jast/Output.py 26 Nov 2001 15:21:09 -0000 2.2 +++ jython/Tools/jythonc/jast/Output.py 10 Jun 2005 09:40:08 -0000 @@ -3,7 +3,7 @@ from Modifier import ModifierString - + class SourceFile: def __init__(self, classname): self.text = [] @@ -61,7 +61,7 @@ self.writeln('}') - + if __name__ == '__main__': sf = SourceFile('foo') sf.write('public class foo') Index: jython/Tools/jythonc/jast/Statement.py =================================================================== RCS file: /cvsroot/jython/jython/Tools/jythonc/jast/Statement.py,v retrieving revision 2.7 diff -u -r2.7 Statement.py --- jython/Tools/jythonc/jast/Statement.py 30 May 2002 16:20:13 -0000 2.7 +++ jython/Tools/jythonc/jast/Statement.py 10 Jun 2005 09:40:08 -0000 @@ -4,7 +4,7 @@ COMMASPACE = ', ' - + class Statement: def __repr__(self): out = SourceFile('Foo') @@ -14,7 +14,7 @@ def exits(self): return 0 - + class Class(Statement): def __init__(self, name, access, superclass, interfaces, body): self.name = name @@ -35,7 +35,7 @@ self.superclass, self.interfaces, self.body) - + class Method(Statement): def __init__(self, name, access, args, body, throws=[]): self.name = name @@ -62,7 +62,7 @@ return "Method(%s, %s, %s, %s)" % (self.name, self.access, self.args, self.body) - + class Constructor(Statement): def __init__(self, name, access, args, body, throws=[]): self.name = name @@ -90,7 +90,7 @@ self.args, self.body) - + class BlankLine(Statement): def writeSource(self, out): out.writeln() @@ -101,7 +101,7 @@ Blank = BlankLine() - + class Import(Statement): def __init__(self, package): self.package = package @@ -113,7 +113,7 @@ return "Import(%s)" % (self.package) - + class SimpleComment(Statement): """ ??? """ def __init__(self, text): @@ -126,7 +126,7 @@ return "SimpleComment(%s)" % (self.text) - + class Comment(Statement): """ ??? """ def __init__(self, text): @@ -147,7 +147,7 @@ return "Comment(%s)" % (self.package) - + class Declare(Statement): def __init__(self, type, name, value=None): self.type = type @@ -165,7 +165,7 @@ return "Declare(%s, %s, %s)" % (self.type, self.name, self.value) - + class Pass(Statement): def writeSource(self, out): pass @@ -174,7 +174,7 @@ return "Pass()" - + def flatten(lst): ret = [] for item in lst: @@ -187,7 +187,7 @@ return ret - + class FreeBlock(Statement): def __init__(self, code=None): if code is None: @@ -235,7 +235,7 @@ return "FreeBlock(%s)" % (self.code) - + class Block(FreeBlock): def writeSource(self, out): out.beginBlock() @@ -246,7 +246,7 @@ return "Block(%s)" % (self.code) - + class TryCatch(Statement): def __init__(self, body, exctype, excname, catchbody): self.body = body @@ -264,7 +264,7 @@ return self.body.exits() and self.catchbody.exits() - + class TryCatches(Statement): def __init__(self, body, catches): self.body = body @@ -283,7 +283,7 @@ r = r and catchbody.exits() return r - + class TryFinally(Statement): def __init__(self, body, finalbody): self.body = body @@ -299,7 +299,7 @@ return self.body.exits() or self.finalbody.exits() - + class If(Statement): def __init__(self, test, thenBody, elseBody=None): self.test = test @@ -319,7 +319,7 @@ return self.thenBody.exits() and self.elseBody.exits() - + class MultiIf(Statement): def __init__(self, tests, elseBody=None): self.tests = tests @@ -348,7 +348,7 @@ return 1 - + class While(Statement): def __init__(self, test, body): self.test = test @@ -359,7 +359,7 @@ self.body.writeSource(out) - + class WhileElse(Statement): def __init__(self, test, body, else_body, while_temp): self.test = test @@ -375,7 +375,7 @@ self.else_body.writeSource(out) - + class Switch(Statement): def __init__(self, index, cases, defaultCase=None): self.index = index @@ -394,7 +394,7 @@ out.endBlock() - + class Return(Statement): def __init__(self, value=None): self.value = value @@ -409,7 +409,7 @@ return 1 - + class Throw(Statement): def __init__(self, value): self.value = value @@ -422,7 +422,7 @@ return 1 - + class Break(Statement): def writeSource(self, out): out.writeln("break;") @@ -432,7 +432,7 @@ out.writeln("continue;") - + class Expression: def __repr__(self): return self.sourceString() @@ -460,13 +460,13 @@ return 0 - + class UnsafeExpression(Expression): def safeSourceString(self): return "("+self.sourceString()+")" - + class Cast(UnsafeExpression): def __init__(self, totype, value): self.totype = totype @@ -476,7 +476,7 @@ return "(%s)%s" % (self.totype, self.value.safeSourceString()) - + class Set(UnsafeExpression): def __init__(self, lvalue, value): self.lvalue = lvalue @@ -487,7 +487,7 @@ self.value.safeSourceString()) - + class Constant(Expression): def __init__(self, value): self.value = value @@ -506,7 +506,7 @@ pass - + class StringConstant(Constant): def sourceString(self): ret = ['"'] @@ -526,7 +526,7 @@ return ''.join(ret) - + class Operation(UnsafeExpression): def __init__(self, op, x, y=None): self.op = op @@ -540,7 +540,7 @@ return "%s %s %s" % (self.x.safeSourceString(), self.op, self.y.safeSourceString()) - + class TriTest(UnsafeExpression): def __init__(self, test, x, y): self.test = test @@ -553,7 +553,7 @@ self.y.safeSourceString()) - + class PostOperation(UnsafeExpression): def __init__(self, x, op): self.op = op @@ -572,7 +572,7 @@ return "%s[%s]" % (self.x.safeSourceString(), self.ind) - + class InvokeLocal(Expression): def __init__(self, name, args): self.name = name @@ -582,7 +582,7 @@ return '%s(%s)' % (self.name, self._calcargs()) - + class Invoke(Expression): def __init__(self, this, name, args): self.name = name @@ -594,7 +594,7 @@ self.name, self._calcargs()) - + class InvokeStatic(Expression): def __init__(self, this, name, args): self.name = name @@ -605,7 +605,7 @@ return '%s.%s(%s)' % (self.this, self.name, self._calcargs()) - + class GetInstanceAttribute(Expression): def __init__(self, this, name): self.name = name @@ -615,7 +615,7 @@ return "%s.%s" % (self.this.sourceString(), self.name) - + class GetStaticAttribute(Expression): def __init__(self, this, name): self.name = name @@ -625,7 +625,7 @@ return "%s.%s" % (self.this, self.name) - + class SetInstanceAttribute(Expression): def __init__(self, this, name, value): self.name = name @@ -637,7 +637,7 @@ self.value.sourceString()) - + class SetStaticAttribute(Expression): def __init__(self, this, name, value): self.name = name @@ -648,7 +648,7 @@ return "%s.%s = %s" % (self.this, self.name, self.value.sourceString()) - + class Identifier(Expression): def __init__(self, name): self.name = name @@ -657,7 +657,7 @@ return str(self.name) - + class New(Expression): def __init__(self, name, args): self.name = name @@ -667,7 +667,7 @@ return 'new %s(%s)' % (self.name, self._calcargs()) - + class FilledArray(Expression): def __init__(self, type, values): self.type = type @@ -679,7 +679,7 @@ COMMASPACE.join(map(lambda arg: arg.sourceString(), self.values))) - + class NewArray(Expression): def __init__(self, mytype, dimensions): self.type = mytype @@ -693,7 +693,7 @@ ']['.join(map(lambda arg: str(arg), self.dimensions))) - + class StringArray(FilledArray): def __init__(self, values): lst = [] @@ -707,7 +707,7 @@ self.type = "String" - + class ClassReference(Expression): def __init__(self, name): self.name = name @@ -716,7 +716,7 @@ return module.simpleClassName(self.name) - + True = Identifier("true") False = Identifier("false") Null = Identifier("null") @@ -729,7 +729,7 @@ ## def __init__(self, lvalue, name, value): - + # Python also has a complicated set sequence form here, but that's just sugar # for ???