summaryrefslogtreecommitdiff
path: root/lib/gem.c
diff options
context:
space:
mode:
authorJeff Armstrong <jeffrey.armstrong@approximatrix.com>2011-07-12 23:02:14 -0400
committerJeff Armstrong <jeffrey.armstrong@approximatrix.com>2011-07-12 23:02:14 -0400
commit33346eaee2add1bf9c801cf92f19664ffaa71f2b (patch)
tree5c12daa2aeb41d40e00333bb79518af852d6870f /lib/gem.c
parent020592344c70c1b287e52729086a493211daea5a (diff)
downloadgempy-33346eaee2add1bf9c801cf92f19664ffaa71f2b.tar.gz
gempy-33346eaee2add1bf9c801cf92f19664ffaa71f2b.zip
Added appl_write and basic resource functions.
Diffstat (limited to 'lib/gem.c')
-rw-r--r--lib/gem.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/lib/gem.c b/lib/gem.c
index ed1bd16..e4a1ba6 100644
--- a/lib/gem.c
+++ b/lib/gem.c
@@ -8,24 +8,42 @@
#include "py_aes.h"
+/* --- A GEM exception --- */
+static PyObject *GEMError;
+
/* --- Python-C API Calls --- */
static void *pycallbacks[PY_API_FCOUNT];
/* --- Python API Bookkeeping --- */
static PyMethodDef
GemMethods[] = {
+ /* AES Application Library */
{"appl_init", py_appl_init, METH_VARARGS, "Initialize a GEM application"},
{"appl_exit", py_appl_exit, METH_VARARGS, "Exit a GEM application"},
+ {"appl_write", py_appl_write, METH_VARARGS, "Send a message to a GEM application"},
+
+ /* AES Forms Library */
{"form_alert", py_form_alert, METH_VARARGS, "Display a GEM alert dialog"},
+
+ /* AES Resource Library */
+ {"rsrc_load", py_rsrc_load, METH_VARARGS, "Load a resource into memory"},
+ {"rsrc_gaddr", py_rsrc_gaddr, METH_VARARGS, "Return an encapsulated memory address of a resource component"},
{NULL,NULL,0,NULL}
};
PyMODINIT_FUNC __CDECL initgem(void)
{
+PyObject *m;
- printf("Welcome to shared init.\nStandby...\n");
+ //printf("Welcome to shared init.\nStandby...\n");
//LPy_InitModule("gem",GemMethods,NULL,NULL);
- ldg_callback(pycallbacks[0],"gem",GemMethods,NULL,NULL);
+
+ m = Py_InitModule("_gem",GemMethods);
+
+ GEMError = PyErr_NewException("_gem.error",NULL,NULL);
+ Py_INCREF(GEMError);
+ PyModule_AddObject(m,"error",GEMError);
+
return;
}
/* --- End Python API Bookkeeping --- */
@@ -43,18 +61,28 @@ int i;
PROC LibFunc[] = {
"assign_pycalls", "Assigns Python callbacks", assign_pycalls,
"initgem", "Internal\n", initgem,
- "py_form_alert", "Internal\n", py_form_alert,
+
+ /* AES Application Library */
"py_appl_exit", "Internal\n", py_appl_exit,
- "py_appl_init", "Internal\n", py_appl_init
+ "py_appl_init", "Internal\n", py_appl_init,
+ "py_appl_write", "Internal\n", py_appl_write,
+
+ /* AES Forms Library */
+ "py_form_alert", "Internal\n", py_form_alert,
+
+ /* AES Resource Library */
+ "py_rsrc_load", "Internal\n", py_rsrc_load,
+ "py_rsrc_gaddr", "Internal\n", py_rsrc_gaddr
};
LDGLIB LibLdg[] = {
- 0x0001, 5, LibFunc, "GEM Extensions for Python", 0
+ 0x0001, 8, LibFunc, "GEM Extensions for Python", 0
};
int main( void)
{
if( ldg_init( LibLdg) == -1) {
+ printf("*** %s ***\n",LibLdg[0].infos);
printf("This program is a shared library.\n");
}
return 0;