pyxforms/Pyxform/Modules/xforms.c
2024-05-31 17:16:31 -03:00

77 lines
1.8 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}
};
void initxforms()
{
(void) Py_InitModule("xforms",xformsMethods);
}