Thread: [pygccxml-development] Scanning pure C header files
Brought to you by:
mbaas,
roman_yakovenko
From: Gustavo C. <gjc...@gm...> - 2008-02-16 18:25:08
|
Hi. I am looking at scanning with pygccxml a pure C header file, that looks like this: #ifndef __HELLO_H__ #define __HELLO_H__ #ifdef __cplusplus extern "C" { #endif void hello_print(const char *message); double hello_sum(double x, double y); #ifdef __cplusplus } #endif #endif /* __HELLO_H__ */ My current code, that woks for C++ headers perfectly, fails with this pure C header file: File "../pybindgen/gccxmlparser.py", line 416, in parse_init self.module_namespace = declarations.get_global_namespace( self.declarations) File "/usr/local//lib/python2.5/site-packages/pygccxml/declarations/algorithm.py", line 170, in get_global_namespace raise RuntimeError( "Unable to find global namespace." ) RuntimeError: Unable to find global namespace. Any tips on what I should be using instead of get_global_namespace() to get the definitions? Thanks in advance. -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |
From: Roman Y. <rom...@gm...> - 2008-02-16 19:03:58
|
On Feb 16, 2008 8:25 PM, Gustavo Carneiro <gjc...@gm...> wrote: > Hi. I am looking at scanning with pygccxml a pure C header file, that looks > like this: > > #ifndef __HELLO_H__ > #define __HELLO_H__ > > #ifdef __cplusplus > extern "C" > { > #endif > > > void hello_print(const char *message); > double hello_sum(double x, double y); > > > #ifdef __cplusplus > } > #endif > > #endif /* __HELLO_H__ */ > > My current code, that woks for C++ headers perfectly, fails with this pure C > header file: > > File "../pybindgen/gccxmlparser.py", line 416, in parse_init > self.module_namespace = > declarations.get_global_namespace(self.declarations) > File > "/usr/local//lib/python2.5/site-packages/pygccxml/declarations/algorithm.py", > line 170, in get_global_namespace > raise RuntimeError( "Unable to find global namespace." ) > RuntimeError: Unable to find global namespace. > > Any tips on what I should be using instead of get_global_namespace() to get > the definitions? > Let me check this. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Roman Y. <rom...@gm...> - 2008-02-17 18:39:39
|
On Feb 16, 2008 9:02 PM, Roman Yakovenko <rom...@gm...> wrote: > > On Feb 16, 2008 8:25 PM, Gustavo Carneiro <gjc...@gm...> wrote: > > Hi. I am looking at scanning with pygccxml a pure C header file, that looks > > like this: > > > > #ifndef __HELLO_H__ > > #define __HELLO_H__ > > > > #ifdef __cplusplus > > extern "C" > > { > > #endif > > > > > > void hello_print(const char *message); > > double hello_sum(double x, double y); > > > > > > #ifdef __cplusplus > > } > > #endif > > > > #endif /* __HELLO_H__ */ > > > > My current code, that woks for C++ headers perfectly, fails with this pure C > > header file: > > > > File "../pybindgen/gccxmlparser.py", line 416, in parse_init > > self.module_namespace = > > declarations.get_global_namespace(self.declarations) > > File > > "/usr/local//lib/python2.5/site-packages/pygccxml/declarations/algorithm.py", > > line 170, in get_global_namespace > > raise RuntimeError( "Unable to find global namespace." ) > > RuntimeError: Unable to find global namespace. > > > > Any tips on what I should be using instead of get_global_namespace() to get > > the definitions? > > > > Let me check this. Well I created tester and it is working fine. Can you take a look on "plain_c_tester.py" and modify it, so I can see the problem too. Thanks -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |
From: Gustavo C. <gjc...@gm...> - 2008-02-17 19:49:36
|
On 17/02/2008, Roman Yakovenko <rom...@gm...> wrote: > > On Feb 16, 2008 9:02 PM, Roman Yakovenko <rom...@gm...> > wrote: > > > > On Feb 16, 2008 8:25 PM, Gustavo Carneiro <gjc...@gm...> wrote: > > > Hi. I am looking at scanning with pygccxml a pure C header file, that > looks > > > like this: > > > > > > #ifndef __HELLO_H__ > > > #define __HELLO_H__ > > > > > > #ifdef __cplusplus > > > extern "C" > > > { > > > #endif > > > > > > > > > void hello_print(const char *message); > > > double hello_sum(double x, double y); > > > > > > > > > #ifdef __cplusplus > > > } > > > #endif > > > > > > #endif /* __HELLO_H__ */ > > > > > > My current code, that woks for C++ headers perfectly, fails with this > pure C > > > header file: > > > > > > File "../pybindgen/gccxmlparser.py", line 416, in parse_init > > > self.module_namespace = > > > declarations.get_global_namespace(self.declarations) > > > File > > > > "/usr/local//lib/python2.5/site-packages/pygccxml/declarations/algorithm.py", > > > line 170, in get_global_namespace > > > raise RuntimeError( "Unable to find global namespace." ) > > > RuntimeError: Unable to find global namespace. > > > > > > Any tips on what I should be using instead of get_global_namespace() > to get > > > the definitions? > > > > > > > Let me check this. > > Well I created tester and it is working fine. Can you take a look on > "plain_c_tester.py" and modify it, so I can see the problem too. "&"%$! I screwed up big. There was a problem in my build script, and the list of files that I gave pygccxml to scan was actually empty! :-/ Sorry for wasting your time. It works fine now. I might only have a minor complaint in that pygccxml silently allows parsing an empty list of header files, and in the end gives an error message that does not appear very related to the error. Maybe pygccxml should raise ValueError if I ask it to parse an empty list of header files? Anyway, thanks a lot for looking into this. -- Gustavo J. A. M. Carneiro INESC Porto, Telecommunications and Multimedia Unit "The universe is always one step beyond logic." -- Frank Herbert |