remove gccxmlparser (in favour of castxmlparser)

This commit is contained in:
Gustavo Carneiro committed 2021-02-21 12:01:47 +00:00
1 parent 5cf981c5c5
commit 71852b1158
8 files changed
+29 -2346

No files matched your search

+3 -3
View File
@@ -18,10 +18,10 @@ Higher layers
cppexception
container
gccxmlparser
castxmlparser
settings
Lower layers
-----------------------
.. toctree::
@@ -1,10 +1,10 @@
==========================================================
gccxmlparser: scan header files to extract API definitions
castxmlparser: scan header files to extract API definitions
==========================================================
.. automodule:: pybindgen.gccxmlparser
.. automodule:: pybindgen.castxmlparser
:members:
:undoc-members:
:show-inheritance:
+19 -23
View File
@@ -37,7 +37,7 @@ and, then, will proceed to show how to use the automatic binding generator.
Supported Python versions
=========================
PyBindGen officially supports Python versions 2.6, 2.7, and >= 3.3[*] (tested in 3.3 and 3.4).
PyBindGen officially supports Python versions 2.6, 2.7, and >= 3.3 (tested in 3.3 and 3.4).
PyBindGen does not support Python versions 3.0, 3.1, and 3.2.
@@ -45,10 +45,6 @@ Note that C files generated by PyBindGen transparently support
multiple Python versions. In particular, the generated code can build
in either Python 2.x or Python 3.x.
[*] The automatic header file scanning feature of PyBindGen (submodule
`pybindgen.gccxmlparser`) does not work in any Python 3.x version,
since the pygccxml package has not been ported to Python 3.
Work flows
@@ -77,7 +73,7 @@ are several ways that PyBindGen can be used:
A simple example
================
The best way to get a feel for what PyBindGen looks like is to go through a
The best way to get a feel for what PyBindGen looks like is to go through a
simple example.
Code generation script
@@ -90,7 +86,7 @@ declared in a header my-module.h:
void MyModuleDoAction (void);
What we want to do is call this C function from python and be able to write
What we want to do is call this C function from python and be able to write
python code such as::
import MyModule
@@ -188,13 +184,13 @@ should be self-explanatory::
[...]
$ export PYTHONPATH=build/lib.linux-x86_64-2.7/
$ python
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
Python 2.7.5+ (default, Sep 19 2013, 13:48:49)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mymodule
>>> mymodule.MyModuleDoAction ()
You called MyModuleDoAction !
>>>
>>>
Wrapping types by value
@@ -217,8 +213,8 @@ argument to add_function specifies that our function returns a value of type
'int' and the third argument specifies that our function takes as a
single argument an 'int' of name 'value'::
mod.add_function('MyModuleDoAction',
pybindgen.retval ('int'),
mod.add_function('MyModuleDoAction',
pybindgen.retval ('int'),
[pybindgen.param ('int', 'v1'),
pybindgen.param ('int', 'v2')])
@@ -241,7 +237,7 @@ using positional arguments.
Of course, the above example could be rewritten to the more compact and readable::
from pybindgen import *
mod.add_function('MyModuleDoAction', retval ('int'),
mod.add_function('MyModuleDoAction', retval ('int'),
[param ('int', 'v1'),
param ('int', 'v2')])
@@ -459,11 +455,11 @@ no special challenge. Let's look at an example:
namespace Outer {
void Do (void);
class MyClass
class MyClass
{};
namespace Inner {
void Do (void);
class MyClass
class MyClass
{};
} // namespace Inner
} // namespace Outer
@@ -502,7 +498,7 @@ Memory management for pointer types
Until then, we have shown how to pass back and forth data through C/C++ APIs
only by value but, a large fraction of real-world APIs use raw pointers
(and, in the case of C++, smart pointers) as arguments or return values
(and, in the case of C++, smart pointers) as arguments or return values
of functions/methods.
Rather than try to explain the detail of every option offered by PyBindGen
@@ -572,14 +568,14 @@ disappears.
A reference-counted object
--------------------------
A nice way to avoid some of the ambiguities of the above-mentioned API bindings is to
A nice way to avoid some of the ambiguities of the above-mentioned API bindings is to
use reference-counted C or C++ objects which must provide a pair of functions or methods
to increase or decrease the reference count of the object. For example, a classic
C++ reference-counted class:
.. code-block:: c++
class MyClass
class MyClass
{
public:
void Ref (void);
@@ -597,9 +593,9 @@ To wrap this class, we first need to declare our class::
from pybindgen import cppclass
[...]
mod.add_class('MyClass', memory_policy=cppclass.ReferenceCountingMethodsPolicy(
incref_method='Ref',
decref_method='Unref',
mod.add_class('MyClass', memory_policy=cppclass.ReferenceCountingMethodsPolicy(
incref_method='Ref',
decref_method='Unref',
peekref_method='PeekRef'))
The above allows PyBindGen to maintain and track the reference count
@@ -621,7 +617,7 @@ method. If transfer_ownership=True it would mean that the caller
would keep the passed in reference to itself, and if the caller
wants to keep the reference it must call the incref method first.
A more interesting case is that of returning such a reference counted
A more interesting case is that of returning such a reference counted
object from a function:
.. code-block:: c++
@@ -749,7 +745,7 @@ scan the API definitions directly from the header files::
import pybindgen
from pybindgen import FileCodeSink
from pybindgen.gccxmlparser import ModuleParser
from pybindgen.castxmlparser import ModuleParser
def my_module_gen():
module_parser = ModuleParser('a1', '::')
@@ -781,7 +777,7 @@ PyBindGen based Python script::
import sys
from pybindgen import FileCodeSink
from pybindgen.gccxmlparser import ModuleParser
from pybindgen.castxmlparser import ModuleParser
def my_module_gen():
module_parser = ModuleParser('a2', '::')
File diff suppressed because it is too large. Load diff
+1 -5
View File
@@ -5,6 +5,7 @@ import re
import pybindgen
from pybindgen import FileCodeSink
from pybindgen.castxmlparser import ModuleParser
constructor_rx = re.compile("hello_foo_new(_.*)?")
@@ -40,11 +41,6 @@ def pre_scan_hook(dummy_module_parser,
def my_module_gen(out_file, pygccxml_mode):
if pygccxml_mode == 'castxml':
from pybindgen.castxmlparser import ModuleParser
else:
from pybindgen.gccxmlparser import ModuleParser
out = FileCodeSink(out_file)
#pybindgen.write_preamble(out)
out.writeln("#include \"hello.h\"")
+2 -2
View File
@@ -652,7 +652,7 @@ public:
return new AbstractBaseClassImpl;
}
// This method will be scanned by gccxmlparser and generate an error
// This method will be scanned by castxmlparser and generate an error
// that is only detected in code generation time.
// -#- @return(caller_owns_return=false) -#-
static AbstractBaseClass* get_abstract_base_class_ptr2 ()
@@ -676,7 +676,7 @@ inline AbstractBaseClass* get_abstract_base_class_ptr1 ()
return AbstractBaseClassImpl::get_abstract_base_class_ptr1 ();
}
// This function will be scanned by gccxmlparser and generate an error
// This function will be scanned by castxmlparser and generate an error
// that is only detected in code generation time.
// -#- @return(caller_owns_return=false) -#-
inline AbstractBaseClass* get_abstract_base_class_ptr2 ()
+1 -4
View File
@@ -10,6 +10,7 @@ from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink)
from pybindgen import (CppMethod, CppConstructor, CppClass, Enum)
from pybindgen.function import CustomFunctionWrapper
from pybindgen.cppmethod import CustomCppMethodWrapper
from pybindgen.castxmlparser import ModuleParser, PygenClassifier, PygenSection
import foomodulegen_common
@@ -17,10 +18,6 @@ import foomodulegen_common
def my_module_gen():
if sys.argv[6] == 'castxml':
from pybindgen.castxmlparser import ModuleParser, PygenClassifier, PygenSection
else:
from pybindgen.gccxmlparser import ModuleParser, PygenClassifier, PygenSection
class MyPygenClassifier(PygenClassifier):
def classify(self, pygccxml_definition):
+1 -4
View File
@@ -11,16 +11,13 @@ from pybindgen import (ReturnValue, Parameter, Module, Function, FileCodeSink)
from pybindgen import (CppMethod, CppConstructor, CppClass, Enum)
from pybindgen.function import CustomFunctionWrapper
from pybindgen.cppmethod import CustomCppMethodWrapper
from pybindgen.castxmlparser import ModuleParser
import foomodulegen_common
def my_module_gen():
pygccxml_mode = sys.argv[4]
if pygccxml_mode == 'castxml':
from pybindgen.castxmlparser import ModuleParser
else:
from pybindgen.gccxmlparser import ModuleParser
out = FileCodeSink(sys.stdout)
pygen_file = open(sys.argv[3], "wt")