lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1162608 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/sources/JArray.cpp jcc/sources/JArray.h jcc/sources/functions.cpp
Date Sun, 28 Aug 2011 23:22:25 GMT
Author: vajda
Date: Sun Aug 28 23:22:24 2011
New Revision: 1162608

URL: http://svn.apache.org/viewvc?rev=1162608&view=rev
Log:
 - fixed bug with missing code for returning arrays from iterators

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp
    lucene/pylucene/trunk/jcc/jcc/sources/JArray.h
    lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1162608&r1=1162607&r2=1162608&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Sun Aug 28 23:22:24 2011
@@ -5,6 +5,7 @@ Version 2.10 ->
  - non public classes listed on command line now wrapped (Lukasz Jancewicz)
  - fixed bug with generating wrappers for unimplemented interface methods
  - fixed bug with generating propMethods for void getters
+ - fixed bug with missing code for returning arrays from iterators
  - 
 
 Version 2.9 -> 2.10

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp?rev=1162608&r1=1162607&r2=1162608&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JArray.cpp Sun Aug 28 23:22:24 2011
@@ -25,7 +25,7 @@
 using namespace java::lang;
 
 
-template<typename T> class _t_jarray : public t_jarray<T> {
+template<typename T> class _t_JArray : public t_JArray<T> {
 public:
     static PyObject *format;
 };
@@ -476,7 +476,7 @@ static PyObject *assignable_(PyTypeObjec
     return instance_<T>(type, args, kwds);
 }
 
-template< typename T, typename U = _t_jarray<T> > class jarray_type {
+template< typename T, typename U = _t_JArray<T> > class jarray_type {
 public:
     PySequenceMethods seq_methods;
     PyTypeObject type_object;
@@ -607,7 +607,7 @@ public:
     }
 };
 
-template<typename T> class _t_jobjectarray : public _t_jarray<T> {
+template<typename T> class _t_jobjectarray : public _t_JArray<T> {
 public:
     PyObject *(*wrapfn)(const T&);
 };
@@ -894,7 +894,7 @@ template<> PyObject *assignable_<jobject
 
 
 template<typename T> PyTypeObject *_t_iterator<T>::JArrayIterator;
-template<typename T> PyObject *_t_jarray<T>::format;
+template<typename T> PyObject *_t_JArray<T>::format;
 
 static jarray_type< jobject, _t_jobjectarray<jobject> > jarray_jobject;
 
@@ -926,12 +926,12 @@ PyObject *JArray<jobject>::wrap(PyObject
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jstring>::wrap()
+PyObject *JArray<jstring>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jstring> *obj =
-            PyObject_New(_t_jarray<jstring>, &jarray_jstring.type_object);
+        _t_JArray<jstring> *obj =
+            PyObject_New(_t_JArray<jstring>, &jarray_jstring.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jstring>));
         obj->array = *this;
@@ -942,12 +942,12 @@ PyObject *JArray<jstring>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jboolean>::wrap()
+PyObject *JArray<jboolean>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jboolean> *obj =
-            PyObject_New(_t_jarray<jboolean>, &jarray_jboolean.type_object);
+        _t_JArray<jboolean> *obj =
+            PyObject_New(_t_JArray<jboolean>, &jarray_jboolean.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jboolean>));
         obj->array = *this;
@@ -958,12 +958,12 @@ PyObject *JArray<jboolean>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jbyte>::wrap()
+PyObject *JArray<jbyte>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jbyte> *obj =
-            PyObject_New(_t_jarray<jbyte>, &jarray_jbyte.type_object);
+        _t_JArray<jbyte> *obj =
+            PyObject_New(_t_JArray<jbyte>, &jarray_jbyte.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jbyte>));
         obj->array = *this;
@@ -974,12 +974,12 @@ PyObject *JArray<jbyte>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jchar>::wrap()
+PyObject *JArray<jchar>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jchar> *obj =
-            PyObject_New(_t_jarray<jchar>, &jarray_jchar.type_object);
+        _t_JArray<jchar> *obj =
+            PyObject_New(_t_JArray<jchar>, &jarray_jchar.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jchar>));
         obj->array = *this;
@@ -990,12 +990,12 @@ PyObject *JArray<jchar>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jdouble>::wrap()
+PyObject *JArray<jdouble>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jdouble> *obj =
-            PyObject_New(_t_jarray<jdouble>, &jarray_jdouble.type_object);
+        _t_JArray<jdouble> *obj =
+            PyObject_New(_t_JArray<jdouble>, &jarray_jdouble.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jdouble>));
         obj->array = *this;
@@ -1006,12 +1006,12 @@ PyObject *JArray<jdouble>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jfloat>::wrap()
+PyObject *JArray<jfloat>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jfloat> *obj =
-            PyObject_New(_t_jarray<jfloat>, &jarray_jfloat.type_object);
+        _t_JArray<jfloat> *obj =
+            PyObject_New(_t_JArray<jfloat>, &jarray_jfloat.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jfloat>));
         obj->array = *this;
@@ -1022,12 +1022,12 @@ PyObject *JArray<jfloat>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jint>::wrap()
+PyObject *JArray<jint>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jint> *obj =
-            PyObject_New(_t_jarray<jint>, &jarray_jint.type_object);
+        _t_JArray<jint> *obj =
+            PyObject_New(_t_JArray<jint>, &jarray_jint.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jint>));
         obj->array = *this;
@@ -1038,12 +1038,12 @@ PyObject *JArray<jint>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jlong>::wrap()
+PyObject *JArray<jlong>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jlong> *obj =
-            PyObject_New(_t_jarray<jlong>, &jarray_jlong.type_object);
+        _t_JArray<jlong> *obj =
+            PyObject_New(_t_JArray<jlong>, &jarray_jlong.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jlong>));
         obj->array = *this;
@@ -1054,12 +1054,12 @@ PyObject *JArray<jlong>::wrap()
     Py_RETURN_NONE;
 }
 
-PyObject *JArray<jshort>::wrap()
+PyObject *JArray<jshort>::wrap() const
 {
     if (this$ != NULL)
     {
-        _t_jarray<jshort> *obj =
-            PyObject_New(_t_jarray<jshort>, &jarray_jshort.type_object);
+        _t_JArray<jshort> *obj =
+            PyObject_New(_t_JArray<jshort>, &jarray_jshort.type_object);
 
         memset(&(obj->array), 0, sizeof(JArray<jshort>));
         obj->array = *this;
@@ -1139,13 +1139,13 @@ PyObject *JArray_Type(PyObject *self, Py
     return type;
 }
 
-static PyObject *t_jarray_jbyte__get_string_(t_jarray<jbyte> *self, void *data)
+static PyObject *t_JArray_jbyte__get_string_(t_JArray<jbyte> *self, void *data)
 {
     return self->array.to_string_();
 }
 
-static PyGetSetDef t_jarray_jbyte__fields[] = {
-    { "string_", (getter) t_jarray_jbyte__get_string_, NULL, "", NULL },
+static PyGetSetDef t_JArray_jbyte__fields[] = {
+    { "string_", (getter) t_JArray_jbyte__get_string_, NULL, "", NULL },
     { NULL, NULL, NULL, NULL, NULL }
 };
 
@@ -1176,7 +1176,7 @@ void _install_jarray(PyObject *module)
                             "__JArray_bool_iterator", module);
     PY_TYPE(JArrayBool) = &jarray_jboolean.type_object;
 
-    jarray_jbyte.type_object.tp_getset = t_jarray_jbyte__fields;
+    jarray_jbyte.type_object.tp_getset = t_JArray_jbyte__fields;
     jarray_jbyte.install("JArray_byte", "byte",
                          "__JArray_byte_iterator", module);
     PY_TYPE(JArrayByte) = &jarray_jbyte.type_object;

Modified: lucene/pylucene/trunk/jcc/jcc/sources/JArray.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/JArray.h?rev=1162608&r1=1162607&r2=1162608&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/JArray.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/JArray.h Sun Aug 28 23:22:24 2011
@@ -327,7 +327,7 @@ template<> class JArray<jstring> : publi
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jstring operator[](int n) {
@@ -465,7 +465,7 @@ template<> class JArray<jboolean> : publ
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jboolean operator[](int n) {
@@ -639,7 +639,7 @@ template<> class JArray<jbyte> : public 
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jbyte operator[](int n) {
@@ -826,7 +826,7 @@ template<> class JArray<jchar> : public 
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jchar operator[](int n) {
@@ -973,7 +973,7 @@ template<> class JArray<jdouble> : publi
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jdouble operator[](int n) {
@@ -1120,7 +1120,7 @@ template<> class JArray<jfloat> : public
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jfloat operator[](int n) {
@@ -1267,7 +1267,7 @@ template<> class JArray<jint> : public j
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jint operator[](int n) {
@@ -1414,7 +1414,7 @@ template<> class JArray<jlong> : public 
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jlong operator[](long n) {
@@ -1561,7 +1561,7 @@ template<> class JArray<jshort> : public
         return -1;
     }
 
-    PyObject *wrap();
+    PyObject *wrap() const;
 #endif
 
     jshort operator[](int n) {
@@ -1579,10 +1579,18 @@ template<> class JArray<jshort> : public
 
 #ifdef PYTHON
 
-template<typename T> class t_jarray {
+template<typename T> class t_JArray {
 public:
     PyObject_HEAD
     JArray<T> array;
+
+    static PyObject *wrap_Object(const JArray<T>& array)
+    {
+        if (!!array)
+            return array.wrap();
+
+        Py_RETURN_NONE;
+    }
 };
 
 #endif

Modified: lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp?rev=1162608&r1=1162607&r2=1162608&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp Sun Aug 28 23:22:24 2011
@@ -640,7 +640,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jobject>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayObject)))
-                      *array = ((t_jarray<jobject> *) arg)->array;
+                      *array = ((t_JArray<jobject> *) arg)->array;
                   else 
                       *array = JArray<jobject>(cls, arg);
 
@@ -684,7 +684,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jboolean>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayBool)))
-                      *array = ((t_jarray<jboolean> *) arg)->array;
+                      *array = ((t_JArray<jboolean> *) arg)->array;
                   else
                       *array = JArray<jboolean>(arg);
 
@@ -708,7 +708,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jbyte>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayByte)))
-                      *array = ((t_jarray<jbyte> *) arg)->array;
+                      *array = ((t_JArray<jbyte> *) arg)->array;
                   else 
                       *array = JArray<jbyte>(arg);
 
@@ -737,7 +737,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jchar>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayChar)))
-                      *array = ((t_jarray<jchar> *) arg)->array;
+                      *array = ((t_JArray<jchar> *) arg)->array;
                   else 
                       *array = JArray<jchar>(arg);
 
@@ -761,7 +761,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jint>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayInt)))
-                      *array = ((t_jarray<jint> *) arg)->array;
+                      *array = ((t_JArray<jint> *) arg)->array;
                   else 
                       *array = JArray<jint>(arg);
 
@@ -785,7 +785,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jshort>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayShort)))
-                      *array = ((t_jarray<jshort> *) arg)->array;
+                      *array = ((t_JArray<jshort> *) arg)->array;
                   else 
                       *array = JArray<jshort>(arg);
 
@@ -809,7 +809,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jdouble>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayDouble)))
-                      *array = ((t_jarray<jdouble> *) arg)->array;
+                      *array = ((t_JArray<jdouble> *) arg)->array;
                   else 
                       *array = JArray<jdouble>(arg);
 
@@ -833,7 +833,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jfloat>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayFloat)))
-                      *array = ((t_jarray<jfloat> *) arg)->array;
+                      *array = ((t_JArray<jfloat> *) arg)->array;
                   else 
                       *array = JArray<jfloat>(arg);
 
@@ -857,7 +857,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jlong>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayLong)))
-                      *array = ((t_jarray<jlong> *) arg)->array;
+                      *array = ((t_JArray<jlong> *) arg)->array;
                   else 
                       *array = JArray<jlong>(arg);
 
@@ -881,7 +881,7 @@ int _parseArgs(PyObject **args, unsigned
                   if (arg == Py_None)
                       *array = JArray<jstring>((jobject) NULL);
                   else if (PyObject_TypeCheck(arg, PY_TYPE(JArrayString)))
-                      *array = ((t_jarray<jstring> *) arg)->array;
+                      *array = ((t_JArray<jstring> *) arg)->array;
                   else 
                       *array = JArray<jstring>(arg);
 



Mime
View raw message