[C++-sig] typedef'd unnamed enum / pyste

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Nov 8 16:27:25 CET 2004


I am using boost_python 1.31.0 with pyste and gccxml-0.6.0, and am
trying to wrap an enum defined like

    typedef unsigned char cover_type;    //----cover_type
    enum
    {
        cover_shift = 8,                 //----cover_shift
        cover_size  = 1 << cover_shift,  //----cover_size 
        cover_mask  = cover_size - 1,    //----cover_mask 
        cover_none  = 0,                 //----cover_none 
        cover_full  = cover_mask         //----cover_full 
    };


How does one wrap an enum like this in pyste?  If I try the naive,

Enum("agg::cover_type", "agg_basics.h")

I get an exception in pyste, included below -- the enum object appears
to not have the values attribute.

FYI, other functions that I need to wrap will pass cover_type args as
well as cover_type arrays.

Thanks for any help, I've read though some of the archives on how to
handle unnamed enums, but wasn't able to grok the answers to figure
out what I should do.

JDH


peds-pc311:~/python/projects/aggboost> pyste.py -I/usr/local/include/agg --module=bagg --out=src/basics.cpp pyste/basics.pyste
gccxml -I "/tmp" -I "/usr/local/include/agg"  /tmp/tmpBsdOix.h -fxml=/tmp/tmpDRjYOM.xml
/tmp/tmpDRjYOM.xml
Traceback (most recent call last):
  File "/usr/local/bin/pyste.py", line 4, in ?
    pyste.main()
  File "/usr/local/lib/python2.3/site-packages/Pyste/pyste.py", line 405, in main
    status = Begin()
  File "/usr/local/lib/python2.3/site-packages/Pyste/pyste.py", line 244, in Begin
    return GenerateCode(parser, module, out, interfaces, multiple)
  File "/usr/local/lib/python2.3/site-packages/Pyste/pyste.py", line 372, in GenerateCode
    export.GenerateCode(codeunit, exported_names)
  File "/usr/local/lib/python2.3/site-packages/Pyste/Exporter.py", line 50, in GenerateCode
    self.Export(codeunit, exported_names)
  File "/usr/local/lib/python2.3/site-packages/Pyste/EnumExporter.py", line 44, in Export
    for name in self.enum.values:
AttributeError: 'Typedef' object has no attribute 'values'
[2]  - Done                          sudo emacs -q /usr/local/lib/python2.3/site-packages/Pyste/EnumExporter.py



More information about the Cplusplus-sig mailing list