2024-05-31 20:16:31 +00:00
|
|
|
/*************************************************************
|
|
|
|
**************************************************************
|
|
|
|
**************************************************************
|
|
|
|
XForms -specific functions
|
|
|
|
**************************************************************
|
|
|
|
**************************************************************
|
|
|
|
*************************************************************/
|
|
|
|
#include <Python.h>
|
|
|
|
#include <forms.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************
|
|
|
|
Method to initialize the xforms library.
|
|
|
|
Args:
|
|
|
|
|
|
|
|
appname: The name of the application
|
|
|
|
appclass: The Class of the application
|
|
|
|
argvo: argv[0] (Needs Work)
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
NULL if error
|
|
|
|
******************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
pyxforms_init(self,args)
|
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
|
|
|
{
|
|
|
|
int sts;
|
|
|
|
char *appname;
|
|
|
|
char *appclass;
|
|
|
|
char *argv0;
|
|
|
|
|
|
|
|
sts=1;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple (args,"sss",&appname,&appclass,&argv0))
|
|
|
|
return NULL;
|
|
|
|
fl_initialize (&sts,&argv0,appname,0,0);
|
|
|
|
return Py_BuildValue("");
|
|
|
|
}
|
|
|
|
/**************************************************************
|
|
|
|
Function to let the library run the forms at will
|
|
|
|
Args: None
|
|
|
|
Returns: NULL on error
|
|
|
|
pointer to any object that returned, if succesful
|
|
|
|
don't know what it does when you close the windows...
|
|
|
|
**************************************************************/
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
pyxforms_do_forms(self,args)
|
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
|
|
|
{
|
|
|
|
FL_OBJECT *obj;
|
|
|
|
obj=fl_do_only_forms (); /* XXXXX not do_forms, until EVENTS get done */
|
|
|
|
return Py_BuildValue("l",(long)obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static PyMethodDef xformsMethods [] ={
|
|
|
|
|
|
|
|
/* XForms specifics */
|
|
|
|
{"init",pyxforms_init,1},
|
|
|
|
{"do_forms",pyxforms_do_forms,1},
|
|
|
|
/* FENCE */
|
|
|
|
{NULL,NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-05-31 21:06:19 +00:00
|
|
|
static struct PyModuleDef moduledef = {
|
|
|
|
PyModuleDef_HEAD_INIT,
|
|
|
|
"xforms", /* m_name */
|
|
|
|
"", /* m_doc */
|
|
|
|
-1, /* m_size */
|
|
|
|
xformsMethods, /* m_methods */
|
|
|
|
NULL, /* m_reload */
|
|
|
|
NULL, /* m_traverse */
|
|
|
|
NULL, /* m_clear */
|
|
|
|
NULL, /* m_free */
|
|
|
|
};
|
|
|
|
|
2024-06-03 14:29:22 +00:00
|
|
|
PyMODINIT_FUNC
|
|
|
|
PyInit_xforms()
|
2024-05-31 20:16:31 +00:00
|
|
|
{
|
2024-05-31 21:06:19 +00:00
|
|
|
PyModule_Create(&moduledef);
|
2024-05-31 20:16:31 +00:00
|
|
|
}
|
|
|
|
|