Extend/embedd python problem?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mile Blenton

    #1

    Extend/embedd python problem?


    Hello all,

    I am considering python as a 'scripting' language to be used
    in my application where users must be able to write their own
    code to access application data, use the application mechanisms
    to gather various data and basicly must be able to control the
    application itself.

    Currently, to accomplish this task, my app uses my custom C-like
    language and my bytecode interpreter. In this case I am able to
    control the execution of a single 'instruction' in my interpreter
    and interpret the user code when I want. It also enables me to support
    multiple 'user tasks' (not a system LWP-like tasks, but a higher-level
    concurrent execution simulation - each task has it's own interpreter
    and each interpreter is executed every n-th iteration for example).

    I have glanced at the python/C api ref manual and know I can
    use the 'PyRun_Interact iveOne' to execute a single python
    statement, but am not sure if there's a way to 'precompile'
    python code and prepare it for execution so I can interpret
    the precompiled statements one-by-one, similarly to my custom
    interpreter.

    I noticed the 'Py_CompileStri ng' but am not sure what to do and
    how to interact with 'PyObject*' it returns me - how do I run it,
    can I interrupt it when it's executing, can I run it on
    per-statement basis'?

    Any help or pointers where to look for answers to my questions is
    grately apreciated.

    Thanks,
    Regards,
    Mario


Working...