pygccxml-development Mailing List for C++ Python language bindings (Page 60)
Brought to you by:
mbaas,
roman_yakovenko
You can subscribe to this list here.
2006 |
Jan
|
Feb
(6) |
Mar
(160) |
Apr
(96) |
May
(152) |
Jun
(72) |
Jul
(99) |
Aug
(189) |
Sep
(161) |
Oct
(110) |
Nov
(9) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(13) |
Feb
(48) |
Mar
(35) |
Apr
(7) |
May
(37) |
Jun
(8) |
Jul
(15) |
Aug
(8) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(38) |
2008 |
Jan
(11) |
Feb
(29) |
Mar
(17) |
Apr
(3) |
May
|
Jun
(64) |
Jul
(49) |
Aug
(51) |
Sep
(18) |
Oct
(22) |
Nov
(9) |
Dec
(9) |
2009 |
Jan
(28) |
Feb
(15) |
Mar
(2) |
Apr
(11) |
May
(6) |
Jun
(2) |
Jul
(3) |
Aug
(34) |
Sep
(5) |
Oct
(7) |
Nov
(13) |
Dec
(14) |
2010 |
Jan
(39) |
Feb
(3) |
Mar
(3) |
Apr
(14) |
May
(11) |
Jun
(8) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(7) |
Apr
|
May
|
Jun
(3) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2016 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2021 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
From: Roman Y. <rom...@gm...> - 2006-05-17 18:04:35
|
On 5/17/06, Roman Yakovenko <rom...@gm...> wrote: > On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > > I have included a patch that I find useful for simplifying decl lookup > > in pyplusplus. > > > > It allows code like the following to be written using the __getitem__ > > interface. > > > > ns =3D mb.global_ns.namespace( 'my_ns',) > > ns["MyClass"].exclude() > > class_a =3D ns["ClassA"] > > class_a["doSomething"].include() I like this part of the patch > > It also allows an attribute interface (similar to Pyste). > > > > ns.MyClass.exclude() > > class_a =3D ns.ClassA > > class_a.doSomething.include() This one I like less. If user made some mistake and spelled wrong property = name of the class_t or namespace_t and there is a declaration with that name, then .... I prefer to apply the patch without __getattr__ part. Thoughts? --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-17 17:23:17
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > I have included a patch that I find useful for simplifying decl lookup > in pyplusplus. > > It allows code like the following to be written using the __getitem__ > interface. > > ns =3D mb.global_ns.namespace( 'my_ns',) > ns["MyClass"].exclude() > class_a =3D ns["ClassA"] > class_a["doSomething"].include() > > It also allows an attribute interface (similar to Pyste). > > ns.MyClass.exclude() > class_a =3D ns.ClassA > class_a.doSomething.include() > > These both can be used to dramatically reduce the amount of clutter > (redundant code calls) using in a script to generate bindings. Although > the second one could be seen as a little dangerous because of potential > name conflicts, I think the interface of Pyste has proven that people > like an interface like this because it allows something that feels like > a very tight domain specific langauge for creating bindings. > > I know that neither of these methods is anything more then syntactic > sugar, but IMHO it is pretty sweet sugar. :) Thanks. I will apply the patch. There is only one question: Why not to implement the __getattr__ next way: found_decls =3D self.decls(name=3Dname, allow_empty=3DTrue) if found_decls: return found_decls else: raise AttributeError Why do you need treatment for '__' ? > -Allen Thanks. --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-17 17:13:32
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > Roman Yakovenko wrote: > > > On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > > > >> I have a function class method that I am trying to wrap with pyplusplu= s. > >> > >> The method is similar to: > >> > >> std::vector< boost::shared_ptr< ClassA > > MyClass::getData(); > >> > >> I would like to use the indexing suite or something similar to make it > >> possible to iterate over and use this list from python. Is there any > >> support for this directly in pyplusplus or can anyone tell me what I > >> need to do custom to allow this? > > > > > > There are 2 ways to solve the problem. I will not like both of them. > > > > 1. Add custom code to class A: > > > > class_<std::vector< boost::shared_ptr<A> > >("AVec") > > .def(vector_indexing_suite<std::vector< std::vector< > > boost::shared_ptr<A> > > >()) > > ; > > > > And then from Python create a reference from global scope to it: > > > > AVec =3D A.AVec > > > > http://boost.org/libs/python/doc/v2/indexing.html > > I will have to try this one. I have to admit the code sample above > doesn't make sense yet, but I will re-read the indexing documentation > and see if I can figure it out. > > > > > 2. I will accept the patch. Now when I think about it, it should be > > fairly simple. > > 1. There is a need for vector_indexing_suite_ code creator. > > 2. After this small modification should be done to types_database_t= . > > It should recognize, that data type is vector or map. > > pygccxml.declarations.templates parser will do the job easier > > 3. Modify module_creator.creator_t class > > > > I am running out of time, otherwise I would implement the patch by > > myself. > > I think it should take like 3-5 hours. > > > Unfortunately I am not skilled enough to implement this. It is one > thing to make patches that change interfaces slightly or fix small parts > of code, it is an entirely different thing to understand the full code > base and add a large new capability. :) > > I wish I had time to learn the code that well, but I do not right now. > Sorry. :( You don't have to be sorry. Your comments keeps me in focus. I will impleme= nt this feature in next release. > Thanks for your help. > -Allen > --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-17 17:11:48
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > This seems like something that should be made easier for the user. > > Perhaps something like: > > my_ns.class_("ClassA").finalize() > > class_a.member_function("my_method").finalize() > > Is there any reason pyplusplus can't provide a more simple interface > like this for the user? What should do pyplusplus if the only way to export declaration is to create some wrapper for it? For example class with pure virtual function: raise an error? create wrapper? try to export without wrapper and let to the user to understand what he did wrong? > -Allen > --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-17 16:54:37
|
I have included a patch that I find useful for simplifying decl lookup in pyplusplus. It allows code like the following to be written using the __getitem__ interface. ns = mb.global_ns.namespace( 'my_ns',) ns["MyClass"].exclude() class_a = ns["ClassA"] class_a["doSomething"].include() It also allows an attribute interface (similar to Pyste). ns.MyClass.exclude() class_a = ns.ClassA class_a.doSomething.include() These both can be used to dramatically reduce the amount of clutter (redundant code calls) using in a script to generate bindings. Although the second one could be seen as a little dangerous because of potential name conflicts, I think the interface of Pyste has proven that people like an interface like this because it allows something that feels like a very tight domain specific langauge for creating bindings. I know that neither of these methods is anything more then syntactic sugar, but IMHO it is pretty sweet sugar. :) -Allen |
From: Allen B. <al...@vr...> - 2006-05-17 15:35:31
|
This seems like something that should be made easier for the user. Perhaps something like: my_ns.class_("ClassA").finalize() class_a.member_function("my_method").finalize() Is there any reason pyplusplus can't provide a more simple interface like this for the user? -Allen Roman Yakovenko wrote: > On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > >> Is it possible to finalize a wrapped class? In the library I am >> wrapping there are a number of classes that I know I do not want to >> allow the users to extend. Thus I would like to not expose protected >> method or provide a wrapper to allow overriding virtuals. >> >> Is it possible to do this with pyplusplus? > > > The short answer - may be yes. > > mb = module_builder_t( ... ) > non_public = ~declarations.access_type_matcher_t( 'public' ) > mb.calldefs( query ).exclude() > > mb.member_functions().virtuality = > declarations.VIRTUALITY_TYPES.NOT_VIRTUAL > > This is a hack, but it should work. > > The long answer is here: > http://sourceforge.net/mailarchive/forum.php?forum_id=47898&max_rows=25&style=flat&viewmonth=200603&viewday=20 > > >> -Allen > > |
From: Allen B. <al...@vr...> - 2006-05-17 14:58:39
|
Roman Yakovenko wrote: > On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > >> I have a function class method that I am trying to wrap with pyplusplus. >> >> The method is similar to: >> >> std::vector< boost::shared_ptr< ClassA > > MyClass::getData(); >> >> I would like to use the indexing suite or something similar to make it >> possible to iterate over and use this list from python. Is there any >> support for this directly in pyplusplus or can anyone tell me what I >> need to do custom to allow this? > > > There are 2 ways to solve the problem. I will not like both of them. > > 1. Add custom code to class A: > > class_<std::vector< boost::shared_ptr<A> > >("AVec") > .def(vector_indexing_suite<std::vector< std::vector< > boost::shared_ptr<A> > > >()) > ; > > And then from Python create a reference from global scope to it: > > AVec = A.AVec > > http://boost.org/libs/python/doc/v2/indexing.html I will have to try this one. I have to admit the code sample above doesn't make sense yet, but I will re-read the indexing documentation and see if I can figure it out. > > 2. I will accept the patch. Now when I think about it, it should be > fairly simple. > 1. There is a need for vector_indexing_suite_ code creator. > 2. After this small modification should be done to types_database_t. > It should recognize, that data type is vector or map. > pygccxml.declarations.templates parser will do the job easier > 3. Modify module_creator.creator_t class > > I am running out of time, otherwise I would implement the patch by > myself. > I think it should take like 3-5 hours. > Unfortunately I am not skilled enough to implement this. It is one thing to make patches that change interfaces slightly or fix small parts of code, it is an entirely different thing to understand the full code base and add a large new capability. :) I wish I had time to learn the code that well, but I do not right now. Sorry. :( Thanks for your help. -Allen |
From: Roman Y. <rom...@gm...> - 2006-05-17 05:15:50
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > Is it possible to finalize a wrapped class? In the library I am > wrapping there are a number of classes that I know I do not want to > allow the users to extend. Thus I would like to not expose protected > method or provide a wrapper to allow overriding virtuals. > > Is it possible to do this with pyplusplus? The short answer - may be yes. mb =3D module_builder_t( ... ) non_public =3D ~declarations.access_type_matcher_t( 'public' ) mb.calldefs( query ).exclude() mb.member_functions().virtuality =3D declarations.VIRTUALITY_TYPES.NOT_VIRT= UAL This is a hack, but it should work. The long answer is here: http://sourceforge.net/mailarchive/forum.php?forum_id=3D47898&max_rows=3D25= &style=3Dflat&viewmonth=3D200603&viewday=3D20 > -Allen --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-17 05:05:31
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > I have a function class method that I am trying to wrap with pyplusplus. > > The method is similar to: > > std::vector< boost::shared_ptr< ClassA > > MyClass::getData(); > > I would like to use the indexing suite or something similar to make it > possible to iterate over and use this list from python. Is there any > support for this directly in pyplusplus or can anyone tell me what I > need to do custom to allow this? There are 2 ways to solve the problem. I will not like both of them. 1. Add custom code to class A: class_<std::vector< boost::shared_ptr<A> > >("AVec") .def(vector_indexing_suite<std::vector< std::vector< boost::shared_ptr<A> > > >()) ; And then from Python create a reference from global scope to it: AVec =3D A.AVec http://boost.org/libs/python/doc/v2/indexing.html 2. I will accept the patch. Now when I think about it, it should be fairly simple. 1. There is a need for vector_indexing_suite_ code creator. 2. After this small modification should be done to types_database_t. It should recognize, that data type is vector or map. pygccxml.declarations.templates parser will do the job easier 3. Modify module_creator.creator_t class I am running out of time, otherwise I would implement the patch by myself. I think it should take like 3-5 hours. --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-17 04:50:28
|
Roman Yakovenko wrote: > On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > >> I am fine with either. They really do the same thing behind the >> scenes. Mine could be easier to understand since the user sees it as >> part of their method call, but I am not going to argue it either way. > > > Thanks > >> What about the other patch, the one that allows adopt_include to take a >> string as an argument? > > > I forgot aboit it. I will add it, but function name will be > add_include. Is it fine with you? Sure, I am fine with whatever function name you like. Now that you explained what adopt_include means it makes sense to me. Thanks. -Allen |
From: Roman Y. <rom...@gm...> - 2006-05-17 04:44:47
|
On 5/17/06, Allen Bierbaum <al...@vr...> wrote: > I am fine with either. They really do the same thing behind the > scenes. Mine could be easier to understand since the user sees it as > part of their method call, but I am not going to argue it either way. Thanks > What about the other patch, the one that allows adopt_include to take a > string as an argument? I forgot aboit it. I will add it, but function name will be add_include. Is it fine with you? > -Allen > > --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-17 04:29:22
|
Is it possible to finalize a wrapped class? In the library I am wrapping there are a number of classes that I know I do not want to allow the users to extend. Thus I would like to not expose protected method or provide a wrapper to allow overriding virtuals. Is it possible to do this with pyplusplus? -Allen |
From: Allen B. <al...@vr...> - 2006-05-17 04:12:51
|
I have a function class method that I am trying to wrap with pyplusplus. The method is similar to: std::vector< boost::shared_ptr< ClassA > > MyClass::getData(); I would like to use the indexing suite or something similar to make it possible to iterate over and use this list from python. Is there any support for this directly in pyplusplus or can anyone tell me what I need to do custom to allow this? -Allen |
From: Allen B. <al...@vr...> - 2006-05-16 22:44:51
|
Roman Yakovenko wrote: > On 5/16/06, Allen Bierbaum <al...@vr...> wrote: > >> Roman: >> >> I have attached a patch to pyplusplus that adds to things. >> >> - In module_builder/builder.py >> >> Add decl_headers parameter to build_code_creator method. This is just >> passed on directly to creator.create() to allow the user to overried the >> headers used. >> >> - in module_t code creator >> >> Extended adopt_include method so it can take directory names (string's) >> directly. It will check the type and automatically create an include_t >> behind the scenes if it is needed. This makes it a little easier to add >> includes to the code creator returned from the module_builder and makes >> it so the users don't need to know about the code creator types. > > > :-). I am a little bit ill, so I have some time to work on py++. > This is exactly the problem I found and implemented an other solution. > > I am not sure which one is better( easier to understand, correct ). > My solution is next: > To module_t code creator I added new function: > replace_included_headers( list of headers( == strings ) > , > leave_boost_python_header=True ) > > So user needs to call this function. > Now comparison: > > What is bad in my implementation: user needs to take a look on module_t > code creator. > > What is not so good in your implementation: it is not extensibility. I > am sure, that > there are inconveniences or bugs in interface of code creators, that > you will not > be able to fix by passing argument to build_code_creator. > > I am not sure with what implementation to go. Thoughts? I am fine with either. They really do the same thing behind the scenes. Mine could be easier to understand since the user sees it as part of their method call, but I am not going to argue it either way. What about the other patch, the one that allows adopt_include to take a string as an argument? -Allen |
From: Roman Y. <rom...@gm...> - 2006-05-16 19:22:27
|
On 5/16/06, Allen Bierbaum <al...@vr...> wrote: > Roman: > > I have attached a patch to pyplusplus that adds to things. > > - In module_builder/builder.py > > Add decl_headers parameter to build_code_creator method. This is just > passed on directly to creator.create() to allow the user to overried the > headers used. > > - in module_t code creator > > Extended adopt_include method so it can take directory names (string's) > directly. It will check the type and automatically create an include_t > behind the scenes if it is needed. This makes it a little easier to add > includes to the code creator returned from the module_builder and makes > it so the users don't need to know about the code creator types. :-). I am a little bit ill, so I have some time to work on py++. This is exactly the problem I found and implemented an other solution. I am not sure which one is better( easier to understand, correct ). My solution is next: To module_t code creator I added new function: replace_included_headers( list of headers( =3D=3D strings ) , leave_boost_python_header=3DTrue ) So user needs to call this function. Now comparison: What is bad in my implementation: user needs to take a look on module_t code creator. What is not so good in your implementation: it is not extensibility. I am sure, that there are inconveniences or bugs in interface of code creators, that you will not be able to fix by passing argument to build_code_creator. I am not sure with what implementation to go. Thoughts? > One other note: I am a little confused by the use of the word "adopt" > in the API. For example adopt_include seems more like it should be > named add_include since it is adding an include to a module. There is > really no adopting going on as far as I can tell. adopt_include as argument takes include code creator. Every code creator has "parent" property. This is a reference to the parent code creator. Take a look on next code: ( compound_t code creator ) def adopt_creator( self, creator, index=3DNone): creator.parent =3D self if index or index =3D=3D 0: self._creators.insert( index, creator ) else: self._creators.append( creator ) Function post condition: parent code creator has new son. So I choose name "adopt". Also I understand, what are you talking about. Yesterday, I added 2 new functions to module_t code creator: def add_namespace_usage( self, namespace_name ): self.adopt_creator( namespace.namespace_using_t( 'boost' ) , self.last_include_index() + 1 ) def add_namespace_alias( self, alias, full_namespace_name ): self.adopt_creator( namespace.namespace_alias_t( alias=3Dalias , full_namespace_name=3Dfull_namespace_name= ) , self.last_include_index() + 1 ) As you can see, I use here "add". > Thanks, > Allen --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-14 09:12:23
|
Hi. I committed a set of changes, that improves pyplusplus template instantiation handling. In order to try them you need SVN version of gccxml + pygccxml + pyplusplus. You can find more information about pygccxml and pyplusplus here: http://www.language-binding.net/ Examples 1. you have some template global function do_smth template< class X > struct basic_string{}; template< class Ch > basic_string<Ch> do_smth(){ return basic_string<Ch>(); } inline void inst(){ do_smth<wchar_t>(); do_smth<char>(); } gccxml reports that there are 2 functions with the same name - do_smth and different return types. Obviously this is wrong. This fact causes pyplusplu= s to generate wrong code( code, that could not be compiled ). Another example is class templates: namespace demangled{ template< unsigned long i1, unsigned long i2, unsigned long i3> struct item_t{ static const unsigned long v1 =3D i1; static const unsigned long v2 =3D i2; static const unsigned long v3 =3D i3; }; struct buggy{ typedef unsigned long ulong; typedef item_t< ulong( 0xDEECE66DUL ) | (ulong(0x5) << 32), 0xB, ulong(1) << 31 > my_item_t; my_item_t my_item_var; }; } gccxml reports my_item_var class name as "item_t<0deece66d,11,080000000>" Obviously the reported name is wrong. Now about solution: Recently I created a patch to gccxml, that adds demangled string to be dump to generated file. gccxml already dumps mangled string for every declaratio= n. For example the mangled name of my_item_t class is: N9demangled6item_tILm3740067437ELm11ELm2147483648EEE If we demangle the string we will get: demangled::item_t<3740067437l, 11l, 2147483648l> As you can see, mangled string contains the correct name of the class. So, from now pygccxml + pyplusplus takes into account information extracted from demangled string. Enjoy --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-13 04:53:01
|
On 5/13/06, Neal Becker <ndb...@gm...> wrote: > Now, believe it or not (I tried it twice!), if I just add '-dD' to gccxml > command, now it looks OK: > /usr/bin/gccxml -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" > "/usr/local/src/boost.cvs/libs/random/random_test.cpp" > -fxml=3D"/usr/local/src/pygccxml/pyplusplus_dev/examples/pyboost_dev/pybo= ost/random/generated/random_test.xml" > -dD -E > stuff2 > void > compiler_log_formatter::log_build_info( std::ostream& output ) > { > output << "Platform: " << "linux" << '\n' > << "Compiler: " << "GCC-XML C++ version " 700 << '\n' > << "STL : " << "GNU libstdc++ version " "20060304" << '\n= ' > << "Boost : " << 103400/100000 << "." > << 103400/100 % 1000 << "." > << 103400 % 100 << std::endl; > } I will try it later. I have few un-committed changes in pygccxml/py++ that allows to export boost.random almost as is. Previously it was impossible, because GCC-XML reported wrong class names. Now pygccxml takes into account demangled name of the class. I think, I will have this library exported to Python to the end of next wee= k > --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Neal B. <ndb...@gm...> - 2006-05-12 23:18:46
|
Now, believe it or not (I tried it twice!), if I just add '-dD' to gccxml command, now it looks OK: /usr/bin/gccxml -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" "/usr/local/src/boost.cvs/libs/random/random_test.cpp" -fxml="/usr/local/src/pygccxml/pyplusplus_dev/examples/pyboost_dev/pyboost/random/generated/random_test.xml" -dD -E > stuff2 void compiler_log_formatter::log_build_info( std::ostream& output ) { output << "Platform: " << "linux" << '\n' << "Compiler: " << "GCC-XML C++ version " 700 << '\n' << "STL : " << "GNU libstdc++ version " "20060304" << '\n' << "Boost : " << 103400/100000 << "." << 103400/100 % 1000 << "." << 103400 % 100 << std::endl; } |
From: Neal B. <ndb...@gm...> - 2006-05-12 23:15:27
|
Looks like gccxml bug with preprocessor gcc -dD -fsyntax-only -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" "/usr/local/src/boost.cvs/libs/random/random_test.cpp" -E > stuff /usr/bin/gccxml -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" "/usr/local/src/boost.cvs/libs/random/random_test.cpp" -fxml="/usr/local/src/pygccxml/pyplusplus_dev/examples/pyboost_dev/pyboost/random/generated/random_test.xml" -E > stuff2 Now look at stuff: void compiler_log_formatter::log_build_info( std::ostream& output ) { output << "Platform: " << "linux" << '\n' << "Compiler: " << "GNU C++ version " "4.1.0 20060304 (Red Hat 4.1.0-3)" << '\n' << "STL : " << "GNU libstdc++ version " "20060304" << '\n' << "Boost : " << 103400/100000 << "." << 103400/100 % 1000 << "." << 103400 % 100 << std::endl; } And here's stuff2: void xml_log_formatter::log_build_info( std::ostream& ostr ) { ostr << "<BuildInfo" << " platform" << attr_value() << "linux" << " compiler" << attr_value() << "GCC-XML C++ version " 700 << " stl" << attr_value() << "GNU libstdc++ version " "20060304" << " boost=\"" << 103400/100000 << "." << 103400/100 % 1000 << "." << 103400 % 100 << '\"' << "/>"; } No, I did NOT type those extra characters, they are in the gccxml cpp output. I also did not change STL to stl or Boost to boost=\ |
From: Neal B. <ndb...@gm...> - 2006-05-12 22:40:53
|
I tried to run boost::random example from pygccxml/pyplusplus_dev/examples/pyboost_dev/pyboost/random/. This is using: cvs gccxml svn pygccxml svn pyplusplus linux (fedora FC5) gcc gcc-4.1.0-3 boost cvs python generate_code.py /usr/local/src/pygccxml/pyplusplus_dev pygccxml INSTALLED version will be used parsing files - started gccxml cmd: /usr/bin/gccxml -I"." -I"/usr/local/src/boost.cvs" -U"__MINGW32__" "/usr/local/src/boost.cvs/libs/random/random_test.cpp" -fxml="/usr/local/src/pygccxml/pyplusplus_dev/examples/pyboost_dev/pyboost/random/generated/random_test.xml" Traceback (most recent call last): File "generate_code.py", line 94, in ? export() File "generate_code.py", line 90, in export cg = code_generator_t() File "generate_code.py", line 34, in __init__ , undefine_symbols=settings.undefined_symbols) File "/usr/lib/python2.4/site-packages/pyplusplus/module_builder/builder.py", line 76, in __init__ , cache ) File "/usr/lib/python2.4/site-packages/pyplusplus/module_builder/builder.py", line 101, in __parse_declarations decls = reader.read_files( files, compilation_mode ) File "/usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py", line 149, in read_files return self.__parse_file_by_file(files) File "/usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py", line 183, in __parse_file_by_file reader.create_xml_file( header, prj_file.cached_source_file ) File "/usr/lib/python2.4/site-packages/pygccxml/parser/source_reader.py", line 154, in create_xml_file raise error pygccxml.parser.source_reader.gccxml_runtime_error_t: Error occured while running GCC-XML: In file included from /usr/local/src/boost.cvs/boost/test/included/test_exec_monitor.hpp:18, from /usr/local/src/boost.cvs/libs/random/random_test.cpp:25: /usr/local/src/boost.cvs/boost/test/impl/compiler_log_formatter.ipp: In member function `virtual void boost::unit_test::output::compiler_log_formatter::log_build_info(std::ostream&) ': /usr/local/src/boost.cvs/boost/test/impl/compiler_log_formatter.ipp:66: error: syntax error before numeric constant In file included from /usr/local/src/boost.cvs/boost/test/included/test_exec_monitor.hpp:32, from /usr/local/src/boost.cvs/libs/random/random_test.cpp:25: /usr/local/src/boost.cvs/boost/test/impl/xml_log_formatter.ipp: In member function `virtual void boost::unit_test::output::xml_log_formatter::log_build_info(std::ostream&)': /usr/local/src/boost.cvs/boost/test/impl/xml_log_formatter.ipp:72: error: syntax error before numeric constant |
From: Roman Y. <rom...@gm...> - 2006-05-12 18:40:55
|
On 5/12/06, Allen Bierbaum <al...@vr...> wrote: > Roman Yakovenko wrote: > > In most cases pyplusplus will find out this automatically. Any way, > > pyplusplus/decl_wrappers class_t has held_type property. > > What does pyplusplus use to determine this? I ask because it didn't > work for any of my classes. When py++ creates code creators for your declarations, it registers every u= sed type ( =3D=3D return type and function arguments ) in "types database". After, all functions have been exported, py++ then queries that data base f= or help_type and register_ptr_to_python. Please take a look on module_creator.types_database.py file. By default py++ creates an instance of this class and passes it to module_creator.creator_t instance. module_builder.module_builder_t.build_code_creator function takes an argume= nt types_db, by default is None. You can create your own types_dn and pass it to py++. Or may be you can take a look on types_database_t class and fix it= ? > I am not surprised it didn't work, but it may be interesting to > understand why it is not working. I agree with you > -Allen --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-12 18:28:22
|
On 5/12/06, Allen Bierbaum <al...@vr...> wrote: > > > > > Yes, just use an API I gave you: > > > > add_code( your code, works_on_instance=3DFalse ) > > > > It should do the trick > > > I can't seem to find a similar API for adding code outside of a class. Because it does not exists. > For example if I want to add a custom .def at the global scope or put a > new method inline in the file or something like that. I think the > prototype API I had allowed custom code to be added to any decl (not > just classes). If you want to open this topic, please start another thread, with an exampl= e, that shows, how this functionality would help you. > -Allen > --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-12 18:20:02
|
On 5/12/06, Allen Bierbaum <al...@vr...> wrote: > Roman Yakovenko wrote: > > In most cases pyplusplus will find out this automatically. Any way, > > pyplusplus/decl_wrappers class_t has held_type property. > > Manually setting this lead to code that would not compile. The error is > below. May be you should set always_expose_using_scope flag to True. > It appears that once it had problems with the wapper class pointer type > after I set the held type. Is there something else I need to do to make > this work? Sorry, but I don't understand you, can you send me simple C++ code you want to export and your py++ script? Thanks > -Allen --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2006-05-12 18:16:08
|
Hi. I attach file that fix throw specification for generated functions. It is for SVN version. Enjoy. If you find bug, please report it. --=20 Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Allen B. <al...@vr...> - 2006-05-12 16:14:06
|
Roman Yakovenko wrote: > On 5/11/06, Allen Bierbaum <al...@vr...> wrote: > >> All of my libraries use boost::shared_ptr's. >> >> How do I: >> >> - register held types for a class. The experimental pypp_api I did had >> a .setHeldType() method, is there something similar still. > > > In most cases pyplusplus will find out this automatically. Any way, > pyplusplus/decl_wrappers class_t has held_type property. What does pyplusplus use to determine this? I ask because it didn't work for any of my classes. I am not surprised it didn't work, but it may be interesting to understand why it is not working. -Allen > >> - How do I generate "register_ptr_to_python" calls? > > > Same as above. If it does not work for you you will need to modify > code creators tree directly. So, if it will not work for you, I will > show you the code. > >> - How do I generate "implicitly_convertible" calls? > > > Same as above > >> - How do I add custom text (or the code creator for custom text) to a >> decl wrapper? (I could probably find this in the code, but thought I >> would ask first) > > > You can use 2 methods defined on decl_wrapper.class_t class: > > add_code( code, works_on_instance=True ) > add_wrapper_code( code ). > >> Thanks, >> Allen > > > P.S. Pay attention I redirect my answer to mailing list too. I want > this information > available to other people too. > |