You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Finn B. <bc...@us...> - 2001-02-07 09:26:02
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv21480 Modified Files: os.java Log Message: Check for a non-null prefix before using it. Index: os.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/os.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** os.java 2001/02/02 11:29:42 2.4 --- os.java 2001/02/07 09:26:19 2.5 *************** *** 9,16 **** // An ugly hack, but it keeps the site.py from CPython2.0 happy ! public static String __file__ = ! Py.getSystemState().prefix.toString() + "/Lib/javaos.py"; public static void classDictInit(PyObject dict) { // Fake from javaos import * PyFrame frame = new PyFrame(null, dict, dict, null); --- 9,19 ---- // An ugly hack, but it keeps the site.py from CPython2.0 happy ! public static String __file__; public static void classDictInit(PyObject dict) { + String prefix = Py.getSystemState().prefix; + if (prefix != null) + __file__ = prefix + "/Lib/javaos.py"; + // Fake from javaos import * PyFrame frame = new PyFrame(null, dict, dict, null); |
From: Finn B. <bc...@us...> - 2001-02-07 09:23:34
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv20912 Modified Files: PyClass.java PyFloat.java PyInstance.java PyInteger.java PyLong.java PyString.java Log Message: Fix bug #127340. These instances can now be coerced to Serializable. Index: PyClass.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyClass.java,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -r2.18 -r2.19 *** PyClass.java 2001/02/02 09:28:36 2.18 --- PyClass.java 2001/02/07 09:23:52 2.19 *************** *** 137,141 **** public Object __tojava__(Class c) { ! if ((c == Object.class || c == Class.class) && proxyClass != null) { return proxyClass; } --- 137,142 ---- public Object __tojava__(Class c) { ! if ((c == Object.class || c == Class.class || c == Serializable.class) ! && proxyClass != null) { return proxyClass; } Index: PyFloat.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFloat.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** PyFloat.java 2001/02/02 09:28:36 2.6 --- PyFloat.java 2001/02/07 09:23:52 2.7 *************** *** 2,5 **** --- 2,7 ---- package org.python.core; + import java.io.Serializable; + public class PyFloat extends PyObject { *************** *** 61,65 **** public Object __tojava__(Class c) { if (c == Double.TYPE || c == Number.class || ! c == Double.class || c == Object.class) { return new Double(value); --- 63,67 ---- public Object __tojava__(Class c) { if (c == Double.TYPE || c == Number.class || ! c == Double.class || c == Object.class || c == Serializable.class) { return new Double(value); Index: PyInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInstance.java,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -r2.17 -r2.18 *** PyInstance.java 2001/02/02 09:28:36 2.17 --- PyInstance.java 2001/02/07 09:23:52 2.18 *************** *** 2,5 **** --- 2,6 ---- package org.python.core; import java.util.Hashtable; + import java.io.Serializable; public class PyInstance extends PyObject *************** *** 108,112 **** public Object __tojava__(Class c) { ! if (c == Object.class && javaProxy != null) { return javaProxy; } --- 109,114 ---- public Object __tojava__(Class c) { ! if ((c == Object.class || c == Serializable.class) && ! javaProxy != null) { return javaProxy; } *************** *** 397,402 **** ret = invoke_ex("__hash__"); ! if (ret == null) return super.hashCode(); if (ret instanceof PyInteger) { return ((PyInteger)ret).getValue(); --- 399,408 ---- ret = invoke_ex("__hash__"); ! if (ret == null) { ! if (__findattr__("__eq__") != null || ! __findattr__("__cmp__") != null) ! throw Py.TypeError("unhashable instance"); return super.hashCode(); + } if (ret instanceof PyInteger) { return ((PyInteger)ret).getValue(); Index: PyInteger.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInteger.java,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** PyInteger.java 2001/02/02 09:28:36 2.8 --- PyInteger.java 2001/02/07 09:23:52 2.9 *************** *** 2,5 **** --- 2,7 ---- package org.python.core; + import java.io.Serializable; + public class PyInteger extends PyObject { *************** *** 32,36 **** public Object __tojava__(Class c) { if (c == Integer.TYPE || c == Number.class || ! c == Object.class || c == Integer.class) { return new Integer(value); --- 34,39 ---- public Object __tojava__(Class c) { if (c == Integer.TYPE || c == Number.class || ! c == Object.class || c == Integer.class || ! c == Serializable.class) { return new Integer(value); Index: PyLong.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyLong.java,v retrieving revision 2.9 retrieving revision 2.10 diff -C2 -r2.9 -r2.10 *** PyLong.java 2001/02/02 09:28:37 2.9 --- PyLong.java 2001/02/07 09:23:52 2.10 *************** *** 3,8 **** import java.math.BigInteger; - public class PyLong extends PyObject { --- 3,8 ---- import java.math.BigInteger; + import java.io.Serializable; public class PyLong extends PyObject { *************** *** 86,90 **** } if (c == BigInteger.class || c == Number.class || ! c == Object.class) { return value; --- 86,90 ---- } if (c == BigInteger.class || c == Number.class || ! c == Object.class || c == Serializable.class) { return value; Index: PyString.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyString.java,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -r2.38 -r2.39 *** PyString.java 2001/02/02 13:07:32 2.38 --- PyString.java 2001/02/07 09:23:52 2.39 *************** *** 2,5 **** --- 2,7 ---- package org.python.core; + import java.io.Serializable; + class StringFuncs extends PyBuiltinFunctionSet *************** *** 626,630 **** public Object __tojava__(Class c) { //This is a hack to make almost all Java calls happy ! if (c == String.class || c == Object.class) return string; if (c == Character.TYPE) --- 628,632 ---- public Object __tojava__(Class c) { //This is a hack to make almost all Java calls happy ! if (c == String.class || c == Object.class || c == Serializable.class) return string; if (c == Character.TYPE) |
From: Finn B. <bc...@us...> - 2001-02-07 09:21:05
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv20512 Modified Files: Code.java CodeCompiler.java Added Files: LineNumberTable.java Log Message: Added LineNumberTable support. As a result a java stacktrace will show the correct source linenumber in the $py.class class. --- NEW FILE --- // Copyright 2001 Finn Bock package org.python.compiler; import java.io.*; import java.util.*; public class LineNumberTable extends Attribute { int attName; ConstantPool pool; Vector lines; public LineNumberTable(ConstantPool pool) throws IOException { this.pool = pool; attName = pool.UTF8("LineNumberTable"); lines = new Vector(); } public void write(DataOutputStream stream) throws IOException { stream.writeShort(attName); int n = lines.size(); stream.writeInt(n * 2 + 2); stream.writeShort(n / 2); for (int i = 0; i < n; i += 2) { Short startpc = (Short) lines.elementAt(i); Short lineno = (Short) lines.elementAt(i+1); stream.writeShort(startpc.shortValue()); stream.writeShort(lineno.shortValue()); } } public void addLine(int startpc, int lineno) { lines.addElement(new Short((short) startpc)); lines.addElement(new Short((short) lineno)); } public int length() { return lines.size() * 2 + 8; } } Index: Code.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/Code.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** Code.java 1999/05/17 19:55:09 2.2 --- Code.java 2001/02/07 09:21:23 2.3 *************** *** 32,35 **** --- 32,36 ---- int att_name; Vector labels, exceptions; + LineNumberTable linenumbers; public Label getLabel() { *************** *** 129,132 **** --- 130,135 ---- int n = exceptions.size(); int length = bytes.length+12+8*n;; + if (linenumbers != null) + length += linenumbers.length(); stream.writeShort(att_name); stream.writeInt(length); *************** *** 145,149 **** stream.writeShort(e.exc); } ! ClassFile.writeAttributes(stream, new Attribute[0]); } --- 148,155 ---- stream.writeShort(e.exc); } ! if (linenumbers != null) ! ClassFile.writeAttributes(stream, new Attribute[] { linenumbers }); ! else ! ClassFile.writeAttributes(stream, new Attribute[0]); } *************** *** 507,510 **** --- 513,522 ---- labels[i].setBranch(position, 4); } + } + + public void setline(int line) throws IOException { + if (linenumbers == null) + linenumbers = new LineNumberTable(pool); + linenumbers.addLine(size(), line); } } Index: CodeCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/CodeCompiler.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** CodeCompiler.java 2000/12/18 21:57:37 2.10 --- CodeCompiler.java 2001/02/07 09:21:23 2.11 *************** *** 76,79 **** --- 76,80 ---- //System.out.println("line: "+line+", "+code.stack); if (module.linenumbers) { + code.setline(line); loadFrame(); code.iconst(line); |
From: Finn B. <bc...@us...> - 2001-02-07 09:17:50
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20347 Modified Files: socket.py Log Message: Added some unsupported constants that allow test_socket to run. Index: socket.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/socket.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** socket.py 2001/01/10 11:27:29 1.9 --- socket.py 2001/02/07 09:18:08 1.10 *************** *** 21,24 **** --- 21,27 ---- SOCK_DGRAM = 1 SOCK_STREAM = 2 + SOCK_RAW = 3 # not supported + SOCK_RDM = 4 # not supported + SOCK_SEQPACKET = 5 # not supported def _gethostbyaddr(name): *************** *** 324,327 **** --- 327,331 ---- sock.close() + SocketType = _tcpsocket def test(): |
From: Finn B. <bc...@us...> - 2001-02-07 09:16:46
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv20216 Modified Files: build.xml Log Message: Conditional compilation of PyServlet. Added a debug property. Index: build.xml =================================================================== RCS file: /cvsroot/jython/jython/build.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** build.xml 2001/01/15 18:21:44 1.6 --- build.xml 2001/02/07 09:17:03 1.7 *************** *** 5,10 **** --- 5,12 ---- <property name="sourceDir" value="." /> <property name="outputDir" value="build" /> + <property name="debug" value="no" /> <available classname="java.util.List" property="java2" /> + <available classname="javax.servlet.Servlet" property="servlet" /> <!-- This propery should be specified in the ant.property file *************** *** 68,77 **** </target> ! <target name="compile" depends="prepare,parser,checkjavaversion"> <javac srcdir="${sourceDir}/" includes="org/**" destdir="${outputDir}/" ! excludes="org/python/parser/python.java,${excludejava2files}" /> --- 70,85 ---- </target> ! <target name="checkservlet" unless="servlet"> ! <property name="excludeservletfiles" ! value="**/PyServlet.java"/> ! </target> ! ! <target name="compile" depends="prepare,parser,checkjavaversion,checkservlet"> <javac srcdir="${sourceDir}/" includes="org/**" destdir="${outputDir}/" ! excludes="org/python/parser/python.java,${excludejava2files},${excludeservletfiles}" ! debug="${debug}" /> *************** *** 80,83 **** --- 88,92 ---- includes="jxxload_help/**" destdir="${outputDir}/" + debug="${debug}" /> |
From: Samuele P. <ped...@us...> - 2001-02-06 17:17:24
|
Update of /cvsroot/jython/jython/Doc In directory usw-pr-cvs1:/tmp/cvs-serv4940 Modified Files: index.ht Log Message: un/reloading java classes doc links in index Index: index.ht =================================================================== RCS file: /cvsroot/jython/jython/Doc/index.ht,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** index.ht 2001/01/21 13:50:47 1.6 --- index.ht 2001/02/06 17:17:39 1.7 *************** *** 54,58 **** Python source code to real Java classes, and is used for building applets, servlets, beans, etc. ! </ul> <h3>General Python Documentation</h3> --- 54,63 ---- Python source code to real Java classes, and is used for building applets, servlets, beans, etc. ! ! <li><a href="jreload.html#unload">Unloading of java classes and internalTablesImpl option.</a> ! ! <li><a href="jreload.html">Reloading java classes.</a> ! ! </ul> <h3>General Python Documentation</h3> |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:40
|
Update of /cvsroot/jython/jython/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23147 Modified Files: test_string.py Log Message: Addtional tests for a count bug. Index: test_string.py =================================================================== RCS file: /cvsroot/jython/jython/Lib/test/test_string.py,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** test_string.py 2000/09/30 13:33:25 2.1 --- test_string.py 2001/02/04 14:50:54 2.2 *************** *** 210,213 **** --- 210,222 ---- test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2) + test('count', 'aaa', 3, 'a') + test('count', 'aaa', 2, 'a', 0, 2) + test('count', 'ababab', 3, 'ab', 0) + test('count', 'ababab', 2, 'ab', 0, 5) + test('count', 'ababab', 2, 'ab', 1) + test('count', 'ababab', 2, 'ab', 1, 6) + test('count', 'ababab', 0, 'abc') + test('count', 'ababab', 7, '') + string.whitespace string.lowercase |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:40
|
Update of /cvsroot/jython/jython/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23319 Modified Files: make_binops.py Log Message: Consistent formatting. Removed traling spaces and tabs. Index: make_binops.py =================================================================== RCS file: /cvsroot/jython/jython/Misc/make_binops.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** make_binops.py 2001/01/31 13:16:37 1.3 --- make_binops.py 2001/02/04 14:51:47 1.4 *************** *** 11,24 **** * @param other the object to perform this binary operation with * (the right-hand operand). ! * @return the result of the %(name)s, or null if this operation * is not defined **/ public PyObject __%(name)s__(PyObject other) { %(function)s } ! /** * Equivalent to the standard Python __r%(name)s__ method * @param other the object to perform this binary operation with * (the left-hand operand). ! * @return the result of the %(name)s, or null if this operation * is not defined. **/ --- 11,24 ---- * @param other the object to perform this binary operation with * (the right-hand operand). ! * @return the result of the %(name)s, or null if this operation * is not defined **/ public PyObject __%(name)s__(PyObject other) { %(function)s } ! /** * Equivalent to the standard Python __r%(name)s__ method * @param other the object to perform this binary operation with * (the left-hand operand). ! * @return the result of the %(name)s, or null if this operation * is not defined. **/ *************** *** 29,33 **** * @param other the object to perform this binary operation with * (the right-hand operand). ! * @return the result of the %(name)s, or null if this operation * is not defined **/ --- 29,33 ---- * @param other the object to perform this binary operation with * (the right-hand operand). ! * @return the result of the %(name)s, or null if this operation * is not defined **/ *************** *** 38,42 **** * @param other the object to perform this binary operation with. * @return the result of the %(name)s. ! * @exception PyTypeError if this operation can't be performed * with these operands. **/ --- 38,42 ---- * @param other the object to perform this binary operation with. * @return the result of the %(name)s. ! * @exception PyTypeError if this operation can't be performed * with these operands. **/ *************** *** 86,94 **** public %(ret)s __%(name)s__() { PyObject ret = invoke("__%(name)s__"); ! if (ret instanceof %(ret)s) return (%(ret)s)ret; throw Py.TypeError("__%(name)s__() should return a %(retname)s"); } ! """ template2 = comment + """\ --- 86,94 ---- public %(ret)s __%(name)s__() { PyObject ret = invoke("__%(name)s__"); ! if (ret instanceof %(ret)s) return (%(ret)s)ret; throw Py.TypeError("__%(name)s__() should return a %(retname)s"); } ! """ template2 = comment + """\ *************** *** 96,100 **** return invoke("__%(name)s__"); } ! """ --- 96,100 ---- return invoke("__%(name)s__"); } ! """ *************** *** 129,133 **** } } ! """ --- 129,133 ---- } } ! """ *************** *** 140,144 **** return super.__%(name)s__(o); } ! """ --- 140,144 ---- return super.__%(name)s__(o); } ! """ |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:39
|
Update of /cvsroot/jython/jython/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23736 Removed Files: StringIO.py copy.py Log Message: Removed temporary Jython version because CPython-2.1a? have been updated with the required changes. --- StringIO.py DELETED --- --- copy.py DELETED --- |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:39
|
Update of /cvsroot/jython/jython/installer In directory usw-pr-cvs1:/tmp/cvs-serv23936 Modified Files: mklist.py Log Message: Re-use the CPython version of StringIO and copy.py. Index: mklist.py =================================================================== RCS file: /cvsroot/jython/jython/installer/mklist.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** mklist.py 2001/01/16 20:40:35 1.9 --- mklist.py 2001/02/04 14:54:34 1.10 *************** *** 53,57 **** 'SimpleHTTPServer.py', 'SocketServer.py', ! #'StringIO.py', # Temporarily removed. 'UserDict.py', 'UserList.py', --- 53,57 ---- 'SimpleHTTPServer.py', 'SocketServer.py', ! 'StringIO.py', 'UserDict.py', 'UserList.py', *************** *** 68,72 **** 'commands.py', 'compileall.py', ! #'copy.py', # Temporarily removed. 'copy_reg.py', 'dircache.py', --- 68,72 ---- 'commands.py', 'compileall.py', ! 'copy.py', 'copy_reg.py', 'dircache.py', |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:36
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv24304 Modified Files: LocalsCompiler.java Log Message: for_stmt(): Fix bug #129364. Index: LocalsCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/LocalsCompiler.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** LocalsCompiler.java 2000/12/18 21:57:37 2.6 --- LocalsCompiler.java 2001/02/04 14:56:29 2.7 *************** *** 206,209 **** --- 206,212 ---- public Object for_stmt(SimpleNode node) throws Exception { + if (mode == SET) + super.for_stmt(node); + // The for_stmt node is handled in checkForStmt return null; |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:36
|
Update of /cvsroot/jython/jython/org/python/compiler In directory usw-pr-cvs1:/tmp/cvs-serv24873 Modified Files: LocalsCompiler.java Log Message: global_stmt(): Fix a situation so that test_compile.py can run without errors. Index: LocalsCompiler.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/compiler/LocalsCompiler.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** LocalsCompiler.java 2001/02/04 14:56:29 2.7 --- LocalsCompiler.java 2001/02/04 14:59:28 2.8 *************** *** 173,176 **** --- 173,179 ---- for (int i=0; i<n; i++) { Object name = node.getChild(i).getInfo(); + if (locals.get(name) != null) + throw org.python.core.Py.SyntaxError("name " + name + + " is local and global"); globals.put(name, name); } |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:35
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv25594 Modified Files: ACKNOWLEDGMENTS Log Message: Added Ype Kingma. Index: ACKNOWLEDGMENTS =================================================================== RCS file: /cvsroot/jython/jython/ACKNOWLEDGMENTS,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** ACKNOWLEDGMENTS 2001/01/17 13:54:16 2.8 --- ACKNOWLEDGMENTS 2001/02/04 15:01:50 2.9 *************** *** 44,47 **** --- 44,48 ---- Brian Zimmer Ivan Kougaenko + Ype Kingma |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:33
|
Update of /cvsroot/jython/jython In directory usw-pr-cvs1:/tmp/cvs-serv25929 Modified Files: NEWS Log Message: PyServlet news. Index: NEWS =================================================================== RCS file: /cvsroot/jython/jython/NEWS,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -r2.26 -r2.27 *** NEWS 2001/02/01 14:21:16 2.26 --- NEWS 2001/02/04 15:04:21 2.27 *************** *** 14,17 **** --- 14,18 ---- - Updated sre to CPython-2.1a1 - Added the "new" module + - Added a PyServlet class to the util package. Bug fixes. |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:33
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26333 Modified Files: Py.java Log Message: FixedFileWrapper(): Allow using both a outputstreams and writers in the extending print syntax: print >>outputstream, "hello world" Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.34 retrieving revision 2.35 diff -C2 -r2.34 -r2.35 *** Py.java 2001/02/02 09:28:36 2.34 --- Py.java 2001/02/04 15:07:32 2.35 *************** *** 1556,1559 **** --- 1556,1573 ---- name = "fixed file"; this.file = file; + + if (file instanceof PyJavaInstance) { + Object tmp = file.__tojava__(OutputStream.class); + if ((tmp != Py.NoConversion) && (tmp != null)) { + OutputStream os = (OutputStream)tmp; + this.file = new PyFile(os, "<java OutputStream>"); + } else { + tmp = file.__tojava__(Writer.class); + if ((tmp != Py.NoConversion) && (tmp != null)) { + Writer w = (Writer)tmp; + this.file = new PyFile(w, "<java Writer>"); + } + } + } } |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:33
|
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv26870 Modified Files: codeop.java Log Message: Added an __all__ attribute to make test___all__.py happy. Index: codeop.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/codeop.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** codeop.java 1999/05/17 19:55:20 2.1 --- codeop.java 2001/02/04 15:08:03 2.2 *************** *** 5,8 **** --- 5,12 ---- public class codeop { + public static PyList __all__ = new PyList(new PyString[] { + new PyString("compile_command") + }); + public static PyObject compile_command(String string) { return compile_command(string, "<input>", "single"); |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:33
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv26037 Modified Files: InternalTables.java Log Message: createInternalTables(): Avoid an ugly exception in MSIE by checking "java.version" before attempting to use InternalTables2. Index: InternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** InternalTables.java 2001/02/02 09:28:36 2.7 --- InternalTables.java 2001/02/04 15:05:47 2.8 *************** *** 46,52 **** String cands = PySystemState.registry.getProperty( "python.options.internalTablesImpl"); ! if (cands == null) ! cands = ">2:>1"; ! else cands = cands + ":>2:>1"; StringTokenizer candEnum = new StringTokenizer(cands,":"); --- 46,56 ---- String cands = PySystemState.registry.getProperty( "python.options.internalTablesImpl"); ! if (cands == null) { ! String version = System.getProperty("java.version"); ! if (version.compareTo("1.2") >= 0) ! cands = ">2:>1"; ! else ! cands = ">1"; ! } else cands = cands + ":>2:>1"; StringTokenizer candEnum = new StringTokenizer(cands,":"); |
From: Finn B. <bc...@us...> - 2001-02-04 20:02:31
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv30810 Modified Files: CollectionProxy.java CollectionProxy2.java Log Message: __finditem__(int): Thow a type error for Map and Dictionary. This prevents a "for x in Hashtable()". This may be enable again when CPython figures out if it is a good idea. Fix #130261. Index: CollectionProxy.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CollectionProxy.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** CollectionProxy.java 2001/02/01 16:41:10 2.2 --- CollectionProxy.java 2001/02/04 15:34:52 2.3 *************** *** 163,166 **** --- 163,170 ---- } + public PyObject __finditem__(int key) { + throw Py.TypeError("loop over non-sequence"); + } + public PyObject __finditem__(PyObject key) { return Py.java2py(proxy.get(Py.tojava(key, Object.class))); Index: CollectionProxy2.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CollectionProxy2.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** CollectionProxy2.java 1999/05/17 19:59:37 2.1 --- CollectionProxy2.java 2001/02/04 15:34:52 2.2 *************** *** 95,98 **** --- 95,102 ---- } + public PyObject __finditem__(int key) { + throw Py.TypeError("loop over non-sequence"); + } + public PyObject __finditem__(PyObject key) { return Py.java2py(proxy.get(Py.tojava(key, Object.class))); |
From: Samuele P. <ped...@us...> - 2001-02-04 01:05:20
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv6409 Modified Files: imp.java Log Message: unnoticed __all__ bug fix Index: imp.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/imp.java,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -r2.37 -r2.38 *** imp.java 2001/02/02 09:28:37 2.37 --- imp.java 2001/02/04 01:05:28 2.38 *************** *** 618,633 **** } - // if __all__ is present, things work properly under the assumption - // that names is sorted (__*__ names come first) private static void loadNames(PyObject names, PyObject module, PyObject locals) { int i=0; PyObject name; while ((name=names.__finditem__(i++)) != null) { String sname = ((PyString)name).internedString(); ! if (sname == "__all__") { ! loadNames(module.__findattr__("__all__"), module, locals); ! } else if (sname.startsWith("__")) { continue; } else { --- 618,631 ---- } private static void loadNames(PyObject names, PyObject module, PyObject locals) { + PyObject __all__ = module.__findattr__("__all__"); + if (__all__ != null) names = __all__; int i=0; PyObject name; while ((name=names.__finditem__(i++)) != null) { String sname = ((PyString)name).internedString(); ! if (sname.startsWith("__")) { continue; } else { |
From: Finn B. <bc...@us...> - 2001-02-03 19:31:00
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv21030 Added Files: PyServlet.java Log Message: First version. --- NEW FILE --- package org.python.util; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.python.core.*; /** * This servlet is used to re-serve JPython servlets. It stores * bytecode for JPython servlets and re-uses it if the underlying .py * file has not changed. * * Many people have been involved with this class: * * Chris Gokey * David Syer * Finn Bock * * If somebody is missing from this list, let us know. * * * <pre> * * e.g. http://localhost:8080/test/hello.py * * class test(HttpServlet): * def doGet(self,req, res): * res.setContentType("text/html"); * out = res.getOutputStream() * print >>out, "<html>" * print >>out, "<head><title>Hello World, How are we?</title></head>" * print >>out, "<body>Hello World, how are we?" * print >>out, "</body>" * print >>out, "</html>" * out.close() * return * * in web.xml for the PyServlet context: * * <web-app> * <servlet> * <servlet-name>PyServlet</servlet-name> * <servlet-class>org.python.util.PyServlet</servlet-class> * <init-param> * <param-name>python.home</param-name> * <param-value>/usr/home/jython-2.0</param-value> * </init-param> * </servlet> * <servlet-mapping> * <servlet-name>PyServlet</servlet-name> * <url-pattern>*.py</url-pattern> * </servlet-mapping> * </web-app> * * </pre> */ public class PyServlet extends HttpServlet { private PythonInterpreter interp; private Hashtable cache = new Hashtable(); public void init() { Properties props = new Properties(); Enumeration e = getInitParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); props.setProperty(name, getInitParameter(name)); } PythonInterpreter.initialize(System.getProperties(), props, new String[0]); interp = new PythonInterpreter(); PySystemState sys = Py.getSystemState(); sys.add_package("javax.servlet"); sys.add_package("javax.servlet.http"); sys.add_package("javax.servlet.jsp"); sys.add_package("javax.servlet.jsp.tagext"); } public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { String spath = ((HttpServletRequest) req).getServletPath(); String rpath = getServletContext().getRealPath(spath); HttpServlet servlet = getServlet(rpath); if (servlet != null) servlet.service(req, res); else throw new ServletException("No python servlet found at:" + spath); } private HttpServlet getServlet(String path) throws ServletException, IOException { CacheEntry entry = (CacheEntry) cache.get(path); if (entry == null) return loadServlet(path); File file = new File(path); if (file.lastModified() > entry.date) return loadServlet(path); return entry.servlet; } private HttpServlet loadServlet(String path) throws ServletException, IOException { HttpServlet servlet = null; File file = new File(path); // Extract servlet name from path (strip ".../" and ".py") int start = path.lastIndexOf(File.separator); if (start < 0) start = 0; else start++; int end = path.lastIndexOf(".py"); if ((end < 0) || (end <= start)) end = path.length(); String name = path.substring(start, end); // PyString dir = new PyString(file.getParent()); // PySystemState sys = Py.getSystemState(); // if (!sys.path.__contains__(dir)) // sys.path.append(dir); try { interp.execfile(path); PyObject cls = interp.get(name); if (cls == null) throw new ServletException("No callable (class or function) "+ "named " + name + " in " + path); PyObject pyServlet = cls.__call__(); Object o = pyServlet.__tojava__(HttpServlet.class); if (o == Py.NoConversion) throw new ServletException("The value from " + name + "must extend HttpServlet"); servlet = (HttpServlet)o; servlet.init(getServletConfig()); } catch (PyException e) { throw new ServletException("Could not create "+ "Jython servlet" + e.toString()); } CacheEntry entry = new CacheEntry(servlet, file.lastModified()); cache.put(path, entry); return servlet; } } class CacheEntry { public long date; public HttpServlet servlet; CacheEntry(HttpServlet servlet, long date) { this.servlet= servlet; this.date = date; } } |
From: Finn B. <bc...@us...> - 2001-02-02 13:07:28
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv20600 Modified Files: PyString.java Log Message: count(): Fix a one-off bug regarding the end index. Index: PyString.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyString.java,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -r2.37 -r2.38 *** PyString.java 2001/02/02 09:28:37 2.37 --- PyString.java 2001/02/02 13:07:32 2.38 *************** *** 1095,1110 **** public int count(String sub, int start, int end) { ! int n = string.length(); ! if (start < 0) ! start = n+start; if (end < 0) ! end = n+end; ! if (end > n) ! end = n; ! if (start > end) ! start = end; ! int slen = sub.length(); ! //end = end-slen; int count=0; --- 1095,1114 ---- public int count(String sub, int start, int end) { ! int len = string.length(); ! if (end > len) ! end = len; ! if (end < 0) ! end += len; if (end < 0) ! end = 0; ! if (start < 0) ! start += len; ! if (start < 0) ! start = 0; ! int n = sub.length(); ! end = end + 1 - n; ! if (n == 0) ! return end-start; int count=0; *************** *** 1114,1118 **** break; count++; ! start = index+slen; } return count; --- 1118,1122 ---- break; count++; ! start = index + n; } return count; |
From: Finn B. <bc...@us...> - 2001-02-02 13:06:32
|
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv20508 Modified Files: PyFunction.java Log Message: __delattr__(): Make __doc__ del'able. Index: PyFunction.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFunction.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** PyFunction.java 2001/02/02 09:28:36 2.7 --- PyFunction.java 2001/02/02 13:06:36 2.8 *************** *** 82,86 **** public void __delattr__(String name) { - // TBD: should __doc__ be del'able? if (name == "__dict__" || name == "func_dict") { __dict__ = null; --- 82,85 ---- *************** *** 88,91 **** --- 87,93 ---- } else if (name == "func_defaults") { func_defaults = Py.EmptyObjects; + return; + } else if (name == "func_doc" || name == "__doc__") { + __doc__ = Py.None; return; } |
Update of /cvsroot/jython/jython/org/python/modules In directory usw-pr-cvs1:/tmp/cvs-serv2689 Modified Files: MD5Module.java MD5Object.java MatchObject.java RegexObject.java SHA1.java Setup.java _codecs.java _jython.java _sre.java binascii.java cPickle.java cStringIO.java imp.java md.java newmodule.java operator.java os.java py_compile.java re.java sha.java struct.java synchronize.java thread.java time.java types.java ucnhash.java Log Message: Consistent formatting. Line length, trailing spaces and tabs. Index: MD5Module.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/MD5Module.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** MD5Module.java 2000/10/09 14:45:14 2.6 --- MD5Module.java 2001/02/02 11:29:41 2.7 *************** *** 12,16 **** ! class MD5Functions extends PyBuiltinFunctionSet { public MD5Functions(String name, int index, int minargs, int maxargs) { --- 12,16 ---- ! class MD5Functions extends PyBuiltinFunctionSet { public MD5Functions(String name, int index, int minargs, int maxargs) { Index: MD5Object.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/MD5Object.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** MD5Object.java 2000/09/28 15:26:23 2.3 --- MD5Object.java 2001/02/02 11:29:42 2.4 *************** *** 27,31 **** // still want to hide it from Python. There should be another // way to hide Java methods from Python. ! throw Py.TypeError("argument 1 expected string"); data += arg.toString(); return Py.None; --- 27,31 ---- // still want to hide it from Python. There should be another // way to hide Java methods from Python. ! throw Py.TypeError("argument 1 expected string"); data += arg.toString(); return Py.None; Index: MatchObject.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/MatchObject.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** MatchObject.java 2000/10/13 20:20:41 2.7 --- MatchObject.java 2001/02/02 11:29:42 2.8 *************** *** 69,73 **** if (tmp == null) { ret[i] = defalt; ! } else { ret[i] = new PyString(tmp); } --- 69,73 ---- if (tmp == null) { ret[i] = defalt; ! } else { ret[i] = new PyString(tmp); } Index: RegexObject.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/RegexObject.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** RegexObject.java 2000/10/13 20:20:08 2.4 --- RegexObject.java 2001/02/02 11:29:42 2.5 *************** *** 6,10 **** ! public class RegexObject extends PyObject { private static Perl5Compiler compiler = new Perl5Compiler(); --- 6,10 ---- ! public class RegexObject extends PyObject { private static Perl5Compiler compiler = new Perl5Compiler(); *************** *** 100,104 **** private MatchResult doSearch(Object input) { Perl5Matcher matcher = getMatcher(); ! if (input instanceof String) { if (!matcher.contains((String)input, code)) --- 100,104 ---- private MatchResult doSearch(Object input) { Perl5Matcher matcher = getMatcher(); ! if (input instanceof String) { if (!matcher.contains((String)input, code)) *************** *** 111,119 **** return matcher.getMatch(); } ! public PyString sub(PyObject repl, String string) { return sub(repl, string, 0); } ! public PyString sub(PyObject repl, String string, int count) { return (PyString)subn(repl, string, count).__getitem__(0); --- 111,119 ---- return matcher.getMatch(); } ! public PyString sub(PyObject repl, String string) { return sub(repl, string, 0); } ! public PyString sub(PyObject repl, String string, int count) { return (PyString)subn(repl, string, count).__getitem__(0); *************** *** 123,127 **** return subn(repl, string, 0); } ! public PyTuple subn(PyObject repl, String string, int count) { // Real work is done here --- 123,127 ---- return subn(repl, string, 0); } ! public PyTuple subn(PyObject repl, String string, int count) { // Real work is done here *************** *** 138,142 **** count = Integer.MAX_VALUE; } ! // How to handle repl as String vs. callable? int n=0; --- 138,142 ---- count = Integer.MAX_VALUE; } ! // How to handle repl as String vs. callable? int n=0; *************** *** 145,149 **** PatternMatcherInput match = new PatternMatcherInput(string); int lastmatch = 0; ! while (n < count && !match.endOfInput()) { if (!matcher.contains(match, code)) --- 145,149 ---- PatternMatcherInput match = new PatternMatcherInput(string); int lastmatch = 0; ! while (n < count && !match.endOfInput()) { if (!matcher.contains(match, code)) *************** *** 157,161 **** if (srepl == null) { MatchObject m = new MatchObject(this, string, lastmatch, ! string.length(), matcher.getMatch()); PyObject ret = repl.__call__(m); --- 157,161 ---- if (srepl == null) { MatchObject m = new MatchObject(this, string, lastmatch, ! string.length(), matcher.getMatch()); PyObject ret = repl.__call__(m); *************** *** 179,187 **** }); } ! public PyList split(String string) { return split(string, 0); ! } ! public PyList split(String string, int maxsplit) { if (maxsplit < 0) { --- 179,187 ---- }); } ! public PyList split(String string) { return split(string, 0); ! } ! public PyList split(String string, int maxsplit) { if (maxsplit < 0) { *************** *** 191,195 **** maxsplit = Integer.MAX_VALUE; } ! int n=0; Perl5Matcher matcher = getMatcher(); --- 191,195 ---- maxsplit = Integer.MAX_VALUE; } ! int n=0; Perl5Matcher matcher = getMatcher(); *************** *** 197,216 **** int lastmatch = 0; PyList results = new PyList(); ! while (n < maxsplit && !match.endOfInput()) { if (!matcher.contains(match, code)) break; n++; ! int begin = match.getMatchBeginOffset(); int end = match.getMatchEndOffset(); ! if (begin == end) { // More needed? continue; } ! results.append(new PyString(match.substring(lastmatch, begin))); ! MatchResult m = matcher.getMatch(); int ngroups = m.groups(); --- 197,216 ---- int lastmatch = 0; PyList results = new PyList(); ! while (n < maxsplit && !match.endOfInput()) { if (!matcher.contains(match, code)) break; n++; ! int begin = match.getMatchBeginOffset(); int end = match.getMatchEndOffset(); ! if (begin == end) { // More needed? continue; } ! results.append(new PyString(match.substring(lastmatch, begin))); ! MatchResult m = matcher.getMatch(); int ngroups = m.groups(); *************** *** 232,236 **** return results; } ! private int getindex(PyString s) { PyInteger v = (PyInteger)groupindex.__finditem__(s); --- 232,236 ---- return results; } ! private int getindex(PyString s) { PyInteger v = (PyInteger)groupindex.__finditem__(s); *************** *** 243,251 **** throw re.ReError("illegal character in group name"); else ! throw Py.IndexError("group "+s.__repr__()+" is undefined"); } } return v.getValue(); ! } private boolean isdigit(char c) { --- 243,252 ---- throw re.ReError("illegal character in group name"); else ! throw Py.IndexError("group "+s.__repr__() + ! " is undefined"); } } return v.getValue(); ! } private boolean isdigit(char c) { *************** *** 284,288 **** if (index > 2 && chars[index-2] == '\\') continue; ! if (index < n && chars[index] == '?') { index++; --- 285,289 ---- if (index > 2 && chars[index-2] == '\\') continue; ! if (index < n && chars[index] == '?') { index++; *************** *** 370,374 **** } } ! public String expandMatch(MatchResult match, String repl) { char[] chars = repl.toCharArray(); --- 371,375 ---- } } ! public String expandMatch(MatchResult match, String repl) { char[] chars = repl.toCharArray(); *************** *** 426,430 **** buf.append(chars, lasti, start-3-lasti); PyString str = new PyString(new String(chars, start, ! index-1-start)); String tmp = match.group(getindex(str)); if (tmp == null) { --- 427,431 ---- buf.append(chars, lasti, start-3-lasti); PyString str = new PyString(new String(chars, start, ! index-1-start)); String tmp = match.group(getindex(str)); if (tmp == null) { Index: SHA1.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/SHA1.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** SHA1.java 2000/10/26 08:30:49 2.1 --- SHA1.java 2001/02/02 11:29:42 2.2 *************** *** 2,39 **** * SHA1.java - An implementation of the SHA-1 Algorithm * ! * Modified for Jython by Finn Bock. The original was split * into two files. * * Original author and copyright: ! * * Copyright (c) 1997 Systemics Ltd * on behalf of the Cryptix Development Team. All rights reserved. * @author David Hopwood ! * * Cryptix General License ! * Copyright © 1995, 1996, 1997, 1998, 1999, 2000 The Cryptix Foundation Limited. ! * All rights reserved. ! * ! * Redistribution and use in source and binary forms, with or ! * without modification, are permitted provided that the * following conditions are met: ! * ! * - Redistributions of source code must retain the copyright notice, this ! * list of conditions and the following disclaimer. ! * - 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. ! * ! * THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED * 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 CRYPTIX FOUNDATION LIMITED * 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 --- 2,40 ---- * SHA1.java - An implementation of the SHA-1 Algorithm * ! * Modified for Jython by Finn Bock. The original was split * into two files. * * Original author and copyright: ! * * Copyright (c) 1997 Systemics Ltd * on behalf of the Cryptix Development Team. All rights reserved. * @author David Hopwood ! * * Cryptix General License ! * Copyright © 1995, 1996, 1997, 1998, 1999, 2000 The Cryptix Foundation ! * Limited. ! * All rights reserved. ! * ! * Redistribution and use in source and binary forms, with or ! * without modification, are permitted provided that the * following conditions are met: ! * ! * - Redistributions of source code must retain the copyright notice, this ! * list of conditions and the following disclaimer. ! * - 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. ! * ! * THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED * 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 CRYPTIX FOUNDATION LIMITED * 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 *************** *** 65,69 **** * <b>Copyright</b> © 1995-1997 * <a href="http://www.systemics.com/">Systemics Ltd</a> on behalf of the ! * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>. * <br>All rights reserved. * <p> --- 66,71 ---- * <b>Copyright</b> © 1995-1997 * <a href="http://www.systemics.com/">Systemics Ltd</a> on behalf of the ! * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development ! * Team</a>. * <br>All rights reserved. * <p> *************** *** 233,237 **** /** * Returns the digest of the data added and resets the digest. ! * @return the digest of all the data added to the message digest as a byte array. */ protected byte[] engineDigest(byte[] in, int length) --- 235,240 ---- /** * Returns the digest of the data added and resets the digest. ! * @return the digest of all the data added to the message digest ! * as a byte array. */ protected byte[] engineDigest(byte[] in, int length) *************** *** 267,271 **** // bitcount() used to return a long, now it's an int. long bc = count * 8; ! data[14] = (int) (bc>>>32); data[15] = (int) bc; --- 270,274 ---- // bitcount() used to return a long, now it's an int. long bc = count * 8; ! data[14] = (int) (bc>>>32); data[15] = (int) bc; *************** *** 290,297 **** //........................................................................... ! private static int f1(int a, int b, int c) { return (c^(a&(b^c))) + 0x5A827999; } ! private static int f2(int a, int b, int c) { return (a^b^c) + 0x6ED9EBA1; } ! private static int f3(int a, int b, int c) { return ((a&b)|(c&(a|b))) + 0x8F1BBCDC; } ! private static int f4(int a, int b, int c) { return (a^b^c) + 0xCA62C1D6; } private void transform (int[] X) --- 293,308 ---- //........................................................................... ! private static int f1(int a, int b, int c) { ! return (c^(a&(b^c))) + 0x5A827999; ! } ! private static int f2(int a, int b, int c) { ! return (a^b^c) + 0x6ED9EBA1; ! } ! private static int f3(int a, int b, int c) { ! return ((a&b)|(c&(a|b))) + 0x8F1BBCDC; ! } ! private static int f4(int a, int b, int c) { ! return (a^b^c) + 0xCA62C1D6; ! } private void transform (int[] X) *************** *** 315,398 **** } ! E += ((A << 5)|(A >>> -5)) + f1(B, C, D) + W[0]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f1(A, B, C) + W[1]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f1(E, A, B) + W[2]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f1(D, E, A) + W[3]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f1(C, D, E) + W[4]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f1(B, C, D) + W[5]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f1(A, B, C) + W[6]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f1(E, A, B) + W[7]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f1(D, E, A) + W[8]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f1(C, D, E) + W[9]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f1(B, C, D) + W[10]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f1(A, B, C) + W[11]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f1(E, A, B) + W[12]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f1(D, E, A) + W[13]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f1(C, D, E) + W[14]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f1(B, C, D) + W[15]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f1(A, B, C) + W[16]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f1(E, A, B) + W[17]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f1(D, E, A) + W[18]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f1(C, D, E) + W[19]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f2(B, C, D) + W[20]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f2(A, B, C) + W[21]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f2(E, A, B) + W[22]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f2(D, E, A) + W[23]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f2(C, D, E) + W[24]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f2(B, C, D) + W[25]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f2(A, B, C) + W[26]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f2(E, A, B) + W[27]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f2(D, E, A) + W[28]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f2(C, D, E) + W[29]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f2(B, C, D) + W[30]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f2(A, B, C) + W[31]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f2(E, A, B) + W[32]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f2(D, E, A) + W[33]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f2(C, D, E) + W[34]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f2(B, C, D) + W[35]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f2(A, B, C) + W[36]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f2(E, A, B) + W[37]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f2(D, E, A) + W[38]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f2(C, D, E) + W[39]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f3(B, C, D) + W[40]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f3(A, B, C) + W[41]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f3(E, A, B) + W[42]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f3(D, E, A) + W[43]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f3(C, D, E) + W[44]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f3(B, C, D) + W[45]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f3(A, B, C) + W[46]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f3(E, A, B) + W[47]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f3(D, E, A) + W[48]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f3(C, D, E) + W[49]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f3(B, C, D) + W[50]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f3(A, B, C) + W[51]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f3(E, A, B) + W[52]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f3(D, E, A) + W[53]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f3(C, D, E) + W[54]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f3(B, C, D) + W[55]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f3(A, B, C) + W[56]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f3(E, A, B) + W[57]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f3(D, E, A) + W[58]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f3(C, D, E) + W[59]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f4(B, C, D) + W[60]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f4(A, B, C) + W[61]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f4(E, A, B) + W[62]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f4(D, E, A) + W[63]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f4(C, D, E) + W[64]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f4(B, C, D) + W[65]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f4(A, B, C) + W[66]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f4(E, A, B) + W[67]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f4(D, E, A) + W[68]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f4(C, D, E) + W[69]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f4(B, C, D) + W[70]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f4(A, B, C) + W[71]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f4(E, A, B) + W[72]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f4(D, E, A) + W[73]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f4(C, D, E) + W[74]; C =((C << 30)|(C >>> -30)); ! E += ((A << 5)|(A >>> -5)) + f4(B, C, D) + W[75]; B =((B << 30)|(B >>> -30)); ! D += ((E << 5)|(E >>> -5)) + f4(A, B, C) + W[76]; A =((A << 30)|(A >>> -30)); ! C += ((D << 5)|(D >>> -5)) + f4(E, A, B) + W[77]; E =((E << 30)|(E >>> -30)); ! B += ((C << 5)|(C >>> -5)) + f4(D, E, A) + W[78]; D =((D << 30)|(D >>> -30)); ! A += ((B << 5)|(B >>> -5)) + f4(C, D, E) + W[79]; C =((C << 30)|(C >>> -30)); digest[0] += A; --- 326,409 ---- } ! E += ((A<<5)|(A >>> -5)) + f1(B,C,D) + W[0]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f1(A,B,C) + W[1]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f1(E,A,B) + W[2]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f1(D,E,A) + W[3]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f1(C,D,E) + W[4]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f1(B,C,D) + W[5]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f1(A,B,C) + W[6]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f1(E,A,B) + W[7]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f1(D,E,A) + W[8]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f1(C,D,E) + W[9]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f1(B,C,D) + W[10]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f1(A,B,C) + W[11]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f1(E,A,B) + W[12]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f1(D,E,A) + W[13]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f1(C,D,E) + W[14]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f1(B,C,D) + W[15]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f1(A,B,C) + W[16]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f1(E,A,B) + W[17]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f1(D,E,A) + W[18]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f1(C,D,E) + W[19]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f2(B,C,D) + W[20]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f2(A,B,C) + W[21]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f2(E,A,B) + W[22]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f2(D,E,A) + W[23]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f2(C,D,E) + W[24]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f2(B,C,D) + W[25]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f2(A,B,C) + W[26]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f2(E,A,B) + W[27]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f2(D,E,A) + W[28]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f2(C,D,E) + W[29]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f2(B,C,D) + W[30]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f2(A,B,C) + W[31]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f2(E,A,B) + W[32]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f2(D,E,A) + W[33]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f2(C,D,E) + W[34]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f2(B,C,D) + W[35]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f2(A,B,C) + W[36]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f2(E,A,B) + W[37]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f2(D,E,A) + W[38]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f2(C,D,E) + W[39]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f3(B,C,D) + W[40]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f3(A,B,C) + W[41]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f3(E,A,B) + W[42]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f3(D,E,A) + W[43]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f3(C,D,E) + W[44]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f3(B,C,D) + W[45]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f3(A,B,C) + W[46]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f3(E,A,B) + W[47]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f3(D,E,A) + W[48]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f3(C,D,E) + W[49]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f3(B,C,D) + W[50]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f3(A,B,C) + W[51]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f3(E,A,B) + W[52]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f3(D,E,A) + W[53]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f3(C,D,E) + W[54]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f3(B,C,D) + W[55]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f3(A,B,C) + W[56]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f3(E,A,B) + W[57]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f3(D,E,A) + W[58]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f3(C,D,E) + W[59]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f4(B,C,D) + W[60]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f4(A,B,C) + W[61]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f4(E,A,B) + W[62]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f4(D,E,A) + W[63]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f4(C,D,E) + W[64]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f4(B,C,D) + W[65]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f4(A,B,C) + W[66]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f4(E,A,B) + W[67]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f4(D,E,A) + W[68]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f4(C,D,E) + W[69]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f4(B,C,D) + W[70]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f4(A,B,C) + W[71]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f4(E,A,B) + W[72]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f4(D,E,A) + W[73]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f4(C,D,E) + W[74]; C =((C<<30)|(C>>>-30)); ! E += ((A<<5)|(A >>> -5)) + f4(B,C,D) + W[75]; B =((B<<30)|(B>>>-30)); ! D += ((E<<5)|(E >>> -5)) + f4(A,B,C) + W[76]; A =((A<<30)|(A>>>-30)); ! C += ((D<<5)|(D >>> -5)) + f4(E,A,B) + W[77]; E =((E<<30)|(E>>>-30)); ! B += ((C<<5)|(C >>> -5)) + f4(D,E,A) + W[78]; D =((D<<30)|(D>>>-30)); ! A += ((B<<5)|(B >>> -5)) + f4(C,D,E) + W[79]; C =((C<<30)|(C>>>-30)); digest[0] += A; Index: Setup.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/Setup.java,v retrieving revision 2.15 retrieving revision 2.16 diff -C2 -r2.15 -r2.16 *** Setup.java 2001/02/01 13:21:07 2.15 --- Setup.java 2001/02/02 11:29:42 2.16 *************** *** 5,9 **** // specify additional builtin modules. ! public class Setup { // Each element of this array is a string naming a builtin module to --- 5,9 ---- // specify additional builtin modules. ! public class Setup { // Each element of this array is a string naming a builtin module to Index: _codecs.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/_codecs.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** _codecs.java 2001/01/21 16:24:31 2.6 --- _codecs.java 2001/02/02 11:29:42 2.7 *************** *** 34,38 **** ! /* --- UTF-8 Codec -------------------------------------------------------- */ public static PyTuple utf_8_decode(String str, String errors) { --- 34,38 ---- ! /* --- UTF-8 Codec --------------------------------------------------- */ public static PyTuple utf_8_decode(String str, String errors) { *************** *** 50,58 **** return codec_tuple(codecs.PyUnicode_EncodeUTF8(str, errors), size); } - - /* --- Character Mapping Codec -------------------------------------------- */ public static PyTuple charmap_decode(String str, String errors, PyObject mapping) { --- 50,58 ---- return codec_tuple(codecs.PyUnicode_EncodeUTF8(str, errors), size); } + /* --- Character Mapping Codec --------------------------------------- */ + public static PyTuple charmap_decode(String str, String errors, PyObject mapping) { *************** *** 63,67 **** char ch = str.charAt(i); if (ch > 0xFF) { ! codecs.decoding_error("charmap", v, errors, "ordinal not in range(255)"); i++; --- 63,67 ---- char ch = str.charAt(i); if (ch > 0xFF) { ! codecs.decoding_error("charmap", v, errors, "ordinal not in range(255)"); i++; *************** *** 85,89 **** v.append((char) value); } else if (x == Py.None) { ! codecs.decoding_error("charmap", v, errors, "character maps to <undefined>"); } else if (x instanceof PyString) { --- 85,89 ---- v.append((char) value); } else if (x == Py.None) { ! codecs.decoding_error("charmap", v, errors, "character maps to <undefined>"); } else if (x instanceof PyString) { *************** *** 97,102 **** else { /* wrong return value */ ! throw Py.TypeError( ! "character mapping must return integer, None or unicode"); } } --- 97,102 ---- else { /* wrong return value */ ! throw Py.TypeError("character mapping must return integer, " + ! "None or unicode"); } } *************** *** 108,116 **** ! public static PyTuple charmap_encode(String str, String errors, PyObject mapping) { int size = str.length(); StringBuffer v = new StringBuffer(size); ! for (int i = 0; i < size; i++) { char ch = str.charAt(i); --- 108,116 ---- ! public static PyTuple charmap_encode(String str, String errors, PyObject mapping) { int size = str.length(); StringBuffer v = new StringBuffer(size); ! for (int i = 0; i < size; i++) { char ch = str.charAt(i); *************** *** 122,126 **** v.append(ch); else ! codecs.encoding_error("charmap", v, errors, "missing character mapping"); continue; --- 122,126 ---- v.append(ch); else ! codecs.encoding_error("charmap", v, errors, "missing character mapping"); continue; *************** *** 133,137 **** v.append((char) value); } else if (x == Py.None) { ! codecs.encoding_error("charmap", v, errors, "character maps to <undefined>"); } else if (x instanceof PyString) { --- 133,137 ---- v.append((char) value); } else if (x == Py.None) { ! codecs.encoding_error("charmap", v, errors, "character maps to <undefined>"); } else if (x instanceof PyString) { *************** *** 145,155 **** else { /* wrong return value */ ! throw Py.TypeError( ! "character mapping must return integer, None or unicode"); } } return codec_tuple(v.toString(), size); } ! --- 145,155 ---- else { /* wrong return value */ ! throw Py.TypeError("character mapping must return " + ! "integer, None or unicode"); } } return codec_tuple(v.toString(), size); } ! *************** *** 165,173 **** public static PyTuple ascii_encode(String str, String errors) { int size = str.length(); ! return codec_tuple(codecs.PyUnicode_EncodeASCII(str, size, errors), size); } - /* --- Latin-1 Codec -------------------------------------------- */ --- 165,173 ---- public static PyTuple ascii_encode(String str, String errors) { int size = str.length(); ! return codec_tuple(codecs.PyUnicode_EncodeASCII(str, size, errors), size); } + /* --- Latin-1 Codec -------------------------------------------- */ *************** *** 181,185 **** v.append(ch); } else { ! codecs.decoding_error("latin-1", v, errors, "ordinal not in range(256)"); i++; --- 181,185 ---- v.append(ch); } else { ! codecs.decoding_error("latin-1", v, errors, "ordinal not in range(256)"); i++; *************** *** 197,205 **** int size = str.length(); StringBuffer v = new StringBuffer(size); ! for (int i = 0; i < size; i++) { char ch = str.charAt(i); if (ch >= 256) { ! codecs.encoding_error("latin-1", v, errors, "ordinal not in range(256)"); } else --- 197,205 ---- int size = str.length(); StringBuffer v = new StringBuffer(size); ! for (int i = 0; i < size; i++) { char ch = str.charAt(i); if (ch >= 256) { ! codecs.encoding_error("latin-1", v, errors, "ordinal not in range(256)"); } else *************** *** 219,223 **** public static PyTuple utf_16_encode(String str, String errors, int byteorder) { ! return codec_tuple(encode_UTF16(str, errors, byteorder), str.length()); } --- 219,224 ---- public static PyTuple utf_16_encode(String str, String errors, int byteorder) { ! return codec_tuple(encode_UTF16(str, errors, byteorder), ! str.length()); } *************** *** 231,238 **** ! private static String encode_UTF16(String str, String errors, int byteorder) { int size = str.length(); ! StringBuffer v = new StringBuffer((size + (byteorder == 0 ? 1 : 0)) * 2); --- 232,239 ---- ! private static String encode_UTF16(String str, String errors, int byteorder) { int size = str.length(); ! StringBuffer v = new StringBuffer((size + (byteorder == 0 ? 1 : 0)) * 2); *************** *** 258,263 **** return v.toString(); } - --- 259,264 ---- return v.toString(); } + *************** *** 267,271 **** } ! public static PyTuple utf_16_decode(String str, String errors, int byteorder) { int[] bo = new int[] { byteorder }; --- 268,272 ---- } ! public static PyTuple utf_16_decode(String str, String errors, int byteorder) { int[] bo = new int[] { byteorder }; *************** *** 291,302 **** int[] bo = new int[] { 0 }; String s = decode_UTF16(str, errors, bo); ! return new PyTuple(new PyObject[] { ! Py.newString(s), ! Py.newInteger(str.length()), Py.newInteger(bo[0]) }); } ! private static String decode_UTF16(String str, String errors, int[] byteorder) { int bo = 0; --- 292,303 ---- int[] bo = new int[] { 0 }; String s = decode_UTF16(str, errors, bo); ! return new PyTuple(new PyObject[] { ! Py.newString(s), ! Py.newInteger(str.length()), Py.newInteger(bo[0]) }); } ! private static String decode_UTF16(String str, String errors, int[] byteorder) { int bo = 0; *************** *** 321,325 **** continue; } ! char ch; if (bo == -1) --- 322,326 ---- continue; } ! char ch; if (bo == -1) *************** *** 332,337 **** continue; } - /* UTF-16 code pair: */ if (i == size-1) { --- 333,338 ---- continue; } + /* UTF-16 code pair: */ if (i == size-1) { *************** *** 349,353 **** Py_UNICODE type only has 16 bits... this might change someday, even though it's unlikely. */ ! codecs.decoding_error("UTF-16", v, errors, "code pairs are not supported"); continue; --- 350,354 ---- Py_UNICODE type only has 16 bits... this might change someday, even though it's unlikely. */ ! codecs.decoding_error("UTF-16", v, errors, "code pairs are not supported"); continue; *************** *** 367,380 **** ! public static PyTuple raw_unicode_escape_encode(String str, String errors) { ! return codec_tuple(codecs.PyUnicode_EncodeRawUnicodeEscape(str, errors, false), str.length()); } ! public static PyTuple raw_unicode_escape_decode(String str, String errors) { ! return codec_tuple(codecs.PyUnicode_DecodeRawUnicodeEscape(str, errors), str.length()); } --- 368,383 ---- ! public static PyTuple raw_unicode_escape_encode(String str, String errors) { ! return codec_tuple(codecs.PyUnicode_EncodeRawUnicodeEscape(str, ! errors, false), str.length()); } ! public static PyTuple raw_unicode_escape_decode(String str, String errors) { ! return codec_tuple(codecs.PyUnicode_DecodeRawUnicodeEscape(str, ! errors), str.length()); } *************** *** 386,400 **** public static PyTuple unicode_escape_encode(String str, String errors) { ! return codec_tuple(PyString.encode_UnicodeEscape(str, false), str.length()); } public static PyTuple unicode_escape_decode(String str, String errors) { int n = str.length(); ! return codec_tuple(PyString.decode_UnicodeEscape(str, 0, n, errors, true), n); } ! /* --- UnicodeInternal Codec -------------------------------------------- */ --- 389,405 ---- public static PyTuple unicode_escape_encode(String str, String errors) { ! return codec_tuple(PyString.encode_UnicodeEscape(str, false), ! str.length()); } public static PyTuple unicode_escape_decode(String str, String errors) { int n = str.length(); ! return codec_tuple(PyString.decode_UnicodeEscape(str, ! 0, n, errors, true), n); } ! /* --- UnicodeInternal Codec ------------------------------------------ */ Index: _jython.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/_jython.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** _jython.java 2001/02/01 13:48:45 2.2 --- _jython.java 2001/02/02 11:29:42 2.3 *************** *** 13,17 **** switch (index) { case 0: ! if(!(arg instanceof PyJavaClass)) throw Py.TypeError("is_lazy(): arg is not a jclass"); return Py.newBoolean(((PyJavaClass)arg).isLazy()); default: --- 13,18 ---- switch (index) { case 0: ! if (!(arg instanceof PyJavaClass)) ! throw Py.TypeError("is_lazy(): arg is not a jclass"); return Py.newBoolean(((PyJavaClass)arg).isLazy()); default: *************** *** 24,28 **** { public static void classDictInit(PyObject dict) { ! dict.__setitem__("is_lazy", new JythonInternalFunctions("is_lazy", 0, 1)); } --- 25,30 ---- { public static void classDictInit(PyObject dict) { ! dict.__setitem__("is_lazy", ! new JythonInternalFunctions("is_lazy", 0, 1)); } Index: _sre.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/_sre.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** _sre.java 2001/02/01 13:23:06 1.4 --- _sre.java 2001/02/02 11:29:42 1.5 *************** *** 26,36 **** ! public static PatternObject compile(PyString pattern, int flags, PyObject code, ! int groups, PyObject groupindex, PyObject indexgroup) { char[] ccode = null; if (code instanceof PyList) { int n = code.__len__(); ccode = new char[n]; ! for (int i = 0; i < n; i++) ccode[i] = (char) code.__getitem__(i).__int__().getValue(); } else { --- 26,38 ---- ! public static PatternObject compile(PyString pattern, int flags, ! PyObject code, int groups, ! PyObject groupindex, ! PyObject indexgroup) { char[] ccode = null; if (code instanceof PyList) { int n = code.__len__(); ccode = new char[n]; ! for (int i = 0; i < n; i++) ccode[i] = (char) code.__getitem__(i).__int__().getValue(); } else { *************** *** 38,42 **** } ! PatternObject po = new PatternObject(pattern, flags, ccode, groups, groupindex, indexgroup); return po; } --- 40,49 ---- } ! PatternObject po = new PatternObject(pattern, ! flags, ! ccode, ! groups, ! groupindex, ! indexgroup); return po; } Index: binascii.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/binascii.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** binascii.java 2000/10/17 19:14:19 2.4 --- binascii.java 2001/02/02 11:29:42 2.5 *************** *** 1,8 **** /* * Copyright 1998 Finn Bock. ! * * This program contains material copyrighted by: * Copyright © 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, ! * Amsterdam, The Netherlands. */ --- 1,8 ---- /* [...1279 lines suppressed...] ! System.out.println(l); ! System.out.println(a2b_hqx(l)); } */ --- 881,895 ---- /* public static void main(String[] args) { ! String l = b2a_uu("Hello"); ! System.out.println(l); ! System.out.println(a2b_uu(l)); ! ! l = b2a_base64("Hello"); ! System.out.println(l); ! System.out.println(a2b_base64(l)); ! ! l = b2a_hqx("Hello-"); ! System.out.println(l); ! System.out.println(a2b_hqx(l)); } */ Index: cPickle.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/cPickle.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** cPickle.java 2001/01/21 16:25:08 1.14 --- cPickle.java 2001/02/02 11:29:42 1.15 *************** *** 1,8 **** /* * Copyright 1998 Finn Bock. ! * * This program contains material copyrighted by: ! * Copyright © 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, ! * The Netherlands. */ --- 1,8 ---- /* [...3688 lines suppressed...] + int len = arr.length; + System.arraycopy(stack, stackTop - len, arr, 0, len); + stackTop -= len; + } ! final private void push(PyObject val) { ! if (stackTop >= stack.length) { ! PyObject[] newStack = new PyObject[(stackTop+1) * 2]; ! System.arraycopy(stack, 0, newStack, 0, stack.length); ! stack = newStack; ! } ! stack[stackTop++] = val; ! } } private static PyObject importModule(String name) { ! PyObject silly_list = new PyTuple(new PyString[] { Py.newString("__doc__"), }); Index: cStringIO.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/cStringIO.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cStringIO.java 2000/11/29 18:59:05 1.7 --- cStringIO.java 2001/02/02 11:29:42 1.8 *************** *** 1,8 **** /* * Copyright 1998 Finn Bock. ! * * This program contains material copyrighted by: ! * Copyright © 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, ! * The Netherlands. */ --- 1,8 ---- /* * Copyright 1998 Finn Bock. ! * * This program contains material copyrighted by: ! * Copyright © 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, ! * The Netherlands. */ *************** *** 15,21 **** /** ! * This module implements a file-like class, StringIO, that reads and ! * writes a string buffer (also known as memory files). ! * See the description on file objects for operations. * @author Finn Bock, bc...@pi... * @version cStringIO.java,v 1.10 1999/05/20 18:03:20 fb Exp --- 15,21 ---- /** ! * This module implements a file-like class, StringIO, that reads and ! * writes a string buffer (also known as memory files). ! * See the description on file objects for operations. * @author Finn Bock, bc...@pi... * @version cStringIO.java,v 1.10 1999/05/20 18:03:20 fb Exp *************** *** 24,40 **** /** * Create an empty StringIO object ! * @return a new StringIO object. */ public static StringIO StringIO() { ! return new StringIO(); } /** * Create a StringIO object, initialized by the value. ! * @param buf The initial value. ! * @return a new StringIO object. */ public static StringIO StringIO(String buf) { ! return new StringIO(buf); } --- 24,40 ---- /** * Create an empty StringIO object ! * @return a new StringIO object. */ public static StringIO StringIO() { ! return new StringIO(); } /** * Create a StringIO object, initialized by the value. ! * @param buf The initial value. ! * @return a new StringIO object. */ public static StringIO StringIO(String buf) { ! return new StringIO(buf); } *************** *** 42,239 **** /** * The StringIO object ! * @see cStringIO#StringIO() * @see cStringIO#StringIO(String) */ public static class StringIO extends PyObject { ! transient public boolean softspace = false; ! transient public String name = "<cStringIO>"; ! transient public String mode = "w"; ! transient public boolean closed = false; ! ! transient private char[] buf; ! transient private int count; ! transient private int pos; ! ! ! StringIO() { ! this.buf = new char[16]; ! } ! ! ! StringIO(String buf) { ! this.buf = new char[buf.length() + 16]; ! write(buf); ! seek(0); ! } ! ! ! /** ! * Free the memory buffer. ! */ ! public void close() { ! buf = null; ! closed = true; ! } ! ! ! /** ! * Return false. ! * @return false. ! */ ! public boolean isatty() { ! return false; ! } ! ! ! /** ! * Position the file pointer to the absolute position. ! * @param pos the position in the file. ! */ ! public void seek(long pos) { ! seek(pos, 0); ! } ! ! ! /** ! * Position the file pointer to the position in the . ! * @param pos the position in the file. ! * @param mode; 0=from the start, 1=relative, 2=from the end. ! */ ! public void seek(long pos, int mode) { ! if (mode == 1) ! this.pos = (int)pos + this.pos; ! else if (mode == 2) ! this.pos = (int)pos + count; ! this.pos = Math.max(0, (int)pos); ! } ! ! ! /** ! * Return the file position. ! * @returns the position in the file. ! */ ! public long tell() { ! return pos; ! } ! ! ! ! /** ! * Read all data until EOF is reached. ! * An empty string is returned when EOF is encountered immediately. ! * @returns A string containing the data. ! */ ! public String read() { ! return read(-1); ! } ! ! ! /** ! * Read at most size bytes from the file (less if the read hits EOF). ! * If the size argument is negative, read all data until EOF is reached. ! * An empty string is returned when EOF is encountered immediately. ! * @param size the number of characters to read. ! * @returns A string containing the data read. ! */ ! public String read(int size) { opencheck(); ! int newpos = (size < 0) ? count : Math.min(pos+size, count); ! String r = null; ! if (size == 1) { ! r = cStringIO.getString(buf[pos]); ! } else { ! r = new String(buf, pos, newpos-pos); ! } ! pos = newpos; ! return r; ! } ! ! ! private int indexOf(char ch, int pos) { ! for (int i = pos; i < count; i++) { ! if (buf[i] == ch) ! return i; ! } ! return -1; ! } ! ! ! /** ! * Read one entire line from the file. A trailing newline character ! * is kept in the string (but may be absent when a file ends with ! * an incomplete line). ! * An empty string is returned when EOF is hit immediately. ! * @returns data from the file up to and including the newline. ! */ ! public String readline() { ! return readline(-1); ! } ! ! ! /** ! * Read one entire line from the file. A trailing newline character ! * is kept in the string (but may be absent when a file ends with an ! * incomplete line). ! * If the size argument is non-negative, it is a maximum byte count ! * (including the trailing newline) and an incomplete line may be returned. ! * @returns data from the file up to and including the newline. ! */ ! public String readline(int length) { opencheck(); ! int i = indexOf('\n', pos); ! int newpos = (i < 0) ? count : i+1; ! if (length != -1 && pos + length < newpos) ! newpos = pos + length; ! String r = new String(buf, pos, newpos-pos); ! pos = newpos; ! return r; ! } ! ! ! /** ! * Read and return a line without the trailing newling. ! * Usind by cPickle as an optimization. ! */ ! public String readlineNoNl() { ! int i = indexOf('\n', pos); ! int newpos = (i < 0) ? count : i; ! String r = new String(buf, pos, newpos-pos); ! pos = newpos; ! if (pos < count) // Skip the newline ! pos++; ! return r; ! } ! /** ! * Read until EOF using readline() and return a list containing ! * the lines thus read. ! * @return a list of the lines. ! */ ! public PyObject readlines() { return readlines(0); } ! /** ! * Read until EOF using readline() and return a list containing ! * the lines thus read. ! * @return a list of the lines. ! */ ! public PyObject readlines(int sizehint) { opencheck(); int total = 0; ! PyList lines = new PyList(); ! String line = readline(); ! while (line.length() > 0) { ! lines.append(new PyString(line)); total += line.length(); if (0 < sizehint && sizehint <= total) break; ! line = readline(); ! } ! return lines; ! } /** --- 42,241 ---- /** * The StringIO object ! * @see cStringIO#StringIO() * @see cStringIO#StringIO(String) */ public static class StringIO extends PyObject { ! transient public boolean softspace = false; ! transient public String name = "<cStringIO>"; ! transient public String mode = "w"; ! transient public boolean closed = false; ! ! transient private char[] buf; ! transient private int count; ! transient private int pos; ! ! ! StringIO() { ! this.buf = new char[16]; ! } ! ! ! StringIO(String buf) { ! this.buf = new char[buf.length() + 16]; ! write(buf); ! seek(0); ! } ! ! ! /** ! * Free the memory buffer. ! */ ! public void close() { ! buf = null; ! closed = true; ! } ! ! ! /** ! * Return false. ! * @return false. ! */ ! public boolean isatty() { ! return false; ! } ! ! ! /** ! * Position the file pointer to the absolute position. ! * @param pos the position in the file. ! */ ! public void seek(long pos) { ! seek(pos, 0); ! } ! ! ! /** ! * Position the file pointer to the position in the . ! * @param pos the position in the file. ! * @param mode; 0=from the start, 1=relative, 2=from the end. ! */ ! public void seek(long pos, int mode) { ! if (mode == 1) ! this.pos = (int)pos + this.pos; ! else if (mode == 2) ! this.pos = (int)pos + count; ! this.pos = Math.max(0, (int)pos); ! } ! ! ! /** ! * Return the file position. ! * @returns the position in the file. ! */ ! public long tell() { ! return pos; ! } ! ! ! ! /** ! * Read all data until EOF is reached. ! * An empty string is returned when EOF is encountered immediately. ! * @returns A string containing the data. ! */ ! public String read() { ! return read(-1); ! } ! ! ! /** ! * Read at most size bytes from the file (less if the read hits EOF). ! * If the size argument is negative, read all data until EOF is ! * reached. An empty string is returned when EOF is encountered ! * immediately. ! * @param size the number of charact... [truncated message content] |
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv11196 Modified Files: AutoInternalTables.java BytecodeLoader.java CachedJarsPackageManager.java InternalTables.java MakeProxies.java PackageManager.java PathPackageManager.java Py.java PyBeanEventProperty.java PyClass.java PyComplex.java PyFile.java PyFloat.java PyFunction.java PyInstance.java PyInteger.java PyJavaClass.java PyJavaInstance.java PyJavaPackage.java PyList.java PyLong.java PyMethod.java PyModule.java PyObject.java PyReflectedConstructor.java PyReflectedFunction.java PySequence.java PyString.java PyStringMap.java PySystemState.java PyTableCode.java ReflectedArgs.java SysPackageManager.java SyspathJavaLoader.java ThreadStateMapping.java __builtin__.java codecs.java imp.java parser.java Log Message: Consistent formatting. Keep lines shorter than 78 chars. Index: AutoInternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/AutoInternalTables.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** AutoInternalTables.java 2001/02/01 16:41:10 2.4 --- AutoInternalTables.java 2001/02/02 09:28:36 2.5 *************** *** 10,14 **** protected ReferenceQueue queue = new ReferenceQueue(); ! protected abstract Reference newAutoRef(short type,Object key, Object obj); protected abstract short getAutoRefType(Reference ref); protected abstract Object getAutoRefKey(Reference ref); --- 10,15 ---- protected ReferenceQueue queue = new ReferenceQueue(); ! protected abstract Reference newAutoRef(short type, Object key, ! Object obj); protected abstract short getAutoRefType(Reference ref); protected abstract Object getAutoRefKey(Reference ref); *************** *** 133,137 **** case ADAPTER_CLASS: Map.Entry entry = (Map.Entry)cur; ! if (((Reference)entry.getValue()).get() == null ) continue; return entry.getKey(); } --- 134,139 ---- case ADAPTER_CLASS: Map.Entry entry = (Map.Entry)cur; ! if (((Reference)entry.getValue()).get() == null ) ! continue; return entry.getKey(); } Index: BytecodeLoader.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/BytecodeLoader.java,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** BytecodeLoader.java 2001/02/01 16:41:10 2.11 --- BytecodeLoader.java 2001/02/02 09:28:36 2.12 *************** *** 48,52 **** if (version.compareTo("1.2") >= 0) { try { ! loaderClass = Class.forName("org.python.core.BytecodeLoader2"); } catch (Throwable e) { loaderClass = BytecodeLoader1.class; --- 48,53 ---- if (version.compareTo("1.2") >= 0) { try { ! loaderClass = ! Class.forName("org.python.core.BytecodeLoader2"); } catch (Throwable e) { loaderClass = BytecodeLoader1.class; *************** *** 63,67 **** } ! public static Class makeClass(String name, Vector referents, byte[] data) { Loader loader = makeLoader(); --- 64,70 ---- } ! public static Class makeClass(String name, Vector referents, ! byte[] data) ! { Loader loader = makeLoader(); *************** *** 69,73 **** for (int i = 0; i < referents.size(); i++) { try { ! ClassLoader cur = ((Class)referents.elementAt(i)).getClassLoader(); if (cur != null) loader.addParent(cur); --- 72,77 ---- for (int i = 0; i < referents.size(); i++) { try { ! Class cls = (Class)referents.elementAt(i); ! ClassLoader cur = cls.getClassLoader(); if (cur != null) loader.addParent(cur); Index: CachedJarsPackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CachedJarsPackageManager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** CachedJarsPackageManager.java 2001/02/01 16:41:10 1.5 --- CachedJarsPackageManager.java 2001/02/02 09:28:36 1.6 *************** *** 43,49 **** /** Filter class/pkg by name helper method - hook. ! * The default impl. is used by {@link #addJarToPackages} in order to filter out classes ! * whose name contains '$' (e.g. inner classes,...). ! * Should be used or overriden by derived classes too. Also to be used in {@link #doDir}. * @param name class/pkg name * @param pkg if true, name refers to a pkg --- 43,50 ---- /** Filter class/pkg by name helper method - hook. ! * The default impl. is used by {@link #addJarToPackages} in order ! * to filter out classes whose name contains '$' (e.g. inner classes,...). ! * Should be used or overriden by derived classes too. ! * Also to be used in {@link #doDir}. * @param name class/pkg name * @param pkg if true, name refers to a pkg *************** *** 55,60 **** /** Filter class by access perms helper method - hook. ! * The default impl. is used by {@link #addJarToPackages} in order to filter out non-public classes. ! * Should be used or overriden by derived classes too. Also to be used in {@link #doDir}. * Access perms can be read with {@link #checkAccess}. * @param name class name --- 56,63 ---- /** Filter class by access perms helper method - hook. ! * The default impl. is used by {@link #addJarToPackages} in order ! * to filter out non-public classes. ! * Should be used or overriden by derived classes too. ! * Also to be used in {@link #doDir}. * Access perms can be read with {@link #checkAccess}. * @param name class name *************** *** 81,85 **** // Add a single class from zipFile to zipPackages // Only add valid, public classes ! private void addZipEntry(Hashtable zipPackages, ZipEntry entry,ZipInputStream zip) throws IOException { String name = entry.getName(); --- 84,90 ---- // Add a single class from zipFile to zipPackages // Only add valid, public classes ! private void addZipEntry(Hashtable zipPackages, ! ZipEntry entry, ! ZipInputStream zip) throws IOException { String name = entry.getName(); *************** *** 143,147 **** * Eventually just using previously cached info. * Eventually updated info is not cached. ! * Persistent cache storage access goes through {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(java.net.URL jarurl) { --- 148,153 ---- * Eventually just using previously cached info. * Eventually updated info is not cached. ! * Persistent cache storage access goes through ! * {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(java.net.URL jarurl) { *************** *** 152,156 **** * Eventually just using previously cached info. * Eventually updated info is (re-)cached if param cache is true. ! * Persistent cache storage access goes through {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(URL jarurl,boolean cache) { --- 158,163 ---- * Eventually just using previously cached info. * Eventually updated info is (re-)cached if param cache is true. ! * Persistent cache storage access goes through ! * {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(URL jarurl,boolean cache) { *************** *** 161,165 **** * Eventually just using previously cached info. * Eventually updated info is not cached. ! * Persistent cache storage access goes through {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(File jarfile) { --- 168,173 ---- * Eventually just using previously cached info. * Eventually updated info is not cached. ! * Persistent cache storage access goes through ! * {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(File jarfile) { *************** *** 170,174 **** * Eventually just using previously cached info. * Eventually updated info is (re-)cached if param cache is true. ! * Persistent cache storage access goes through {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(File jarfile,boolean cache) { --- 178,183 ---- * Eventually just using previously cached info. * Eventually updated info is (re-)cached if param cache is true. ! * Persistent cache storage access goes through ! * {@link #inOpenCacheFile}, {@link #outCreateCacheFile}. */ public void addJarToPackages(File jarfile,boolean cache) { *************** *** 187,195 **** // This is necessary because 'file:' url-connections // return always 0 through getLastModified (bug?). ! // And in order to handle localfiles (from urls too) uniformly. if(jarconn.getURL().getProtocol().equals("file")) { // ??pending: need to use java2 URLDecoder.decode? // but under 1.1 this is absent and should be simulated. ! jarfile = new File(jarurl.getFile().replace('/',File.separatorChar)); } else localfile = false; --- 196,207 ---- // This is necessary because 'file:' url-connections // return always 0 through getLastModified (bug?). ! // And in order to handle localfiles (from urls too) ! // uniformly. if(jarconn.getURL().getProtocol().equals("file")) { // ??pending: need to use java2 URLDecoder.decode? // but under 1.1 this is absent and should be simulated. ! String jarfilename = jarurl.getFile(); ! jarfilename = jarfilename.replace('/',File.separatorChar); ! jarfile = new File(jarfilename); } else localfile = false; *************** *** 258,267 **** InputStream jarin; ! if (jarconn == null) jarin = new BufferedInputStream(new FileInputStream(jarfile)); ! else jarin = jarconn.getInputStream(); zipPackages = getZipPackages(jarin); ! if(caching) writeCacheFile(entry, jarcanon, zipPackages, brandNew); // Write the cache file } --- 270,283 ---- InputStream jarin; ! if (jarconn == null) ! jarin = new BufferedInputStream( ! new FileInputStream(jarfile)); ! else ! jarin = jarconn.getInputStream(); zipPackages = getZipPackages(jarin); ! if (caching) ! writeCacheFile(entry, jarcanon, zipPackages, brandNew); } *************** *** 270,274 **** // silently skip any bad directories warning("skipping bad jar, '" + ! (jarfile!=null?jarfile.toString():jarurl.toString()) + "'"); // ?? solve bug } --- 286,293 ---- // silently skip any bad directories warning("skipping bad jar, '" + ! (jarfile != null ? ! jarfile.toString() : ! jarurl.toString()) + ! "'"); } *************** *** 425,429 **** /** Open cache index for reading from persistent storage - hook. * Must Return null if this is absent. ! * This default impl is part of the off-the-shelf local file-system cache impl. * Can be overriden. */ --- 444,449 ---- /** Open cache index for reading from persistent storage - hook. * Must Return null if this is absent. ! * This default impl is part of the off-the-shelf local ! * file-system cache impl. * Can be overriden. */ *************** *** 440,444 **** /** Open cache index for writing back to persistent storage - hook. ! * This default impl is part of the off-the-shelf local file-system cache impl. * Can be overriden. */ --- 460,465 ---- /** Open cache index for writing back to persistent storage - hook. ! * This default impl is part of the off-the-shelf local ! * file-system cache impl. * Can be overriden. */ *************** *** 451,463 **** /** Open cache file for reading from persistent storage - hook. ! * This default impl is part of the off-the-shelf local file-system cache impl. * Can be overriden. */ ! protected DataInputStream inOpenCacheFile(String cachefile) throws IOException { ! return new DataInputStream(new BufferedInputStream(new FileInputStream(cachefile))); } /** Delete (invalidated) cache file from persistent storage - hook. ! * This default impl is part of the off-the-shelf local file-system cache impl. * Can be overriden. */ --- 472,490 ---- /** Open cache file for reading from persistent storage - hook. ! * This default impl is part of the off-the-shelf local ! * file-system cache impl. * Can be overriden. */ ! protected DataInputStream inOpenCacheFile(String cachefile) ! throws IOException ! { ! return new DataInputStream( ! new BufferedInputStream( ! new FileInputStream(cachefile))); } /** Delete (invalidated) cache file from persistent storage - hook. ! * This default impl is part of the off-the-shelf local ! * file-system cache impl. * Can be overriden. */ *************** *** 466,479 **** } ! /** Create/open cache file for rewriting back to persistent storage - hook. * If create is false, cache file is supposed to exist and must be opened * for rewriting, entry.cachefile is a valid cachefile id. ! * If create is true, cache file must be created. entry.cachefile is a flat ! * jarname to be used to produce a valid cachefile id (to be put back in entry.cachefile ! * on exit). ! * This default impl is part of the off-the-shelf local file-system cache impl. * Can be overriden. */ ! protected DataOutputStream outCreateCacheFile(JarXEntry entry, boolean create) throws IOException { File cachefile = null; --- 493,511 ---- } ! /** ! * Create/open cache file for rewriting back to persistent storage - hook. * If create is false, cache file is supposed to exist and must be opened * for rewriting, entry.cachefile is a valid cachefile id. ! * If create is true, cache file must be created. entry.cachefile is a ! * flat jarname to be used to produce a valid cachefile id (to be put ! * back in entry.cachefile on exit). ! * This default impl is part of the off-the-shelf local file-system ! * cache impl. * Can be overriden. */ ! protected DataOutputStream outCreateCacheFile(JarXEntry entry, ! boolean create) ! throws IOException ! { File cachefile = null; *************** *** 492,496 **** } else cachefile = new File(entry.cachefile); ! return new DataOutputStream(new BufferedOutputStream(new FileOutputStream(cachefile))); } --- 524,530 ---- } else cachefile = new File(entry.cachefile); ! return new DataOutputStream( ! new BufferedOutputStream( ! new FileOutputStream(cachefile))); } Index: InternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** InternalTables.java 2001/02/01 16:41:10 2.6 --- InternalTables.java 2001/02/02 09:28:36 2.7 *************** *** 3,6 **** --- 3,8 ---- package org.python.core; + import java.util.StringTokenizer; + public abstract class InternalTables { *************** *** 32,36 **** } } ! // System.err.println("*InternalTables*-create-try: "+id); // ??dbg return (InternalTables)Class.forName(id).newInstance(); } --- 34,38 ---- } } ! // System.err.println("*InternalTables*-create-try: "+id); return (InternalTables)Class.forName(id).newInstance(); } *************** *** 42,51 **** static InternalTables createInternalTables() { ! String cands = PySystemState.registry.getProperty("python.options.internalTablesImpl"); if (cands == null) cands = ">2:>1"; else cands = cands + ":>2:>1"; ! java.util.StringTokenizer candEnum = new java.util.StringTokenizer(cands,":"); while (candEnum.hasMoreTokens()) { InternalTables tbl = tryImpl(candEnum.nextToken().trim()); --- 44,54 ---- static InternalTables createInternalTables() { ! String cands = PySystemState.registry.getProperty( ! "python.options.internalTablesImpl"); if (cands == null) cands = ">2:>1"; else cands = cands + ":>2:>1"; ! StringTokenizer candEnum = new StringTokenizer(cands,":"); while (candEnum.hasMoreTokens()) { InternalTables tbl = tryImpl(candEnum.nextToken().trim()); *************** *** 59,64 **** protected abstract PyJavaClass getLazyCanonical(String name); ! protected abstract void putCanonical(Class c,PyJavaClass canonical); ! protected abstract void putLazyCanonical(String name,PyJavaClass canonical); protected abstract Class getAdapterClass(Class c); --- 62,68 ---- protected abstract PyJavaClass getLazyCanonical(String name); ! protected abstract void putCanonical(Class c, PyJavaClass canonical); ! protected abstract void putLazyCanonical(String name, ! PyJavaClass canonical); protected abstract Class getAdapterClass(Class c); Index: MakeProxies.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/MakeProxies.java,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -r2.14 -r2.15 *** MakeProxies.java 2001/02/01 16:41:10 2.14 --- MakeProxies.java 2001/02/02 09:28:36 2.15 *************** *** 14,19 **** class MakeProxies { ! private static Class makeClass(Class referent, Vector secondary,String name, ! ByteArrayOutputStream bytes) { Vector referents = null; --- 14,19 ---- class MakeProxies { ! private static Class makeClass(Class referent, Vector secondary, ! String name, ByteArrayOutputStream bytes) { Vector referents = null; Index: PackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PackageManager.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** PackageManager.java 2001/02/01 16:41:10 2.6 --- PackageManager.java 2001/02/02 09:28:36 2.7 *************** *** 22,26 **** public void notifyPackageImport(String pkg,String name) {} ! /** Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. * Should be overriden. * @param pkg parent pkg name --- 22,27 ---- public void notifyPackageImport(String pkg,String name) {} ! /** Dynamically check if pkg.name exists as java pkg in the ! * controlled hierarchy. * Should be overriden. * @param pkg parent pkg name *************** *** 31,46 **** /** Reports the specified package content names. Should be overriden. ! * Used by {@link PyJavaPackage#__dir__} and {@link PyJavaPackage#fillDir}. * @return resulting list of names (PyList of PyString) ! * @param jpkg queried package ! * @param instantiate if true then instatiate reported names in package dict ! * @param exclpkgs exclude packages (just when instantiate is false) */ ! public abstract PyList doDir(PyJavaPackage jpkg,boolean instantiate,boolean exclpkgs); /** Basic helper implementation of {@link #doDir}. ! * It merges information from jpkg {@link PyJavaPackage#clsSet} and {@link PyJavaPackage#__dict__}. */ ! protected PyList basicDoDir(PyJavaPackage jpkg,boolean instantiate,boolean exclpkgs) { PyStringMap dict = jpkg.__dict__; PyStringMap cls = jpkg.clsSet; --- 32,53 ---- /** Reports the specified package content names. Should be overriden. ! * Used by {@link PyJavaPackage#__dir__} and ! * {@link PyJavaPackage#fillDir}. * @return resulting list of names (PyList of PyString) ! * @param jpkg queried package ! * @param instantiate if true then instatiate reported names in ! * package dict ! * @param exclpkgs exclude packages (just when instantiate is false) */ ! public abstract PyList doDir(PyJavaPackage jpkg, boolean instantiate, ! boolean exclpkgs); /** Basic helper implementation of {@link #doDir}. ! * It merges information from jpkg {@link PyJavaPackage#clsSet} ! * and {@link PyJavaPackage#__dict__}. */ ! protected PyList basicDoDir(PyJavaPackage jpkg, boolean instantiate, ! boolean exclpkgs) ! { PyStringMap dict = jpkg.__dict__; PyStringMap cls = jpkg.clsSet; *************** *** 54,58 **** PyObject name = dictKeys.get(i); if (!cls.has_key(name)) { ! if (exclpkgs && dict.get(name) instanceof PyJavaPackage) continue; ret.append(name); } --- 61,66 ---- PyObject name = dictKeys.get(i); if (!cls.has_key(name)) { ! if (exclpkgs && dict.get(name) instanceof PyJavaPackage) ! continue; ret.append(name); } *************** *** 103,107 **** /** Creates package/updates statically known classes info. ! * Uses {@link PyJavaPackage#addPackage(java.lang.String, java.lang.String) }, {@link PyJavaPackage#addPlaceholders}. * * @param name package name --- 111,116 ---- /** Creates package/updates statically known classes info. ! * Uses {@link PyJavaPackage#addPackage(java.lang.String, ! * java.lang.String) }, {@link PyJavaPackage#addPlaceholders}. * * @param name package name *************** *** 110,114 **** * @return created/updated package */ ! public PyJavaPackage makeJavaPackage(String name,String classes,String jarfile) { PyJavaPackage p = topLevelPackage; if(name.length() != 0) p=p.addPackage(name,jarfile); --- 119,125 ---- * @return created/updated package */ ! public PyJavaPackage makeJavaPackage(String name, String classes, ! String jarfile) ! { PyJavaPackage p = topLevelPackage; if(name.length() != 0) p=p.addPackage(name,jarfile); *************** *** 124,128 **** * And return its access permissions as an int. */ ! static protected int checkAccess(java.io.InputStream cstream) throws java.io.IOException { java.io.DataInputStream istream=new java.io.DataInputStream(cstream); --- 135,141 ---- * And return its access permissions as an int. */ ! static protected int checkAccess(java.io.InputStream cstream) ! throws java.io.IOException ! { java.io.DataInputStream istream=new java.io.DataInputStream(cstream); *************** *** 158,163 **** break; default: ! //System.err.println("unexpected cid: "+cid+", "+i+", "+nconstants); ! //for (int j=0; j<10; j++) { System.err.print(", "+istream.readByte()); } //System.err.println(); return -1; --- 171,178 ---- break; default: ! //System.err.println("unexpected cid: "+cid+", "+i+", "+ ! // nconstants); ! //for (int j=0; j<10; j++) ! // System.err.print(", "+istream.readByte()); //System.err.println(); return -1; Index: PathPackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PathPackageManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** PathPackageManager.java 2001/02/01 16:41:10 1.3 --- PathPackageManager.java 2001/02/02 09:28:36 1.4 *************** *** 7,12 **** import java.lang.reflect.Modifier; ! /** Path package manager. Gathering classes info dynamically from a set of directories ! * in path {@link #searchPath}, and statically from a set of jars, like {@link CachedJarsPackageManager}. */ public abstract class PathPackageManager extends CachedJarsPackageManager { --- 7,13 ---- import java.lang.reflect.Modifier; ! /** Path package manager. Gathering classes info dynamically ! * from a set of directories in path {@link #searchPath}, and ! * statically from a set of jars, like {@link CachedJarsPackageManager}. */ public abstract class PathPackageManager extends CachedJarsPackageManager { *************** *** 23,31 **** */ protected boolean packageExists(PyList path,String pkg,String name) { ! String child = pkg.replace('.',File.separatorChar) + File.separator + name; for (int i=0; i < path.__len__(); i++) { String dir = path.get(i).__str__().toString(); ! if(dir.length() == 0) dir = null; if (new File(dir,child).isDirectory()) return true; --- 24,33 ---- */ protected boolean packageExists(PyList path,String pkg,String name) { ! String child = pkg.replace('.',File.separatorChar) + ! File.separator + name; for (int i=0; i < path.__len__(); i++) { String dir = path.get(i).__str__().toString(); ! if (dir.length() == 0) dir = null; if (new File(dir,child).isDirectory()) return true; *************** *** 39,48 **** * Filter out classes using {@link #filterByName},{@link #filterByAccess}. */ ! protected void doDir(PyList path,PyList ret, PyJavaPackage jpkg,boolean instantiate,boolean exclpkgs) { String child=jpkg.__name__.replace('.',File.separatorChar); for (int i=0; i < path.__len__(); i++) { String dir = path.get(i).__str__().toString(); ! if(dir.length() == 0) dir = null; File childFile = new File(dir,child); --- 41,52 ---- * Filter out classes using {@link #filterByName},{@link #filterByAccess}. */ ! protected void doDir(PyList path, PyList ret, PyJavaPackage jpkg, ! boolean instantiate,boolean exclpkgs) ! { String child=jpkg.__name__.replace('.',File.separatorChar); for (int i=0; i < path.__len__(); i++) { String dir = path.get(i).__str__().toString(); ! if (dir.length() == 0) dir = null; File childFile = new File(dir,child); *************** *** 75,91 **** // for opt maybe we should some hash-set for ret ! if (jpkg.__dict__.has_key(name) || jpkg.clsSet.has_key(name) || ret.__contains__(name)) { continue; } ! if(!Character.isJavaIdentifierStart(jname.charAt(0))) continue; ! for(int k = 1; k < jlen; k++) { ! if(!Character.isJavaIdentifierPart(jname.charAt(k))) continue doList; } if(!pkgCand) { try { ! int acc = checkAccess(new BufferedInputStream(new FileInputStream(cand))); ! if ((acc == -1) || filterByAccess(jname, acc) ) continue; } catch(IOException e) { continue; --- 79,101 ---- // for opt maybe we should some hash-set for ret ! if (jpkg.__dict__.has_key(name) || ! jpkg.clsSet.has_key(name) || ! ret.__contains__(name)) { continue; } ! if (!Character.isJavaIdentifierStart(jname.charAt(0))) ! continue; ! for (int k = 1; k < jlen; k++) { ! if (!Character.isJavaIdentifierPart(jname.charAt(k))) ! continue doList; } if(!pkgCand) { try { ! int acc = checkAccess(new BufferedInputStream( ! new FileInputStream(cand))); ! if ((acc == -1) || filterByAccess(jname, acc)) ! continue; } catch(IOException e) { continue; *************** *** 93,98 **** } ! if(instantiate) { ! if(pkgCand) jpkg.addPackage(jname); else jpkg.addLazyClass(jname); } --- 103,108 ---- } ! if (instantiate) { ! if (pkgCand) jpkg.addPackage(jname); else jpkg.addLazyClass(jname); } *************** *** 109,114 **** public void addDirectory(File dir) { try { ! if (dir.getPath().length() == 0) searchPath.append(Py.EmptyString); ! else searchPath.append(new PyString(dir.getCanonicalPath())); } catch(IOException e) { warning("skipping bad directory, '" +dir+ "'"); --- 119,126 ---- public void addDirectory(File dir) { try { ! if (dir.getPath().length() == 0) ! searchPath.append(Py.EmptyString); ! else ! searchPath.append(new PyString(dir.getCanonicalPath())); } catch(IOException e) { warning("skipping bad directory, '" +dir+ "'"); *************** *** 118,129 **** // ??pending: ! // Uses simply split and not a StringTokenizer+trim to adhere to sun jvm parsing of classpath. ! // E.g. "a;" is parsed by sun jvm as a, ""; the latter is interpreted as cwd. ! // jview trims and cwd is per default in classpath. The logic here should work ! // for both(...). Need to distinguish? ! // This code does not avoid duplicates in searchPath. Should cause no problem (?). ! /** Adds "classpath" entry. Calls {@link #addDirectory} if path refers to a dir, {@link #addJarToPackages(java.io.File, boolean)} ! with param cache true if path refers to a jar. ! */ public void addClassPath(String path) { PyList paths = new PyString(path).split(java.io.File.pathSeparator); --- 130,145 ---- // ??pending: ! // Uses simply split and not a StringTokenizer+trim to adhere to ! // sun jvm parsing of classpath. ! // E.g. "a;" is parsed by sun jvm as a, ""; the latter is interpreted ! // as cwd. jview trims and cwd is per default in classpath. ! // The logic here should work for both(...). Need to distinguish? ! // This code does not avoid duplicates in searchPath. ! // Should cause no problem (?). ! ! /** Adds "classpath" entry. Calls {@link #addDirectory} if path ! * refers to a dir, {@link #addJarToPackages(java.io.File, boolean)} ! * with param cache true if path refers to a jar. ! */ public void addClassPath(String path) { PyList paths = new PyString(path).split(java.io.File.pathSeparator); *************** *** 135,144 **** } else { File dir = new File(entry); ! if (entry.length() == 0 || dir.isDirectory()) addDirectory(dir); } } } ! public PyList doDir(PyJavaPackage jpkg,boolean instantiate,boolean exclpkgs) { PyList basic = basicDoDir(jpkg,instantiate,exclpkgs); PyList ret = new PyList(); --- 151,163 ---- } else { File dir = new File(entry); ! if (entry.length() == 0 || dir.isDirectory()) ! addDirectory(dir); } } } ! public PyList doDir(PyJavaPackage jpkg, boolean instantiate, ! boolean exclpkgs) ! { PyList basic = basicDoDir(jpkg,instantiate,exclpkgs); PyList ret = new PyList(); Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -r2.33 -r2.34 *** Py.java 2001/02/01 16:41:10 2.33 --- Py.java 2001/02/02 09:28:36 2.34 *************** *** 19,23 **** public static PyObject None; ! /** The singleton Ellipsis Python object - written as ... when indexing **/ public static PyObject Ellipsis; --- 19,23 ---- public static PyObject None; ! /** The singleton Ellipsis Python object - written as ... when indexing */ public static PyObject Ellipsis; *************** *** 263,267 **** } ! // ??pending: was @deprecated but is actually used by proxie code. Can get rid of it? public static Object tojava(PyObject o, String s) { Class c = findClass(s); --- 263,268 ---- } ! // ??pending: was @deprecated but is actually used by proxie code. ! // Can get rid of it? public static Object tojava(PyObject o, String s) { Class c = findClass(s); *************** *** 281,285 **** return null; ! // Set the current system state to match proxy -- usually this is a waste of time :-( Py.setSystemState(proxy._getPySystemState()); return ret; --- 282,287 ---- return null; ! // Set the current system state to match proxy -- usually ! // this is a waste of time :-( Py.setSystemState(proxy._getPySystemState()); return ret; *************** *** 593,597 **** ClassLoader classLoader = Py.getSystemState().getClassLoader(); if (classLoader != null) { ! writeDebug("import", "trying " + name + " as " + reason + " in classLoader"); return classLoader.loadClass(name); } --- 595,600 ---- ClassLoader classLoader = Py.getSystemState().getClassLoader(); if (classLoader != null) { ! writeDebug("import", "trying " + name + " as " + reason + ! " in classLoader"); return classLoader.loadClass(name); } *************** *** 604,612 **** secEnv=true; } ! writeDebug("import", "trying " + name + " as " + reason + " in syspath loader"); return classLoader.loadClass(name); } ! writeDebug("import", "trying " + name + " as " + reason + " in Class.forName"); return Class.forName(name); } --- 607,617 ---- secEnv=true; } ! writeDebug("import", "trying " + name + " as " + reason + ! " in syspath loader"); return classLoader.loadClass(name); } ! writeDebug("import", "trying " + name + " as " + reason + ! " in Class.forName"); return Class.forName(name); } *************** *** 720,724 **** PyObject mod; ! Class modClass = Py.findClass(module+"$_PyInner"); // ??pending: findClass or should avoid sys.path loading? if (modClass != null) { //System.err.println("found as class: "+modClass); --- 725,730 ---- PyObject mod; ! // ??pending: findClass or should avoid sys.path loading? ! Class modClass = Py.findClass(module+"$_PyInner"); if (modClass != null) { //System.err.println("found as class: "+modClass); *************** *** 755,759 **** Class mainClass=null; try { ! mainClass = Class.forName(module); // ??pending: should use Py.findClass? } catch (ClassNotFoundException exc) { System.err.println("Error running main. Can't find: "+module); --- 761,766 ---- Class mainClass=null; try { ! // ??pending: should use Py.findClass? ! mainClass = Class.forName(module); } catch (ClassNotFoundException exc) { System.err.println("Error running main. Can't find: "+module); *************** *** 770,774 **** } ! public static void runMain(String module, String[] args, String[] packages, String[] props, String frozenPackage, --- 777,782 ---- } ! public static void runMain(String module, String[] args, ! String[] packages, String[] props, String frozenPackage, *************** *** 779,783 **** Class mainClass=null; try { ! mainClass = Class.forName(module); // ??pending: should use Py.findClass? } catch (ClassNotFoundException exc) { System.err.println("Error running main. Can't find: "+module); --- 787,792 ---- Class mainClass=null; try { ! // ??pending: should use Py.findClass? ! mainClass = Class.forName(module); } catch (ClassNotFoundException exc) { System.err.println("Error running main. Can't find: "+module); *************** *** 1101,1105 **** PySystemState oldSystemState = ts.systemState; if (oldSystemState != newSystemState) { ! //System.err.println("Warning: changing systemState for same thread!"); ts.systemState = newSystemState; } --- 1110,1115 ---- PySystemState oldSystemState = ts.systemState; if (oldSystemState != newSystemState) { ! //System.err.println("Warning: changing systemState "+ ! // "for same thread!"); ts.systemState = newSystemState; } *************** *** 1398,1408 **** } ! public static PyCode compile(SimpleNode node, String name, String filename) { return compile(node, name, filename, true, false); } ! public static PyCode compile(SimpleNode node, String name, String filename, ! boolean linenumbers, boolean printResults) { try { --- 1408,1421 ---- } ! public static PyCode compile(SimpleNode node, String name, ! String filename) { return compile(node, name, filename, true, false); } ! public static PyCode compile(SimpleNode node, String name, ! String filename, ! boolean linenumbers, ! boolean printResults) { try { Index: PyBeanEventProperty.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyBeanEventProperty.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** PyBeanEventProperty.java 2001/02/01 16:41:10 2.4 --- PyBeanEventProperty.java 2001/02/02 09:28:36 2.5 *************** *** 62,66 **** Class pc = Py.findClass("org.python.proxies."+c.getName()+"$Adapter"); if (pc == null) { ! //System.err.println("adapter not found for: "+"org.python.proxies."+c.getName()+"$Adapter"); pc = MakeProxies.makeAdapter(c); } --- 62,68 ---- Class pc = Py.findClass("org.python.proxies."+c.getName()+"$Adapter"); if (pc == null) { ! //System.err.println("adapter not found for: "+ ! // "org.python.proxies."+ ! // c.getName()+"$Adapter"); pc = MakeProxies.makeAdapter(c); } Index: PyClass.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyClass.java,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -r2.17 -r2.18 *** PyClass.java 2001/02/01 16:41:10 2.17 --- PyClass.java 2001/02/02 09:28:36 2.18 *************** *** 69,85 **** Class baseClass = null; for (int i=0; i<bases.list.length; i++) { ! Class previousProxy = ((PyClass)bases.list[i]).getProxyClass(); ! if (previousProxy != null) { ! if (previousProxy.isInterface()) { ! interfaces.addElement(previousProxy); } else { if (baseClass != null) { throw Py.TypeError("no multiple inheritance "+ "for Java classes: "+ ! previousProxy.getName()+ " and "+ baseClass.getName()); } ! baseClass = previousProxy; } } --- 69,85 ---- Class baseClass = null; for (int i=0; i<bases.list.length; i++) { ! Class proxy = ((PyClass)bases.list[i]).getProxyClass(); ! if (proxy != null) { ! if (proxy.isInterface()) { ! interfaces.addElement(proxy); } else { if (baseClass != null) { throw Py.TypeError("no multiple inheritance "+ "for Java classes: "+ ! proxy.getName()+ " and "+ baseClass.getName()); } ! baseClass = proxy; } } *************** *** 108,112 **** } } ! //System.out.println("proxyClasses: "+proxyClasses+", "+proxyClasses[0]); if (dict.__finditem__("__doc__") == null) { dict.__setitem__("__doc__", Py.None); --- 108,113 ---- } } ! //System.out.println("proxyClasses: "+proxyClasses+", "+ ! // proxyClasses[0]); if (dict.__finditem__("__doc__") == null) { dict.__setitem__("__doc__", Py.None); *************** *** 151,155 **** resolvedClass = (PyClass)(__bases__.__getitem__(i)); PyObject[] res = resolvedClass.lookupGivingClass(name, ! stop_at_java); result = res[0]; resolvedClass = (PyClass)(res[1]); --- 152,156 ---- resolvedClass = (PyClass)(__bases__.__getitem__(i)); PyObject[] res = resolvedClass.lookupGivingClass(name, ! stop_at_java); result = res[0]; resolvedClass = (PyClass)(res[1]); *************** *** 200,204 **** inst.__init__(args, keywords); ! if (proxyClass != null && PyObject.class.isAssignableFrom(proxyClass)) { // It would be better if we didn't have to create a PyInstance // in the first place. --- 201,206 ---- inst.__init__(args, keywords); ! if (proxyClass != null && ! PyObject.class.isAssignableFrom(proxyClass)) { // It would be better if we didn't have to create a PyInstance // in the first place. Index: PyComplex.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyComplex.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** PyComplex.java 2001/02/01 16:41:10 2.3 --- PyComplex.java 2001/02/02 09:28:36 2.4 *************** *** 209,213 **** z.imag = 0.0; ! return new PyTuple(new PyObject[] {z, value.__sub__(z.__mul__(right))}); } --- 209,214 ---- z.imag = 0.0; ! return new PyTuple(new PyObject[] ! { z, value.__sub__(z.__mul__(right))}); } Index: PyFile.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFile.java,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -r2.14 -r2.15 *** PyFile.java 2001/02/01 16:41:10 2.14 --- PyFile.java 2001/02/02 09:28:36 2.15 *************** *** 302,316 **** int extraCopy = len - copyLength; ! // If the amount remaining is more than a buffer's length, read it ! // directly from the file. if (extraCopy > buffer.length) { file.seek(filePosition); ! extraCopy = file.read( b, off + copyLength, len - copyLength ); } else { ! // ...or read a new buffer full, and copy as much as possible... seek(filePosition, 0); if (!endOfFile) { ! extraCopy = (extraCopy > dataSize) ? dataSize : extraCopy; ! System.arraycopy(buffer, 0, b, off + copyLength, extraCopy); } else { extraCopy = -1; --- 302,320 ---- int extraCopy = len - copyLength; ! // If the amount remaining is more than a buffer's ! // length, read it directly from the file. if (extraCopy > buffer.length) { file.seek(filePosition); ! extraCopy = file.read(b, off + copyLength, ! len - copyLength); } else { ! // ...or read a new buffer full, and copy as much ! // as possible... seek(filePosition, 0); if (!endOfFile) { ! extraCopy = (extraCopy > dataSize) ? ! dataSize : extraCopy; ! System.arraycopy(buffer, 0, b, off + copyLength, ! extraCopy); } else { extraCopy = -1; *************** *** 318,323 **** } ! // If we did manage to copy any more, update the file position and ! // return the amount copied. if (extraCopy > 0) { filePosition += extraCopy; --- 322,327 ---- } ! // If we did manage to copy any more, update the file ! // position and return the amount copied. if (extraCopy > 0) { filePosition += extraCopy; *************** *** 334,345 **** // If the file position is within the data, return the byte... if (filePosition < dataEnd) { ! return (int)(buffer[(int)(filePosition++ - bufferStart)] & 0xff); ! ! // ...or should we indicate EOF... } else if (endOfFile) { return -1; - - // ...or seek to fill the buffer, and try again. } else { seek(filePosition, 0); return read(); --- 338,348 ---- // If the file position is within the data, return the byte... if (filePosition < dataEnd) { ! return (int)(buffer[(int)(filePosition++ - bufferStart)] ! & 0xff); } else if (endOfFile) { + // ...or should we indicate EOF... return -1; } else { + // ...or seek to fill the buffer, and try again. seek(filePosition, 0); return read(); *************** *** 365,374 **** int copyLength = 0; if (filePosition >= bufferStart) ! spaceInBuffer = (int)((bufferStart + buffer.length) - filePosition); if (spaceInBuffer > 0) { // Copy as much as possible to the buffer. ! copyLength = (spaceInBuffer > len) ? len : spaceInBuffer; System.arraycopy(b, 0, buffer, ! (int)(filePosition - bufferStart), copyLength ); bufferModified = true; long myDataEnd = filePosition + copyLength; --- 368,380 ---- int copyLength = 0; if (filePosition >= bufferStart) ! spaceInBuffer = (int)((bufferStart + buffer.length) - ! filePosition); if (spaceInBuffer > 0) { // Copy as much as possible to the buffer. ! copyLength = (spaceInBuffer > len) ? ! len : spaceInBuffer; System.arraycopy(b, 0, buffer, ! (int)(filePosition - bufferStart), ! copyLength ); bufferModified = true; long myDataEnd = filePosition + copyLength; *************** *** 378,383 **** } ! // If there is any data remaining, move to the new position and copy to ! // the new buffer. if (copyLength < len) { seek(filePosition, 0); --- 384,389 ---- } ! // If there is any data remaining, move to the ! // new position and copy to the new buffer. if (copyLength < len) { seek(filePosition, 0); *************** *** 807,811 **** for (int i = 0; (item = a.__finditem__(i)) != null; i++) { if (!(item instanceof PyString)) ! throw Py.TypeError("writelines() argument must be a sequence of strings"); write(item.toString()); } --- 813,818 ---- for (int i = 0; (item = a.__finditem__(i)) != null; i++) { if (!(item instanceof PyString)) ! throw Py.TypeError("writelines() argument must be a " + ! "sequence of strings"); write(item.toString()); } *************** *** 863,867 **** public String toString() { ! return "<file " + name + ", mode " + mode + " at " + Py.id(this) + ">"; } --- 870,875 ---- public String toString() { ! return "<file " + name + ", mode " + mode + " at " + ! Py.id(this) + ">"; } Index: PyFloat.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFloat.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** PyFloat.java 2001/02/01 16:41:10 2.5 --- PyFloat.java 2001/02/02 09:28:36 2.6 *************** *** 45,53 **** if (fractPart == 0) { ! if (intPart <= Integer.MAX_VALUE && intPart >= Integer.MIN_VALUE) { return (int)value; ! } else { return __long__().hashCode(); - } } else { long v = Double.doubleToLongBits(value); --- 45,52 ---- if (fractPart == 0) { ! if (intPart <= Integer.MAX_VALUE && intPart >= Integer.MIN_VALUE) return (int)value; ! else return __long__().hashCode(); } else { long v = Double.doubleToLongBits(value); *************** *** 239,243 **** if (value == 0.0) { if (iw < 0.0) ! throw Py.ZeroDivisionError("0.0 cannot be raised to a negative power"); return new PyFloat(0); } --- 238,243 ---- if (value == 0.0) { if (iw < 0.0) ! throw Py.ZeroDivisionError("0.0 cannot be raised to a " + ! "negative power"); return new PyFloat(0); } Index: PyFunction.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyFunction.java,v retrieving revision 2.6 retrieving revision 2.7 diff -C2 -r2.6 -r2.7 *** PyFunction.java 2001/02/01 16:41:10 2.6 --- PyFunction.java 2001/02/02 09:28:36 2.7 *************** *** 147,151 **** return func_code.call(args, keywords, func_globals, func_defaults); } ! public PyObject __call__(PyObject arg1, PyObject[] args, String[] keywords) { return func_code.call(arg1, args, keywords, func_globals, --- 147,152 ---- return func_code.call(args, keywords, func_globals, func_defaults); } ! public PyObject __call__(PyObject arg1, PyObject[] args, ! String[] keywords) { return func_code.call(arg1, args, keywords, func_globals, Index: PyInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInstance.java,v retrieving revision 2.16 retrieving revision 2.17 diff -C2 -r2.16 -r2.17 *** PyInstance.java 2001/02/01 16:41:10 2.16 --- PyInstance.java 2001/02/02 09:28:36 2.17 *************** *** 180,198 **** } - /*private PyProxy createProxy(Class c) { - try { - return (PyProxy)c.getConstructor(new Class[] {PyInstance.class}).newInstance(new Object[] {this}); - } catch (Exception exc) { - throw Py.JavaError(exc); - } - }*/ - - /*public PyObject __jgetattr__(String name) { - System.err.println("jgetting: "+name); - PyObject ret = __findattr__(name, true); - if (ret != null) return ret; - throw Py.AttributeError(name); - }*/ - public PyObject __jfindattr__(String name) { //System.err.println("jfinding: "+name); --- 180,183 ---- Index: PyInteger.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyInteger.java,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** PyInteger.java 2001/02/01 16:41:10 2.7 --- PyInteger.java 2001/02/02 09:28:36 2.8 *************** *** 224,230 **** if (pow < 0) { if (value != 0) ! throw Py.ValueError("cannot raise integer to a negative power"); else ! throw Py.ZeroDivisionError("cannot raise 0 to a negative power"); } --- 224,232 ---- if (pow < 0) { if (value != 0) ! throw Py.ValueError("cannot raise integer to a " + ! "negative power"); else ! throw Py.ZeroDivisionError("cannot raise 0 to a " + ! "negative power"); } Index: PyJavaClass.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyJavaClass.java,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -r2.31 -r2.32 *** PyJavaClass.java 2001/02/01 16:41:10 2.31 --- PyJavaClass.java 2001/02/02 09:28:36 2.32 *************** *** 109,113 **** } catch (Exception exc) { ! // System.err.println("Got exception: " + exc + " " + proxyClass); throw Py.JavaError(exc); } --- 109,114 ---- } catch (Exception exc) { ! // System.err.println("Got exception: " + exc + " " + ! // proxyClass); throw Py.JavaError(exc); } *************** *** 146,162 **** if (!PyObject.class.isAssignableFrom(c)) return; - - // // Handle the special static __class__ fields on PyObject instances - // if (name == "__class__" && isstatic && - // PyObject.class.isAssignableFrom(field.getDeclaringClass()) && - // field.getType().isAssignableFrom(PyJavaClass.class)) { - // try { - // field.set(null, this); - // continue; - // } catch (Throwable t) { - // System.err.println("invalid __class__ field on: "+c.getName()); - // } - // } - try { Field field = c.getField("__class__"); --- 147,150 ---- *************** *** 786,790 **** inst.__init__(args, keywords); ! if (proxyClass != null && PyObject.class.isAssignableFrom(proxyClass)) { // It would be better if we didn't have to create a PyInstance // in the first place. --- 774,779 ---- inst.__init__(args, keywords); ! if (proxyClass != null && ! PyObject.class.isAssignableFrom(proxyClass)) { // It would be better if we didn't have to create a PyInstance // in the first place. Index: PyJavaInstance.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyJavaInstance.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** PyJavaInstance.java 2001/02/01 16:41:10 2.3 --- PyJavaInstance.java 2001/02/02 09:28:37 2.4 *************** *** 68,73 **** protected void unassignableField(String name, PyObject value) { ! throw Py.TypeError("can't assign to this attribute in java instance: "+ ! name); } --- 68,73 ---- protected void unassignableField(String name, PyObject value) { ! throw Py.TypeError("can't assign to this attribute in java " + ! "instance: " + name); } Index: PyJavaPackage.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PyJavaPackage.java,v retrieving revision 2.8 retrieving revision 2.9 diff -C2 -r2.8 -r2.9 *** PyJavaPackage.java 2001/02/01 16:41:10 2.8 --- PyJavaPackage.java 2001/02/02 09:28:37 2.9 *************** *** 70,77 **** PyJavaPackage p = (PyJavaPackage)__dict__.__finditem__(firstName); if (p == null) { ! p = new PyJavaPacka... [truncated message content] |
Update of /cvsroot/jython/jython/org/python/core In directory usw-pr-cvs1:/tmp/cvs-serv4687 Modified Files: ArgParser.java AutoInternalTables.java BytecodeLoader.java BytecodeLoader1.java BytecodeLoader2.java CachedJarsPackageManager.java ClassDictInit.java CollectionProxy.java InternalTables.java InternalTables1.java InternalTables2.java Java2Accessibility.java JavaAccessibility.java MakeProxies.java Options.java PackageManager.java PathPackageManager.java Py.java PyArray.java PyBeanEventProperty.java PyBeanProperty.java PyBuiltinFunctionSet.java PyClass.java PyCode.java PyComplex.java PyDictionary.java PyException.java PyFile.java PyFloat.java PyFrame.java PyFunction.java PyInstance.java PyInteger.java PyJavaClass.java PyJavaInstance.java PyJavaPackage.java PyList.java PyLong.java PyMethod.java PyModule.java PyObject.java PyProxy.java PyReflectedConstructor.java PyReflectedField.java PyReflectedFunction.java PySequence.java PyString.java PyStringMap.java PySyntaxError.java PySystemState.java PyTableCode.java PyTuple.java PyXRange.java ReflectedArgs.java ReflectedCallData.java SoftIInternalTables.java StdoutWrapper.java SysPackageManager.java SyspathJavaLoader.java ThreadState.java ThreadStateMapping.java ThreadStateMapping2.java WeakInternalTables.java __builtin__.java codecs.java imp.java parser.java Log Message: Consistent formatting. Removed traling spaces and tabs. Index: ArgParser.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/ArgParser.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ArgParser.java 2000/10/28 11:53:10 1.1 --- ArgParser.java 2001/02/01 16:41:10 1.2 *************** *** 3,11 **** /** * A utilityclass for handling mixed positional and keyword arguments. ! * * A typical usage: * <pre> * public MatchObject search(PyObject[] args, String[] kws) { ! * ArgParser ap = new ArgParser("search", args, kws, * "pattern", "pos", "endpos"); * String string = ap.getString(0); --- 3,11 ---- /** * A utilityclass for handling mixed positional and keyword arguments. ! * * A typical usage: * <pre> * public MatchObject search(PyObject[] args, String[] kws) { ! * ArgParser ap = new ArgParser("search", args, kws, * "pattern", "pos", "endpos"); * String string = ap.getString(0); *************** *** 46,50 **** } ! public ArgParser(String funcname, PyObject[] args, String[] kws, String p0, String p1) { this(funcname, args, kws); --- 46,50 ---- } ! public ArgParser(String funcname, PyObject[] args, String[] kws, String p0, String p1) { this(funcname, args, kws); *************** *** 60,64 **** } ! public ArgParser(String funcname, PyObject[] args, String[] kws, String[] paramnames) { this(funcname, args, kws); --- 60,64 ---- } ! public ArgParser(String funcname, PyObject[] args, String[] kws, String[] paramnames) { this(funcname, args, kws); *************** *** 117,121 **** PyObject ret = getOptionalArg(pos); if (ret == null) ! throw Py.TypeError(funcname + ": The " + ordinal(pos) + " argument is required"); return ret; --- 117,121 ---- PyObject ret = getOptionalArg(pos); if (ret == null) ! throw Py.TypeError(funcname + ": The " + ordinal(pos) + " argument is required"); return ret; *************** *** 149,153 **** Object ret = value.__tojava__(clss); ! if (ret == Py.NoConversion) throw Py.TypeError("argument " + (pos+1) + ": expected " + classname + ", " + Py.safeRepr(value) + --- 149,153 ---- Object ret = value.__tojava__(clss); ! if (ret == Py.NoConversion) throw Py.TypeError("argument " + (pos+1) + ": expected " + classname + ", " + Py.safeRepr(value) + Index: AutoInternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/AutoInternalTables.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** AutoInternalTables.java 2001/02/01 13:48:26 2.3 --- AutoInternalTables.java 2001/02/01 16:41:10 2.4 *************** *** 1,4 **** // Copyright 2000 Samuele Pedroni ! package org.python.core; --- 1,4 ---- // Copyright 2000 Samuele Pedroni ! package org.python.core; *************** *** 7,17 **** public abstract class AutoInternalTables extends InternalTables2 { ! protected ReferenceQueue queue = new ReferenceQueue(); protected abstract Reference newAutoRef(short type,Object key, Object obj); ! protected abstract short getAutoRefType(Reference ref); protected abstract Object getAutoRefKey(Reference ref); ! private synchronized void cleanup() { if (keepstable >= GSTABLE) --- 7,17 ---- public abstract class AutoInternalTables extends InternalTables2 { ! protected ReferenceQueue queue = new ReferenceQueue(); protected abstract Reference newAutoRef(short type,Object key, Object obj); ! protected abstract short getAutoRefType(Reference ref); protected abstract Object getAutoRefKey(Reference ref); ! private synchronized void cleanup() { if (keepstable >= GSTABLE) *************** *** 25,29 **** Class cl = (Class)key; classes.remove(cl); ! classesDec(cl.getName()); break; case LAZY_JCLASS: --- 25,29 ---- Class cl = (Class)key; classes.remove(cl); ! classesDec(cl.getName()); break; case LAZY_JCLASS: *************** *** 31,45 **** break; case ADAPTER_CLASS: ! adapterClasses.remove(key); } } } ! ! protected boolean queryCanonical(String name) { cleanup(); return super.queryCanonical(name); } ! protected PyJavaClass getCanonical(Class c) { cleanup(); --- 31,45 ---- break; case ADAPTER_CLASS: ! adapterClasses.remove(key); } } } ! ! protected boolean queryCanonical(String name) { cleanup(); return super.queryCanonical(name); } ! protected PyJavaClass getCanonical(Class c) { cleanup(); *************** *** 48,52 **** return (PyJavaClass)ref.get(); } ! protected PyJavaClass getLazyCanonical(String name) { cleanup(); --- 48,52 ---- return (PyJavaClass)ref.get(); } ! protected PyJavaClass getLazyCanonical(String name) { cleanup(); *************** *** 55,64 **** return (PyJavaClass)ref.get(); } ! protected void putCanonical(Class c,PyJavaClass canonical) { cleanup(); classesPut(c,newAutoRef(JCLASS,c,canonical)); } ! protected void putLazyCanonical(String name,PyJavaClass canonical) { cleanup(); --- 55,64 ---- return (PyJavaClass)ref.get(); } ! protected void putCanonical(Class c,PyJavaClass canonical) { cleanup(); classesPut(c,newAutoRef(JCLASS,c,canonical)); } ! protected void putLazyCanonical(String name,PyJavaClass canonical) { cleanup(); *************** *** 72,76 **** return (Class)ref.get(); } ! protected void putAdapterClass(Class c,Class ac) { cleanup(); --- 72,76 ---- return (Class)ref.get(); } ! protected void putAdapterClass(Class c,Class ac) { cleanup(); *************** *** 82,94 **** return super.getAdapter(o,evc); } ! protected void putAdapter(Object o,String evc,Object ad) { cleanup(); super.putAdapter(o,evc,ad); } ! ! public boolean _doesSomeAutoUnload() { return true; } ! public void _forceCleanup() { cleanup(); } --- 82,94 ---- return super.getAdapter(o,evc); } ! protected void putAdapter(Object o,String evc,Object ad) { cleanup(); super.putAdapter(o,evc,ad); } ! ! public boolean _doesSomeAutoUnload() { return true; } ! public void _forceCleanup() { cleanup(); } *************** *** 97,106 **** super._beginCanonical(); } ! public void _beginLazyCanonical() { cleanup(); super._beginLazyCanonical(); } ! public void _beginOverAdapterClasses() { cleanup(); --- 97,106 ---- super._beginCanonical(); } ! public void _beginLazyCanonical() { cleanup(); super._beginLazyCanonical(); } ! public void _beginOverAdapterClasses() { cleanup(); *************** *** 108,112 **** } ! public void _beginOverAdapters() { cleanup(); --- 108,112 ---- } ! public void _beginOverAdapters() { cleanup(); *************** *** 117,122 **** if (iterType == ADAPTER) { Object ret = super._next(); ! if (ret != null) return ret; ! } else { while(iter.hasNext()) { cur = iter.next(); --- 117,122 ---- if (iterType == ADAPTER) { Object ret = super._next(); ! if (ret != null) return ret; ! } else { while(iter.hasNext()) { cur = iter.next(); *************** *** 139,152 **** cur = null; iter = null; ! endStable(); } cleanup(); return null; } ! public void _flush(PyJavaClass jc) { cleanup(); super._flush(jc); } ! } --- 139,152 ---- cur = null; iter = null; ! endStable(); } cleanup(); return null; } ! public void _flush(PyJavaClass jc) { cleanup(); super._flush(jc); } ! } Index: BytecodeLoader.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/BytecodeLoader.java,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** BytecodeLoader.java 2000/12/17 19:46:26 2.10 --- BytecodeLoader.java 2001/02/01 16:41:10 2.11 *************** *** 16,20 **** ! static Class findParentClass(Vector parents, String name) throws ClassNotFoundException { --- 16,20 ---- ! static Class findParentClass(Vector parents, String name) throws ClassNotFoundException { *************** *** 24,28 **** } catch(ClassNotFoundException e) { } } ! // couldn't find the .class file on sys.path throw new ClassNotFoundException(name); } --- 24,28 ---- } catch(ClassNotFoundException e) { } } ! // couldn't find the .class file on sys.path throw new ClassNotFoundException(name); } Index: BytecodeLoader1.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/BytecodeLoader1.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** BytecodeLoader1.java 2000/12/17 19:46:26 2.1 --- BytecodeLoader1.java 2001/02/01 16:41:10 2.2 *************** *** 7,11 **** public class BytecodeLoader1 extends ClassLoader implements Loader { private Vector parents; ! public BytecodeLoader1() { parents = BytecodeLoader.init(); --- 7,11 ---- public class BytecodeLoader1 extends ClassLoader implements Loader { private Vector parents; ! public BytecodeLoader1() { parents = BytecodeLoader.init(); *************** *** 16,24 **** parents.addElement(referent); } ! // override from abstract base class protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException ! { Class c = findLoadedClass(name); if (c != null) --- 16,24 ---- parents.addElement(referent); } ! // override from abstract base class protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException ! { Class c = findLoadedClass(name); if (c != null) Index: BytecodeLoader2.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/BytecodeLoader2.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** BytecodeLoader2.java 2000/12/17 19:46:26 2.1 --- BytecodeLoader2.java 2001/02/01 16:41:10 2.2 *************** *** 8,12 **** public class BytecodeLoader2 extends SecureClassLoader implements Loader { private Vector parents; ! public BytecodeLoader2() { parents = BytecodeLoader.init(); --- 8,12 ---- public class BytecodeLoader2 extends SecureClassLoader implements Loader { private Vector parents; ! public BytecodeLoader2() { parents = BytecodeLoader.init(); *************** *** 17,25 **** parents.addElement(referent); } ! // override from abstract base class protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException ! { Class c = findLoadedClass(name); if (c != null) --- 17,25 ---- parents.addElement(referent); } ! // override from abstract base class protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException ! { Class c = findLoadedClass(name); if (c != null) Index: CachedJarsPackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CachedJarsPackageManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** CachedJarsPackageManager.java 2001/01/15 04:43:30 1.4 --- CachedJarsPackageManager.java 2001/02/01 16:41:10 1.5 *************** *** 175,186 **** addJarToPackages(null,jarfile,cache); } ! private void addJarToPackages(URL jarurl,File jarfile,boolean cache) { ! try { boolean caching = jarfiles!=null; URLConnection jarconn = null; boolean localfile = true; ! if (jarfile == null) { jarconn = jarurl.openConnection(); --- 175,186 ---- addJarToPackages(null,jarfile,cache); } ! private void addJarToPackages(URL jarurl,File jarfile,boolean cache) { ! try { boolean caching = jarfiles!=null; URLConnection jarconn = null; boolean localfile = true; ! if (jarfile == null) { jarconn = jarurl.openConnection(); *************** *** 190,199 **** if(jarconn.getURL().getProtocol().equals("file")) { // ??pending: need to use java2 URLDecoder.decode? ! // but under 1.1 this is absent and should be simulated. ! jarfile = new File(jarurl.getFile().replace('/',File.separatorChar)); } else localfile = false; } ! if (localfile && !jarfile.exists()) return; --- 190,199 ---- if(jarconn.getURL().getProtocol().equals("file")) { // ??pending: need to use java2 URLDecoder.decode? ! // but under 1.1 this is absent and should be simulated. ! jarfile = new File(jarurl.getFile().replace('/',File.separatorChar)); } else localfile = false; } ! if (localfile && !jarfile.exists()) return; *************** *** 260,264 **** if (jarconn == null) jarin = new BufferedInputStream(new FileInputStream(jarfile)); else jarin = jarconn.getInputStream(); ! zipPackages = getZipPackages(jarin); --- 260,264 ---- if (jarconn == null) jarin = new BufferedInputStream(new FileInputStream(jarfile)); else jarin = jarconn.getInputStream(); ! zipPackages = getZipPackages(jarin); *************** *** 401,405 **** // hooks for changing cache storage ! /** To pass a cachefile id by ref. And for internal use. * @see #outCreateCacheFile --- 401,405 ---- // hooks for changing cache storage ! /** To pass a cachefile id by ref. And for internal use. * @see #outCreateCacheFile Index: ClassDictInit.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/ClassDictInit.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** ClassDictInit.java 2000/10/17 19:14:19 2.2 --- ClassDictInit.java 2001/02/01 16:41:10 2.3 *************** *** 4,8 **** /** ! * An empty tagging interface. If a java class implements this * interface, it must also have a method like: * <pre> --- 4,8 ---- /** ! * An empty tagging interface. If a java class implements this * interface, it must also have a method like: * <pre> Index: CollectionProxy.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/CollectionProxy.java,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** CollectionProxy.java 1999/05/17 19:59:37 2.1 --- CollectionProxy.java 2001/02/01 16:41:10 2.2 *************** *** 6,10 **** public class CollectionProxy { public static final CollectionProxy NoProxy = new EnumerationProxy(null); ! private static boolean checkedJava2 = false; private static CollectionProxy java2Proxy = null; --- 6,10 ---- public class CollectionProxy { public static final CollectionProxy NoProxy = new EnumerationProxy(null); ! private static boolean checkedJava2 = false; private static CollectionProxy java2Proxy = null; *************** *** 12,19 **** return null; } ! public static CollectionProxy findCollection(Object object) { if (object == null) return NoProxy; ! if (!checkedJava2) { checkedJava2 = true; --- 12,19 ---- return null; } ! public static CollectionProxy findCollection(Object object) { if (object == null) return NoProxy; ! if (!checkedJava2) { checkedJava2 = true; *************** *** 109,122 **** class VectorProxy extends CollectionProxy { Vector proxy; ! public VectorProxy(Vector proxy) { this.proxy = proxy; ! } ! public int __len__() { return proxy.size(); ! } ! ! public PyObject __finditem__(int key) { try { --- 109,122 ---- class VectorProxy extends CollectionProxy { Vector proxy; ! public VectorProxy(Vector proxy) { this.proxy = proxy; ! } ! public int __len__() { return proxy.size(); ! } ! ! public PyObject __finditem__(int key) { try { *************** *** 126,130 **** } } ! public PyObject __finditem__(PyObject key) { if (key instanceof PyInteger) { --- 126,130 ---- } } ! public PyObject __finditem__(PyObject key) { if (key instanceof PyInteger) { *************** *** 134,138 **** } } ! public void __setitem__(PyObject key, PyObject value) { if (key instanceof PyInteger) { --- 134,138 ---- } } ! public void __setitem__(PyObject key, PyObject value) { if (key instanceof PyInteger) { *************** *** 154,175 **** class DictionaryProxy extends CollectionProxy { Dictionary proxy; ! public DictionaryProxy(Dictionary proxy) { this.proxy = proxy; ! } ! public int __len__() { return proxy.size(); } ! public PyObject __finditem__(PyObject key) { return Py.java2py(proxy.get(Py.tojava(key, Object.class))); } ! public void __setitem__(PyObject key, PyObject value) { proxy.put(Py.tojava(key, Object.class), Py.tojava(value, Object.class)); } ! public void __delitem__(PyObject key) { proxy.remove(Py.tojava(key, Object.class)); --- 154,175 ---- class DictionaryProxy extends CollectionProxy { Dictionary proxy; ! public DictionaryProxy(Dictionary proxy) { this.proxy = proxy; ! } ! public int __len__() { return proxy.size(); } ! public PyObject __finditem__(PyObject key) { return Py.java2py(proxy.get(Py.tojava(key, Object.class))); } ! public void __setitem__(PyObject key, PyObject value) { proxy.put(Py.tojava(key, Object.class), Py.tojava(value, Object.class)); } ! public void __delitem__(PyObject key) { proxy.remove(Py.tojava(key, Object.class)); Index: InternalTables.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** InternalTables.java 2001/02/01 13:48:26 2.5 --- InternalTables.java 2001/02/01 16:41:10 2.6 *************** *** 1,8 **** // Copyright 2000 Samuele Pedroni ! package org.python.core; public abstract class InternalTables { ! // x__ --> org.python.core.X__InternalTables // (x|X)__> --> org.python.core.X__InternalTables --- 1,8 ---- // Copyright 2000 Samuele Pedroni ! package org.python.core; public abstract class InternalTables { ! // x__ --> org.python.core.X__InternalTables // (x|X)__> --> org.python.core.X__InternalTables *************** *** 34,38 **** // System.err.println("*InternalTables*-create-try: "+id); // ??dbg return (InternalTables)Class.forName(id).newInstance(); ! } catch(Throwable e) { // System.err.println(" exc: "+e); // ??dbg --- 34,38 ---- // System.err.println("*InternalTables*-create-try: "+id); // ??dbg return (InternalTables)Class.forName(id).newInstance(); ! } catch(Throwable e) { // System.err.println(" exc: "+e); // ??dbg *************** *** 40,44 **** } } ! static InternalTables createInternalTables() { String cands = PySystemState.registry.getProperty("python.options.internalTablesImpl"); --- 40,44 ---- } } ! static InternalTables createInternalTables() { String cands = PySystemState.registry.getProperty("python.options.internalTablesImpl"); *************** *** 54,62 **** return null; // never reached } ! protected abstract boolean queryCanonical(String name); protected abstract PyJavaClass getCanonical(Class c); protected abstract PyJavaClass getLazyCanonical(String name); ! protected abstract void putCanonical(Class c,PyJavaClass canonical); protected abstract void putLazyCanonical(String name,PyJavaClass canonical); --- 54,62 ---- return null; // never reached } ! protected abstract boolean queryCanonical(String name); protected abstract PyJavaClass getCanonical(Class c); protected abstract PyJavaClass getLazyCanonical(String name); ! protected abstract void putCanonical(Class c,PyJavaClass canonical); protected abstract void putLazyCanonical(String name,PyJavaClass canonical); *************** *** 67,91 **** protected abstract Object getAdapter(Object o,String evc); protected abstract void putAdapter(Object o,String evc,Object ad); ! public boolean _doesSomeAutoUnload() { return false; } ! public void _forceCleanup() {} public abstract void _beginCanonical(); public abstract void _beginLazyCanonical(); ! public abstract void _beginOverAdapterClasses(); public abstract void _beginOverAdapters(); ! public abstract Object _next(); public abstract void _flushCurrent(); ! public abstract void _flush(PyJavaClass jc); - static public class _LazyRep { public String name; public PackageManager mgr; ! _LazyRep(String name, PackageManager mgr) { this.name = name; --- 67,91 ---- protected abstract Object getAdapter(Object o,String evc); protected abstract void putAdapter(Object o,String evc,Object ad); ! public boolean _doesSomeAutoUnload() { return false; } ! public void _forceCleanup() {} public abstract void _beginCanonical(); public abstract void _beginLazyCanonical(); ! public abstract void _beginOverAdapterClasses(); public abstract void _beginOverAdapters(); ! public abstract Object _next(); public abstract void _flushCurrent(); ! public abstract void _flush(PyJavaClass jc); + static public class _LazyRep { public String name; public PackageManager mgr; ! _LazyRep(String name, PackageManager mgr) { this.name = name; *************** *** 93,96 **** } } ! } --- 93,96 ---- } } ! } Index: InternalTables1.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables1.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** InternalTables1.java 2001/02/01 13:48:26 2.3 --- InternalTables1.java 2001/02/01 16:41:10 2.4 *************** *** 1,4 **** // Copyright 2000 Samuele Pedroni ! package org.python.core; --- 1,4 ---- // Copyright 2000 Samuele Pedroni ! package org.python.core; *************** *** 17,36 **** private static class TableProvid1 extends Hashtable implements Table { } ! final protected static short JCLASS=0; final protected static short LAZY_JCLASS=1; final protected static short ADAPTER_CLASS=2; final protected static short ADAPTER = 3; ! protected Table classes; protected Table temp; protected Table counters; protected Table lazyClasses; ! protected Table adapterClasses; ! protected final short GSTABLE=1; protected final short JCSTABLE=2; ! protected short keepstable; --- 17,36 ---- private static class TableProvid1 extends Hashtable implements Table { } ! final protected static short JCLASS=0; final protected static short LAZY_JCLASS=1; final protected static short ADAPTER_CLASS=2; final protected static short ADAPTER = 3; ! protected Table classes; protected Table temp; protected Table counters; protected Table lazyClasses; ! protected Table adapterClasses; ! protected final short GSTABLE=1; protected final short JCSTABLE=2; ! protected short keepstable; *************** *** 38,42 **** keepstable = lvl; } ! protected void classesPut(Class c,Object jc) { if (keepstable == JCSTABLE) { --- 38,42 ---- keepstable = lvl; } ! protected void classesPut(Class c,Object jc) { if (keepstable == JCSTABLE) { *************** *** 55,59 **** } } ! protected Object classesGet(Class c) { Object o = classes.get(c); --- 55,59 ---- } } ! protected Object classesGet(Class c) { Object o = classes.get(c); *************** *** 67,71 **** keepstable = 0; } ! protected void classesDec(String name) { int c = ((Integer)counters.get(name)).intValue(); --- 67,71 ---- keepstable = 0; } ! protected void classesDec(String name) { int c = ((Integer)counters.get(name)).intValue(); *************** *** 75,79 **** counters.put(name,new Integer(c-1)); } ! protected void commitTemp() { for(Enumeration e=((Hashtable)temp).keys();e.hasMoreElements();) { --- 75,79 ---- counters.put(name,new Integer(c-1)); } ! protected void commitTemp() { for(Enumeration e=((Hashtable)temp).keys();e.hasMoreElements();) { *************** *** 83,111 **** temp.clear(); } ! protected boolean queryCanonical(String name) { return counters.get(name) != null || lazyClasses.get(name) != null; } ! protected PyJavaClass getCanonical(Class c) { return (PyJavaClass)classesGet(c); } ! protected PyJavaClass getLazyCanonical(String name) { return (PyJavaClass)lazyClasses.get(name); } ! protected void putCanonical(Class c,PyJavaClass canonical) { classesPut(c,canonical); } ! protected void putLazyCanonical(String name,PyJavaClass canonical) { lazyClasses.put(name,canonical); } ! protected Class getAdapterClass(Class c) { return (Class)adapterClasses.get(c); } ! protected void putAdapterClass(Class c,Class ac) { adapterClasses.put(c,ac); --- 83,111 ---- temp.clear(); } ! protected boolean queryCanonical(String name) { return counters.get(name) != null || lazyClasses.get(name) != null; } ! protected PyJavaClass getCanonical(Class c) { return (PyJavaClass)classesGet(c); } ! protected PyJavaClass getLazyCanonical(String name) { return (PyJavaClass)lazyClasses.get(name); } ! protected void putCanonical(Class c,PyJavaClass canonical) { classesPut(c,canonical); } ! protected void putLazyCanonical(String name,PyJavaClass canonical) { lazyClasses.put(name,canonical); } ! protected Class getAdapterClass(Class c) { return (Class)adapterClasses.get(c); } ! protected void putAdapterClass(Class c,Class ac) { adapterClasses.put(c,ac); *************** *** 113,121 **** private Hashtable adapters; ! protected Object getAdapter(Object o,String evc) { ! return adapters.get(evc+'$'+System.identityHashCode(o)); } ! protected void putAdapter(Object o,String evc,Object ad) { adapters.put(evc+'$'+System.identityHashCode(o),ad); --- 113,121 ---- private Hashtable adapters; ! protected Object getAdapter(Object o,String evc) { ! return adapters.get(evc+'$'+System.identityHashCode(o)); } ! protected void putAdapter(Object o,String evc,Object ad) { adapters.put(evc+'$'+System.identityHashCode(o),ad); *************** *** 127,131 **** private Enumeration enum; private Hashtable enumTable; ! public void _beginCanonical() { beginStable(JCSTABLE); --- 127,131 ---- private Enumeration enum; private Hashtable enumTable; ! public void _beginCanonical() { beginStable(JCSTABLE); *************** *** 134,138 **** iterType = JCLASS; } ! public void _beginLazyCanonical() { enum = ((TableProvid1)lazyClasses).keys(); --- 134,138 ---- iterType = JCLASS; } ! public void _beginLazyCanonical() { enum = ((TableProvid1)lazyClasses).keys(); *************** *** 140,153 **** iterType = LAZY_JCLASS; } ! public void _beginOverAdapterClasses() { enum = ((TableProvid1)adapterClasses).keys(); enumTable = (TableProvid1)adapterClasses; iterType = ADAPTER_CLASS; ! } ! public void _beginOverAdapters() { ! enum = adapters.keys(); enumTable = adapters; iterType = ADAPTER; --- 140,153 ---- iterType = LAZY_JCLASS; } ! public void _beginOverAdapterClasses() { enum = ((TableProvid1)adapterClasses).keys(); enumTable = (TableProvid1)adapterClasses; iterType = ADAPTER_CLASS; ! } ! public void _beginOverAdapters() { ! enum = adapters.keys(); enumTable = adapters; iterType = ADAPTER; *************** *** 155,159 **** public Object _next() { ! if(enum.hasMoreElements()) { cur = enum.nextElement(); switch(iterType) { --- 155,159 ---- public Object _next() { ! if(enum.hasMoreElements()) { cur = enum.nextElement(); switch(iterType) { *************** *** 174,183 **** return null; } ! public void _flushCurrent() { enumTable.remove(cur); if (iterType == JCLASS) classesDec(((Class)cur).getName()); } ! public void _flush(PyJavaClass jc) { Class c = jc.proxyClass; --- 174,183 ---- return null; } ! public void _flushCurrent() { enumTable.remove(cur); if (iterType == JCLASS) classesDec(((Class)cur).getName()); } ! public void _flush(PyJavaClass jc) { Class c = jc.proxyClass; *************** *** 189,196 **** } } ! protected InternalTables1(boolean fake) { } ! public InternalTables1() { classes = new TableProvid1(); --- 189,196 ---- } } ! protected InternalTables1(boolean fake) { } ! public InternalTables1() { classes = new TableProvid1(); *************** *** 198,204 **** counters = new TableProvid1(); lazyClasses = new TableProvid1(); ! adapterClasses = new TableProvid1(); ! adapters = new Hashtable(); } --- 198,204 ---- counters = new TableProvid1(); lazyClasses = new TableProvid1(); ! adapterClasses = new TableProvid1(); ! adapters = new Hashtable(); } Index: InternalTables2.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/InternalTables2.java,v retrieving revision 2.3 retrieving revision 2.4 diff -C2 -r2.3 -r2.4 *** InternalTables2.java 2001/01/23 02:07:22 2.3 --- InternalTables2.java 2001/02/01 16:41:10 2.4 *************** *** 1,4 **** // Copyright 2000 Samuele Pedroni ! package org.python.core; --- 1,4 ---- // Copyright 2000 Samuele Pedroni ! package org.python.core; *************** *** 7,11 **** public class InternalTables2 extends InternalTables1 { ! protected static class TableProvid2 extends HashMap implements Table { } --- 7,11 ---- public class InternalTables2 extends InternalTables1 { ! protected static class TableProvid2 extends HashMap implements Table { } *************** *** 14,21 **** ((TableProvid2)classes).putAll((TableProvid2)temp); temp.clear(); ! } protected WeakHashMap adapters; ! protected Object getAdapter(Object o,String evc) { HashMap ads = (HashMap)adapters.get(o); --- 14,21 ---- ((TableProvid2)classes).putAll((TableProvid2)temp); temp.clear(); ! } protected WeakHashMap adapters; ! protected Object getAdapter(Object o,String evc) { HashMap ads = (HashMap)adapters.get(o); *************** *** 25,29 **** return adw.get(); } ! protected void putAdapter(Object o,String evc,Object ad) { HashMap ads = (HashMap)adapters.get(o); --- 25,29 ---- return adw.get(); } ! protected void putAdapter(Object o,String evc,Object ad) { HashMap ads = (HashMap)adapters.get(o); *************** *** 35,41 **** } ! protected Iterator iter; protected Iterator grand; ! public void _beginCanonical() { beginStable(JCSTABLE); --- 35,41 ---- } ! protected Iterator iter; protected Iterator grand; ! public void _beginCanonical() { beginStable(JCSTABLE); *************** *** 43,47 **** iterType = JCLASS; } ! public void _beginLazyCanonical() { beginStable(GSTABLE); --- 43,47 ---- iterType = JCLASS; } ! public void _beginLazyCanonical() { beginStable(GSTABLE); *************** *** 49,60 **** iterType = LAZY_JCLASS; } ! public void _beginOverAdapterClasses() { beginStable(GSTABLE); iter = ((TableProvid2)adapterClasses).entrySet().iterator(); iterType = ADAPTER_CLASS; ! } ! public void _beginOverAdapters() { beginStable((short)0); --- 49,60 ---- iterType = LAZY_JCLASS; } ! public void _beginOverAdapterClasses() { beginStable(GSTABLE); iter = ((TableProvid2)adapterClasses).entrySet().iterator(); iterType = ADAPTER_CLASS; ! } ! public void _beginOverAdapters() { beginStable((short)0); *************** *** 101,105 **** return null; } ! public void _flushCurrent() { iter.remove(); --- 101,105 ---- return null; } ! public void _flushCurrent() { iter.remove(); *************** *** 112,126 **** } } ! public InternalTables2() { super(true); ! classes = new TableProvid2(); temp = new TableProvid2(); counters = new TableProvid2(); lazyClasses = new TableProvid2(); ! adapterClasses = new TableProvid2(); ! adapters = new WeakHashMap(); } --- 112,126 ---- } } ! public InternalTables2() { super(true); ! classes = new TableProvid2(); temp = new TableProvid2(); counters = new TableProvid2(); lazyClasses = new TableProvid2(); ! adapterClasses = new TableProvid2(); ! adapters = new WeakHashMap(); } Index: Java2Accessibility.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Java2Accessibility.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** Java2Accessibility.java 1999/09/16 21:56:58 2.2 --- Java2Accessibility.java 2001/02/01 16:41:10 2.3 *************** *** 12,20 **** { void setAccess(Field field, boolean flag) throws SecurityException { ! field.setAccessible(flag); } void setAccess(Method method, boolean flag) throws SecurityException { ! method.setAccessible(flag); } --- 12,20 ---- { void setAccess(Field field, boolean flag) throws SecurityException { ! field.setAccessible(flag); } void setAccess(Method method, boolean flag) throws SecurityException { ! method.setAccessible(flag); } *************** *** 22,26 **** throws SecurityException { ! constructor.setAccessible(flag); } } --- 22,26 ---- throws SecurityException { ! constructor.setAccessible(flag); } } Index: JavaAccessibility.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/JavaAccessibility.java,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** JavaAccessibility.java 1999/09/16 21:56:08 2.2 --- JavaAccessibility.java 2001/02/01 16:41:10 2.3 *************** *** 17,33 **** static void initialize() { ! // If we can find it, and the registry option ! // python.security.respectJavaAccessibility is set, then we set the ! // access object to an instance of the subclass Java2Accessibility if (Options.respectJavaAccessibility) return; ! try { Class c = Class.forName("org.python.core.Java2Accessibility"); Class.forName("java.lang.reflect.AccessibleObject"); access = (JavaAccessibility)c.newInstance(); } ! catch (InstantiationException e) {} ! catch (IllegalAccessException e) {} ! catch (ClassNotFoundException e) {} } --- 17,33 ---- static void initialize() { ! // If we can find it, and the registry option ! // python.security.respectJavaAccessibility is set, then we set the ! // access object to an instance of the subclass Java2Accessibility if (Options.respectJavaAccessibility) return; ! try { Class c = Class.forName("org.python.core.Java2Accessibility"); Class.forName("java.lang.reflect.AccessibleObject"); access = (JavaAccessibility)c.newInstance(); } ! catch (InstantiationException e) {} ! catch (IllegalAccessException e) {} ! catch (ClassNotFoundException e) {} } *************** *** 52,71 **** throws SecurityException { ! if (access != null) ! access.setAccess(field, flag); } ! public static void setAccessible(Method method, boolean flag) throws SecurityException { ! if (access != null) ! access.setAccess(method, flag); } ! public static void setAccessible(Constructor constructor, boolean flag) throws SecurityException { ! if (access != null) ! access.setAccess(constructor, flag); } } --- 52,71 ---- throws SecurityException { ! if (access != null) ! access.setAccess(field, flag); } ! public static void setAccessible(Method method, boolean flag) throws SecurityException { ! if (access != null) ! access.setAccess(method, flag); } ! public static void setAccessible(Constructor constructor, boolean flag) throws SecurityException { ! if (access != null) ! access.setAccess(constructor, flag); } } Index: MakeProxies.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/MakeProxies.java,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -r2.13 -r2.14 *** MakeProxies.java 2000/12/17 19:46:26 2.13 --- MakeProxies.java 2001/02/01 16:41:10 2.14 *************** *** 12,16 **** ! class MakeProxies { private static Class makeClass(Class referent, Vector secondary,String name, --- 12,16 ---- ! class MakeProxies { private static Class makeClass(Class referent, Vector secondary,String name, *************** *** 18,22 **** { Vector referents = null; ! if (secondary != null) { if (referent != null) { --- 18,22 ---- { Vector referents = null; ! if (secondary != null) { if (referent != null) { *************** *** 30,34 **** } } ! return BytecodeLoader.makeClass(name, referents, bytes.toByteArray()); } --- 30,34 ---- } } ! return BytecodeLoader.makeClass(name, referents, bytes.toByteArray()); } *************** *** 68,74 **** if (mn==null) pythonModuleName = "foo"; ! else pythonModuleName = (String)mn.__tojava__(String.class); ! JavaMaker jm = new JavaMaker(superclass, interfaces, name, pythonModuleName, proxyName, dict); --- 68,74 ---- if (mn==null) pythonModuleName = "foo"; ! else pythonModuleName = (String)mn.__tojava__(String.class); ! JavaMaker jm = new JavaMaker(superclass, interfaces, name, pythonModuleName, proxyName, dict); Index: Options.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Options.java,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -r2.4 -r2.5 *** Options.java 2000/12/15 03:19:00 2.4 --- Options.java 2001/02/01 16:41:10 2.5 *************** *** 11,15 **** public static boolean showJavaExceptions = false; ! // if this is not null, it must be a string indicating the directory to // save proxy adapter class files to public static String proxyCacheDirectory = null; --- 11,15 ---- public static boolean showJavaExceptions = false; ! // if this is not null, it must be a string indicating the directory to // save proxy adapter class files to public static String proxyCacheDirectory = null; *************** *** 42,46 **** public static boolean extendedClassLoader = true; */ ! // TBD public static boolean importSite = true; --- 42,46 ---- public static boolean extendedClassLoader = true; */ ! // TBD public static boolean importSite = true; *************** *** 48,55 **** // TBD public static int verbose = Py.MESSAGE; ! // TBD public static boolean deprecatedKeywordMangling = true; ! // TBD public static boolean parserVerboseExceptions = false; --- 48,55 ---- // TBD public static int verbose = Py.MESSAGE; ! // TBD public static boolean deprecatedKeywordMangling = true; ! // TBD public static boolean parserVerboseExceptions = false; *************** *** 69,73 **** return prop.equalsIgnoreCase("true") || prop.equalsIgnoreCase("yes"); } ! private static String getStringOption(String name, String defaultValue) { String prop = PySystemState.registry.getProperty("python."+name); --- 69,73 ---- return prop.equalsIgnoreCase("true") || prop.equalsIgnoreCase("yes"); } ! private static String getStringOption(String name, String defaultValue) { String prop = PySystemState.registry.getProperty("python."+name); *************** *** 83,94 **** Options.showJavaExceptions); ! Options.showPythonProxyExceptions = getBooleanOption("options.showPythonProxyExceptions", Options.showPythonProxyExceptions); ! Options.skipCompile = getBooleanOption("options.skipCompile", Options.skipCompile); ! Options.deprecatedKeywordMangling = getBooleanOption("deprecated.keywordMangling", Options.deprecatedKeywordMangling); --- 83,94 ---- Options.showJavaExceptions); ! Options.showPythonProxyExceptions = getBooleanOption("options.showPythonProxyExceptions", Options.showPythonProxyExceptions); ! Options.skipCompile = getBooleanOption("options.skipCompile", Options.skipCompile); ! Options.deprecatedKeywordMangling = getBooleanOption("deprecated.keywordMangling", Options.deprecatedKeywordMangling); Index: PackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PackageManager.java,v retrieving revision 2.5 retrieving revision 2.6 diff -C2 -r2.5 -r2.6 *** PackageManager.java 2000/12/16 13:37:14 2.5 --- PackageManager.java 2001/02/01 16:41:10 2.6 *************** *** 15,19 **** abstract public Class findClass(String pkg,String name,String reason); ! public Class findClass(String pkg,String name) { return findClass(pkg,name,"java class"); --- 15,19 ---- abstract public Class findClass(String pkg,String name,String reason); ! public Class findClass(String pkg,String name) { return findClass(pkg,name,"java class"); *************** *** 21,25 **** public void notifyPackageImport(String pkg,String name) {} ! /** Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. * Should be overriden. --- 21,25 ---- public void notifyPackageImport(String pkg,String name) {} ! /** Dynamically check if pkg.name exists as java pkg in the controlled hierarchy. * Should be overriden. *************** *** 115,124 **** if (classes != null) p.addPlaceholders(classes); ! return p; } private static final int MAXSKIP = 512; ! /** Check that a given stream is a valid Java .class file. * And return its access permissions as an int. --- 115,124 ---- if (classes != null) p.addPlaceholders(classes); ! return p; } private static final int MAXSKIP = 512; ! /** Check that a given stream is a valid Java .class file. * And return its access permissions as an int. Index: PathPackageManager.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/PathPackageManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** PathPackageManager.java 2000/11/25 21:11:43 1.2 --- PathPackageManager.java 2001/02/01 16:41:10 1.3 *************** *** 88,93 **** int acc = checkAccess(new BufferedInputStream(new FileInputStream(cand))); if ((acc == -1) || filterByAccess(jname, acc) ) continue; ! } catch(IOException e) { ! continue; } } --- 88,93 ---- int acc = checkAccess(new BufferedInputStream(new FileInputStream(cand))); if ((acc == -1) || filterByAccess(jname, acc) ) continue; ! } catch(IOException e) { ! continue; } } *************** *** 117,121 **** ! // ??pending: // Uses simply split and not a StringTokenizer+trim to adhere to sun jvm parsing of classpath. // E.g. "a;" is parsed by sun jvm as a, ""; the latter is interpreted as cwd. --- 117,121 ---- ! // ??pending: // Uses simply split and not a StringTokenizer+trim to adhere to sun jvm parsing of classpath. // E.g. "a;" is parsed by sun jvm as a, ""; the latter is interpreted as cwd. *************** *** 138,142 **** } } ! } public PyList doDir(PyJavaPackage jpkg,boolean instantiate,boolean exclpkgs) { --- 138,142 ---- } } ! } public PyList doDir(PyJavaPackage jpkg,boolean instantiate,boolean exclpkgs) { Index: Py.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/core/Py.java,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -r2.32 -r2.33 *** Py.java 2001/01/21 14:00:33 2.32 --- Py.java 2001/02/01 16:41:10 2.33 *************** *** 12,22 **** private final static Object PRESENT=new Object(); static java.util.Hashtable frozenModules; ! static boolean initialized; ! /* Holds the singleton None and Ellipsis objects */ /** The singleton None Python object **/ public static PyObject None; ! /** The singleton Ellipsis Python object - written as ... when indexing **/ public static PyObject Ellipsis; --- 12,22 ---- private final static Object PRESENT=new Object(); static java.util.Hashtable frozenModules; ! static boolean initialized; ! /* Holds the singleton None and Ellipsis objects */ /** The singleton None Python object **/ public static PyObject None; ! /** The singleton Ellipsis Python object - written as ... when indexing **/ public static PyObject Ellipsis; *************** *** 25,39 **** don't have any keyword arguments **/ public static String[] NoKeywords; ! /** A zero-length array of PyObject's to pass to functions that expect zero-arguments **/ public static PyObject[] EmptyObjects; ! /** A tuple with zero elements **/ public static PyTuple EmptyTuple; ! /** The Python integer 0 - also used as false **/ public static PyInteger Zero; ! /** The Python integer 1 - also used as true **/ public static PyInteger One; --- 25,39 ---- don't have any keyword arguments **/ public static String[] NoKeywords; ! /** A zero-length array of PyObject's to pass to functions that expect zero-arguments **/ public static PyObject[] EmptyObjects; ! /** A tuple with zero elements **/ public static PyTuple EmptyTuple; ! /** The Python integer 0 - also used as false **/ public static PyInteger Zero; ! /** The Python integer 1 - also used as true **/ public static PyInteger One; *************** *** 41,60 **** /** A zero-length Python string **/ public static PyString EmptyString; ! /** A Python string containing '\n' **/ public static PyString Newline; ! /** A Python string containing ' ' **/ public static PyString Space; ! /** A unique object to indicate no conversion is possible in __tojava__ methods **/ ! public static Object NoConversion; ! public static PyObject OSError; public static PyObject NotImplementedError; public static PyObject EnvironmentError; ! ! /* The standard Python exceptions */ public static PyObject OverflowError; --- 41,60 ---- /** A zero-length Python string **/ public static PyString EmptyString; ! /** A Python string containing '\n' **/ public static PyString Newline; ! /** A Python string containing ' ' **/ public static PyString Space; ! /** A unique object to indicate no conversion is possible in __tojava__ methods **/ ! public static Object NoConversion; ! public static PyObject OSError; public static PyObject NotImplementedError; public static PyObject EnvironmentError; ! ! /* The standard Python exceptions */ public static PyObject OverflowError; *************** *** 164,168 **** } else { if (value != Py.None) { ! try { Py.println(value); System.exit(1); --- 164,168 ---- } else { if (value != Py.None) { ! try { Py.println(value); System.exit(1); *************** *** 174,179 **** } } - public static PyObject ImportError; public static PyException ImportError(String message) { --- 174,179 ---- } } + public static PyObject ImportError; public static PyException ImportError(String message) { *************** *** 206,210 **** System.exit(-1); } ! public static PyException MemoryError(String message) { return new PyException(Py.MemoryError, message); --- 206,210 ---- System.exit(-1); } ! public static PyException MemoryError(String message) { return new PyException(Py.MemoryError, message); *************** *** 241,245 **** // Don't allow any constructors. Class only provides static methods. ! private Py() { ; } /** @deprecated **/ --- 241,245 ---- // Don't allow any constructors. Class only provides static methods. ! private Py() { ; } /** @deprecated **/ *************** *** 250,254 **** Identical to <code>o.__tojava__(c)</code> except that it will raise a <code>TypeError</code> if the conversion fails. ! @param o the <code>PyObject</code> to convert. @param c the class to convert it to. --- 250,254 ---- Identical to <code>o.__tojava__(c)</code> except that it will raise a <code>TypeError</code> if the conversion fails. ! @param o the <code>PyObject</code> to convert. @param c the class to convert it to. *************** *** 269,275 **** return tojava(o, c); // prev:Class.forName } ! /* Helper functions for PyProxy's */ ! /** @deprecated **/ public static PyObject jfindattr(PyProxy proxy, String name) { --- 269,275 ---- return tojava(o, c); // prev:Class.forName } ! /* Helper functions for PyProxy's */ ! /** @deprecated **/ public static PyObject jfindattr(PyProxy proxy, String name) { *************** *** 280,284 **** if (ret == null) return null; ! // Set the current system state to match proxy -- usually this is a waste of time :-( Py.setSystemState(proxy._getPySystemState()); --- 280,284 ---- if (ret == null) return null; ! // Set the current system state to match proxy -- usually this is a waste of time :-( Py.setSystemState(proxy._getPySystemState()); *************** *** 303,307 **** /* Convenience methods to create new constants without using "new" */ private static PyInteger[] integerCache = null; ! public static final PyInteger newInteger(int i) { if (integerCache == null) { --- 303,307 ---- /* Convenience methods to create new constants without using "new" */ private static PyInteger[] integerCache = null; ! public static final PyInteger newInteger(int i) { if (integerCache == null) { *************** *** 324,356 **** return newInteger((int)i); } ! public static PyLong newLong(String s) { return new PyLong(s); } ! public static PyComplex newImaginary(double v) { return new PyComplex(0, v); } ! public static PyFloat newFloat(float v) { return new PyFloat((double)v); ! } ! public static PyFloat newFloat(double v) { return new PyFloat(v); } ! public static PyString newString(char c) { return makeCharacter(c); ! } ! public static PyString newString(String s) { return new PyString(s); } ! public static PyInteger newBoolean(boolean t) { return t ? Py.One : Py.Zero; } ! public static PyCode newCode(int argcount, String varnames[], String filename, String name, --- 324,356 ---- return newInteger((int)i); } ! public static PyLong newLong(String s) { return new PyLong(s); } ! public static PyComplex newImaginary(double v) { return new PyComplex(0, v); } ! public static PyFloat newFloat(float v) { return new PyFloat((double)v); ! } ! public static PyFloat newFloat(double v) { return new PyFloat(v); } ! public static PyString newString(char c) { return makeCharacter(c); ! } ! public static PyString newString(String s) { return new PyString(s); } ! public static PyInteger newBoolean(boolean t) { return t ? Py.One : Py.Zero; } ! public static PyCode newCode(int argcount, String varnames[], ... [truncated message content] |