[C++-sig] Pyste: support for user defined code.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Sat Aug 16 05:26:23 CEST 2003


>>>>> "N" == nicodemus  <nicodemus at globalite.com.br> writes:

    N> Prabhu Ramachandran wrote:
    >> Hi,
    >>
    >> I was thinking of adding a new feature to Pyste so that a user
    >> could add arbitrary code to the code generated by Pyste.
    >> Something along these lines:
    >>
    >> ud = UserDefined() ud.addToHeader(['h1.hpp', 'h2.hpp'])
    >> ud.addToDeclaration("""// insert code in the declaration area
    >> """) ud.addToModule("""// insert code inside the module
    >> area""")

    N> Seems easy, but I think a more functional interface would fit
    N> with the rest better:

    N> add_include('h1.hpp', 'h2.hpp') add_code(MODULE, '''
    N>          class_< std::vector<bool> > ("VectorBool")
    N>              .def(vector_indexing_suite< std::vector<bool>,
    N>              true> ());''')

Thats fine too but will there be a problem with ordering of the code
if the interface is functional? i.e. if I have a class('A', 'h.hpp')
and then want to add the user defined code after this, is it possible
to do with this approach?  I also thought that the UserDefined
approach would be easier to implement.

cheers,
prabhu




More information about the Cplusplus-sig mailing list