1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/* Need to define an internal flag to avoid an extern */
#define LDG_INTERNAL
#include "ldg_Python.h"
#include <gem.h>
#include <ldg.h>
#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<PY_API_FCOUNT;i++)
pycallbacks[i] = calls[i];
}
PROC LibFunc[] = {
"assign_pycalls", "Assigns Python callbacks", assign_pycalls,
"initgem", "Internal\n", initgem,
"py_form_alert", "Internal\n", py_form_alert,
"py_appl_exit", "Internal\n", py_appl_exit,
"py_appl_init", "Internal\n", py_appl_init
};
LDGLIB LibLdg[] = {
0x0001, 5, LibFunc, "GEM Extensions for Python", 0
};
int main( void)
{
if( ldg_init( LibLdg) == -1) {
printf("This program is a shared library.\n");
}
return 0;
}
/* --- End LDG Bookkeeping --- */
|