diff options
| author | Jeff Armstrong <jeffrey.armstrong@approximatrix.com> | 2011-07-12 23:02:14 -0400 |
|---|---|---|
| committer | Jeff Armstrong <jeffrey.armstrong@approximatrix.com> | 2011-07-12 23:02:14 -0400 |
| commit | 33346eaee2add1bf9c801cf92f19664ffaa71f2b (patch) | |
| tree | 5c12daa2aeb41d40e00333bb79518af852d6870f /lib/py_aes.c | |
| parent | 020592344c70c1b287e52729086a493211daea5a (diff) | |
| download | gempy-33346eaee2add1bf9c801cf92f19664ffaa71f2b.tar.gz gempy-33346eaee2add1bf9c801cf92f19664ffaa71f2b.zip | |
Added appl_write and basic resource functions.
Diffstat (limited to 'lib/py_aes.c')
| -rw-r--r-- | lib/py_aes.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/py_aes.c b/lib/py_aes.c index e97f4d5..d4d315b 100644 --- a/lib/py_aes.c +++ b/lib/py_aes.c @@ -1,6 +1,8 @@ #include "ldg_Python.h" #include <gem.h> +extern PyObject *GEMError; + /* --- Application Library --- */ static PyObject* __CDECL py_appl_init(PyObject *self, PyObject *args) { @@ -18,6 +20,20 @@ int ret; return Py_BuildValue("i",ret); } +static PyObject* __CDECL py_appl_write(PyObject *self, PyObject *args) +{ +int ret; +int app_id; +char *message; +int msg_length; + + if(!PyArg_ParseTuple(args,"iiy*",&app_id,&msg_length,&message)) + return NULL; + + ret = appl_write(app_id,msg_length,message); + return Py_BuildValue("i",ret); +} + /* --- Forms Library --- */ static PyObject* __CDECL py_form_alert(PyObject *self, PyObject *args) { @@ -30,3 +46,36 @@ int x; x = form_alert(x,text); return Py_BuildValue("i",x); } + +/* --- Resources Library --- */ +static void __CDECL py_rsrc_load(PyObject *self, PyObject *args) +{ +char *file; +int x; + + if(!PyArg_ParseTuple(args,"s",&file)) + return NULL; + + if(rsrc_load(file) == 0) { + PyErr_SetString(GEMError,"Resource failed to load"); + return NULL; + } + return Py_BuildValue("i",x); +} + +static PyObject* __CDECL py_rsrc_gaddr(PyObject *self, PyObject *args) +{ +char *file; +int type, index; +void *gaddr; + + if(!PyArg_ParseTuple(args,"ii",&type,&index)) + return NULL; + + if(rsrc_gaddr(type,index,&gaddr) == 0) { + PyErr_SetString(GEMError,"Resource item was not found"); + return NULL; + } + + return PyCapsule_New(gaddr,NULL,NULL); +} |
