Re: [C++-sig] pygccxml KeyError

2011-12-19 Thread Roman Yakovenko
On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh  wrote:
> Hopefully, there’s enough information in the traceback, but if not I can try
> to sanitize an example.  I’m on rev 1856.

More or less. Sorry for late response, I was pretty busy.

>   File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py",
> line 445, in _join_class_hierarchy


You are using project_reader_t class to parse a set of C++ files. This
method is not reliable and pretty slow. I suggest you to use
"source_reader_t" class.

Please read the project documentation, it explains how to start using it.


Regards,
Roman
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

2011-12-19 Thread Davidson, Josh
Short of modifying the distribution, I don't see any way within Py++ to change 
the type of reader.  It seems to be hardcoded to project_reader_t:

def __parse_declarations( self, files, gccxml_config, compilation_mode, 
cache, indexing_suite_version ):
if None is gccxml_config:
gccxml_config = parser.config_t()
if None is compilation_mode:
compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
start_time = time.clock()
self.logger.debug( 'parsing files - started' )
reader = parser.project_reader_t( gccxml_config, cache, 
decl_wrappers.dwfactory_t() )

-Original Message-
From: cplusplus-sig-bounces+josh.davidson=lmco@python.org 
[mailto:cplusplus-sig-bounces+josh.davidson=lmco@python.org] On Behalf Of 
Roman Yakovenko
Sent: Monday, December 19, 2011 12:37 PM
To: Development of Python/C++ integration
Subject: EXTERNAL: Re: [C++-sig] pygccxml KeyError

On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh  wrote:
> Hopefully, there's enough information in the traceback, but if not I 
> can try to sanitize an example.  I'm on rev 1856.

More or less. Sorry for late response, I was pretty busy.

>   File 
> "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py",
> line 445, in _join_class_hierarchy


You are using project_reader_t class to parse a set of C++ files. This method 
is not reliable and pretty slow. I suggest you to use "source_reader_t" class.

Please read the project documentation, it explains how to start using it.


Regards,
Roman
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

2011-12-19 Thread Davidson, Josh
May have been a bit too quick to respond.  Looks like setting the compilation 
mode can be used to have the project_reader_t use a source_reader_t.  Sorry 
about that.

-Original Message-
From: Davidson, Josh 
Sent: Monday, December 19, 2011 1:00 PM
To: 'Development of Python/C++ integration'
Subject: RE: EXTERNAL: Re: [C++-sig] pygccxml KeyError

Short of modifying the distribution, I don't see any way within Py++ to change 
the type of reader.  It seems to be hardcoded to project_reader_t:

def __parse_declarations( self, files, gccxml_config, compilation_mode, 
cache, indexing_suite_version ):
if None is gccxml_config:
gccxml_config = parser.config_t()
if None is compilation_mode:
compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
start_time = time.clock()
self.logger.debug( 'parsing files - started' )
reader = parser.project_reader_t( gccxml_config, cache, 
decl_wrappers.dwfactory_t() )

-Original Message-
From: cplusplus-sig-bounces+josh.davidson=lmco@python.org 
[mailto:cplusplus-sig-bounces+josh.davidson=lmco@python.org] On Behalf Of 
Roman Yakovenko
Sent: Monday, December 19, 2011 12:37 PM
To: Development of Python/C++ integration
Subject: EXTERNAL: Re: [C++-sig] pygccxml KeyError

On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh  wrote:
> Hopefully, there's enough information in the traceback, but if not I 
> can try to sanitize an example.  I'm on rev 1856.

More or less. Sorry for late response, I was pretty busy.

>   File
> "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py",
> line 445, in _join_class_hierarchy


You are using project_reader_t class to parse a set of C++ files. This method 
is not reliable and pretty slow. I suggest you to use "source_reader_t" class.

Please read the project documentation, it explains how to start using it.


Regards,
Roman
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

2011-12-19 Thread Davidson, Josh
Actually, it is using a source_reader_t by default.  __parse_declarations 
invokes __parse_file_by_file, which uses a source_reader_t (line 236) to parse 
each file.  It then bombs out after parsing all of the files when it calls 
_join_class_hierarchy.

I continue to have this issue with various combinations of classes.  In other 
words, I have headers that work fine with parsed in isolation, but when I try 
to build a module containing both, I get the KeyError.

-Original Message-
From: Davidson, Josh 
Sent: Monday, December 19, 2011 1:07 PM
To: 'Development of Python/C++ integration'
Subject: RE: EXTERNAL: Re: [C++-sig] pygccxml KeyError

May have been a bit too quick to respond.  Looks like setting the compilation 
mode can be used to have the project_reader_t use a source_reader_t.  Sorry 
about that.

-Original Message-
From: Davidson, Josh
Sent: Monday, December 19, 2011 1:00 PM
To: 'Development of Python/C++ integration'
Subject: RE: EXTERNAL: Re: [C++-sig] pygccxml KeyError

Short of modifying the distribution, I don't see any way within Py++ to change 
the type of reader.  It seems to be hardcoded to project_reader_t:

def __parse_declarations( self, files, gccxml_config, compilation_mode, 
cache, indexing_suite_version ):
if None is gccxml_config:
gccxml_config = parser.config_t()
if None is compilation_mode:
compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
start_time = time.clock()
self.logger.debug( 'parsing files - started' )
reader = parser.project_reader_t( gccxml_config, cache, 
decl_wrappers.dwfactory_t() )

-Original Message-
From: cplusplus-sig-bounces+josh.davidson=lmco@python.org 
[mailto:cplusplus-sig-bounces+josh.davidson=lmco@python.org] On Behalf Of 
Roman Yakovenko
Sent: Monday, December 19, 2011 12:37 PM
To: Development of Python/C++ integration
Subject: EXTERNAL: Re: [C++-sig] pygccxml KeyError

On Sat, Dec 17, 2011 at 2:23 AM, Davidson, Josh  wrote:
> Hopefully, there's enough information in the traceback, but if not I 
> can try to sanitize an example.  I'm on rev 1856.

More or less. Sorry for late response, I was pretty busy.

>   File
> "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py",
> line 445, in _join_class_hierarchy


You are using project_reader_t class to parse a set of C++ files. This method 
is not reliable and pretty slow. I suggest you to use "source_reader_t" class.

Please read the project documentation, it explains how to start using it.


Regards,
Roman
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

2011-12-19 Thread Roman Yakovenko
On Mon, Dec 19, 2011 at 10:24 PM, Davidson, Josh  wrote:
> Actually, it is using a source_reader_t by default.  __parse_declarations 
> invokes __parse_file_by_file, which uses a source_reader_t (line 236) to 
> parse each file.  It then bombs out after parsing all of the files when it 
> calls _join_class_hierarchy.
>
> I continue to have this issue with various combinations of classes.  In other 
> words, I have headers that work fine with parsed in isolation, but when I try 
> to build a module containing both, I get the KeyError.

Can you create a single header file, which includes all others?

HTH
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

2011-12-19 Thread Davidson, Josh
Including everything into a single header does work, so it looks like there is 
a problem with the joining process.  Well, it builds anyways.  I still get 
compilation error W1050 telling me that I didn't specify a call policies (I did 
and they show up in the generated code).

These are the Py++ settings I'm using for this minimal example:

mb.code_creator.add_include("model_io/storage/SharedMemoryBuilder.hpp")

mb.code_creator.add_include("boost/interprocess/managed_shared_memory.hpp")
mb.code_creator.add_include("string")

mb.class_("SpaceWireStore").member_functions(lambda decl: 
decl.name.startswith("getUrgent")).call_policies = \

call_policies.return_value_policy(call_policies.reference_existing_object)
mb.class_("SpaceWireStore").member_functions(lambda decl: 
decl.name.startswith("getNormal")).call_policies = \

call_policies.return_value_policy(call_policies.reference_existing_object) 

Here are the 4 header files that when used together will reproduce the issue: 
SharedMemoryDeleter.hpp, SharedMemoryBuilder.hpp, DiscreteStore.hpp, & 
SpaceWireStore.hpp

+
#ifndef SHAREDMEMORYDELETER_HPP_
#define SHAREDMEMORYDELETER_HPP_

#include 
class SharedMemoryDeleter {
public:
SharedMemoryDeleter(const std::string& name);
~SharedMemoryDeleter();
protected:
std::string mName;
};

#endif /* SHAREDMEMORYDELETER_HPP_ */
-

+
#ifndef SHAREDMEMORYBUILDER_HPP_
#define SHAREDMEMORYBUILDER_HPP_

#include 
#include 
#include 

#include "SharedMemoryDeleter.hpp"

class SharedMemoryBuilder {
public:
SharedMemoryBuilder(const std::string& name, size_t num_bytes);
virtual ~SharedMemoryBuilder();
boost::shared_ptr getSegment();
protected:
SharedMemoryDeleter mDeleter;
boost::shared_ptr mSegment;
};

#endif /* SHAREDMEMORYBUILDER_HPP_ */
-

+
#ifndef SHAREDMEMORYBUILDER_HPP_
#define SHAREDMEMORYBUILDER_HPP_

#include 
#include 
#include 

#include "SharedMemoryDeleter.hpp"

class SharedMemoryBuilder {
public:
SharedMemoryBuilder(const std::string& name, size_t num_bytes);
virtual ~SharedMemoryBuilder();
boost::shared_ptr getSegment();
protected:
SharedMemoryDeleter mDeleter;
boost::shared_ptr mSegment;
};

#endif /* SHAREDMEMORYBUILDER_HPP_ */
-

+
#ifndef DISCRETESTORE_HPP_
#define DISCRETESTORE_HPP_

#include 

#include 
#include 
#include 

#include 

class DiscreteStore {
public:

enum {
NUM_BUFFERS = 4
};
DiscreteStore();
~DiscreteStore();
void frameTransition();
bool getSimicsInput();
void setSimicsOutput(bool isHigh);
bool getSimInput();
void setSimOutput(bool isHigh);

protected:
bool mIsHigh[NUM_BUFFERS];
size_t mSimicsInIndex;
size_t mSimicsOutIndex;
size_t mSimInIndex;
size_t mSimOutIndex;
};

#endif /* DISCRETESTORE_HPP_ */
-
-Original Message-
From: cplusplus-sig-bounces+josh.davidson=lmco@python.org 
[mailto:cplusplus-sig-bounces+josh.davidson=lmco@python.org] On Behalf Of 
Roman Yakovenko
Sent: Monday, December 19, 2011 1:35 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

On Mon, Dec 19, 2011 at 10:24 PM, Davidson, Josh  wrote:
> Actually, it is using a source_reader_t by default.  __parse_declarations 
> invokes __parse_file_by_file, which uses a source_reader_t (line 236) to 
> parse each file.  It then bombs out after parsing all of the files when it 
> calls _join_class_hierarchy.
>
> I continue to have this issue with various combinations of classes.  In other 
> words, I have headers that work fine with parsed in isolation, but when I try 
> to build a module containing both, I get the KeyError.

Can you create a single header file, which includes all others?

HTH
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


[C++-sig] Complaint about missing call policies, when they are in fact specified

2011-12-19 Thread Davidson, Josh
I'm adding return value call policies to methods of a class as follows:
mb.class_("SerialStore").member_functions(lambda decl: 
decl.name.startswith("getSim")).call_policies = \
call_policies.return_internal_reference()

--

During generation, I get the following warning:
WARNING: boost::container::list, 0ull>, boost::interprocess::iset_index> 
> > * SerialStore::getSimicsInput() [member function]

> compilation error W1050: The function returns

> "boost::container::list char,boost::interprocess::allocator boost::interprocess::segment_manager _best_fit boost::interprocess::offset_ptr, 0ull>,

> boost::interprocess::iset_index> > > *" type. You have to specify a

> call policies.Be sure to take a look on `Py++` defined call policies

--

Here is the generated code for that method that appears to have the call policy 
specified:
{ //::SerialStore::getSimicsInput

typedef ::boost::container::list, 0ull>, boost::interprocess::iset_index> 
> > * ( ::SerialStore::*getSimicsInput_function_type )(  ) ;

SerialStore_exposer.def( 
"getSimicsInput"
, getSimicsInput_function_type( &::SerialStore::getSimicsInput )
, bp::return_internal_reference< >() );

}
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Complaint about missing call policies, when they are in fact specified

2011-12-19 Thread Roman Yakovenko
On Mon, Dec 19, 2011 at 9:01 PM, Davidson, Josh  wrote:
> I'm adding return value call policies to methods of a class as follows:
>        mb.class_("SerialStore").member_functions(lambda decl: 
> decl.name.startswith("getSim")).call_policies = \
>            call_policies.return_internal_reference()
>
> --
>
> During generation, I get the following warning:
> WARNING: boost::container::list char,boost::interprocess::allocator boost::interprocess::segment_manager boost::interprocess::rbtree_best_fit boost::interprocess::offset_ptr, 0ull>, 
> boost::interprocess::iset_index> > > * SerialStore::getSimicsInput() [member 
> function]
>
>> compilation error W1050: The function returns
>
>> "boost::container::list
>> char,boost::interprocess::allocator
>> boost::interprocess::segment_manager
>> _best_fit
>> boost::interprocess::offset_ptr, 0ull>,
>
>> boost::interprocess::iset_index> > > *" type. You have to specify a
>
>> call policies.Be sure to take a look on `Py++` defined call policies
>
> --
>
> Here is the generated code for that method that appears to have the call 
> policy specified:
>        { //::SerialStore::getSimicsInput
>
>            typedef ::boost::container::list char,boost::interprocess::allocator boost::interprocess::segment_manager boost::interprocess::rbtree_best_fit boost::interprocess::offset_ptr, 0ull>, 
> boost::interprocess::iset_index> > > * ( 
> ::SerialStore::*getSimicsInput_function_type )(  ) ;
>
>            SerialStore_exposer.def(
>                "getSimicsInput"
>                , getSimicsInput_function_type( &::SerialStore::getSimicsInput 
> )
>                , bp::return_internal_reference< >() );
>
>        }

Please open a bug on sorceforge with the source code to reproduce it.
Meanwhile, py++ provides functionality to disable warnings ( for the
concrete declaration ) - just use it.

Roman
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig