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] |