Menu

generating code

Help
Daniel
2010-06-17
2013-04-06
  • Daniel

    Daniel - 2010-06-17

    Hi I'm trying to generate some code with the pythonqt_generator (I've got everything compiled)
    and well when I have a pretty barebones typesystem file

    <?xml version="1.0"?>
    <typesystem package="org.clementine-player.generator">
    </typesystem>
    

    after it prints out the file name of the last header file then it segfaults

    when i try to include this

    <load-typesystem 
            name=":../../../../PythonQt2.0.1/generator/typesystem_core.xml"
            generate="no"/>
    

    I get the message

    Fatal error: line=6, column=16, message=Failed to parse: ':../../../../PythonQt2.0.1/generator/typesystem_core.xml'
    
     
  • Florian Link

    Florian Link - 2010-06-17

    A minimal example that I did was:

    pythonqt_generator -include-paths="some include paths to find dependend files" -output-directory=. yourincludes.h  typesystem_test.txt

    (include paths are useful if you include things from somewhere else)

    where the typesystem looks like this:

    <typesystem package="de.pythonqt.test" default-superclass="com.trolltech.qt.QtJambiObject">
        <load-typesystem name=":/trolltech/generator/typesystem_core.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_gui.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_sql.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_opengl.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_svg.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_network.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_xml.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_xmlpatterns.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_webkit.txt" generate="no" />
        <load-typesystem name=":/trolltech/generator/typesystem_phonon.txt" generate="no" />

    <object-type name="SomeObject" />

    </typesystem>

    The important part is the generate=no for the included typesystems.
    Note that the typesystems are embedded with qrc, so adressing them with : is inside the ressource system, not
    the filesystem, which is why :../../sometypesystem.txt can not work.

    For morre details, lookup the QtJambi example in the QtJambi Git repository, there is a generator_example which should work more or less with the pythonqt generator.

    regards,
    Florian

     
  • Daniel

    Daniel - 2010-06-17

    Thank's I'll try that

     
  • Daniel

    Daniel - 2010-06-17

    It still just segfaults after it's parsed the header files I've tried including several different includes but can't seem to get it to work

     
  • Florian Link

    Florian Link - 2010-06-17

    Did you try a minimal version?

    Just define some class in your header and try to wrap that for a start.

     
  • Florian Link

    Florian Link - 2010-06-17

    Ah and segfault means you could have a look using gdb, 8-)

     
  • Daniel

    Daniel - 2010-06-17

    gdb output without debuging symbols

    Program received signal SIGSEGV, Segmentation fault.
    0x08065315 in Binder::visitFunctionDefinition(FunctionDefinitionAST*) ()
    

    OK ran it on one header file seems to work but It's not generating any thing perhaps I had to many headers in it at once
    thanks for you help

     
  • Florian Link

    Florian Link - 2010-06-17

    The parser is not really perfect, it was mainly crafted for Qt wrapping, so it might stumble on some constructs.
    One thing where it failed on me was a

    #define SOMEFILE "somefile.h"

    #include SOMEFILE

    where I had to expand the macro.

    I did not modify the parser at all, it is original QtJambi code…

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.