From: Clark U. <cu...@us...> - 2005-05-12 14:01:24
|
Update of /cvsroot/jython/jython/org/python/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5838/jython/org/python/modules Modified Files: Tag: collections-integration Setup.java thread.java Added Files: Tag: collections-integration ArrayModule.java Log Message: PyList and PyTuple now implement java.util.List, list + List, and new array module. --- NEW FILE: ArrayModule.java --- package org.python.modules; import org.python.core.*; public class ArrayModule { public static PyString __doc__ = new PyString( "This module defines a new object type which can efficiently represent\n" + "an array of basic values: characters, integers, floating point\n" + "numbers. Arrays are sequence types and behave very much like lists,\n" + "except that the type of objects stored in them is constrained. The\n" + "type is specified at object creation time by using a type code, which\n" + "is a single character. The following type codes are defined:\n" + "\n" + " Type code C Type Minimum size in bytes \n" + " 'z' boolean 1 \n" + " 'c' character 1 \n" + " 'b' signed integer 1 \n" + //" 'B' unsigned integer 1 \n" + " 'h' signed integer 2 \n" + //" 'H' unsigned integer 2 \n" + " 'i' signed integer 2 \n" + //" 'I' unsigned integer 2 \n" + " 'l' signed integer 4 \n" + //" 'L' unsigned integer 4 \n" + " 'f' floating point 4 \n" + " 'd' floating point 8 \n" + "\n" + "Functions:\n" + "\n" + "array(typecode [, initializer]) -- create a new array\n" + "\n" + "Special Objects:\n" + "\n" + "ArrayType -- type object for array objects\n" ); public static PyString __name__ = new PyString("array"); public static PyArray ArrayType(char TypeCode) { return PyArray.array(new PyList(), TypeCode); } public static PyObject ArrayType(char TypeCode, PyObject sequence) { return PyArray.array(sequence, TypeCode); } public static PyObject array(char TypeCode) { return PyArray.array(new PyList(), TypeCode); } public static PyObject array(char TypeCode, PyObject sequence) { return PyArray.array(sequence, TypeCode); } } Index: Setup.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/Setup.java,v retrieving revision 2.22 retrieving revision 2.22.6.1 diff -C2 -d -r2.22 -r2.22.6.1 *** Setup.java 18 May 2003 22:32:01 -0000 2.22 --- Setup.java 12 May 2005 14:00:34 -0000 2.22.6.1 *************** *** 52,55 **** --- 52,56 ---- "xreadlines", "errno", + "array:org.python.modules.ArrayModule" }; } Index: thread.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/modules/thread.java,v retrieving revision 2.8 retrieving revision 2.8.4.1 diff -C2 -d -r2.8 -r2.8.4.1 *** thread.java 22 Feb 2005 04:19:33 -0000 2.8 --- thread.java 12 May 2005 14:00:35 -0000 2.8.4.1 *************** *** 41,45 **** public static void start_new_thread(PyObject func, PyTuple args) { ! Thread pt = new FunctionThread(func, args.list); pt.start(); } --- 41,45 ---- public static void start_new_thread(PyObject func, PyTuple args) { ! Thread pt = new FunctionThread(func, args.getArray()); pt.start(); } |