You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2010/04/08 18:52:02 UTC

svn commit: r932000 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/cpp.py jcc/python.py jcc/sources/functions.cpp jcc/sources/functions.h

Author: vajda
Date: Thu Apr  8 16:52:01 2010
New Revision: 932000

URL: http://svn.apache.org/viewvc?rev=932000&view=rev
Log:
 - added support for auto-boxing Number from python int, long and float
 - added 'asm' to list of reserved words

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

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=932000&r1=931999&r2=932000&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Thu Apr  8 16:52:01 2010
@@ -12,7 +12,9 @@ Version 2.5 ->
  - fixed bug with not heeding type parameter for --sequence get method
  - parameterized return values are now unboxed
  - improved auto-boxing of primitive type parameters
- - added support for auto-boxing CharSequence from python strings
+ - added support for auto-boxing CharSequence from python str and unicode
+ - added support for auto-boxing Number from python int, long and float
+ - added 'asm' to list of reserved words
  - 
 
 Version 2.4 -> 2.5

Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=932000&r1=931999&r2=932000&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Thu Apr  8 16:52:01 2010
@@ -80,7 +80,7 @@ PRIMITIVES = { 'boolean': 'Z',
                'void': 'V' }
 
 RESERVED = set(['delete', 'and', 'or', 'not', 'xor', 'union', 'NULL',
-                'register', 'const', 'bool', 'operator', 'typeof'])
+                'register', 'const', 'bool', 'operator', 'typeof', 'asm'])
 
 def cppname(name):
 

Modified: lucene/pylucene/trunk/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/python.py?rev=932000&r1=931999&r2=932000&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/python.py Thu Apr  8 16:52:01 2010
@@ -60,6 +60,7 @@ BOXED = { 'java.lang.Boolean': (True, Tr
           'java.lang.Float': (True, True),
           'java.lang.Integer': (True, True),
           'java.lang.Long': (True, True),
+          'java.lang.Number': (True, False),
           'java.lang.Short': (True, True),
           'java.lang.String': (True, True) }
 

Modified: lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp?rev=932000&r1=931999&r2=932000&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/functions.cpp Thu Apr  8 16:52:01 2010
@@ -1784,6 +1784,34 @@ int boxLong(PyTypeObject *type, PyObject
     return 0;
 }
 
+int boxNumber(PyTypeObject *type, PyObject *arg, java::lang::Object *obj)
+{
+    int result = boxJObject(type, arg, obj);
+
+    if (result <= 0)
+        return result;
+
+    if (PyInt_Check(arg))
+    {
+        if (obj != NULL)
+            *obj = Integer((jint) PyInt_AS_LONG(arg));
+    }
+    else if (PyLong_Check(arg))
+    {
+        if (obj != NULL)
+            *obj = Long((jlong) PyLong_AsLongLong(arg));
+    }
+    else if (PyFloat_Check(arg))
+    {
+        if (obj != NULL)
+            *obj = Double((jdouble) PyFloat_AS_DOUBLE(arg));
+    }
+    else
+        return -1;
+
+    return 0;
+}
+
 int boxShort(PyTypeObject *type, PyObject *arg, java::lang::Object *obj)
 {
     int result = boxJObject(type, arg, obj);

Modified: lucene/pylucene/trunk/jcc/jcc/sources/functions.h
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/sources/functions.h?rev=932000&r1=931999&r2=932000&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/sources/functions.h (original)
+++ lucene/pylucene/trunk/jcc/jcc/sources/functions.h Thu Apr  8 16:52:01 2010
@@ -90,6 +90,7 @@ int boxDouble(PyTypeObject *type, PyObje
 int boxFloat(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);
 int boxInteger(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);
 int boxLong(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);
+int boxNumber(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);
 int boxShort(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);
 int boxString(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);
 int boxObject(PyTypeObject *type, PyObject *arg, java::lang::Object *obj);