As I described it before I tried it, but gccxml couldn't parse the
tuples.hpp file.
I build gccxml from CVS ver. 0.9( 1.134 ) and it parsed the source file
successfully. That's a big progress since the last time.
But now... there's some problem with pygccxml I think :|
I get the following error:
$ python generate.py
INFO Parsing source file "problem.h" ...
INFO gccxml cmd: /usr/bin/gccxml -I"."
-I"/home/macieks/error_examples/boost_tuples_to_python2"
-I"/usr/include" -I"/usr/include/python2.4"
-I"/home/macieks/boost/boost_1_42_0" "problem.h"
-fxml="/tmp/tmp80gNLk.xml"
INFO GCCXML version - 0.9( 1.134 )
INFO Parsing source file "tuples.hpp" ...
INFO gccxml cmd: /usr/bin/gccxml -I"."
-I"/home/macieks/error_examples/boost_tuples_to_python2"
-I"/usr/include" -I"/usr/include/python2.4"
-I"/home/macieks/boost/boost_1_42_0" "tuples.hpp"
-fxml="/tmp/tmpkNs2uu.xml"
INFO GCCXML version - 0.9( 1.134 )
Traceback (most recent call last):
File "generate.py", line 17, in ?
indexing_suite_version=2
File
"usr/lib/python2.4/site-packages/pyplusplus/module_builder/boost_python_builder.py",
line 95, in __init__
File
"usr/lib/python2.4/site-packages/pyplusplus/module_builder/boost_python_builder.py",
line 138, in __parse_declarations
File
"usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py",
line 217, in read_files
File
"usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py",
line 272, in __parse_file_by_file
File
"usr/lib/python2.4/site-packages/pygccxml/parser/project_reader.py",
line 445, in _join_class_hierarchy
KeyError:
((u'/home/macieks/boost/boost_1_42_0/boost/type_traits/is_function.hpp',
52), (u'::', u'boost', u'detail', u'is_function_chooser<false>',
u'result_<long long>'))
generate.py and problem.h attached
Best regards
--
Maciek Sitarz
import os
import sys
from pyplusplus import module_builder
mb = module_builder.module_builder_t(
files=[
'problem.h'
, 'tuples.hpp'
],
include_paths=[
os.getcwd()
, "/usr/include"
, "/usr/include/python2.4"
, "/home/macieks/boost/boost_1_42_0"
],
indexing_suite_version=2
)
mb.class_( 'JobIdWrapper' ).include()
mb.class_( 'map<std::string, boost::tuples::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, std::less<std::string>, std::allocator<std::pair<std::string const, boost::tuples::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >' ).include()
mb.print_declarations()
mb.build_code_creator( module_name='problem' )
mb.code_creator.user_defined_directories.append( os.path.abspath('.') )
mb.write_module( os.path.join( os.path.abspath('.'), 'generated.cpp' ) )
#ifndef __TEST_H__
#define __TEST_H__
#include <map>
#include <utility>
#include <string>
#include <boost/tuple/tuple.hpp>
class JobIdWrapper {
public:
JobIdWrapper() : a(0) { }
JobIdWrapper(int i) : a(i) { }
int a;
enum RESULT {
OK,
ERROR
};
};
typedef std::map< std::string, boost::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string> > RegisterArrayResult;
void fun( RegisterArrayResult *regArray) {
boost::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string> tuple1(JobIdWrapper::OK, JobIdWrapper(1), "1");
boost::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string> tuple2(JobIdWrapper::ERROR, JobIdWrapper(2), "2");
regArray->insert(
std::pair<std::string, boost::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string> >( "one", tuple1 )
);
regArray->insert(
std::pair<std::string, boost::tuple<JobIdWrapper::RESULT, JobIdWrapper, std::string> >( "two", tuple2 )
);
}
namespace python_problem {
namespace details {
inline void instantiate() {
sizeof( JobIdWrapper );
sizeof( RegisterArrayResult );
JobIdWrapper c( 0 );
RegisterArrayResult reg();
}
}
}
int main( void ){
JobIdWrapper a( 0 );
RegisterArrayResult r();
}
#endif // __TEST_H__
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig