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 [2/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
Modified: lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp Tue May 18 19:43:19 2010
@@ -81,7 +81,7 @@ PyObject *findClass(PyObject *self, PyOb
 
         if (cls)
             return t_Class::wrap_Object(Class(cls));
-    } catch (JCCEnv::pythonError e) {
+    } catch (JCCEnv::pythonError) {
         return NULL;
     } catch (JCCEnv::exception e) {
         PyErr_SetJavaError(e.throwable);
@@ -213,7 +213,7 @@ int _parseArgs(PyObject **args, unsigned
                   try {
                       getclassfn initializeClass = va_arg(list, getclassfn);
                       cls = (*initializeClass)();
-                  } catch (JCCEnv::pythonError e) {
+                  } catch (JCCEnv::pythonError) {
                       return -1;
                   } catch (JCCEnv::exception e) {
                       PyErr_SetJavaError(e.throwable);
@@ -233,7 +233,7 @@ int _parseArgs(PyObject **args, unsigned
 
               if (array)
               {
-                  if (PyObject_TypeCheck(arg, JArrayObject$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayObject)))
                       break;
 
                   if (PySequence_Check(arg) &&
@@ -246,14 +246,14 @@ int _parseArgs(PyObject **args, unsigned
 
                           if (obj == Py_None)
                               ok = 1;
-                          else if (PyObject_TypeCheck(obj, &Object$$Type) &&
+                          else if (PyObject_TypeCheck(obj, &PY_TYPE(Object)) &&
                                    vm_env->IsInstanceOf(((t_Object *) obj)->object.this$,
cls))
                               ok = 1;
-                          else if (PyObject_TypeCheck(obj, &FinalizerProxy$$Type))
+                          else if (PyObject_TypeCheck(obj, &PY_TYPE(FinalizerProxy)))
                           {
                               PyObject *o = ((t_fp *) obj)->object;
 
-                              if (PyObject_TypeCheck(o, &Object$$Type) &&
+                              if (PyObject_TypeCheck(o, &PY_TYPE(Object)) &&
                                   vm_env->IsInstanceOf(((t_Object *) o)->object.this$,
cls))
                                   ok = 1;
                           }
@@ -266,13 +266,13 @@ int _parseArgs(PyObject **args, unsigned
                           break;
                   }
               }
-              else if (PyObject_TypeCheck(arg, &Object$$Type) &&
+              else if (PyObject_TypeCheck(arg, &PY_TYPE(Object)) &&
                        vm_env->IsInstanceOf(((t_Object *) arg)->object.this$, cls))
                   break;
-              else if (PyObject_TypeCheck(arg, &FinalizerProxy$$Type))
+              else if (PyObject_TypeCheck(arg, &PY_TYPE(FinalizerProxy)))
               {
                   arg = ((t_fp *) arg)->object;
-                  if (PyObject_TypeCheck(arg, &Object$$Type) &&
+                  if (PyObject_TypeCheck(arg, &PY_TYPE(Object)) &&
                       vm_env->IsInstanceOf(((t_Object *) arg)->object.this$, cls))
                       break;
               }
@@ -287,7 +287,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayBool$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayBool)))
                       break;
 
                   if (PySequence_Check(arg))
@@ -317,7 +317,7 @@ int _parseArgs(PyObject **args, unsigned
               {
                   if (arg == Py_None)
                       break;
-                  if (PyObject_TypeCheck(arg, JArrayByte$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayByte)))
                       break;
               }
               else if (PyString_Check(arg) && (PyString_Size(arg) == 1))
@@ -334,7 +334,7 @@ int _parseArgs(PyObject **args, unsigned
               {
                   if (arg == Py_None)
                       break;
-                  if (PyObject_TypeCheck(arg, JArrayChar$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayChar)))
                       break;
               }
               else if (PyUnicode_Check(arg) && PyUnicode_GET_SIZE(arg) == 1)
@@ -349,7 +349,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayInt$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayInt)))
                       break;
 
                   if (PySequence_Check(arg))
@@ -380,7 +380,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayShort$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayShort)))
                       break;
 
                   if (PySequence_Check(arg))
@@ -411,7 +411,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayDouble$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayDouble)))
                       break;
 
                   if (PySequence_Check(arg))
@@ -442,7 +442,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayFloat$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayFloat)))
                       break;
 
                   if (PySequence_Check(arg))
@@ -473,7 +473,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayLong$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayLong)))
                       break;
 
                   if (PySequence_Check(arg))
@@ -504,7 +504,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       break;
 
-                  if (PyObject_TypeCheck(arg, JArrayString$$Type))
+                  if (PyObject_TypeCheck(arg, PY_TYPE(JArrayString)))
                       break;
 
                   if (PySequence_Check(arg) && 
@@ -630,7 +630,7 @@ int _parseArgs(PyObject **args, unsigned
 #endif
                   if (arg == Py_None)
                       *array = JArray<jobject>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayObject$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayObject)))
                       *array = ((t_jarray<jobject> *) arg)->array;
                   else 
                       *array = JArray<jobject>(cls, arg);
@@ -642,7 +642,7 @@ int _parseArgs(PyObject **args, unsigned
               {
                   Object *obj = va_arg(list, Object *);
 
-                  if (PyObject_TypeCheck(arg, &FinalizerProxy$$Type))
+                  if (PyObject_TypeCheck(arg, &PY_TYPE(FinalizerProxy)))
                       arg = ((t_fp *) arg)->object;
 
 #ifdef _java_generics
@@ -674,7 +674,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jboolean>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayBool$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayBool)))
                       *array = ((t_jarray<jboolean> *) arg)->array;
                   else
                       *array = JArray<jboolean>(arg);
@@ -698,7 +698,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jbyte>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayByte$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayByte)))
                       *array = ((t_jarray<jbyte> *) arg)->array;
                   else 
                       *array = JArray<jbyte>(arg);
@@ -727,7 +727,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jchar>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayChar$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayChar)))
                       *array = ((t_jarray<jchar> *) arg)->array;
                   else 
                       *array = JArray<jchar>(arg);
@@ -751,7 +751,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jint>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayInt$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayInt)))
                       *array = ((t_jarray<jint> *) arg)->array;
                   else 
                       *array = JArray<jint>(arg);
@@ -775,7 +775,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jshort>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayShort$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayShort)))
                       *array = ((t_jarray<jshort> *) arg)->array;
                   else 
                       *array = JArray<jshort>(arg);
@@ -799,7 +799,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jdouble>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayDouble$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayDouble)))
                       *array = ((t_jarray<jdouble> *) arg)->array;
                   else 
                       *array = JArray<jdouble>(arg);
@@ -823,7 +823,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jfloat>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayFloat$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayFloat)))
                       *array = ((t_jarray<jfloat> *) arg)->array;
                   else 
                       *array = JArray<jfloat>(arg);
@@ -847,7 +847,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jlong>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayLong$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayLong)))
                       *array = ((t_jarray<jlong> *) arg)->array;
                   else 
                       *array = JArray<jlong>(arg);
@@ -871,7 +871,7 @@ int _parseArgs(PyObject **args, unsigned
 
                   if (arg == Py_None)
                       *array = JArray<jstring>((jobject) NULL);
-                  else if (PyObject_TypeCheck(arg, JArrayString$$Type))
+                  else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayString)))
                       *array = ((t_jarray<jstring> *) arg)->array;
                   else 
                       *array = JArray<jstring>(arg);
@@ -1048,7 +1048,7 @@ void throwPythonError(void)
                 Py_XDECREF(traceback);
                 exc = je;
 
-                if (exc && PyObject_TypeCheck(exc, &Throwable$$Type))
+                if (exc && PyObject_TypeCheck(exc, &PY_TYPE(Throwable)))
                 {
                     jobject jobj = ((t_Throwable *) exc)->object.this$;
 
@@ -1175,10 +1175,10 @@ PyObject *callSuper(PyTypeObject *type, 
 PyObject *castCheck(PyObject *obj, getclassfn initializeClass,
                     int reportError)
 {
-    if (PyObject_TypeCheck(obj, &FinalizerProxy$$Type))
+    if (PyObject_TypeCheck(obj, &PY_TYPE(FinalizerProxy)))
         obj = ((t_fp *) obj)->object;
 
-    if (!PyObject_TypeCheck(obj, &Object$$Type))
+    if (!PyObject_TypeCheck(obj, &PY_TYPE(Object)))
     {
         if (reportError)
             PyErr_SetObject(PyExc_TypeError, obj);
@@ -1252,9 +1252,9 @@ jobjectArray fromPySequence(jclass cls, 
             jobj = env->fromPyString(obj);
             fromString = 1;
         }
-        else if (PyObject_TypeCheck(obj, &JObject$$Type))
+        else if (PyObject_TypeCheck(obj, &PY_TYPE(JObject)))
             jobj = ((t_JObject *) obj)->object.this$;
-        else if (PyObject_TypeCheck(obj, &FinalizerProxy$$Type))
+        else if (PyObject_TypeCheck(obj, &PY_TYPE(FinalizerProxy)))
             jobj = ((t_JObject *) ((t_fp *) obj)->object)->object.this$;
         else /* todo: add auto-boxing of primitive types */
         {
@@ -1286,8 +1286,8 @@ void installType(PyTypeObject *type, PyO
         Py_INCREF(type);
         if (isExtension)
         {
-            type->ob_type = &FinalizerClass$$Type;
-            Py_INCREF(&FinalizerClass$$Type);
+            type->ob_type = &PY_TYPE(FinalizerClass);
+            Py_INCREF(&PY_TYPE(FinalizerClass));
         }
         PyModule_AddObject(module, name, (PyObject *) type);
     }
@@ -1315,7 +1315,7 @@ PyObject *unboxBoolean(const jobject& ob
         if (!env->isInstanceOf(obj, java::lang::Boolean::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Boolean$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Boolean));
             return NULL;
         }
         
@@ -1335,7 +1335,7 @@ PyObject *unboxByte(const jobject &obj)
         if (!env->isInstanceOf(obj, java::lang::Byte::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Byte$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Byte));
             return NULL;
         }
         
@@ -1352,7 +1352,7 @@ PyObject *unboxCharacter(const jobject &
         if (!env->isInstanceOf(obj, java::lang::Character::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Character$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Character));
             return NULL;
         }
         
@@ -1370,7 +1370,7 @@ PyObject *unboxDouble(const jobject &obj
         if (!env->isInstanceOf(obj, java::lang::Double::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Double$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Double));
             return NULL;
         }
         
@@ -1387,7 +1387,7 @@ PyObject *unboxFloat(const jobject &obj)
         if (!env->isInstanceOf(obj, java::lang::Float::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Float$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Float));
             return NULL;
         }
         
@@ -1404,7 +1404,7 @@ PyObject *unboxInteger(const jobject &ob
         if (!env->isInstanceOf(obj, java::lang::Integer::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Integer$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Integer));
             return NULL;
         }
         
@@ -1421,7 +1421,7 @@ PyObject *unboxLong(const jobject &obj)
         if (!env->isInstanceOf(obj, java::lang::Long::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Long$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Long));
             return NULL;
         }
         
@@ -1438,7 +1438,7 @@ PyObject *unboxShort(const jobject &obj)
         if (!env->isInstanceOf(obj, java::lang::Short::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::Short$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(Short));
             return NULL;
         }
         
@@ -1455,7 +1455,7 @@ PyObject *unboxString(const jobject &obj
         if (!env->isInstanceOf(obj, java::lang::String::initializeClass))
         {
             PyErr_SetObject(PyExc_TypeError,
-                            (PyObject *) &java::lang::String$$Type);
+                            (PyObject *) &java::lang::PY_TYPE(String));
             return NULL;
         }
         
@@ -1473,7 +1473,7 @@ static int boxJObject(PyTypeObject *type
         if (obj != NULL)
             *obj = Object(NULL);
     }
-    else if (PyObject_TypeCheck(arg, &Object$$Type))
+    else if (PyObject_TypeCheck(arg, &PY_TYPE(Object)))
     {
         if (type != NULL && !is_instance_of(arg, type))
             return -1;
@@ -1481,10 +1481,10 @@ static int boxJObject(PyTypeObject *type
         if (obj != NULL)
             *obj = ((t_Object *) arg)->object;
     }
-    else if (PyObject_TypeCheck(arg, &FinalizerProxy$$Type))
+    else if (PyObject_TypeCheck(arg, &PY_TYPE(FinalizerProxy)))
     {
         arg = ((t_fp *) arg)->object;
-        if (PyObject_TypeCheck(arg, &Object$$Type))
+        if (PyObject_TypeCheck(arg, &PY_TYPE(Object)))
         {
             if (type != NULL && !is_instance_of(arg, type))
                 return -1;

Modified: lucene/pylucene/trunk/jcc/jcc/sources/functions.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/functions.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/functions.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/functions.h Tue May 18 19:43:19 2010
@@ -122,20 +122,20 @@ PyObject *callSuper(PyTypeObject *type, 
 
 template<class T> PyObject *get_iterator(T *self)
 {
-    java::util::Iterator iterator((jobject) NULL);
+    jobject iterator;
 
-    OBJ_CALL(iterator = self->object.iterator());
-    return java::util::t_Iterator::wrap_Object(iterator);
+    OBJ_CALL(iterator = env->iterator(self->object.this$));
+    return java::util::t_Iterator::wrap_jobject(iterator);
 }
 
 #ifdef _java_generics
 template<class T> PyObject *get_generic_iterator(T *self)
 {
-    java::util::Iterator iterator((jobject) NULL);
     PyTypeObject *param = self->parameters ? self->parameters[0] : NULL;
+    jobject iterator;
 
-    OBJ_CALL(iterator = self->object.iterator());
-    return java::util::t_Iterator::wrap_Object(iterator, param);
+    OBJ_CALL(iterator = env->iterator(self->object.this$));
+    return java::util::t_Iterator::wrap_jobject(iterator, param);
 }
 #endif
 
@@ -285,8 +285,8 @@ void installType(PyTypeObject *type, PyO
 PyObject *typeParameters(PyTypeObject *types[], size_t size);
 #endif
 
-extern PyTypeObject FinalizerClass$$Type;
-extern PyTypeObject FinalizerProxy$$Type;
+extern PyTypeObject PY_TYPE(FinalizerClass);
+extern PyTypeObject PY_TYPE(FinalizerProxy);
 
 typedef struct {
     PyObject_HEAD

Modified: lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/jcc.cpp Tue May 18 19:43:19 2010
@@ -45,12 +45,16 @@ static PyObject *t_jccenv_isCurrentThrea
 static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg);
 static PyObject *t_jccenv__dumpRefs(PyObject *self,
                                     PyObject *args, PyObject *kwds);
+static PyObject *t_jccenv__addClassPath(PyObject *self, PyObject *args);
+
 static PyObject *t_jccenv__get_jni_version(PyObject *self, void *data);
 static PyObject *t_jccenv__get_java_version(PyObject *self, void *data);
+static PyObject *t_jccenv__get_classpath(PyObject *self, void *data);
 
 static PyGetSetDef t_jccenv_properties[] = {
     { "jni_version", (getter) t_jccenv__get_jni_version, NULL, NULL, NULL },
     { "java_version", (getter) t_jccenv__get_java_version, NULL, NULL, NULL },
+    { "classpath", (getter) t_jccenv__get_classpath, NULL, NULL, NULL },
     { NULL, NULL, NULL, NULL, NULL }
 };
 
@@ -69,10 +73,12 @@ static PyMethodDef t_jccenv_methods[] = 
       METH_O, NULL },
     { "_dumpRefs", (PyCFunction) t_jccenv__dumpRefs,
       METH_VARARGS | METH_KEYWORDS, NULL },
+    { "_addClassPath", (PyCFunction) t_jccenv__addClassPath,
+      METH_VARARGS, NULL },
     { NULL, NULL, 0, NULL }
 };
 
-PyTypeObject JCCEnv$$Type = {
+PyTypeObject PY_TYPE(JCCEnv) = {
     PyObject_HEAD_INIT(NULL)
     0,                                   /* ob_size */
     "jcc.JCCEnv",                        /* tp_name */
@@ -267,6 +273,17 @@ static PyObject *t_jccenv__dumpRefs(PyOb
     return result;
 }
 
+static PyObject *t_jccenv__addClassPath(PyObject *self, PyObject *args)
+{
+    const char *classpath;
+
+    if (!PyArg_ParseTuple(args, "s", &classpath))
+        return NULL;
+
+    env->setClassPath(classpath);
+
+    Py_RETURN_NONE;
+}
 
 static PyObject *t_jccenv__get_jni_version(PyObject *self, void *data)
 {
@@ -278,11 +295,26 @@ static PyObject *t_jccenv__get_java_vers
     return env->fromJString(env->getJavaVersion(), 1);
 }
 
+static PyObject *t_jccenv__get_classpath(PyObject *self, void *data)
+{
+    char *classpath = env->getClassPath();
+
+    if (classpath)
+    {
+        PyObject *result = PyString_FromString(classpath);
+
+        free(classpath);
+        return result;
+    }
+
+    Py_RETURN_NONE;
+}
+
 _DLL_EXPORT PyObject *getVMEnv(PyObject *self)
 {
     if (env->vm != NULL)
     {
-        t_jccenv *jccenv = (t_jccenv *) JCCEnv$$Type.tp_alloc(&JCCEnv$$Type, 0);
+        t_jccenv *jccenv = (t_jccenv *) PY_TYPE(JCCEnv).tp_alloc(&PY_TYPE(JCCEnv), 0);
         jccenv->env = env;
 
         return (PyObject *) jccenv;
@@ -454,7 +486,7 @@ _DLL_EXPORT PyObject *initVM(PyObject *s
         for (unsigned int i = 0; i < nOptions; i++)
             delete vm_options[i].optionString;
 
-        t_jccenv *jccenv = (t_jccenv *) JCCEnv$$Type.tp_alloc(&JCCEnv$$Type, 0);
+        t_jccenv *jccenv = (t_jccenv *) PY_TYPE(JCCEnv).tp_alloc(&PY_TYPE(JCCEnv), 0);
         jccenv->env = env;
 
 #ifdef _jcc_lib

Modified: lucene/pylucene/trunk/jcc/jcc/sources/macros.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/macros.h?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/macros.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/macros.h Tue May 18 19:43:19 2010
@@ -53,10 +53,11 @@
 #define DECLARE_GETSET_FIELD(type, name)        \
     { #name, (getter) type##_get__##name, (setter) type##_set__##name, "", NULL }
 
+#define PY_TYPE(name) name##$$Type
 
 #define DECLARE_TYPE(name, t_name, base, javaClass,                         \
                      init, iter, iternext, getset, mapping, sequence)       \
-PyTypeObject name##$$Type = {                                               \
+PyTypeObject PY_TYPE(name) = {                                              \
     PyObject_HEAD_INIT(NULL)                                                \
     /* ob_size            */   0,                                           \
     /* tp_name            */   #name,                                       \
@@ -88,7 +89,7 @@ PyTypeObject name##$$Type = {           
     /* tp_methods         */   t_name##__methods_,                          \
     /* tp_members         */   0,                                           \
     /* tp_getset          */   getset,                                      \
-    /* tp_base            */   &base##$$Type,                               \
+    /* tp_base            */   &PY_TYPE(base),                              \
     /* tp_dict            */   0,                                           \
     /* tp_descr_get       */   0,                                           \
     /* tp_descr_set       */   0,                                           \
@@ -102,7 +103,7 @@ PyObject *t_name::wrap_Object(const java
     if (!!object)                                                       \
     {                                                                   \
         t_name *self =                                                  \
-            (t_name *) name##$$Type.tp_alloc(&name##$$Type, 0);         \
+            (t_name *) PY_TYPE(name).tp_alloc(&PY_TYPE(name), 0);       \
         if (self)                                                       \
             self->object = object;                                      \
         return (PyObject *) self;                                       \
@@ -116,11 +117,11 @@ PyObject *t_name::wrap_jobject(const job
         if (!env->isInstanceOf(object, javaClass::initializeClass))     \
         {                                                               \
             PyErr_SetObject(PyExc_TypeError,                            \
-                            (PyObject *) &name##$$Type);                \
+                            (PyObject *) &PY_TYPE(name));               \
             return NULL;                                                \
         }                                                               \
         t_name *self = (t_name *)                                       \
-            name##$$Type.tp_alloc(&name##$$Type, 0);                    \
+            PY_TYPE(name).tp_alloc(&PY_TYPE(name), 0);                  \
         if (self)                                                       \
             self->object = javaClass(object);                           \
         return (PyObject *) self;                                       \
@@ -129,11 +130,11 @@ PyObject *t_name::wrap_jobject(const job
 }                                                                       \
 
 
-#define INSTALL_TYPE(name, module)                                     \
-    if (PyType_Ready(&name##$$Type) == 0)                              \
-    {                                                                  \
-        Py_INCREF(&name##$$Type);                                      \
-        PyModule_AddObject(module, #name, (PyObject *) &name##$$Type); \
+#define INSTALL_TYPE(name, module)                                      \
+    if (PyType_Ready(&PY_TYPE(name)) == 0)                              \
+    {                                                                   \
+        Py_INCREF(&PY_TYPE(name));                                      \
+        PyModule_AddObject(module, #name, (PyObject *) &PY_TYPE(name)); \
     }
 
 

Modified: lucene/pylucene/trunk/jcc/jcc/sources/types.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/types.cpp?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/types.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/types.cpp Tue May 18 19:43:19 2010
@@ -52,7 +52,7 @@ static PyObject *t_fp_seq_inplace_concat
 static PyObject *t_fp_seq_inplace_repeat(t_fp *self, Py_ssize_t n);
 
 
-PyTypeObject FinalizerClass$$Type = {
+PyTypeObject PY_TYPE(FinalizerClass) = {
     PyObject_HEAD_INIT(NULL)
     0,                                   /* ob_size */
     "jcc.FinalizerClass",                /* tp_name */
@@ -113,7 +113,7 @@ static PySequenceMethods t_fp_as_sequenc
     (ssizeargfunc)t_fp_seq_inplace_repeat,    /* sq_inplace_repeat */
 };
 
-PyTypeObject FinalizerProxy$$Type = {
+PyTypeObject PY_TYPE(FinalizerProxy) = {
     PyObject_HEAD_INIT(NULL)
     0,                                   /* ob_size */
     "jcc.FinalizerProxy",                /* tp_name */
@@ -162,7 +162,7 @@ static PyObject *t_fc_call(PyObject *sel
 
     if (obj)
     {
-        t_fp *fp = (t_fp *) FinalizerProxy$$Type.tp_alloc(&FinalizerProxy$$Type, 0);
+        t_fp *fp = (t_fp *) PY_TYPE(FinalizerProxy).tp_alloc(&PY_TYPE(FinalizerProxy),
0);
 
         fp->object = obj;
         obj = (PyObject *) fp;
@@ -308,7 +308,7 @@ static PyMethodDef t_descriptor_methods[
 };
 
 
-PyTypeObject ConstVariableDescriptor$$Type = {
+PyTypeObject PY_TYPE(ConstVariableDescriptor) = {
     PyObject_HEAD_INIT(NULL)
     0,                                   /* ob_size */
     "jcc.ConstVariableDescriptor",       /* tp_name */
@@ -362,7 +362,7 @@ static void t_descriptor_dealloc(t_descr
 PyObject *make_descriptor(PyTypeObject *value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -377,7 +377,7 @@ PyObject *make_descriptor(PyTypeObject *
 PyObject *make_descriptor(getclassfn initializeClass)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -401,7 +401,7 @@ PyObject *make_descriptor(getclassfn ini
 PyObject *make_descriptor(PyObject *value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -427,7 +427,7 @@ PyObject *make_descriptor(boxfn fn)
 PyObject *make_descriptor(jboolean b)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -442,7 +442,7 @@ PyObject *make_descriptor(jboolean b)
 PyObject *make_descriptor(jbyte value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -456,7 +456,7 @@ PyObject *make_descriptor(jbyte value)
 PyObject *make_descriptor(jchar value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -472,7 +472,7 @@ PyObject *make_descriptor(jchar value)
 PyObject *make_descriptor(jdouble value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -486,7 +486,7 @@ PyObject *make_descriptor(jdouble value)
 PyObject *make_descriptor(jfloat value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -500,7 +500,7 @@ PyObject *make_descriptor(jfloat value)
 PyObject *make_descriptor(jint value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -514,7 +514,7 @@ PyObject *make_descriptor(jint value)
 PyObject *make_descriptor(jlong value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {
@@ -528,7 +528,7 @@ PyObject *make_descriptor(jlong value)
 PyObject *make_descriptor(jshort value)
 {
     t_descriptor *self = (t_descriptor *)
-        ConstVariableDescriptor$$Type.tp_alloc(&ConstVariableDescriptor$$Type, 0);
+        PY_TYPE(ConstVariableDescriptor).tp_alloc(&PY_TYPE(ConstVariableDescriptor),
0);
 
     if (self)
     {

Propchange: lucene/pylucene/trunk/jcc/setup.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 18 19:43:19 2010
@@ -1 +1,2 @@
+/lucene/pylucene/branches/branch_3x/jcc/setup.py:944934,944952-944954,944961,945445,945488,945517,945782
 /lucene/pylucene/branches/pylucene_2_9/jcc/setup.py:830336

Propchange: lucene/pylucene/trunk/samples/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue May 18 19:43:19 2010
@@ -0,0 +1 @@
+/lucene/pylucene/branches/branch_3x/samples:944953-944954,945800

Modified: lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py (original)
+++ lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/BaseIndexingTestCase.py Tue
May 18 19:43:19 2010
@@ -33,9 +33,18 @@ class BaseIndexingTestCase(TestCase):
 
         indexDir = os.path.join(System.getProperty('java.io.tmpdir', 'tmp'),
                                 'index-dir')
+        self.rmdir(indexDir)
         self.dir = SimpleFSDirectory(File(indexDir))
         self.addDocuments(self.dir)
 
+    def rmdir(self, dir):
+
+        for dir, dirnames, filenames in os.walk(dir):
+            for filename in filenames:
+                os.remove(os.path.join(dir, filename))
+            for dirname in dirnames:
+                os.rmdir(os.path.join(dir, dirname))
+
     def addDocuments(self, dir):
 
         writer = IndexWriter(dir, self.getAnalyzer(), True,

Modified: lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py
(original)
+++ lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py
Tue May 18 19:43:19 2010
@@ -34,9 +34,18 @@ class FSversusRAMDirectoryTest(TestCase)
 
         fsIndexDir = os.path.join(System.getProperty("java.io.tmpdir", "tmp"),
                                   "fs-index")
+        self.rmdir(fsIndexDir)
         self.ramDir = RAMDirectory()
         self.fsDir = SimpleFSDirectory(File(fsIndexDir))
 
+    def rmdir(self, dir):
+
+        for dir, dirnames, filenames in os.walk(dir):
+            for filename in filenames:
+                os.remove(os.path.join(dir, filename))
+            for dirname in dirnames:
+                os.rmdir(os.path.join(dir, dirname))
+
     def testTiming(self):
 
         ramTiming = self.timeIndexWriter(self.ramDir)

Modified: lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/LockTest.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/LockTest.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/LockTest.py (original)
+++ lucene/pylucene/trunk/samples/LuceneInAction/lia/indexing/LockTest.py Tue May 18 19:43:19
2010
@@ -26,8 +26,17 @@ class LockTest(TestCase):
 
         indexDir = os.path.join(System.getProperty("java.io.tmpdir", "tmp"),
                                 "index")
+        self.rmdir(indexDir)
         self.dir = SimpleFSDirectory(File(indexDir))
 
+    def rmdir(self, dir):
+
+        for dir, dirnames, filenames in os.walk(dir):
+            for filename in filenames:
+                os.remove(os.path.join(dir, filename))
+            for dirname in dirnames:
+                os.rmdir(os.path.join(dir, dirname))
+
     def testWriteLock(self):
 
         writer1 = IndexWriter(self.dir, SimpleAnalyzer(),

Modified: lucene/pylucene/trunk/test/test_ICUFoldingFilter.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_ICUFoldingFilter.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_ICUFoldingFilter.py (original)
+++ lucene/pylucene/trunk/test/test_ICUFoldingFilter.py Tue May 18 19:43:19 2010
@@ -25,13 +25,14 @@ from unittest import main
 from BaseTokenStreamTestCase import BaseTokenStreamTestCase
 
 from lucene import *
-from lucene.ICUFoldingFilter import ICUFoldingFilter
 
 
 class TestICUFoldingFilter(BaseTokenStreamTestCase):
 
     def testDefaults(self):
 
+        from lucene.ICUFoldingFilter import ICUFoldingFilter
+
         class _analyzer(PythonAnalyzer):
             def tokenStream(_self, fieldName, reader):
                 return ICUFoldingFilter(WhitespaceTokenizer(Version.LUCENE_CURRENT, reader))

Modified: lucene/pylucene/trunk/test/test_ICUNormalizer2Filter.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_ICUNormalizer2Filter.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_ICUNormalizer2Filter.py (original)
+++ lucene/pylucene/trunk/test/test_ICUNormalizer2Filter.py Tue May 18 19:43:19 2010
@@ -25,13 +25,14 @@ from unittest import main
 from BaseTokenStreamTestCase import BaseTokenStreamTestCase
 
 from lucene import *
-from lucene.ICUNormalizer2Filter import ICUNormalizer2Filter
 
 
 class TestICUNormalizer2Filter(BaseTokenStreamTestCase):
 
     def testDefaults(self):
 
+        from lucene.ICUNormalizer2Filter import ICUNormalizer2Filter
+
         class analyzer(PythonAnalyzer):
             def tokenStream(_self, fieldName, reader):
                 return ICUNormalizer2Filter(WhitespaceTokenizer(Version.LUCENE_CURRENT, reader))
@@ -60,6 +61,8 @@ class TestICUNormalizer2Filter(BaseToken
   
     def testAlternate(self):
 
+        from lucene.ICUNormalizer2Filter import ICUNormalizer2Filter
+
         class analyzer(PythonAnalyzer):
             # specify nfc with decompose to get nfd
             def tokenStream(_self, fieldName, reader):

Modified: lucene/pylucene/trunk/test/test_ICUTransformFilter.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_ICUTransformFilter.py?rev=945842&r1=945841&r2=945842&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_ICUTransformFilter.py (original)
+++ lucene/pylucene/trunk/test/test_ICUTransformFilter.py Tue May 18 19:43:19 2010
@@ -25,13 +25,13 @@ from unittest import main
 from BaseTokenStreamTestCase import BaseTokenStreamTestCase
 
 from lucene import *
-from lucene.ICUTransformFilter import ICUTransformFilter
 
 
 class TestICUTransformFilter(BaseTokenStreamTestCase):
   
     def _checkToken(self, transform, input, expected):
 
+        from lucene.ICUTransformFilter import ICUTransformFilter
         ts = ICUTransformFilter(KeywordTokenizer(StringReader(input)),
                                 transform)
         self._assertTokenStreamContents(ts, [ expected ])



Mime
View raw message