pyxforms/Pyxform/Modules/xforms.c

89 lines
2.1 KiB
C

/*************************************************************
**************************************************************
**************************************************************
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}
};
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 */
};
PyMODINIT_FUNC
PyInit_xforms()
{
PyModule_Create(&moduledef);
}