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 2011/08/05 17:02:52 UTC

svn commit: r1154252 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/__init__.py jcc/cpp.py

Author: vajda
Date: Fri Aug  5 15:02:52 2011
New Revision: 1154252

URL: http://svn.apache.org/viewvc?rev=1154252&view=rev
Log:
 - non public classes listed on command line now wrapped (Lukasz Jancewicz)
 - fixed bug with generating wrappers for unimplemented interface methods

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/__init__.py
    lucene/pylucene/trunk/jcc/jcc/cpp.py

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1154252&r1=1154251&r2=1154252&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Fri Aug  5 15:02:52 2011
@@ -1,4 +1,11 @@
 
+Version 2.10 ->
+---------------
+ - improved recovery from toString() failure, displaying class name instead
+ - non public classes listed on command line now wrapped (Lukasz Jancewicz)
+ - fixed bug with generating wrappers for unimplemented interface methods
+ - 
+
 Version 2.9 -> 2.10
 -------------------
  - added javadoc for org.apache.jcc.PythonVM class (Bill Janssen)

Modified: lucene/pylucene/trunk/jcc/jcc/__init__.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/__init__.py?rev=1154252&r1=1154251&r2=1154252&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/__init__.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/__init__.py Fri Aug  5 15:02:52 2011
@@ -34,3 +34,4 @@ else:
     from _jcc import initVM
 
 CLASSPATH=os.path.join(os.path.abspath(os.path.dirname(__file__)), "classes")
+_jcc.CLASSPATH = CLASSPATH

Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=1154252&r1=1154251&r2=1154252&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Fri Aug  5 15:02:52 2011
@@ -113,7 +113,10 @@ def cppnames(names):
 
 def absname(names):
 
-    return "::%s" %('::'.join(names))
+    if names:
+        return "::%s" %('::'.join(names))
+
+    return ''
 
 
 def typename(cls, current, const):
@@ -332,9 +335,10 @@ def expandjar(path):
 def jcc(args):
 
     classNames = set()
+    listedClassNames = set()
     packages = set()
     jars = []
-    classpath = []
+    classpath = [_jcc.CLASSPATH]
     libpath = []
     vmargs = ['-Djava.awt.headless=true']
     moduleName = None
@@ -479,6 +483,7 @@ def jcc(args):
                 raise ValueError, "Invalid argument: %s" %(arg)
         else:
             classNames.add(arg)
+            listedClassNames.add(arg)
         i += 1
 
     if libpath:
@@ -547,7 +552,8 @@ def jcc(args):
             if className.split('$', 1)[0] in excludes or className in excludes:
                 continue
             cls = findClass(className.replace('.', '/'))
-            if Modifier.isPublic(cls.getModifiers()):
+            if (Modifier.isPublic(cls.getModifiers()) or
+                className in listedClassNames):
                 addRequiredTypes(cls, typeset, generics)
 
         _dll_export = ''
@@ -574,7 +580,7 @@ def jcc(args):
             done.update(importset)
 
         todo = typeset - done
-	if allInOne and wrapperFiles > 1:
+        if allInOne and wrapperFiles > 1:
             classesPerFile = max(1, len(todo) / wrapperFiles)
         classCount = 0
         while todo:
@@ -622,9 +628,9 @@ def jcc(args):
                 elif wrapperFiles > 1:
                     if classCount >= classesPerFile:
                         out_cpp.close()
-	                fileCount += 1
-	                fileName = '__wrap%02d__.cpp' %(fileCount)
-	                out_cpp = file(os.path.join(cppdir, fileName), 'w')
+                        fileCount += 1
+                        fileName = '__wrap%02d__.cpp' %(fileCount)
+                        out_cpp = file(os.path.join(cppdir, fileName), 'w')
                         classCount = 0
                         
             done.update(todo)
@@ -747,27 +753,6 @@ def header(env, out, cls, typeset, packa
                 methods[sig] = method
         elif Modifier.isProtected(modifiers):
             protectedMethods.append(method)
-    for interface in interfaces:
-        for method in interface.getMethods():
-            sig = "%s:%s" %(method.getName(), signature(method, True))
-            if sig not in methods:
-                if generics:
-                    param = method.getGenericReturnType()
-                else:
-                    param = method.getReturnType()
-                if not known(param, typeset, declares, packages, excludes,
-                             generics):
-                    continue
-                if generics:
-                    params = method.getGenericParameterTypes()
-                else:
-                    params = method.getParameterTypes()
-                for param in params:
-                    if not known(param, typeset, declares, packages, excludes,
-                                 generics):
-                        break
-                else:
-                    methods[sig] = method
 
     def _compare(m0, m1):
         value = cmp(m0.getName(), m1.getName())