Extend/embedd python problem?

M

Mile Blenton

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_InteractiveOne' 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_CompileString' 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top