pygccxml-development Mailing List for C++ Python language bindings (Page 11)
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...> - 2009-01-16 19:17:14
|
On Fri, Jan 16, 2009 at 3:22 PM, Maik Beckmann <bec...@go...> wrote: > Hello, > > I got two problems with vector of vectors > 1. nested vector type isn't exported > 2. renaming of "vector<vector<> >" doesn't work as expected > > =============================================== > =============================================== > > 1. nested vector type isn't exported > > test.hpp (include guards omitted) > {{{ > #include <vector> > void bar(std::vector<std::vector<double> > vv) > { ... } > }}} > > This is how I expect it to work in python > {{{ > from pyMaik import vector_less__double__greater_ as vector_double > from pyMaik import > vector_less__std_scope_vector_less__double__greater___greater_ as > vvector_double > from pyMaik import foo > > v1 = vector_double() > v1.append(1) > v2 = vector_double() > v2.append(2) > > vv = vvector_double() > vv.append(v1) > vv.append(v2) > > foo(vv) > }}} > However, it doesn't work because > std::vector<std::vector<double> > > is exported, but > std::vector<double> > not. Adding a dummy to test.hpp > void dummy(std::vector<double> v) { } > solves this problem, but I wonder if there is a better way to do this. Not really, all other solutions are variations of the found one. > > ================================================ > > 2. renaming of "vector<vector<> >" doesn't work as expected. > > To change this > {{{ > from pyMaik import vector_less__double__greater_ as vector_double > from pyMaik import > vector_less__std_scope_vector_less__double__greater___greater_ as > vvector_double > from pyMaik import foo > }}} > to > {{{ > from pyMaik import vector_double, vvector_double, foo > }}} > I've added the following to generate_code.py > {{{ > std = mb.namespace('std'); > > # do work: > #mb.class_('::std::vector<double>').rename('vector_double') > std.class_('vector<double>').rename('vector_double') > > # doesn't work: > #std.class_('vector<vector<double> >').rename('vvector_double') > #mb.class_('::std::vector<::std::vector< double > >>').rename('vvector_double')# doesn't work > #works: > mb.class_('::std::vector< std::vector< double > >').rename('vvector_double') > }}} > > As you can see from the comment vector<double> works nicely with, where > std.class_('vector<double>').rename('vector_double') > is what I prefer. For vector<vector<double> > I tried > std.class_('vector<vector<double> >').rename('vvector_double') > but it doesn't work. Then I tried > mb.class_('::std::vector<::std::vector< double > >>').rename('vvector_double') > because because ::std::vector<double> worked above, but I it doesn't work > either. The only statement I've found to get what I want is > mb.class_('::std::vector< std::vector< double > >').rename('vvector_double') > What are the rules (give me a RTFM with and a link if I missed it) ? The RTFM will not help :-). Mainly because you have to specify the exact name of the class as it reports gccxml. Also, I tried very hard to simplify those things, but as you can see there are still problems. The relevant source code link: http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pygccxml_dev/pygccxml/declarations/matchers.py?revision=1428&view=markup Take a look on class declaration_matcher_t. If you will be able to improve this - I will gladly accept your patch. Py++ propose other solution to the same problem - much easier and less error prone: http://language-binding.net/pyplusplus/documentation/how_to/hints.html HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Maik B. <bec...@go...> - 2009-01-16 13:44:27
|
Maik Beckmann schrieb am Freitag 16 Januar 2009 um 14:22: > The only statement I've found to get what I want is > vv = mb.class_('::std::vector< std::vector< double > >') > vv.rename('vvector_double') What I actually need for my code is to set an alias for vector<vector<double> const*> But vv = mb.class_('::std::vector< std::vector< double > const* >') fails. How is it done right? Thanks, -- Maik |
From: Maik B. <bec...@go...> - 2009-01-16 13:21:42
|
Hello, I got two problems with vector of vectors 1. nested vector type isn't exported 2. renaming of "vector<vector<> >" doesn't work as expected =============================================== =============================================== 1. nested vector type isn't exported test.hpp (include guards omitted) {{{ #include <vector> void bar(std::vector<std::vector<double> > vv) { ... } }}} This is how I expect it to work in python {{{ from pyMaik import vector_less__double__greater_ as vector_double from pyMaik import vector_less__std_scope_vector_less__double__greater___greater_ as vvector_double from pyMaik import foo v1 = vector_double() v1.append(1) v2 = vector_double() v2.append(2) vv = vvector_double() vv.append(v1) vv.append(v2) foo(vv) }}} However, it doesn't work because std::vector<std::vector<double> > is exported, but std::vector<double> not. Adding a dummy to test.hpp void dummy(std::vector<double> v) { } solves this problem, but I wonder if there is a better way to do this. ================================================ 2. renaming of "vector<vector<> >" doesn't work as expected. To change this {{{ from pyMaik import vector_less__double__greater_ as vector_double from pyMaik import vector_less__std_scope_vector_less__double__greater___greater_ as vvector_double from pyMaik import foo }}} to {{{ from pyMaik import vector_double, vvector_double, foo }}} I've added the following to generate_code.py {{{ std = mb.namespace('std'); # do work: #mb.class_('::std::vector<double>').rename('vector_double') std.class_('vector<double>').rename('vector_double') # doesn't work: #std.class_('vector<vector<double> >').rename('vvector_double') #mb.class_('::std::vector<::std::vector< double > >').rename('vvector_double')# doesn't work #works: mb.class_('::std::vector< std::vector< double > >').rename('vvector_double') }}} As you can see from the comment vector<double> works nicely with, where std.class_('vector<double>').rename('vector_double') is what I prefer. For vector<vector<double> > I tried std.class_('vector<vector<double> >').rename('vvector_double') but it doesn't work. Then I tried mb.class_('::std::vector<::std::vector< double > >').rename('vvector_double') because because ::std::vector<double> worked above, but I it doesn't work either. The only statement I've found to get what I want is mb.class_('::std::vector< std::vector< double > >').rename('vvector_double') What are the rules (give me a RTFM with and a link if I missed it) ? Thanks, -- Maik |
From: Roman Y. <rom...@gm...> - 2008-12-23 20:39:22
|
Hello. Recently, GCCXML added new functionality - automatic installer creation during GCCXML build process. I just uploaded the installer to SourceForge ( https://sourceforge.net/project/showfiles.php?group_id=118209&package_id=303864&release_id=649258 ) . The GCCXML is built from SVN, checked out at 22-dec-2008 date. It was built using Visual Studio Express 2008, for 32bit platform. I hope, I will be able to upload Linux setup too, somewhere next week. Enjoy. P.S. Now, there is now reason to use old GCCXML :-) -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: <tho...@fr...> - 2008-12-19 12:06:10
|
>On Fri, Dec 19, 2008 at 7:15 AM, Thomas Paviot <tho...@fr...> wrote: >> Hello, >> >> I use the Py++ 'cache' feature in order to speed up module_build_t >> creation. Unfortunately, generated xml files are huge. For instance, in >> the project I'm currently working on, I have about 200 xml files with an >> approximative size of 2Mb for each one. As a result, total size of >> cached gccxml files are about 800Mb. > >400 Mb, right? Well, if 2*2 still equals 4, then yes: 400Mb! (sorry for the mistake). >> >> Wouldn't it be possible to zip/unzip these files before they are used by >> pygccxml? Speed wouldn't really be affected, and the size improvement >> would be about 80% (new size of my folder would then be only 160Mb). The >> cache filename could be passed to module_builder_t either with .xml >> extension (current behaviour) or with .zip extension (xml file would be >> stored as zip archives). > >I think, if you add such functionality the cache advantage will almost gone. I made another mistake in my message: it seems that cached files are not xml formatted(that's what I thought but I realized it was wrong after I opened these files in my text editor). Regarding time advantage, zipfile python module provides a very fast compression/extraction algorithm. I used it in a other project and was really amazed about the performances. But you're right, it have to be measured. >You can implement something outside of Py++/pygccxml > - "unzip" before passing to py++ > - zip after code generation was done. > >Thus you will get the time measures. If they are good I will be glad >to work with you to integrate this functionality to Py++/pygccxml. It's a good way to check the idea. I send you back the results as soon as I can. >>I do not have enough free time now to implement >> this feature on my own, but I can provide a patch in the next few weeks. > >It could be nice if you describe in few words how you are going to do >this, so we could close the interface only once :-). I don't know yet about the 'how' and just expressed a 'why'. >Thanks Regards, Thomas |
From: Roman Y. <rom...@gm...> - 2008-12-19 11:51:11
|
On Fri, Dec 19, 2008 at 7:15 AM, Thomas Paviot <tho...@fr...> wrote: > Hello, > > I use the Py++ 'cache' feature in order to speed up module_build_t > creation. Unfortunately, generated xml files are huge. For instance, in > the project I'm currently working on, I have about 200 xml files with an > approximative size of 2Mb for each one. As a result, total size of > cached gccxml files are about 800Mb. 400 Mb, right? > > Wouldn't it be possible to zip/unzip these files before they are used by > pygccxml? Speed wouldn't really be affected, and the size improvement > would be about 80% (new size of my folder would then be only 160Mb). The > cache filename could be passed to module_builder_t either with .xml > extension (current behaviour) or with .zip extension (xml file would be > stored as zip archives). I think, if you add such functionality the cache advantage will almost gone. You can implement something outside of Py++/pygccxml - "unzip" before passing to py++ - zip after code generation was done. Thus you will get the time measures. If they are good I will be glad to work with you to integrate this functionality to Py++/pygccxml. >I do not have enough free time now to implement > this feature on my own, but I can provide a patch in the next few weeks. It could be nice if you describe in few words how you are going to do this, so we could close the interface only once :-). Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Thomas P. <tho...@fr...> - 2008-12-19 05:15:19
|
Hello, I use the Py++ 'cache' feature in order to speed up module_build_t creation. Unfortunately, generated xml files are huge. For instance, in the project I'm currently working on, I have about 200 xml files with an approximative size of 2Mb for each one. As a result, total size of cached gccxml files are about 800Mb. Wouldn't it be possible to zip/unzip these files before they are used by pygccxml? Speed wouldn't really be affected, and the size improvement would be about 80% (new size of my folder would then be only 160Mb). The cache filename could be passed to module_builder_t either with .xml extension (current behaviour) or with .zip extension (xml file would be stored as zip archives). I do not have enough free time now to implement this feature on my own, but I can provide a patch in the next few weeks. Best regards, Thomas Paviot |
From: Roman Y. <rom...@gm...> - 2008-12-18 19:46:32
|
There gccxml, which is based on gcc 4.2, could not compile your code - you have to change it. P.S. Please next time explain your problem, If you don't have time to do this - I will not have time to take a look on it. On Thu, Dec 18, 2008 at 9:04 PM, Neal Becker <ndb...@gm...> wrote: > gccxml cvs from today > pygccxml, pyplusplus svn from today > > boost is 1.37.0 + constrained_values package > This code compiles with gcc-4.3.2. > > gccxml_runtime_error_t: Error occured while running GCC-XML: In file included > from /usr/local/src/boost.hg/boost/type_traits/composite_traits.hpp:17, > from > /usr/local/src/boost.hg/boost/function/function_base.hpp:24, > from > /usr/local/src/boost.hg/boost/function/detail/prologue.hpp:17, > from /usr/local/src/boost.hg/boost/function.hpp:24, > from > /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:29, > from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, > from run_time_fixed_pt.hpp:4: > /usr/local/src/boost.hg/boost/type_traits/is_enum.hpp:181: error: a function > call cannot appear in a constant-expression > /usr/local/src/boost.hg/boost/type_traits/is_enum.hpp:181: error: template > argument 2 is invalid > In file included from > /usr/local/src/boost.hg/boost/type_traits/composite_traits.hpp:22, > from > /usr/local/src/boost.hg/boost/function/function_base.hpp:24, > from > /usr/local/src/boost.hg/boost/function/detail/prologue.hpp:17, > from /usr/local/src/boost.hg/boost/function.hpp:24, > from > /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:29, > from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, > from run_time_fixed_pt.hpp:4: > /usr/local/src/boost.hg/boost/type_traits/is_union.hpp:38: error: expected > primary-expression before ')' token > /usr/local/src/boost.hg/boost/type_traits/is_union.hpp:38: error: a function > call cannot appear in a constant-expression > In file included from > /usr/local/src/boost.hg/boost/type_traits/is_convertible.hpp:25, > from > /usr/local/src/boost.hg/boost/type_traits/is_empty.hpp:12, > from > /usr/local/src/boost.hg/boost/detail/compressed_pair.hpp:26, > from /usr/local/src/boost.hg/boost/compressed_pair.hpp:21, > from > /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:30, > from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, > from run_time_fixed_pt.hpp:4: > /usr/local/src/boost.hg/boost/type_traits/is_abstract.hpp:72: error: expected > primary-expression before ')' token > /usr/local/src/boost.hg/boost/type_traits/is_abstract.hpp:72: error: a > function call cannot appear in a constant-expression > In file included from > /usr/local/src/boost.hg/boost/type_traits/is_empty.hpp:19, > from > /usr/local/src/boost.hg/boost/detail/compressed_pair.hpp:26, > from /usr/local/src/boost.hg/boost/compressed_pair.hpp:21, > from > /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:30, > from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, > from run_time_fixed_pt.hpp:4: > /usr/local/src/boost.hg/boost/type_traits/is_class.hpp:122: error: expected > primary-expression before ')' token > /usr/local/src/boost.hg/boost/type_traits/is_class.hpp:122: error: a function > call cannot appear in a constant-expression > In file included from /usr/local/src/boost.hg/boost/serialization/level.hpp:26, > from /usr/local/src/boost.hg/boost/serialization/nvp.hpp:31, > from run_time_fixed_pt.hpp:8: > /usr/local/src/boost.hg/boost/type_traits/is_base_and_derived.hpp:225: error: > expected primary-expression before ',' token > /usr/local/src/boost.hg/boost/type_traits/is_base_and_derived.hpp:225: error: > expected primary-expression before ')' token > /usr/local/src/boost.hg/boost/type_traits/is_base_and_derived.hpp:225: error: > a function call cannot appear in a constant-expression > In file included from > /usr/local/src/boost.hg/boost/serialization/base_object.hpp:34, > from /usr/local/src/boost.hg/boost/serialization/nvp.hpp:34, > from run_time_fixed_pt.hpp:8: > /usr/local/src/boost.hg/boost/type_traits/is_polymorphic.hpp:106: error: a > function call cannot appear in a constant-expression > /usr/local/src/boost.hg/boost/type_traits/is_polymorphic.hpp:106: error: > template argument 2 is invalid > > > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > _______________________________________________ > pygccxml-development mailing list > pyg...@li... > https://lists.sourceforge.net/lists/listinfo/pygccxml-development > > -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Neal B. <ndb...@gm...> - 2008-12-18 19:05:00
|
gccxml cvs from today pygccxml, pyplusplus svn from today boost is 1.37.0 + constrained_values package This code compiles with gcc-4.3.2. gccxml_runtime_error_t: Error occured while running GCC-XML: In file included from /usr/local/src/boost.hg/boost/type_traits/composite_traits.hpp:17, from /usr/local/src/boost.hg/boost/function/function_base.hpp:24, from /usr/local/src/boost.hg/boost/function/detail/prologue.hpp:17, from /usr/local/src/boost.hg/boost/function.hpp:24, from /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:29, from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, from run_time_fixed_pt.hpp:4: /usr/local/src/boost.hg/boost/type_traits/is_enum.hpp:181: error: a function call cannot appear in a constant-expression /usr/local/src/boost.hg/boost/type_traits/is_enum.hpp:181: error: template argument 2 is invalid In file included from /usr/local/src/boost.hg/boost/type_traits/composite_traits.hpp:22, from /usr/local/src/boost.hg/boost/function/function_base.hpp:24, from /usr/local/src/boost.hg/boost/function/detail/prologue.hpp:17, from /usr/local/src/boost.hg/boost/function.hpp:24, from /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:29, from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, from run_time_fixed_pt.hpp:4: /usr/local/src/boost.hg/boost/type_traits/is_union.hpp:38: error: expected primary-expression before ')' token /usr/local/src/boost.hg/boost/type_traits/is_union.hpp:38: error: a function call cannot appear in a constant-expression In file included from /usr/local/src/boost.hg/boost/type_traits/is_convertible.hpp:25, from /usr/local/src/boost.hg/boost/type_traits/is_empty.hpp:12, from /usr/local/src/boost.hg/boost/detail/compressed_pair.hpp:26, from /usr/local/src/boost.hg/boost/compressed_pair.hpp:21, from /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:30, from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, from run_time_fixed_pt.hpp:4: /usr/local/src/boost.hg/boost/type_traits/is_abstract.hpp:72: error: expected primary-expression before ')' token /usr/local/src/boost.hg/boost/type_traits/is_abstract.hpp:72: error: a function call cannot appear in a constant-expression In file included from /usr/local/src/boost.hg/boost/type_traits/is_empty.hpp:19, from /usr/local/src/boost.hg/boost/detail/compressed_pair.hpp:26, from /usr/local/src/boost.hg/boost/compressed_pair.hpp:21, from /usr/local/src/boost.hg/boost/constrained_value/constrained.hpp:30, from /usr/local/src/boost.hg/boost/constrained_value.hpp:30, from run_time_fixed_pt.hpp:4: /usr/local/src/boost.hg/boost/type_traits/is_class.hpp:122: error: expected primary-expression before ')' token /usr/local/src/boost.hg/boost/type_traits/is_class.hpp:122: error: a function call cannot appear in a constant-expression In file included from /usr/local/src/boost.hg/boost/serialization/level.hpp:26, from /usr/local/src/boost.hg/boost/serialization/nvp.hpp:31, from run_time_fixed_pt.hpp:8: /usr/local/src/boost.hg/boost/type_traits/is_base_and_derived.hpp:225: error: expected primary-expression before ',' token /usr/local/src/boost.hg/boost/type_traits/is_base_and_derived.hpp:225: error: expected primary-expression before ')' token /usr/local/src/boost.hg/boost/type_traits/is_base_and_derived.hpp:225: error: a function call cannot appear in a constant-expression In file included from /usr/local/src/boost.hg/boost/serialization/base_object.hpp:34, from /usr/local/src/boost.hg/boost/serialization/nvp.hpp:34, from run_time_fixed_pt.hpp:8: /usr/local/src/boost.hg/boost/type_traits/is_polymorphic.hpp:106: error: a function call cannot appear in a constant-expression /usr/local/src/boost.hg/boost/type_traits/is_polymorphic.hpp:106: error: template argument 2 is invalid |
From: Roman Y. <rom...@gm...> - 2008-12-18 06:53:32
|
On Thu, Dec 18, 2008 at 4:41 AM, Neal Becker <ndb...@gm...> wrote: > After not touching pygccxml for a long time, I did > cd pygccxml > svn update > cd pygccxml_dev > python setup.py build > ... > creating build/lib/pygccxml/msvc/bsc > copying pygccxml/msvc/bsc/__init__.py -> build/lib/pygccxml/msvc/bsc > copying pygccxml/msvc/bsc/c_wrapper.py -> build/lib/pygccxml/msvc/bsc > error: package directory 'pygccxml/msvc/pdb' does not exist Fixed. Thanks for reporting it. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Neal B. <ndb...@gm...> - 2008-12-18 02:41:41
|
After not touching pygccxml for a long time, I did cd pygccxml svn update cd pygccxml_dev python setup.py build ... creating build/lib/pygccxml/msvc/bsc copying pygccxml/msvc/bsc/__init__.py -> build/lib/pygccxml/msvc/bsc copying pygccxml/msvc/bsc/c_wrapper.py -> build/lib/pygccxml/msvc/bsc error: package directory 'pygccxml/msvc/pdb' does not exist |
From: Roman Y. <rom...@gm...> - 2008-12-10 07:07:40
|
Hi all. Recently, I committed few breaking changes, related to indexing suite V2 to SVN. The purpose of those changes is to improve the installation procedure. The changes: * the library became headers only * the include directory has been changed from "boost/python/suite/indexing", the files use "indexing_suite/" The gain: * no need to deal with patching and rebuilding boost * it is possible to use boost libraries, which comes with your system * you can put the library anywhere you want - just update your compiler include paths in the build script * it is easier to redistribute it - just include the library with your sources Py++ was updated to use the new structure. Sorry for breaking change, but I think it worth the trouble. Now, I am playing with idea, to "generate"( copy ) the files automaticaly to the "generated code directory". Thus, indexing suite functionality will be available to user transparently: - no need to modify build script - no need to install it! - no need to know its existence at the start of the project. The only disadvantage is the files will be duplicated on disk. Obviously this feature could be configurable, with default option to copy files ( less trouble for newbies ). What do you think? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2008-11-30 19:47:12
|
On Sun, Nov 30, 2008 at 8:58 PM, Mihail Konstantinov <km...@ro...> wrote: > Hello, > due to limitations of swig I am currently learning Py++ and Pyste (because > it seems currently to be better documented than Py++). Hmm. Did you see http://language-binding.net/pyplusplus/pyplusplus.html page? If so what documentation you think it lacks or what could be improved? > Does Pyste or Py++ offer typemaps like swig > (http://www.swig..org/Doc1.3/SWIGDocumentation.html#Python_nn53) that allow > any sequence of input arguments to be wrapped to other Python arguments > (like for example ....,int len,char *s,... to a Python string) in any > function where they appear, even surrounded by other arguments? > > The only remotely similar I found documented is > http://www.boost.org/doc/libs/1_37_0/libs/python/pyste/doc/wrappers.html > which explains how to write a wrapper between C++ STL and Python containers. > But such a wrapper has to be rewritten for each and every function. Is there > a simple method that automates the repetitive task like swig typemaps? I can answer for Py++ only. If I understand right, SWIG typemaps, than you are looking for "Function Transformation" feature: http://language-binding.net/pyplusplus/documentation/functions/transformation/transformation.html If you combine it with "query" functionality ( http://language-binding.net/pygccxml/query_interface.html ) you get what you want. HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Mihail K. <km...@ro...> - 2008-11-30 18:58:05
|
Hello, due to limitations of swig I am currently learning Py++ and Pyste (because it seems currently to be better documented than Py++). Does Pyste or Py++ offer typemaps like swig (http://www.swig.org/Doc1.3/SWIGDocumentation.html#Python_nn53) that allow any sequence of input arguments to be wrapped to other Python arguments (like for example ...,int len,char *s,.... to a Python string) in any function where they appear, even surrounded by other arguments? The only remotely similar I found documented is http://www.boost.org/doc/libs/1_37_0/libs/python/pyste/doc/wrappers.html which explains how to write a wrapper between C++ STL and Python containers. But such a wrapper has to be rewritten for each and every function. Is there a simple method that automates the repetitive task like swig typemaps? Thanks Mihail |
From: Roman Y. <rom...@gm...> - 2008-11-21 19:55:55
|
On Fri, Nov 21, 2008 at 4:54 AM, gh zhao <ghz...@ya...> wrote: > Hello Roman, Good evening. Sorry for late response. > I have a few beginners' questions w.r.t. Py++: > I am working on a project. I need to convert Lyx to python. > (Lyx is written with boost, python and Qt) I used that software couple of times - a good one. Unfortunately I don't understand what do you mean by "convert". You will have to explain. > I am not familiar with boost.python and pygccxml and py++. > I'd like to know if it is feasible and not very difficult to convert Lyx to > python with Qt replaced by wxpython? > Can it be carried out in a batch file? Unfortunately, I am not able to answer your question. I don't understand what your are trying to do. I don't know your current architecture, code, the amount and complexity of iteration between GUI and the "engine". The question is too general. Py++ is definitely able to handle huge projects and I am sure it does this much better than other code generators. Python-Ogre project is the proof. > Thanks a lot in advance, You are welcome. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: gh z. <ghz...@ya...> - 2008-11-21 02:54:44
|
Hello Roman, I have a few beginners' questions w.r.t. Py++: I am working on a project. I need to convert Lyx to python. (Lyx is written with boost, python and Qt) I am not familiar with boost.python and pygccxml and py++. I'd like to know if it is feasible and not very difficult to convert Lyx to python with Qt replaced by wxpython? Can it be carried out in a batch file? Thanks a lot in advance, ghzhao ___________________________________________________________ 好玩贺卡等你发,邮箱贺卡全新上线! http://card.mail.cn.yahoo.com/ |
From: Roman Y. <rom...@gm...> - 2008-11-01 18:01:55
|
On Sat, Nov 1, 2008 at 5:41 PM, Paul Melis <pyp...@as...> wrote: > Sort of, but applied to arguments, e.g. > > for mf in main_ns.member_functions(arg_types=lambda d: 'blah' in > d.decl_string): > # do something with mf > > But this doesn't seem to work... try this: def my_query( f ): for arg in f.arguments: if <<<your logic>>>( arg.type ): return True else: if <<<your logic>>>( f.return_type ): return True else: return False decls = mb.global_ns( my_query ) HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Paul M. <pyp...@as...> - 2008-11-01 15:41:49
|
Roman Yakovenko wrote: > On Sat, Nov 1, 2008 at 12:06 PM, Paul Melis > <pyp...@as...> wrote: > >> Roman Yakovenko wrote: >> >>> As I promised, I checked how the querying for declarations works. >>> Basically you can search for a declaration: >>> * using full name - "::x::y::z" >>> * using its name only - "z" >>> >>> In the past, I choose this method to prevent confusions. >>> >>> >> Thanks for verifying! >> >>> Pay attention, searching for "x::y::z" will not work and will raise an >>> exception. >>> >>> >> That's good to know, I indeed was expecting that form to work, but it >> makes sense to exclude it. >> > > Good. > > >> Is there a way to match (part of) a declaration on by string? Say I want >> all methods that have parameter types with some string S in them, where >> I just want to match the declaration string. >> > > mb = module_builder_t(...) > mb.global_ns.decls( lambda d: 'xyz' in d.decl_string ) > > Is this what you are looking for? > Sort of, but applied to arguments, e.g. for mf in main_ns.member_functions(arg_types=lambda d: 'blah' in d.decl_string): # do something with mf But this doesn't seem to work... Paul |
From: Roman Y. <rom...@gm...> - 2008-11-01 11:16:09
|
On Sat, Nov 1, 2008 at 12:06 PM, Paul Melis <pyp...@as...> wrote: > Roman Yakovenko wrote: >> As I promised, I checked how the querying for declarations works. >> Basically you can search for a declaration: >> * using full name - "::x::y::z" >> * using its name only - "z" >> >> In the past, I choose this method to prevent confusions. >> > Thanks for verifying! >> Pay attention, searching for "x::y::z" will not work and will raise an >> exception. >> > That's good to know, I indeed was expecting that form to work, but it > makes sense to exclude it. Good. > Is there a way to match (part of) a declaration on by string? Say I want > all methods that have parameter types with some string S in them, where > I just want to match the declaration string. mb = module_builder_t(...) mb.global_ns.decls( lambda d: 'xyz' in d.decl_string ) Is this what you are looking for? -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Paul M. <pyp...@as...> - 2008-11-01 10:06:37
|
Roman Yakovenko wrote: > As I promised, I checked how the querying for declarations works. > Basically you can search for a declaration: > * using full name - "::x::y::z" > * using its name only - "z" > > In the past, I choose this method to prevent confusions. > Thanks for verifying! > Pay attention, searching for "x::y::z" will not work and will raise an > exception. > That's good to know, I indeed was expecting that form to work, but it makes sense to exclude it. Is there a way to match (part of) a declaration on by string? Say I want all methods that have parameter types with some string S in them, where I just want to match the declaration string. Paul |
From: Roman Y. <rom...@gm...> - 2008-11-01 08:10:54
|
As I promised, I checked how the querying for declarations works. Basically you can search for a declaration: * using full name - "::x::y::z" * using its name only - "z" In the past, I choose this method to prevent confusions. Pay attention, searching for "x::y::z" will not work and will raise an exception. I will update the documentation. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Paul M. <pa...@sc...> - 2008-10-31 15:05:37
|
Roman Yakovenko wrote: > On Wed, Oct 29, 2008 at 10:31 PM, Paul Melis > <pyp...@as...> wrote: > >> Roman Yakovenko wrote: >> >>>>> Why do you want to exclude such declarations: >>>>> * to get "clean" build - without warnings. If so, in this specific >>>>> case you can decide that you trust Py++ and suppress the warning. >>>>> * other reasons - please explain. >>>>> >>>>> >>>>> >>>> The reason is quite practical. Up till now I have not been able to even >>>> compile my generated wrappers because of W1005 warnings. >>>> I simply want to get some version of my wrappers working that I can get >>>> started with. From there I can work on replacing/handling the issues w.r.t. >>>> use of non-public classes. >>>> >>>> >>> It sounds like a bug. Can you send me simple test case. I would like >>> to improve the situation. >>> >>> >> After some digging it seems to be caused by the following pattern: >> - the code I'm wrapping uses its own smart pointer class, say smart_ptr<T> >> - the code contains a class, say C, with a protected inner class, say I >> - the smart_ptr class has one or more methods that either return or use >> a pointer to C::I >> >> In the gccxml I see lines <Class ... artificial="1" >> demangled="smart_ptr<C::I>;" mangled="..." name="smart_ptr<C::I>" />, >> which probably make Py++ generate wrappers for the smart_ptr methods. >> > > No, it doesn't help. I don't understand why Py++ still generates them. > Are the functions [pure] virtual? > > Also, I suggest you to read the following link: > http://language-binding.net/pyplusplus/troubleshooting_guide/smart_ptrs/smart_ptrs.html > I thought I had found what was going on. Take, for example, the following class: class Outer { protected: struct Inner { Inner() {} Inner(const Inner& obj) { field = obj.field; } Inner& operator = (const Inner& obj) { field = obj.field; return *this; } int field; }; }; When I run the Python script at the end of this mail I get INFO Parsing source file "all.h" ... INFO gccxml cmd: /home/paul/local/bin/gccxml -I"." "all.h" -fxml="/tmp/tmpQ34w-p.xml" INFO GCCXML version - 0.9 WARNING: Outer::Inner::Inner(Outer::Inner const & obj) [copy constructor] > compilation error W1005: Py++ cannot expose function that takes as > argument/returns instance of non-public class. Generated code will not > compile. WARNING: Outer::Inner & Outer::Inner::operator=(Outer::Inner const & obj) [member operator] > compilation error W1005: Py++ cannot expose function that takes as > argument/returns instance of non-public class. Generated code will not > compile. INFO: file "generated.cpp" - updated( 0.000000 seconds ) So it LOOKS like Py++ is trying to wrap the constructors of the protected inner class, which is obviously not going to work. However, when I look in the generated code there's no wrappers for Outer::Inner, so the warning message's claim "Generated code will not compile." is misleading... All the W1005 warnings I get might, however, still contain legimate ones that cause my compile problems. I'll need to dig further. Regards, Paul The script: #! /usr/bin/python import os import sys import pygccxml from pyplusplus import module_builder mb = module_builder.module_builder_t( files=['all.h'], gccxml_path='/home/paul/local/bin/gccxml') #path to gccxml executable mb.global_ns.include() #Now it is the time to give a name to our module mb.build_code_creator( module_name='doh' ) #I don't want absolute includes within code mb.code_creator.user_defined_directories.append( os.path.abspath('.') ) #And finally we can write code to the disk mb.write_module( os.path.join( os.path.abspath('.'), 'generated.cpp' ) ) |
From: Roman Y. <rom...@gm...> - 2008-10-30 19:03:22
|
On Wed, Oct 29, 2008 at 10:31 PM, Paul Melis <pyp...@as...> wrote: > Roman Yakovenko wrote: >>>> Why do you want to exclude such declarations: >>>> * to get "clean" build - without warnings. If so, in this specific >>>> case you can decide that you trust Py++ and suppress the warning. >>>> * other reasons - please explain. >>>> >>>> >>> The reason is quite practical. Up till now I have not been able to even >>> compile my generated wrappers because of W1005 warnings. >>> I simply want to get some version of my wrappers working that I can get >>> started with. From there I can work on replacing/handling the issues w.r.t. >>> use of non-public classes. >>> >> >> It sounds like a bug. Can you send me simple test case. I would like >> to improve the situation. >> > > After some digging it seems to be caused by the following pattern: > - the code I'm wrapping uses its own smart pointer class, say smart_ptr<T> > - the code contains a class, say C, with a protected inner class, say I > - the smart_ptr class has one or more methods that either return or use > a pointer to C::I > > In the gccxml I see lines <Class ... artificial="1" > demangled="smart_ptr<C::I>;" mangled="..." name="smart_ptr<C::I>" />, > which probably make Py++ generate wrappers for the smart_ptr methods. No, it doesn't help. I don't understand why Py++ still generates them. Are the functions [pure] virtual? Also, I suggest you to read the following link: http://language-binding.net/pyplusplus/troubleshooting_guide/smart_ptrs/smart_ptrs.html -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Paul M. <pyp...@as...> - 2008-10-29 20:46:56
|
Roman Yakovenko wrote: >>> Why do you want to exclude such declarations: >>> * to get "clean" build - without warnings. If so, in this specific >>> case you can decide that you trust Py++ and suppress the warning. >>> * other reasons - please explain. >>> >>> >> The reason is quite practical. Up till now I have not been able to even >> compile my generated wrappers because of W1005 warnings. >> I simply want to get some version of my wrappers working that I can get >> started with. From there I can work on replacing/handling the issues w.r.t. >> use of non-public classes. >> > > It sounds like a bug. Can you send me simple test case. I would like > to improve the situation. > After some digging it seems to be caused by the following pattern: - the code I'm wrapping uses its own smart pointer class, say smart_ptr<T> - the code contains a class, say C, with a protected inner class, say I - the smart_ptr class has one or more methods that either return or use a pointer to C::I In the gccxml I see lines <Class ... artificial="1" demangled="smart_ptr<C::I>;" mangled="..." name="smart_ptr<C::I>" />, which probably make Py++ generate wrappers for the smart_ptr methods. Does this make sense? Paul |
From: Roman Y. <rom...@gm...> - 2008-10-29 10:17:42
|
On Wed, Oct 29, 2008 at 11:38 AM, Paul Melis <pa...@sc...> wrote: > Hi Roman, Hello. > Surprisingly you say that class_('mynamespace::C') might not match any > class, as the following example line is in the query interface docs: > > do_smth = my_class.member_function( 'my_namespace::my_class::do_smth' ) > > I suppose that this form should match something as it is basically the most > used form in C++ code. I haven't seen much code that consistently uses an > absolute namespace path, like ::mynamespace::C, to refer to classes. Hmm. The functionality was implemented few years ago. I will create tester which will show "the real behavior". I will let you know the results. > Right, I did notice the docs about this and saw a quote from you somewhere > that it allows you to exclude items based on warnings they generate. > The above indeed shows that, but the warnings API doesn't allow you to find > WHICH items generated a certain warning so this would mean iterating over > ALL items being exported and checking them for a certain warning? You are right and this is the only solution. Not Py++, neither user can implement such functionality efficiently. Why do you want to exclude such declarations: * to get "clean" build - without warnings. If so, in this specific case you can decide that you trust Py++ and suppress the warning. * other reasons - please explain. >>> >>> - Finally, if I .exclude() a certain class it seems that this doesn't >>> propagate into excluding all methods/functions using that class (related >>> to the previous question)? >>> >> >> You mean you have class A{}; and some function f( A& ) and excluding >> A, doesn't exclude f, right? >> > > Yes. I'm not certain how the generated wrapper would behave when class A is > excluded, but f(A&) WOULD be wrapped. As warning says - you will get Boost.Python run-time error. It will say that it can not invoke the function with the arguments you gave. > If there was a class B derived from A that would be included in the wrappers > then I could still call f(B)? You should check, but if I remember right, you still can do this. It is possible, that few functions defined in class A, will be redefined in class B wrapper - for example pure virtual functions. >> >> If so, Py++ doesn't do it for performance\memory reasons. >> >> Now, when I think about it, it should be easy to add to the class_t >> new function - "exclude_me_and_references_to_me" ( better name is >> needed ) which will does exactly what you want. We can use >> "i_depend_on_them" functionality. >> > > It would be a nice addition to give users a choice of how exclusion of a > class is treated. The current option is simply excluding only the wrapper > for the class, but another variant would then be to exclude the class and > all its uses. I can do this. Please open the ticket on SourceForge. > Regards, > Paul > > PS Why did you choose to name classes with the "_t" postfix, e.g. > declaration_matcher_t versus the more common/pythonic DeclarationMatcher? This is the code convention I am used to. I am coming from C++ world. > And could a statement like "if not None is self.decl_type:" not also be > written as "if self.decl_type is not None:"? It seems that this specific statement was written late at night :-) -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |