1) extending:
anatomy:
a) header files: <include Python.h> b) method functions: PyObject? c) registration tables: PyMethodDef? d) Initialize: Py_Initmodule
compiled as dynamically loadable object file (.so) gcc blah.c -g -I$(PY)/Include -I$(PY) -fpic -shared -o blah.o
(do this in makefile.am)
see also SWIG?.
2) embedding:
a) <include Python.h> b) Py_Initialise c) PyRun?_String (+ see full C API) d) linked with libpython.a + include files path + q external libraries referenced by Python
started work on extend / embed:
1) need to export PYTHONPATH currently for loaded module ???? (fixed adds . in c to path)
still this issue and also of namespace:
fm01.put_con(blah) now works (is wrapped)
now wrapped print → go to console
2) now using PyRunString? with Py_file_input mode flag - didn't realise can't return PyObject? for conversion with PyArgParse? (way that C and Python communicat both ways is issue - could extend py with functions which write into c structs (see yanoid) or use classes → see tutorials)
typedef struct { PyObject?_HEAD PyObject? *first; PyObject? *last; int number; } Noddy;
3) C extension types - see programming python and CD - stacktyp.c and gsimca?
4) in contrast to lisp - no macros - research
Examples/tutorials:
a) gsimca? b) http://www.python.org/doc/current/ext/ext.html extend/embed tutorial c) http://www.linuxjournal.com/article.php?sid=3641 threading d) http://starship.python.net/crew/arcege/extwriting/pyext.html tutorial
python shells? eg. PyEV? shell, GNUmed Python shell, ipython, also look at interpreter in emacs: http://www.python.org/emacs/
How much python can be used like lisp (evaluation of lists? macros → see norvig papers) -→ see extend notes on this