From 020592344c70c1b287e52729086a493211daea5a Mon Sep 17 00:00:00 2001 From: Jeff Armstrong Date: Mon, 11 Jul 2011 22:47:19 -0400 Subject: Starting logical reorg of the native GEM calls. --- lib/gem.c | 152 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 63 insertions(+), 89 deletions(-) (limited to 'lib/gem.c') diff --git a/lib/gem.c b/lib/gem.c index 15dbb61..ed1bd16 100644 --- a/lib/gem.c +++ b/lib/gem.c @@ -1,90 +1,64 @@ -#include -#include -#include - -#define PY_API_FCOUNT 3 -static void *pycallbacks[PY_API_FCOUNT]; - -#define Py_InitModule(name,methods) ldg_callback(pycallbacks[0],name,methods,NULL,NULL) -#define PyArg_ParseTuple(tpl,...) ldg_callback(pycallbacks[1],tpl,##__VA_ARGS__) -#define Py_BuildValue(fmt,...) ldg_callback(pycallbacks[2],fmt,##__VA_ARGS__) - -//PyObject* (*LPy_InitModule)(char *, PyMethodDef *, char *, PyObject *) = NULL; - - -static PyObject* __CDECL py_appl_init(PyObject *self, PyObject *args) -{ -int ret; - - ret = appl_init(); - return Py_BuildValue("i",ret); -} - -static PyObject* __CDECL py_appl_exit(PyObject *self, PyObject *args) -{ -int ret; - - ret = appl_exit(); - return Py_BuildValue("i",ret); -} - -static PyObject* __CDECL py_form_alert(PyObject *self, PyObject *args) -{ -char *text; -int x; - - if(!PyArg_ParseTuple(args,"is",&x,&text)) - return NULL; - - x = form_alert(x,text); - return Py_BuildValue("i",x); -} - -static PyMethodDef -GemMethods[] = { - {"appl_init", py_appl_init, METH_VARARGS, "Initialize a GEM application"}, - {"appl_exit", py_appl_exit, METH_VARARGS, "Exit a GEM application"}, - {"form_alert", py_form_alert, METH_VARARGS, "Display a GEM alert dialog"}, - {NULL,NULL,0,NULL} -}; - -PyMODINIT_FUNC __CDECL initgem(void) -{ - - printf("Welcome to shared init.\nStandby...\n"); - //LPy_InitModule("gem",GemMethods,NULL,NULL); - ldg_callback(pycallbacks[0],"gem",GemMethods,NULL,NULL); - return; -} - - - -void __CDECL assign_pycalls(void **calls) -{ -int i; - - for(i=0;i +#include + +#include "py_aes.h" + +/* --- Python-C API Calls --- */ +static void *pycallbacks[PY_API_FCOUNT]; + +/* --- Python API Bookkeeping --- */ +static PyMethodDef +GemMethods[] = { + {"appl_init", py_appl_init, METH_VARARGS, "Initialize a GEM application"}, + {"appl_exit", py_appl_exit, METH_VARARGS, "Exit a GEM application"}, + {"form_alert", py_form_alert, METH_VARARGS, "Display a GEM alert dialog"}, + {NULL,NULL,0,NULL} +}; + +PyMODINIT_FUNC __CDECL initgem(void) +{ + + printf("Welcome to shared init.\nStandby...\n"); + //LPy_InitModule("gem",GemMethods,NULL,NULL); + ldg_callback(pycallbacks[0],"gem",GemMethods,NULL,NULL); + return; +} +/* --- End Python API Bookkeeping --- */ + + +/* --- LDG Bookkeeping --- */ +void __CDECL assign_pycalls(void **calls) +{ +int i; + + for(i=0;i