python 3 port

This commit is contained in:
Roberto Alsina 2024-05-31 18:06:19 -03:00
parent c4caed4368
commit c28d961744
23 changed files with 305 additions and 114 deletions

View File

@ -57,7 +57,7 @@ PyObject *args;
{
long o;
int w, h;
char *b;
unsigned char *b;
if (!PyArg_ParseTuple(args, "liis", &o, &w, &h, &b))
return NULL;
@ -106,18 +106,29 @@ static char bitmaps_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"bitmaps",
bitmaps_module_documentation,
-1,
bmp_methods,
NULL,
NULL,
NULL,
NULL,
};
void initbitmaps()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("bitmaps", bmp_methods,
bitmaps_module_documentation,
(PyObject *) NULL, PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("bitmaps.error");
ErrorObject = PyBytes_FromString("bitmaps.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -62,19 +62,30 @@ static char box_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"box", /* m_name */
box_module_documentation, /* m_doc */
-1, /* m_size */
box_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initbox()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("box", box_methods,
box_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("box.error");
ErrorObject = PyBytes_FromString("box.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -460,19 +460,29 @@ static char browser_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"browser", /* m_name */
browser_module_documentation, /* m_doc */
-1, /* m_size */
browser_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initbrowser()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("browser", browser_methods,
browser_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("browser.error");
ErrorObject = PyBytes_FromString("browser.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -344,19 +344,28 @@ static char button_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"button", /* m_name */
button_module_documentation, /* m_doc */
-1, /* m_size */
button_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initbutton()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("button", button_methods,
button_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("button.error");
ErrorObject = PyBytes_FromString("button.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -319,19 +319,29 @@ static char choice_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"choice", /* m_name */
choice_module_documentation, /* m_doc */
-1, /* m_size */
choice_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initchoice()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("choice", choice_methods,
choice_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("choice.error");
ErrorObject = PyBytes_FromString("choice.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -80,19 +80,29 @@ static char clock_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"clock", /* m_name */
clock_module_documentation, /* m_doc */
-1, /* m_size */
clock_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initclock()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("clock", clock_methods,
clock_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("clock.error");
ErrorObject = PyBytes_FromString("clock.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -179,6 +179,17 @@ static struct PyMethodDef counter_methods[] = {
static char counter_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"counter", /* m_name */
counter_module_documentation, /* m_doc */
-1, /* m_size */
counter_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initcounter()
@ -186,13 +197,10 @@ initcounter()
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("counter", counter_methods,
counter_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("counter.error");
ErrorObject = PyBytes_FromString("counter.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -179,19 +179,28 @@ static char dial_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"dial", /* m_name */
dial_module_documentation, /* m_doc */
-1, /* m_size */
dial_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initdial()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("dial", dial_methods,
dial_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("dial.error");
ErrorObject = PyBytes_FromString("dial.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -569,8 +569,8 @@ PyObject *args;
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
return Py_BuildValue ("iiiiiil",
((FL_FORM *)o)->vmode,
return Py_BuildValue ("iiiiil",
//((FL_FORM *)o)->vmode,
((FL_FORM *)o)->deactivated,
((FL_FORM *)o)->use_pixmap,
((FL_FORM *)o)->frozen,
@ -666,19 +666,29 @@ static char forms_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"forms", /* m_name */
forms_module_documentation, /* m_doc */
-1, /* m_size */
forms_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initforms()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("forms", forms_methods,
forms_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("forms.error");
ErrorObject = PyBytes_FromString("forms.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -61,19 +61,29 @@ static char frame_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"frame", /* m_name */
frame_module_documentation, /* m_doc */
-1, /* m_size */
frame_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initframe()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("frame", frame_methods,
frame_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("frame.error");
ErrorObject = PyBytes_FromString("frame.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -473,20 +473,28 @@ static struct PyMethodDef goodies_methods[] = {
static char goodies_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"goodies", /* m_name */
goodies_module_documentation, /* m_doc */
-1, /* m_size */
goodies_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initgoodies()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("goodies", goodies_methods,
goodies_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("goodies.error");
ErrorObject = PyBytes_FromString("goodies.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -220,19 +220,29 @@ static char input_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"input", /* m_name */
input_module_documentation, /* m_doc */
-1, /* m_size */
input_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initinput()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("input", input_methods,
input_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("input.error");
ErrorObject = PyBytes_FromString("input.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -280,19 +280,28 @@ static char menu_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"menu", /* m_name */
menu_module_documentation, /* m_doc */
-1, /* m_size */
menu_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initmenu()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("menu", menu_methods,
menu_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("menu.error");
ErrorObject = PyBytes_FromString("menu.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -206,23 +206,6 @@ obj_set_lalign(self, args)
return Py_None;
}
static char obj_scale__doc__[] =
"Scales the object"
;
static PyObject *
obj_scale(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double x,y;
if (!PyArg_ParseTuple(args, "ldd",&o,&x,&y))
return NULL;
fl_scale_object((FL_OBJECT *)o,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_callback__doc__[] =
"XXXXXXNot implemented"
@ -481,7 +464,6 @@ static struct PyMethodDef obj_methods[] = {
{"set_focus", obj_set_focus, 1, obj_set_focus__doc__},
{"redraw", obj_redraw, 1, obj_redraw__doc__},
{"set_lalign", obj_set_lalign, 1, obj_set_lalign__doc__},
{"scale", obj_scale, 1, obj_scale__doc__},
{"set_callback", obj_set_callback, 1, obj_set_callback__doc__},
{"show", obj_show, 1, obj_show__doc__},
{"hide", obj_hide, 1, obj_hide__doc__},
@ -505,6 +487,17 @@ static struct PyMethodDef obj_methods[] = {
static char objects_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"objects", /* m_name */
objects_module_documentation, /* m_doc */
-1, /* m_size */
obj_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initobjects()
@ -512,13 +505,11 @@ initobjects()
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("objects", obj_methods,
objects_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("objects.error");
ErrorObject = PyBytes_FromString("objects.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -104,19 +104,28 @@ static char pixmaps_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"pixmaps", /* m_name */
pixmaps_module_documentation, /* m_doc */
-1, /* m_size */
pmp_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initpixmaps()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("pixmaps", pmp_methods,
pixmaps_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("pixmaps.error");
ErrorObject = PyBytes_FromString("pixmaps.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -347,6 +347,17 @@ static struct PyMethodDef pup_methods[] = {
static char popups_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"popups", /* m_name */
popups_module_documentation, /* m_doc */
-1, /* m_size */
pup_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initpopups()
@ -354,13 +365,11 @@ initpopups()
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("popups", pup_methods,
popups_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("popups.error");
ErrorObject = PyBytes_FromString("popups.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -279,6 +279,17 @@ static struct PyMethodDef posit_methods[] = {
static char positioner_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"positioner", /* m_name */
positioner_module_documentation, /* m_doc */
-1, /* m_size */
posit_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initpositioner()
@ -286,13 +297,11 @@ initpositioner()
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("positioner", posit_methods,
positioner_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("positioner.error");
ErrorObject = PyBytes_FromString("positioner.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -240,6 +240,17 @@ static struct PyMethodDef slider_methods[] = {
static char slider_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"slider", /* m_name */
slider_module_documentation, /* m_doc */
-1, /* m_size */
slider_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initslider()
@ -247,13 +258,11 @@ initslider()
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("slider", slider_methods,
slider_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("slider.error");
ErrorObject = PyBytes_FromString("slider.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -59,19 +59,28 @@ static char text_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"text", /* m_name */
text_module_documentation, /* m_doc */
-1, /* m_size */
text_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
inittext()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("text", text_methods,
text_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("text.error");
ErrorObject = PyBytes_FromString("text.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -100,19 +100,29 @@ static char timer_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"timer", /* m_name */
timer_module_documentation, /* m_doc */
-1, /* m_size */
timer_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
inittimer()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4("timer", timer_methods,
timer_module_documentation,
(PyObject*)NULL,PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyString_FromString("timer.error");
ErrorObject = PyBytes_FromString("timer.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -68,9 +68,20 @@ static PyMethodDef xformsMethods [] ={
};
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 */
};
void initxforms()
{
(void) Py_InitModule("xforms",xformsMethods);
PyModule_Create(&moduledef);
}

View File

@ -417,6 +417,17 @@ static struct PyMethodDef xyplot_methods[] =
static char xyplot_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"xyplot", /* m_name */
xyplot_module_documentation, /* m_doc */
-1, /* m_size */
xyplot_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
void
initxyplot ()
@ -424,13 +435,11 @@ initxyplot ()
PyObject *m, *d;
/* Create the module and add the functions */
m = Py_InitModule4 ("xyplot", xyplot_methods,
xyplot_module_documentation,
(PyObject *) NULL, PYTHON_API_VERSION);
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict (m);
ErrorObject = PyString_FromString ("xyplot.error");
ErrorObject = PyBytes_FromString ("xyplot.error");
PyDict_SetItemString (d, "error", ErrorObject);
/* XXXX Add constants here */

View File

@ -44,7 +44,7 @@ def runforms():
# This is the default callback function:
def _nocb(args):
print "This object has no Callback!"
print("This object has no Callback!")
##############################################################################
#This is the Form class