lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r945842 [1/2] - in /lucene/pylucene/trunk: jcc/ jcc/_jcc/ jcc/_jcc/java/io/ jcc/_jcc/java/lang/ jcc/_jcc/java/lang/reflect/ jcc/_jcc/java/util/ jcc/jcc/ jcc/jcc/sources/ samples/ samples/LuceneInAction/lia/indexing/ test/
Date Tue, 18 May 2010 19:43:21 GMT
Author: vajda
Date: Tue May 18 19:43:19 2010
New Revision: 945842

URL: http://svn.apache.org/viewvc?rev=945842&view=rev
Log:
merged changes from branch_3x

Modified:
    lucene/pylucene/trunk/jcc/   (props changed)
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/_jcc/boot.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/io/PrintWriter.h
    lucene/pylucene/trunk/jcc/_jcc/java/io/StringWriter.h
    lucene/pylucene/trunk/jcc/_jcc/java/io/Writer.h
    lucene/pylucene/trunk/jcc/_jcc/java/io/__init__.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Boolean.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Byte.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Character.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Double.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Exception.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Float.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Integer.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Long.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Object.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/RuntimeException.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Short.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/String.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/Throwable.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/__init__.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Constructor.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Field.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericArrayType.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericDeclaration.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Modifier.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/ParameterizedType.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Type.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/TypeVariable.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/WildcardType.h
    lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/__init__.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/util/Enumeration.h
    lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.cpp
    lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.h
    lucene/pylucene/trunk/jcc/jcc/cpp.py
    lucene/pylucene/trunk/jcc/jcc/python.py
    lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/JArray.h
    lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h
    lucene/pylucene/trunk/jcc/jcc/sources/JObject.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/JObject.h
    lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/functions.h
    lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/macros.h
    lucene/pylucene/trunk/jcc/jcc/sources/types.cpp
    lucene/pylucene/trunk/jcc/setup.py   (props changed)
    lucene/pylucene/trunk/samples/   (props changed)
    lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py
    lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py
    lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/LockTest.py
    lucene/pylucene/trunk/test/test_ICUFoldingFilter.py
    lucene/pylucene/trunk/test/test_ICUNormalizer2Filter.py
    lucene/pylucene/trunk/test/test_ICUTransformFilter.py

Propchange: lucene/pylucene/trunk/jcc/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue May 18 19:43:19 2010
@@ -0,0 +1 @@
+/lucene/pylucene/branches/branch_3x/jcc:944934,944952-944954,944961,945445,945488,945517,945782

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Tue May 18 19:43:19 2010
@@ -17,6 +17,9 @@ Version 2.5 ->
  - added 'asm' to list of reserved words
  - added JCC_VERSION string to modules using JCC
  - added support for --resources
+ - fixed bug with array Release calls using isCopy instead of 0 mode
+ - added support for --import
+ - added read-only env.classpath property
  - 
 
 Version 2.4 -> 2.5

Modified: lucene/pylucene/trunk/jcc/_jcc/boot.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/boot.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/boot.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/boot.cpp Tue May 18 19:43:19 2010
@@ -18,7 +18,7 @@
 #include "java/lang/RuntimeException.h"
 #include "macros.h"
 
-extern PyTypeObject JObject$$Type, ConstVariableDescriptor$$Type;
+extern PyTypeObject PY_TYPE(JObject), PY_TYPE(ConstVariableDescriptor);
 
 PyObject *initJCC(PyObject *module);
 PyObject *initVM(PyObject *self, PyObject *args, PyObject *kwds);

Modified: lucene/pylucene/trunk/jcc/_jcc/java/io/PrintWriter.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/io/PrintWriter.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/io/PrintWriter.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/io/PrintWriter.h Tue May 18 19:43:19 2010
@@ -35,7 +35,7 @@ namespace java {
             PrintWriter(const PrintWriter& obj) : Writer(obj) {}
         };
 
-        extern PyTypeObject PrintWriter$$Type;
+        extern PyTypeObject PY_TYPE(PrintWriter);
 
         class t_PrintWriter {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/io/StringWriter.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/io/StringWriter.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/io/StringWriter.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/io/StringWriter.h Tue May 18 19:43:19 2010
@@ -35,7 +35,7 @@ namespace java {
             StringWriter(const StringWriter& obj) : Writer(obj) {}
         };
 
-        extern PyTypeObject StringWriter$$Type;
+        extern PyTypeObject PY_TYPE(StringWriter);
 
         class t_StringWriter {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/io/Writer.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/io/Writer.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/io/Writer.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/io/Writer.h Tue May 18 19:43:19 2010
@@ -34,7 +34,7 @@ namespace java {
             }
         };
 
-        extern PyTypeObject Writer$$Type;
+        extern PyTypeObject PY_TYPE(Writer);
 
         class t_Writer {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/io/__init__.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/io/__init__.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/io/__init__.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/io/__init__.cpp Tue May 18 19:43:19 2010
@@ -18,9 +18,9 @@
 namespace java {
     namespace io {
 
-        extern PyTypeObject Writer$$Type;
-        extern PyTypeObject StringWriter$$Type;
-        extern PyTypeObject PrintWriter$$Type;
+        extern PyTypeObject PY_TYPE(Writer);
+        extern PyTypeObject PY_TYPE(StringWriter);
+        extern PyTypeObject PY_TYPE(PrintWriter);
         
         namespace reflect {
             void __install__(PyObject *module);

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Boolean.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Boolean.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Boolean.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Boolean.h Tue May 18 19:43:19 2010
@@ -39,7 +39,7 @@ namespace java {
             static Boolean *FALSE;
         };
 
-        extern PyTypeObject Boolean$$Type;
+        extern PyTypeObject PY_TYPE(Boolean);
 
         class t_Boolean {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Byte.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Byte.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Byte.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Byte.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jbyte byteValue() const;
         };
 
-        extern PyTypeObject Byte$$Type;
+        extern PyTypeObject PY_TYPE(Byte);
 
         class t_Byte {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Character.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Character.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Character.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Character.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jchar charValue() const;
         };
 
-        extern PyTypeObject Character$$Type;
+        extern PyTypeObject PY_TYPE(Character);
 
         class t_Character {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.cpp Tue May 18 19:43:19 2010
@@ -507,7 +507,7 @@ namespace java {
 
         static PyObject *t_Class_isAssignableFrom(t_Class *self, PyObject *arg)
         {
-            if (!PyObject_TypeCheck(arg, &Class$$Type))
+            if (!PyObject_TypeCheck(arg, &PY_TYPE(Class)))
             {
                 PyErr_SetObject(PyExc_TypeError, arg);
                 return NULL;

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Class.h Tue May 18 19:43:19 2010
@@ -71,7 +71,7 @@ namespace java {
 #endif
         };
 
-        extern PyTypeObject Class$$Type;
+        extern PyTypeObject PY_TYPE(Class);
 
         class t_Class {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Double.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Double.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Double.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Double.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jdouble doubleValue() const;
         };
 
-        extern PyTypeObject Double$$Type;
+        extern PyTypeObject PY_TYPE(Double);
 
         class t_Double {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Exception.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Exception.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Exception.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Exception.h Tue May 18 19:43:19 2010
@@ -34,7 +34,7 @@ namespace java {
             }
         };
 
-        extern PyTypeObject Exception$$Type;
+        extern PyTypeObject PY_TYPE(Exception);
 
         class t_Exception {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Float.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Float.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Float.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Float.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jfloat floatValue() const;
         };
 
-        extern PyTypeObject Float$$Type;
+        extern PyTypeObject PY_TYPE(Float);
 
         class t_Float {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Integer.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Integer.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Integer.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Integer.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jint intValue() const;
         };
 
-        extern PyTypeObject Integer$$Type;
+        extern PyTypeObject PY_TYPE(Integer);
 
         class t_Integer {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Long.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Long.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Long.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Long.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jlong longValue() const;
         };
 
-        extern PyTypeObject Long$$Type;
+        extern PyTypeObject PY_TYPE(Long);
 
         class t_Long {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Object.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Object.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Object.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Object.h Tue May 18 19:43:19 2010
@@ -40,7 +40,7 @@ namespace java {
             jboolean equals(const Object& obj) const;
         };
 
-        extern PyTypeObject Object$$Type;
+        extern PyTypeObject PY_TYPE(Object);
 
         class t_Object {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/RuntimeException.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/RuntimeException.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/RuntimeException.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/RuntimeException.h Tue May 18 19:43:19 2010
@@ -34,7 +34,7 @@ namespace java {
             }
         };
 
-        extern PyTypeObject RuntimeException$$Type;
+        extern PyTypeObject PY_TYPE(RuntimeException);
 
         class t_RuntimeException {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Short.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Short.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Short.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Short.h Tue May 18 19:43:19 2010
@@ -36,7 +36,7 @@ namespace java {
             jshort shortValue() const;
         };
 
-        extern PyTypeObject Short$$Type;
+        extern PyTypeObject PY_TYPE(Short);
 
         class t_Short {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/String.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/String.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/String.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/String.h Tue May 18 19:43:19 2010
@@ -41,7 +41,7 @@ namespace java {
             int length() const;
         };
 
-        extern PyTypeObject String$$Type;
+        extern PyTypeObject PY_TYPE(String);
 
         class t_String {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/Throwable.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/Throwable.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/Throwable.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/Throwable.h Tue May 18 19:43:19 2010
@@ -44,7 +44,7 @@ namespace java {
             String getMessage() const;
         };
 
-        extern PyTypeObject Throwable$$Type;
+        extern PyTypeObject PY_TYPE(Throwable);
 
         class t_Throwable {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/__init__.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/__init__.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/__init__.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/__init__.cpp Tue May 18 19:43:19 2010
@@ -18,20 +18,20 @@
 namespace java {
     namespace lang {
 
-        extern PyTypeObject Object$$Type;
-        extern PyTypeObject String$$Type;
-        extern PyTypeObject Class$$Type;
-        extern PyTypeObject Throwable$$Type;
-        extern PyTypeObject Exception$$Type;
-        extern PyTypeObject RuntimeException$$Type;
-        extern PyTypeObject Boolean$$Type;
-        extern PyTypeObject Byte$$Type;
-        extern PyTypeObject Character$$Type;
-        extern PyTypeObject Integer$$Type;
-        extern PyTypeObject Double$$Type;
-        extern PyTypeObject Float$$Type;
-        extern PyTypeObject Long$$Type;
-        extern PyTypeObject Short$$Type;
+        extern PyTypeObject PY_TYPE(Object);
+        extern PyTypeObject PY_TYPE(String);
+        extern PyTypeObject PY_TYPE(Class);
+        extern PyTypeObject PY_TYPE(Throwable);
+        extern PyTypeObject PY_TYPE(Exception);
+        extern PyTypeObject PY_TYPE(RuntimeException);
+        extern PyTypeObject PY_TYPE(Boolean);
+        extern PyTypeObject PY_TYPE(Byte);
+        extern PyTypeObject PY_TYPE(Character);
+        extern PyTypeObject PY_TYPE(Integer);
+        extern PyTypeObject PY_TYPE(Double);
+        extern PyTypeObject PY_TYPE(Float);
+        extern PyTypeObject PY_TYPE(Long);
+        extern PyTypeObject PY_TYPE(Short);
         
         namespace reflect {
             void __install__(PyObject *module);

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Constructor.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Constructor.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Constructor.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Constructor.h Tue May 18 19:43:19 2010
@@ -50,7 +50,7 @@ namespace java {
 #endif
             };
 
-            extern PyTypeObject Constructor$$Type;
+            extern PyTypeObject PY_TYPE(Constructor);
 
             class t_Constructor {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Field.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Field.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Field.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Field.h Tue May 18 19:43:19 2010
@@ -46,7 +46,7 @@ namespace java {
 #endif
             };
 
-            extern PyTypeObject Field$$Type;
+            extern PyTypeObject PY_TYPE(Field);
 
             class t_Field {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericArrayType.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericArrayType.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericArrayType.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericArrayType.h Tue May 18 19:43:19 2010
@@ -44,7 +44,7 @@ namespace java {
 namespace java {
     namespace lang {
         namespace reflect {
-            extern PyTypeObject GenericArrayType$$Type;
+            extern PyTypeObject PY_TYPE(GenericArrayType);
 
             class t_GenericArrayType {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericDeclaration.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericDeclaration.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericDeclaration.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/GenericDeclaration.h Tue May 18 19:43:19 2010
@@ -47,7 +47,7 @@ namespace java {
 namespace java {
     namespace lang {
         namespace reflect {
-            extern PyTypeObject GenericDeclaration$$Type;
+            extern PyTypeObject PY_TYPE(GenericDeclaration);
 
             class t_GenericDeclaration {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Method.h Tue May 18 19:43:19 2010
@@ -54,7 +54,7 @@ namespace java {
 #endif
             };
 
-            extern PyTypeObject Method$$Type;
+            extern PyTypeObject PY_TYPE(Method);
 
             class t_Method {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Modifier.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Modifier.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Modifier.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Modifier.h Tue May 18 19:43:19 2010
@@ -44,7 +44,7 @@ namespace java {
                 static int isProtected(int mod);
             };
 
-            extern PyTypeObject Modifier$$Type;
+            extern PyTypeObject PY_TYPE(Modifier);
 
             class t_Modifier {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/ParameterizedType.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/ParameterizedType.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/ParameterizedType.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/ParameterizedType.h Tue May 18 19:43:19 2010
@@ -48,7 +48,7 @@ namespace java {
 namespace java {
     namespace lang {
         namespace reflect {
-            extern PyTypeObject ParameterizedType$$Type;
+            extern PyTypeObject PY_TYPE(ParameterizedType);
 
             class t_ParameterizedType {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Type.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Type.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Type.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/Type.h Tue May 18 19:43:19 2010
@@ -38,7 +38,7 @@ namespace java {
 namespace java {
     namespace lang {
         namespace reflect {
-            extern PyTypeObject Type$$Type;
+            extern PyTypeObject PY_TYPE(Type);
 
             class t_Type {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/TypeVariable.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/TypeVariable.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/TypeVariable.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/TypeVariable.h Tue May 18 19:43:19 2010
@@ -52,7 +52,7 @@ namespace java {
 namespace java {
     namespace lang {
         namespace reflect {
-            extern PyTypeObject TypeVariable$$Type;
+            extern PyTypeObject PY_TYPE(TypeVariable);
 
             class t_TypeVariable {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/WildcardType.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/WildcardType.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/WildcardType.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/WildcardType.h Tue May 18 19:43:19 2010
@@ -46,7 +46,7 @@ namespace java {
 namespace java {
     namespace lang {
         namespace reflect {
-            extern PyTypeObject WildcardType$$Type;
+            extern PyTypeObject PY_TYPE(WildcardType);
 
             class t_WildcardType {
             public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/__init__.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/__init__.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/__init__.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/lang/reflect/__init__.cpp Tue May 18 19:43:19 2010
@@ -19,17 +19,17 @@ namespace java {
     namespace lang {
         namespace reflect {
 
-            extern PyTypeObject Constructor$$Type;
-            extern PyTypeObject Method$$Type;
-            extern PyTypeObject Modifier$$Type;
-            extern PyTypeObject Field$$Type;
+            extern PyTypeObject PY_TYPE(Constructor);
+            extern PyTypeObject PY_TYPE(Method);
+            extern PyTypeObject PY_TYPE(Modifier);
+            extern PyTypeObject PY_TYPE(Field);
 #ifdef _java_generics
-            extern PyTypeObject Type$$Type;
-            extern PyTypeObject ParameterizedType$$Type;
-            extern PyTypeObject TypeVariable$$Type;
-            extern PyTypeObject GenericArrayType$$Type;
-            extern PyTypeObject WildcardType$$Type;
-            extern PyTypeObject GenericDeclaration$$Type;
+            extern PyTypeObject PY_TYPE(Type);
+            extern PyTypeObject PY_TYPE(ParameterizedType);
+            extern PyTypeObject PY_TYPE(TypeVariable);
+            extern PyTypeObject PY_TYPE(GenericArrayType);
+            extern PyTypeObject PY_TYPE(WildcardType);
+            extern PyTypeObject PY_TYPE(GenericDeclaration);
 #endif
 
             void __install__(PyObject *m)

Modified: lucene/pylucene/trunk/jcc/_jcc/java/util/Enumeration.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/util/Enumeration.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/util/Enumeration.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/util/Enumeration.h Tue May 18 19:43:19 2010
@@ -40,7 +40,7 @@ namespace java {
             Object nextElement() const;
         };
 
-        extern PyTypeObject Enumeration$$Type;
+        extern PyTypeObject PY_TYPE(Enumeration);
 
         class t_Enumeration {
         public:

Modified: lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.cpp (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.cpp Tue May 18 19:43:19 2010
@@ -92,6 +92,18 @@ namespace java {
             }
             return obj;
         }
+
+        PyObject *t_Iterator::wrap_jobject(const jobject& object,
+                                           PyTypeObject *T)
+        {
+            PyObject *obj = t_Iterator::wrap_jobject(object);
+            if (obj != Py_None)
+            {
+                t_Iterator *self = (t_Iterator *) obj;
+                self->parameters[0] = T;
+            }
+            return obj;
+        }
 #endif
         static PyObject *t_Iterator_hasNext(t_Iterator *self)
         {

Modified: lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.h (original)
+++ lucene/pylucene/trunk/jcc/_jcc/java/util/Iterator.h Tue May 18 19:43:19 2010
@@ -40,7 +40,7 @@ namespace java {
             Object next() const;
         };
 
-        extern PyTypeObject Iterator$$Type;
+        extern PyTypeObject PY_TYPE(Iterator);
 
         class t_Iterator {
         public:
@@ -54,11 +54,13 @@ namespace java {
             }
 #endif
             static PyObject *wrap_Object(const Iterator& object);
+            static PyObject *wrap_jobject(const jobject& object);
 #ifdef _java_generics
             static PyObject *wrap_Object(const Iterator& object,
                                          PyTypeObject *T);
+            static PyObject *wrap_jobject(const jobject& object,
+                                          PyTypeObject *T);
 #endif
-            static PyObject *wrap_jobject(const jobject& object);
         };
     }
 }

Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Tue May 18 19:43:19 2010
@@ -318,6 +318,7 @@ def jcc(args):
     generics = hasattr(_jcc, "Type")
     arch = []
     resources = []
+    imports = {}
 
     i = 1
     while i < len(args):
@@ -425,6 +426,9 @@ def jcc(args):
             elif arg == '--resources':
                 i += 1
                 resources.append(args[i])
+            elif arg == '--import':
+                i += 1
+                imports[args[i]] = ()
             else:
                 raise ValueError, "Invalid argument: %s" %(arg)
         else:
@@ -440,6 +444,12 @@ def jcc(args):
     typeset = set()
     excludes = set(excludes)
 
+    if imports:
+        if shared:
+            imports = dict((__import__(import_), set()) for import_ in imports)
+        else:
+            raise ValueError, "--shared must be used when using --import"
+
     if recompile or not build and (install or dist):
         if moduleName is None:
             raise ValueError, 'module name not specified (use --python)'
@@ -448,8 +458,23 @@ def jcc(args):
                     install, dist, debug, jars, version,
                     prefix, root, install_dir, home_dir, use_distutils,
                     shared, compiler, modules, wininst, find_jvm_dll,
-                    arch, generics, resources)
+                    arch, generics, resources, imports)
     else:
+        if imports:
+            def walk((include, importset), dirname, names):
+                for name in names:
+                    if name.endswith('.h'):
+                        className = os.path.join(dirname[len(include) + 1:],
+                                                 name[:-2])
+                        if os.path.sep != '/':
+                            className = className.replace(os.path.sep, '/')
+                        importset.add(findClass(className))
+            for import_, importset in imports.iteritems():
+                env._addClassPath(import_.CLASSPATH)
+                include = os.path.join(import_.__dir__, 'include')
+                os.path.walk(include, walk, (include, importset))
+                typeset.update(importset)
+
         for className in classNames:
             if className in excludes:
                 continue
@@ -484,8 +509,11 @@ def jcc(args):
             typeset.add(findClass('java/io/Writer'))
             packages.add('java.lang')
 
+        _dll_export = ''
         if moduleName:
             cppdir = os.path.join(output, '_%s' %(moduleName))
+            if shared and sys.platform == 'win32':
+                _dll_export = "_dll_%s " %(moduleName)
         else:
             cppdir = output
 
@@ -501,6 +529,9 @@ def jcc(args):
                 out_cpp = file(os.path.join(cppdir, fileName), 'w')
 
         done = set()
+        for importset in imports.itervalues():
+            done.update(importset)
+
         todo = typeset - done
 	if allInOne and wrapperFiles > 1:
             classesPerFile = max(1, len(todo) / wrapperFiles)
@@ -522,7 +553,7 @@ def jcc(args):
                 (superCls, constructors, methods, protectedMethods,
                  fields, instanceFields, declares) = \
                     header(env, out_h, cls, typeset, packages, excludes,
-                           generics)
+                           generics, _dll_export)
 
                 if not allInOne:
                     out_cpp = file(fileName + '.cpp', 'w')
@@ -538,7 +569,8 @@ def jcc(args):
                            fields, instanceFields,
                            mappings.get(className), sequences.get(className),
                            renames.get(className),
-                           declares, typeset, moduleName, generics)
+                           declares, typeset, moduleName, generics,
+                           _dll_export)
 
                 line(out_h)
                 line(out_h, 0, '#endif')
@@ -562,17 +594,18 @@ def jcc(args):
 
         if moduleName:
             out = file(os.path.join(cppdir, moduleName) + '.cpp', 'w')
-            module(out, allInOne, done, cppdir, moduleName, shared, generics)
+            module(out, allInOne, done, imports, cppdir, moduleName,
+                   shared, generics)
             out.close()
             if build or install or dist:
                 compile(env, os.path.dirname(args[0]), output, moduleName,
                         install, dist, debug, jars, version,
                         prefix, root, install_dir, home_dir, use_distutils,
                         shared, compiler, modules, wininst, find_jvm_dll,
-                        arch, generics, resources)
+                        arch, generics, resources, imports)
 
 
-def header(env, out, cls, typeset, packages, excludes, generics):
+def header(env, out, cls, typeset, packages, excludes, generics, _dll_export):
 
     names = cls.getName().split('.')
     superCls = cls.getSuperclass()
@@ -736,10 +769,11 @@ def header(env, out, cls, typeset, packa
 
     line(out)
     if superClsName == 'JObject':
-        line(out, indent, 'class %s : public JObject {', cppname(names[-1]))
+        line(out, indent, 'class %s%s : public JObject {',
+             _dll_export, cppname(names[-1]))
     else:
-        line(out, indent, 'class %s : public %s {',
-             cppname(names[-1]), '::'.join(cppnames(superNames)))
+        line(out, indent, 'class %s%s : public %s {',
+             _dll_export, cppname(names[-1]), '::'.join(cppnames(superNames)))
         
     line(out, indent, 'public:')
     indent += 1

Modified: lucene/pylucene/trunk/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/python.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/python.py Tue May 18 19:43:19 2010
@@ -141,7 +141,7 @@ def parseArgs(params, current, generics,
             return ''
         if is_boxed(clsName):
             clsNames = clsName.split('.')
-            return ', &%s::%s$$Type' %('::'.join(cppnames(clsNames[:-1])), cppname(clsNames[-1]))
+            return ', &%s::PY_TYPE(%s)' %('::'.join(cppnames(clsNames[:-1])), cppname(clsNames[-1]))
         return ', %s::initializeClass' %(typename(cls, current, False))
 
     def callarg(cls, i):
@@ -288,7 +288,7 @@ def returnValue(cls, returnType, value, 
             for clsArg in getActualTypeArguments(genericRT):
                 if Class.instance_(clsArg):
                     clsNames = Class.cast_(clsArg).getName().split('.')
-                    clsArg = '&%s::%s$$Type' %('::'.join(cppnames(clsNames[:-1])), cppname(clsNames[-1]))
+                    clsArg = '&%s::PY_TYPE(%s)' %('::'.join(cppnames(clsNames[:-1])), cppname(clsNames[-1]))
                     clsArgs.append(clsArg)
                 elif TypeVariable.instance_(clsArg):
                     gd = TypeVariable.cast_(clsArg).getGenericDeclaration()
@@ -380,7 +380,7 @@ def call(out, indent, cls, inCase, metho
     if isExtension and name == 'clone' and Modifier.isNative(modifiers):
         line(out)
         line(out, indent, '%s object(result.this$);', typename(cls, cls, False))
-        line(out, indent, 'if (PyObject_TypeCheck(arg, &FinalizerProxy$$Type) &&')
+        line(out, indent, 'if (PyObject_TypeCheck(arg, &PY_TYPE(FinalizerProxy)) &&')
         line(out, indent, '    PyObject_TypeCheck(((t_fp *) arg)->object, self->ob_type))')
         line(out, indent, '{')
         line(out, indent + 1, 'PyObject *_arg = ((t_fp *) arg)->object;')
@@ -541,7 +541,8 @@ def extension(env, out, indent, cls, nam
 
 def python(env, out_h, out, cls, superCls, names, superNames,
            constructors, methods, protectedMethods, fields, instanceFields,
-           mapping, sequence, rename, declares, typeset, moduleName, generics):
+           mapping, sequence, rename, declares, typeset, moduleName, generics,
+           _dll_export):
 
     line(out_h)
     line(out_h, 0, '#include <Python.h>')
@@ -551,7 +552,8 @@ def python(env, out_h, out, cls, superCl
     for name in names[:-1]:
         line(out_h, indent, 'namespace %s {', cppname(name))
         indent += 1
-    line(out_h, indent, 'extern PyTypeObject %s$$Type;', names[-1])
+    line(out_h, indent, '%sextern PyTypeObject PY_TYPE(%s);', 
+         _dll_export, names[-1])
 
     if generics:
         clsParams = getTypeParameters(cls)
@@ -559,7 +561,7 @@ def python(env, out_h, out, cls, superCl
         clsParams = None
 
     line(out_h)
-    line(out_h, indent, 'class t_%s {', names[-1])
+    line(out_h, indent, 'class %st_%s {', _dll_export, names[-1])
     line(out_h, indent, 'public:')
     line(out_h, indent + 1, 'PyObject_HEAD')
     line(out_h, indent + 1, '%s object;', cppname(names[-1]))
@@ -573,11 +575,12 @@ def python(env, out_h, out, cls, superCl
 
     line(out_h, indent + 1, 'static PyObject *wrap_Object(const %s&);',
          cppname(names[-1]))
+    line(out_h, indent + 1, 'static PyObject *wrap_jobject(const jobject&);')
     if clsParams:
+        _clsParams = ', '.join(['PyTypeObject *'] * len(clsParams))
         line(out_h, indent + 1, 'static PyObject *wrap_Object(const %s&, %s);',
-             cppname(names[-1]),
-             ', '.join(['PyTypeObject *'] * len(clsParams)))
-    line(out_h, indent + 1, 'static PyObject *wrap_jobject(const jobject&);')
+             cppname(names[-1]), _clsParams)
+        line(out_h, indent + 1, 'static PyObject *wrap_jobject(const jobject&, %s);', _clsParams)
     line(out_h, indent + 1, 'static void install(PyObject *module);')
     line(out_h, indent + 1, 'static void initialize(PyObject *module);')
     line(out_h, indent, '};')
@@ -993,7 +996,27 @@ def python(env, out_h, out, cls, superCl
         line(out, indent, "{")
         line(out, indent + 1, "PyObject *obj = t_%s::wrap_Object(object);",
              names[-1])
-        line(out, indent + 1, "if (obj != Py_None)")
+        line(out, indent + 1, "if (obj != NULL && obj != Py_None)")
+        line(out, indent + 1, "{")
+        line(out, indent + 2, "t_%s *self = (t_%s *) obj;",
+             names[-1], names[-1])
+        i = 0;
+        for clsParam in clsParams:
+            line(out, indent + 2, "self->parameters[%d] = %s;",
+                 i, clsParam.getName())
+            i += 1
+        line(out, indent + 1, "}")
+        line(out, indent + 1, "return obj;");
+        line(out, indent, "}")
+
+        line(out)
+        line(out, indent, 
+             "PyObject *t_%s::wrap_jobject(const jobject& object, %s)",
+             cppname(names[-1]), ', '.join(clsArgs))
+        line(out, indent, "{")
+        line(out, indent + 1, "PyObject *obj = t_%s::wrap_jobject(object);",
+             names[-1])
+        line(out, indent + 1, "if (obj != NULL && obj != Py_None)")
         line(out, indent + 1, "{")
         line(out, indent + 2, "t_%s *self = (t_%s *) obj;",
              names[-1], names[-1])
@@ -1001,6 +1024,7 @@ def python(env, out_h, out, cls, superCl
         for clsParam in clsParams:
             line(out, indent + 2, "self->parameters[%d] = %s;",
                  i, clsParam.getName())
+            i += 1
         line(out, indent + 1, "}")
         line(out, indent + 1, "return obj;");
         line(out, indent, "}")
@@ -1008,20 +1032,20 @@ def python(env, out_h, out, cls, superCl
     line(out)
     line(out, indent, 'void t_%s::install(PyObject *module)', names[-1])
     line(out, indent, '{')
-    line(out, indent + 1, 'installType(&%s$$Type, module, "%s", %d);',
+    line(out, indent + 1, 'installType(&PY_TYPE(%s), module, "%s", %d);',
          names[-1], rename or names[-1], isExtension and 1 or 0)
     for inner in cls.getDeclaredClasses():
         if inner in typeset:
             if Modifier.isStatic(inner.getModifiers()):
                 innerName = inner.getName().split('.')[-1]
-                line(out, indent + 1, 'PyDict_SetItemString(%s$$Type.tp_dict, "%s", make_descriptor(&%s$$Type));',
+                line(out, indent + 1, 'PyDict_SetItemString(PY_TYPE(%s).tp_dict, "%s", make_descriptor(&PY_TYPE(%s)));',
                      names[-1], innerName[len(names[-1])+1:], innerName)
     line(out, indent, '}')
 
     line(out)
     line(out, indent, 'void t_%s::initialize(PyObject *module)', names[-1])
     line(out, indent, '{')
-    line(out, indent + 1, 'PyDict_SetItemString(%s$$Type.tp_dict, "class_", make_descriptor(%s::initializeClass, %s));',
+    line(out, indent + 1, 'PyDict_SetItemString(PY_TYPE(%s).tp_dict, "class_", make_descriptor(%s::initializeClass, %s));',
          names[-1], cppname(names[-1]), generics and 1 or 0)
 
     if is_unboxed(cls.getName()):
@@ -1031,8 +1055,8 @@ def python(env, out_h, out, cls, superCl
         wrapfn_ = "t_%s::wrap_jobject" %(names[-1])
         boxfn_ = "boxObject"
 
-    line(out, indent + 1, 'PyDict_SetItemString(%s$$Type.tp_dict, "wrapfn_", make_descriptor(%s));', names[-1], wrapfn_)
-    line(out, indent + 1, 'PyDict_SetItemString(%s$$Type.tp_dict, "boxfn_", make_descriptor(%s));', names[-1], boxfn_)
+    line(out, indent + 1, 'PyDict_SetItemString(PY_TYPE(%s).tp_dict, "wrapfn_", make_descriptor(%s));', names[-1], wrapfn_)
+    line(out, indent + 1, 'PyDict_SetItemString(PY_TYPE(%s).tp_dict, "boxfn_", make_descriptor(%s));', names[-1], boxfn_)
 
     if isExtension:
         line(out, indent + 1, 'jclass cls = %s::initializeClass();',
@@ -1057,7 +1081,7 @@ def python(env, out_h, out, cls, superCl
         fieldName = field.getName()
         value = '%s::%s' %(cppname(names[-1]), cppname(fieldName))
         value = fieldValue(cls, value, fieldType)
-        line(out, indent + 1, 'PyDict_SetItemString(%s$$Type.tp_dict, "%s", make_descriptor(%s));',
+        line(out, indent + 1, 'PyDict_SetItemString(PY_TYPE(%s).tp_dict, "%s", make_descriptor(%s));',
              names[-1], fieldName, value)
     line(out, indent, '}')
 
@@ -1175,7 +1199,7 @@ def python(env, out_h, out, cls, superCl
                     line(out, indent + 1, 'return callSuper(type, "%s"%s, %d);',
                          name, args, cardinality)
                 else:
-                    line(out, indent + 1, 'return callSuper(&%s$$Type, (PyObject *) self, "%s"%s, %d);',
+                    line(out, indent + 1, 'return callSuper(&PY_TYPE(%s), (PyObject *) self, "%s"%s, %d);',
                          names[-1], name, args, cardinality)
             else:
                 line(out, indent + 1, 'PyErr_SetArgsError(%s, "%s"%s);',
@@ -1462,7 +1486,8 @@ def package(out, allInOne, cppdir, names
         package(out, allInOne, cppdir, entries, names + (name,))
 
 
-def module(out, allInOne, classes, cppdir, moduleName, shared, generics):
+def module(out, allInOne, classes, imports, cppdir, moduleName,
+           shared, generics):
 
     extname = '_%s' %(moduleName)
     line(out, 0, '#include <Python.h>')
@@ -1473,11 +1498,15 @@ def module(out, allInOne, classes, cppdi
         out_init = file(os.path.join(cppdir, '__init__.cpp'), 'w')
     namespaces = {}
     for cls in classes:
-        namespace = namespaces
-        classNames = cls.getName().split('.')
-        for className in classNames[:-1]:
-            namespace = namespace.setdefault(className, {})
-        namespace[classNames[-1]] = True
+        for importset in imports.itervalues():
+            if cls in importset:
+                break
+        else:
+            namespace = namespaces
+            classNames = cls.getName().split('.')
+            for className in classNames[:-1]:
+                namespace = namespace.setdefault(className, {})
+            namespace[classNames[-1]] = True
     if allInOne:
         package(out_init, True, cppdir, namespaces, ())
         out_init.close()
@@ -1487,7 +1516,7 @@ def module(out, allInOne, classes, cppdi
     line(out)
     line(out, 0, 'PyObject *initJCC(PyObject *module);')
     line(out, 0, 'void __install__(PyObject *module);')
-    line(out, 0, 'extern PyTypeObject JObject$$Type, ConstVariableDescriptor$$Type, FinalizerClass$$Type, FinalizerProxy$$Type;')
+    line(out, 0, 'extern PyTypeObject PY_TYPE(JObject), PY_TYPE(ConstVariableDescriptor), PY_TYPE(FinalizerClass), PY_TYPE(FinalizerProxy);')
     line(out, 0, 'extern void _install_jarray(PyObject *);')
     line(out)
     line(out, 0, 'extern "C" {')
@@ -1513,7 +1542,7 @@ def module(out, allInOne, classes, cppdi
 def compile(env, jccPath, output, moduleName, install, dist, debug, jars,
             version, prefix, root, install_dir, home_dir, use_distutils,
             shared, compiler, modules, wininst, find_jvm_dll, arch, generics,
-            resources):
+            resources, imports):
 
     try:
         if use_distutils:
@@ -1611,8 +1640,8 @@ def compile(env, jccPath, output, module
     line(out, 1, 'def getJavaException(self):')
     line(out, 2, 'return self.args[0]')
     line(out, 1, 'def __str__(self):')
-    line(out, 2, 'writer = %s.StringWriter()', extname)
-    line(out, 2, 'self.getJavaException().printStackTrace(%s.PrintWriter(writer))', extname)
+    line(out, 2, 'writer = StringWriter()')
+    line(out, 2, 'self.getJavaException().printStackTrace(PrintWriter(writer))')
     line(out, 2, 'return "\\n".join((super(JavaError, self).__str__(), "    Java stacktrace:", str(writer)))')
     line(out)
     line(out, 0, 'class InvalidArgsError(Exception):')
@@ -1632,11 +1661,15 @@ def compile(env, jccPath, output, module
          extname, extname, extname)
 
     line(out)
+    for import_ in imports:
+        line(out, 0, 'from %s._%s import *', import_.__name__, import_.__name__)
     line(out, 0, 'from %s import *', extname)
     out.close()
 
     includes = [os.path.join(output, extname),
                 os.path.join(jccPath, 'sources')]
+    for import_ in imports:
+        includes.append(os.path.join(import_.__dir__, 'include'))
 
     sources = ['JObject.cpp', 'JArray.cpp', 'functions.cpp', 'types.cpp']
     if not shared:
@@ -1646,6 +1679,25 @@ def compile(env, jccPath, output, module
 	shutil.copy2(os.path.join(jccPath, 'sources', source),
                      os.path.join(output, extname))
 
+    if shared:
+        def copytree(src, dst):
+            _dst = os.path.join(modulePath, dst)
+            if not os.path.exists(_dst):
+                os.mkdir(_dst)
+            for name in os.listdir(src):
+                if name.startswith('.'):
+                    continue
+                _src = os.path.join(src, name)
+                if os.path.islink(_src):
+                    continue
+                _dst = os.path.join(dst, name)
+                if os.path.isdir(_src):
+                    copytree(_src, _dst)
+                elif name.endswith('.h'):
+                    shutil.copy2(_src, os.path.join(modulePath, _dst))
+                    package_data.append(_dst)
+        copytree(os.path.join(output, extname), 'include')
+
     sources = []
     for path, dirs, names in os.walk(os.path.join(output, extname)):
         for name in names:
@@ -1670,7 +1722,7 @@ def compile(env, jccPath, output, module
         script_args.append('--debug')
         compile_args += DEBUG_CFLAGS
     elif sys.platform == 'win32':
-        pass
+	pass
     elif sys.platform == 'sunos5':
         link_args.append('-Wl,-s')
     else:
@@ -1699,11 +1751,12 @@ def compile(env, jccPath, output, module
         'extra_compile_args': compile_args,
         'extra_link_args': link_args,
         'include_dirs': includes,
-        'sources': sources
+        'sources': sources,
+        'define_macros': []
     }
 
     if generics:
-        args['define_macros'] = [('_java_generics', None)]
+        args['define_macros'] += [('_java_generics', None)]
 
     if shared:
         shlibdir = os.path.dirname(os.path.dirname(_jcc.__file__))
@@ -1719,9 +1772,30 @@ def compile(env, jccPath, output, module
             args['extra_link_args'] += ['-Wl,-rpath', shlibdir]
             args['library_dirs'] = [shlibdir]
             args['libraries'] = ['jcc']
+            args['extra_link_args'] += [
+                getattr(import_, "_%s" %(import_.__name__)).__file__
+                for import_ in imports
+            ]
         elif sys.platform == 'win32':
-            jcclib = 'jcc%s.lib' %(debug and '_d' or '')
-            args['extra_link_args'] += [os.path.join(shlibdir, 'jcc', jcclib)]
+            _d = debug and '_d' or ''
+            libdir = os.path.join(modulePath, 'lib')
+            if not os.path.exists(libdir):
+                os.mkdir(libdir)
+            extlib = os.path.join('lib', "%s%s.lib" %(extname, _d))
+            package_data.append(extlib)
+            args['extra_link_args'] += [
+                os.path.join(shlibdir, 'jcc', 'jcc%s.lib' %(_d)),
+                "/IMPLIB:%s" %(os.path.join(modulePath, extlib))
+            ]
+            args['libraries'] = [
+                os.path.join(import_.__dir__, 'lib',
+                             '_%s%s' %(import_.__name__, _d))
+                for import_ in imports
+            ]
+            args['define_macros'] += [
+                ("_dll_%s" %(import_.__name__), '_declspec(dllimport)')
+                for import_ in imports
+            ] + [("_dll_%s" %(moduleName), '_declspec(dllexport)')]
         else:
             raise NotImplementedError, "shared mode on %s" %(sys.platform)
 

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp Tue May 18 19:43:19 2010
@@ -413,7 +413,7 @@ static PyObject *cast_(PyTypeObject *typ
     if (!PyArg_ParseTuple(args, "O", &arg))
         return NULL;
 
-    if (!PyObject_TypeCheck(arg, &Object$$Type))
+    if (!PyObject_TypeCheck(arg, &PY_TYPE(Object)))
     {
         PyErr_SetObject(PyExc_TypeError, arg);
         return NULL;
@@ -450,7 +450,7 @@ static PyObject *instance_(PyTypeObject 
     if (!PyArg_ParseTuple(args, "O", &arg))
         return NULL;
 
-    if (!PyObject_TypeCheck(arg, &Object$$Type))
+    if (!PyObject_TypeCheck(arg, &PY_TYPE(Object)))
         Py_RETURN_FALSE;
 
     Class argCls = ((t_Object *) arg)->object.getClass();
@@ -600,7 +600,7 @@ public:
             (richcmpfunc) (PyObject *(*)(U *, PyObject *, int)) richcompare<U>;
         type_object.tp_iter = (getiterfunc) (PyObject *(*)(U *)) iter<U>;
         type_object.tp_methods = methods;
-        type_object.tp_base = &Object$$Type;
+        type_object.tp_base = &PY_TYPE(Object);
         type_object.tp_init =
             (initproc) (int (*)(U *, PyObject *, PyObject *)) init<T,U>;
         type_object.tp_new = (newfunc) _new;
@@ -638,11 +638,11 @@ template<> int init< jobject,_t_jobjecta
 
     if (clsObj == NULL)
         cls = env->findClass("java/lang/Object");
-    else if (PyObject_TypeCheck(clsObj, &Class$$Type))
+    else if (PyObject_TypeCheck(clsObj, &PY_TYPE(Class)))
         cls = (jclass) ((t_Class *) clsObj)->object.this$;
     else if (PyType_Check(clsObj))
     {
-        if (PyType_IsSubtype((PyTypeObject *) clsObj, &JObject$$Type))
+        if (PyType_IsSubtype((PyTypeObject *) clsObj, &PY_TYPE(JObject)))
         {
             PyObject *cobj = PyObject_GetAttrString(clsObj, "wrapfn_");
 
@@ -732,7 +732,7 @@ template<> PyObject *cast_<jobject>(PyTy
     if (!PyArg_ParseTuple(args, "O|O", &arg, &clsArg))
         return NULL;
 
-    if (!PyObject_TypeCheck(arg, &Object$$Type))
+    if (!PyObject_TypeCheck(arg, &PY_TYPE(Object)))
     {
         PyErr_SetObject(PyExc_TypeError, arg);
         return NULL;
@@ -753,7 +753,7 @@ template<> PyObject *cast_<jobject>(PyTy
             PyErr_SetObject(PyExc_TypeError, clsArg);
             return NULL;
         }
-        else if (!PyType_IsSubtype((PyTypeObject *) clsArg, &JObject$$Type))
+        else if (!PyType_IsSubtype((PyTypeObject *) clsArg, &PY_TYPE(JObject)))
         {
             PyErr_SetObject(PyExc_ValueError, clsArg);
             return NULL;
@@ -801,7 +801,7 @@ template<> PyObject *instance_<jobject>(
     if (!PyArg_ParseTuple(args, "O|O", &arg, &clsArg))
         return NULL;
 
-    if (!PyObject_TypeCheck(arg, &Object$$Type))
+    if (!PyObject_TypeCheck(arg, &PY_TYPE(Object)))
         Py_RETURN_FALSE;
 
     Class argCls = ((t_Object *) arg)->object.getClass();
@@ -816,7 +816,7 @@ template<> PyObject *instance_<jobject>(
             PyErr_SetObject(PyExc_TypeError, clsArg);
             return NULL;
         }
-        else if (!PyType_IsSubtype((PyTypeObject *) clsArg, &JObject$$Type))
+        else if (!PyType_IsSubtype((PyTypeObject *) clsArg, &PY_TYPE(JObject)))
         {
             PyErr_SetObject(PyExc_ValueError, clsArg);
             return NULL;
@@ -851,7 +851,7 @@ template<> PyObject *assignable_<jobject
     if (!PyArg_ParseTuple(args, "O|O", &arg, &clsArg))
         return NULL;
 
-    if (!PyObject_TypeCheck(arg, &Object$$Type))
+    if (!PyObject_TypeCheck(arg, &PY_TYPE(Object)))
         Py_RETURN_FALSE;
 
     Class argCls = ((t_Object *) arg)->object.getClass();
@@ -866,7 +866,7 @@ template<> PyObject *assignable_<jobject
             PyErr_SetObject(PyExc_TypeError, clsArg);
             return NULL;
         }
-        else if (!PyType_IsSubtype((PyTypeObject *) clsArg, &JObject$$Type))
+        else if (!PyType_IsSubtype((PyTypeObject *) clsArg, &PY_TYPE(JObject)))
         {
             PyErr_SetObject(PyExc_ValueError, clsArg);
             return NULL;
@@ -1150,60 +1150,60 @@ static PyGetSetDef t_jarray_jbyte__field
 };
 
 
-PyTypeObject *JArrayObject$$Type;
-PyTypeObject *JArrayString$$Type;
-PyTypeObject *JArrayBool$$Type;
-PyTypeObject *JArrayByte$$Type;
-PyTypeObject *JArrayChar$$Type;
-PyTypeObject *JArrayDouble$$Type;
-PyTypeObject *JArrayFloat$$Type;
-PyTypeObject *JArrayInt$$Type;
-PyTypeObject *JArrayLong$$Type;
-PyTypeObject *JArrayShort$$Type;
+PyTypeObject *PY_TYPE(JArrayObject);
+PyTypeObject *PY_TYPE(JArrayString);
+PyTypeObject *PY_TYPE(JArrayBool);
+PyTypeObject *PY_TYPE(JArrayByte);
+PyTypeObject *PY_TYPE(JArrayChar);
+PyTypeObject *PY_TYPE(JArrayDouble);
+PyTypeObject *PY_TYPE(JArrayFloat);
+PyTypeObject *PY_TYPE(JArrayInt);
+PyTypeObject *PY_TYPE(JArrayLong);
+PyTypeObject *PY_TYPE(JArrayShort);
 
 
 void _install_jarray(PyObject *module)
 {
     jarray_jobject.install("JArray_object", "object",
                             "__JArray_object_iterator", module);
-    JArrayObject$$Type = &jarray_jobject.type_object;
+    PY_TYPE(JArrayObject) = &jarray_jobject.type_object;
 
     jarray_jstring.install("JArray_string", "string",
                             "__JArray_string_iterator", module);
-    JArrayString$$Type = &jarray_jstring.type_object;
+    PY_TYPE(JArrayString) = &jarray_jstring.type_object;
 
     jarray_jboolean.install("JArray_bool", "bool",
                             "__JArray_bool_iterator", module);
-    JArrayBool$$Type = &jarray_jboolean.type_object;
+    PY_TYPE(JArrayBool) = &jarray_jboolean.type_object;
 
     jarray_jbyte.type_object.tp_getset = t_jarray_jbyte__fields;
     jarray_jbyte.install("JArray_byte", "byte",
                          "__JArray_byte_iterator", module);
-    JArrayByte$$Type = &jarray_jbyte.type_object;
+    PY_TYPE(JArrayByte) = &jarray_jbyte.type_object;
 
     jarray_jchar.install("JArray_char", "char",
                          "__JArray_char_iterator", module);
-    JArrayChar$$Type = &jarray_jchar.type_object;
+    PY_TYPE(JArrayChar) = &jarray_jchar.type_object;
 
     jarray_jdouble.install("JArray_double", "double",
                            "__JArray_double_iterator", module);
-    JArrayDouble$$Type = &jarray_jdouble.type_object;
+    PY_TYPE(JArrayDouble) = &jarray_jdouble.type_object;
 
     jarray_jfloat.install("JArray_float", "float",
                           "__JArray_float_iterator", module);
-    JArrayFloat$$Type = &jarray_jfloat.type_object;
+    PY_TYPE(JArrayFloat) = &jarray_jfloat.type_object;
 
     jarray_jint.install("JArray_int", "int",
                         "__JArray_int_iterator", module);
-    JArrayInt$$Type = &jarray_jint.type_object;
+    PY_TYPE(JArrayInt) = &jarray_jint.type_object;
 
     jarray_jlong.install("JArray_long", "long",
                          "__JArray_long_iterator", module);
-    JArrayLong$$Type = &jarray_jlong.type_object;
+    PY_TYPE(JArrayLong) = &jarray_jlong.type_object;
 
     jarray_jshort.install("JArray_short", "short",
                           "__JArray_short_iterator", module);
-    JArrayShort$$Type = &jarray_jshort.type_object;
+    PY_TYPE(JArrayShort) = &jarray_jshort.type_object;
 }
 
 #endif /* PYTHON */

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JArray.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JArray.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JArray.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JArray.h Tue May 18 19:43:19 2010
@@ -1,6 +1,4 @@
 /*
- *   Copyright (c) 2007-2008 Open Source Applications Foundation
- *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
  *   You may obtain a copy of the License at
@@ -24,16 +22,16 @@
 extern jobjectArray fromPySequence(jclass cls, PyObject *sequence);
 extern PyObject *PyErr_SetJavaError(jthrowable throwable);
 
-extern PyTypeObject *JArrayObject$$Type;
-extern PyTypeObject *JArrayString$$Type;
-extern PyTypeObject *JArrayBool$$Type;
-extern PyTypeObject *JArrayByte$$Type;
-extern PyTypeObject *JArrayChar$$Type;
-extern PyTypeObject *JArrayDouble$$Type;
-extern PyTypeObject *JArrayFloat$$Type;
-extern PyTypeObject *JArrayInt$$Type;
-extern PyTypeObject *JArrayLong$$Type;
-extern PyTypeObject *JArrayShort$$Type;
+extern PyTypeObject *PY_TYPE(JArrayObject);
+extern PyTypeObject *PY_TYPE(JArrayString);
+extern PyTypeObject *PY_TYPE(JArrayBool);
+extern PyTypeObject *PY_TYPE(JArrayByte);
+extern PyTypeObject *PY_TYPE(JArrayChar);
+extern PyTypeObject *PY_TYPE(JArrayDouble);
+extern PyTypeObject *PY_TYPE(JArrayFloat);
+extern PyTypeObject *PY_TYPE(JArrayInt);
+extern PyTypeObject *PY_TYPE(JArrayLong);
+extern PyTypeObject *PY_TYPE(JArrayShort);
 
 #endif
 
@@ -181,7 +179,7 @@ template<> class JArray<jobject> : publi
 
             if (n >= 0 && n < length)
             {
-                if (!PyObject_TypeCheck(obj, &JObject$$Type))
+                if (!PyObject_TypeCheck(obj, &PY_TYPE(JObject)))
                 {
                     PyErr_SetObject(PyExc_TypeError, obj);
                     return -1;
@@ -347,7 +345,7 @@ template<> class JArray<jboolean> : publ
             elts = env->get_vm_env()->GetBooleanArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseBooleanArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseBooleanArrayElements(array, elts, 0);
         }
         operator jboolean *() {
             return elts;
@@ -472,7 +470,7 @@ template<> class JArray<jboolean> : publ
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jboolean value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -493,7 +491,7 @@ template<> class JArray<jbyte> : public 
             elts = env->get_vm_env()->GetByteArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseByteArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseByteArrayElements(array, elts, 0);
         }
         operator jbyte *() {
             return elts;
@@ -646,7 +644,7 @@ template<> class JArray<jbyte> : public 
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jbyte value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -667,7 +665,7 @@ template<> class JArray<jchar> : public 
             elts = env->get_vm_env()->GetCharArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseCharArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseCharArrayElements(array, elts, 0);
         }
         operator jchar *() {
             return elts;
@@ -833,7 +831,7 @@ template<> class JArray<jchar> : public 
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jchar value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -854,7 +852,7 @@ template<> class JArray<jdouble> : publi
             elts = env->get_vm_env()->GetDoubleArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseDoubleArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseDoubleArrayElements(array, elts, 0);
         }
         operator jdouble *() {
             return elts;
@@ -980,7 +978,7 @@ template<> class JArray<jdouble> : publi
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jdouble value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -1001,7 +999,7 @@ template<> class JArray<jfloat> : public
             elts = env->get_vm_env()->GetFloatArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseFloatArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseFloatArrayElements(array, elts, 0);
         }
         operator jfloat *() {
             return elts;
@@ -1127,7 +1125,7 @@ template<> class JArray<jfloat> : public
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jfloat value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -1148,7 +1146,7 @@ template<> class JArray<jint> : public j
             elts = env->get_vm_env()->GetIntArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseIntArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseIntArrayElements(array, elts, 0);
         }
         operator jint *() {
             return elts;
@@ -1274,7 +1272,7 @@ template<> class JArray<jint> : public j
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jint value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -1295,7 +1293,7 @@ template<> class JArray<jlong> : public 
             elts = env->get_vm_env()->GetLongArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseLongArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseLongArrayElements(array, elts, 0);
         }
         operator jlong *() {
             return elts;
@@ -1421,7 +1419,7 @@ template<> class JArray<jlong> : public 
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jlong value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }
@@ -1442,7 +1440,7 @@ template<> class JArray<jshort> : public
             elts = env->get_vm_env()->GetShortArrayElements(array, &isCopy);
         }
         virtual ~arrayElements() {
-            env->get_vm_env()->ReleaseShortArrayElements(array, elts, isCopy);
+            env->get_vm_env()->ReleaseShortArrayElements(array, elts, 0);
         }
         operator jshort *() {
             return elts;
@@ -1568,7 +1566,7 @@ template<> class JArray<jshort> : public
             vm_env->GetPrimitiveArrayCritical((jarray) this$, &isCopy);
         jshort value = elts[n];
 
-        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, isCopy);
+        vm_env->ReleasePrimitiveArrayCritical((jarray) this$, elts, 0);
 
         return value;
     }

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.cpp Tue May 18 19:43:19 2010
@@ -111,6 +111,9 @@ void JCCEnv::set_vm(JavaVM *vm, JNIEnv *
         vm_env->GetMethodID(_obj, "getClass",
                             "()Ljava/lang/Class;");
 
+    _mids[mid_iterator] =
+        vm_env->GetMethodID(vm_env->FindClass("java/lang/Iterable"),
+                            "iterator", "()Ljava/util/Iterator;");
     _mids[mid_iterator_next] =
         vm_env->GetMethodID(vm_env->FindClass("java/util/Iterator"),
                             "next", "()Ljava/lang/Object;");
@@ -176,6 +179,11 @@ jstring JCCEnv::getJavaVersion() const
                                get_vm_env()->NewStringUTF("java.version"));
 }
 
+jobject JCCEnv::iterator(jobject obj) const
+{
+    return callObjectMethod(obj, _mids[mid_iterator]);
+}
+
 jobject JCCEnv::iteratorNext(jobject obj) const
 {
     return callObjectMethod(obj, _mids[mid_iterator_next]);
@@ -682,7 +690,7 @@ void JCCEnv::setClassPath(const char *cl
     jmethodID mf = vm_env->GetMethodID(_fil, "<init>", "(Ljava/lang/String;)V");
     jmethodID mu = vm_env->GetMethodID(_fil, "toURL", "()Ljava/net/URL;");
     jmethodID ma = vm_env->GetMethodID(_ucl, "addURL", "(Ljava/net/URL;)V");
-#ifdef WINDOWS
+#if defined(_MSC_VER) || defined(__WIN32)
     char *pathsep = ";";
 #else
     char *pathsep = ":";
@@ -701,6 +709,52 @@ void JCCEnv::setClassPath(const char *cl
     free(path);
 }
 
+char *JCCEnv::getClassPath()
+{
+    JNIEnv *vm_env = get_vm_env();
+    jclass _ucl = (jclass) vm_env->FindClass("java/net/URLClassLoader");
+    jclass _url = (jclass) vm_env->FindClass("java/net/URL");
+    jmethodID mid = vm_env->GetStaticMethodID(_ucl, "getSystemClassLoader",
+                                              "()Ljava/lang/ClassLoader;");
+    jobject classLoader = vm_env->CallStaticObjectMethod(_ucl, mid);
+    jmethodID gu = vm_env->GetMethodID(_ucl, "getURLs", "()[Ljava/net/URL;");
+    jmethodID gp = vm_env->GetMethodID(_url, "getPath", "()Ljava/lang/String;");
+#if defined(_MSC_VER) || defined(__WIN32)
+    char *pathsep = ";";
+#else
+    char *pathsep = ":";
+#endif
+    jobjectArray array = (jobjectArray)
+        vm_env->CallObjectMethod(classLoader, gu);
+    int count = array ? vm_env->GetArrayLength(array) : 0;
+    int first = 1, total = 0;
+    char *classpath = NULL;
+    
+    for (int i = 0; i < count; i++) {
+        jobject url = vm_env->GetObjectArrayElement(array, i);
+        jstring path = (jstring) vm_env->CallObjectMethod(url, gp);
+        const char *chars = vm_env->GetStringUTFChars(path, NULL);
+        int size = vm_env->GetStringUTFLength(path);
+
+        total += size + 1;
+        if (classpath == NULL)
+            classpath = (char *) calloc(total, 1);
+        else
+            classpath = (char *) realloc(classpath, total);
+        if (classpath == NULL)
+            return NULL;
+
+        if (first)
+            first = 0;
+        else
+            strcat(classpath, pathsep);
+
+        strcat(classpath, chars);
+    }
+
+    return classpath;
+}
+
 jstring JCCEnv::fromUTF(const char *bytes) const
 {
     jstring str = get_vm_env()->NewStringUTF(bytes);

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JCCEnv.h Tue May 18 19:43:19 2010
@@ -87,6 +87,7 @@ protected:
         mid_obj_toString,
         mid_obj_hashCode,
         mid_obj_getClass,
+        mid_iterator,
         mid_iterator_next,
         mid_enumeration_nextElement,
         mid_Boolean_booleanValue,
@@ -152,6 +153,7 @@ public:
     virtual void registerNatives(jclass cls, JNINativeMethod *methods,
                                  int n) const;
 
+    virtual jobject iterator(jobject obj) const;
     virtual jobject iteratorNext(jobject obj) const;
     virtual jobject enumerationNext(jobject obj) const;
 
@@ -284,6 +286,7 @@ public:
     }
 
     virtual void setClassPath(const char *classPath);
+    virtual char *getClassPath();
 
     virtual jstring fromUTF(const char *bytes) const;
     virtual char *toUTF(jstring str) const;

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JObject.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JObject.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JObject.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JObject.cpp Tue May 18 19:43:19 2010
@@ -49,7 +49,7 @@ static PyGetSetDef t_JObject_properties[
     { NULL, NULL, NULL, NULL, NULL }
 };
 
-PyTypeObject JObject$$Type = {
+PyTypeObject PY_TYPE(JObject) = {
     PyObject_HEAD_INIT(NULL)
     0,                                   /* ob_size */
     "jcc.JObject",                       /* tp_name */
@@ -116,7 +116,7 @@ static PyObject *t_JObject_richcmp(t_JOb
     switch (op) {
       case Py_EQ:
       case Py_NE:
-        if (PyObject_TypeCheck(arg, &JObject$$Type))
+        if (PyObject_TypeCheck(arg, &PY_TYPE(JObject)))
             b = self->object == ((t_JObject *) arg)->object;
         if (op == Py_EQ)
             Py_RETURN_BOOL(b);

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JObject.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JObject.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JObject.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JObject.h Tue May 18 19:43:19 2010
@@ -20,7 +20,7 @@
 #include <stdio.h>
 #include "JCCEnv.h"
 
-class JObject {
+class _DLL_EXPORT JObject {
 public:
     jobject this$;
     int id;  /* zero when this$ is a weak ref */
@@ -91,6 +91,7 @@ public:
 #ifdef PYTHON
 
 #include <Python.h>
+#include "macros.h"
 
 class t_JObject {
 public:
@@ -98,7 +99,7 @@ public:
     JObject object;
 };
 
-extern PyTypeObject JObject$$Type;
+extern PyTypeObject PY_TYPE(JObject);
 
 #endif /* PYTHON */
 



Mime
View raw message