diff --git a/Pyxform/Modules/bitmaps.c b/Pyxform/Modules/bitmaps.c index 3f864ef..0b11b7f 100644 --- a/Pyxform/Modules/bitmaps.c +++ b/Pyxform/Modules/bitmaps.c @@ -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 */ diff --git a/Pyxform/Modules/box.c b/Pyxform/Modules/box.c index ceb5672..3271d0d 100644 --- a/Pyxform/Modules/box.c +++ b/Pyxform/Modules/box.c @@ -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 */ diff --git a/Pyxform/Modules/browser.c b/Pyxform/Modules/browser.c index 27bf83f..b7632a2 100644 --- a/Pyxform/Modules/browser.c +++ b/Pyxform/Modules/browser.c @@ -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 */ diff --git a/Pyxform/Modules/button.c b/Pyxform/Modules/button.c index 70d2f89..e01dbb2 100644 --- a/Pyxform/Modules/button.c +++ b/Pyxform/Modules/button.c @@ -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 */ diff --git a/Pyxform/Modules/choice.c b/Pyxform/Modules/choice.c index 6a67e5c..70c4c1c 100644 --- a/Pyxform/Modules/choice.c +++ b/Pyxform/Modules/choice.c @@ -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 */ diff --git a/Pyxform/Modules/clock.c b/Pyxform/Modules/clock.c index 64b85e6..27b800e 100644 --- a/Pyxform/Modules/clock.c +++ b/Pyxform/Modules/clock.c @@ -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 */ diff --git a/Pyxform/Modules/counter.c b/Pyxform/Modules/counter.c index a6c8c2a..d44f20e 100644 --- a/Pyxform/Modules/counter.c +++ b/Pyxform/Modules/counter.c @@ -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 */ diff --git a/Pyxform/Modules/dial.c b/Pyxform/Modules/dial.c index e5bace7..afbf608 100644 --- a/Pyxform/Modules/dial.c +++ b/Pyxform/Modules/dial.c @@ -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 */ diff --git a/Pyxform/Modules/forms.c b/Pyxform/Modules/forms.c index 804f8b5..9bcd29c 100644 --- a/Pyxform/Modules/forms.c +++ b/Pyxform/Modules/forms.c @@ -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 */ diff --git a/Pyxform/Modules/frame.c b/Pyxform/Modules/frame.c index 3dd0850..80041aa 100644 --- a/Pyxform/Modules/frame.c +++ b/Pyxform/Modules/frame.c @@ -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 */ diff --git a/Pyxform/Modules/goodies.c b/Pyxform/Modules/goodies.c index ca17da8..a48071b 100644 --- a/Pyxform/Modules/goodies.c +++ b/Pyxform/Modules/goodies.c @@ -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 */ diff --git a/Pyxform/Modules/input.c b/Pyxform/Modules/input.c index 9d46b7d..48e3538 100644 --- a/Pyxform/Modules/input.c +++ b/Pyxform/Modules/input.c @@ -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 */ diff --git a/Pyxform/Modules/menu.c b/Pyxform/Modules/menu.c index 202de88..d0d246f 100644 --- a/Pyxform/Modules/menu.c +++ b/Pyxform/Modules/menu.c @@ -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 */ diff --git a/Pyxform/Modules/objects.c b/Pyxform/Modules/objects.c index 179e7cc..103c2be 100644 --- a/Pyxform/Modules/objects.c +++ b/Pyxform/Modules/objects.c @@ -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 */ diff --git a/Pyxform/Modules/pixmaps.c b/Pyxform/Modules/pixmaps.c index f1a052e..447752e 100644 --- a/Pyxform/Modules/pixmaps.c +++ b/Pyxform/Modules/pixmaps.c @@ -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 */ diff --git a/Pyxform/Modules/popups.c b/Pyxform/Modules/popups.c index c0aaf02..324c911 100644 --- a/Pyxform/Modules/popups.c +++ b/Pyxform/Modules/popups.c @@ -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 */ diff --git a/Pyxform/Modules/positioner.c b/Pyxform/Modules/positioner.c index 98190f7..9cb16b2 100644 --- a/Pyxform/Modules/positioner.c +++ b/Pyxform/Modules/positioner.c @@ -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 */ diff --git a/Pyxform/Modules/slider.c b/Pyxform/Modules/slider.c index 817d33c..5a6bd11 100644 --- a/Pyxform/Modules/slider.c +++ b/Pyxform/Modules/slider.c @@ -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 */ diff --git a/Pyxform/Modules/text.c b/Pyxform/Modules/text.c index 1a03113..d892d8d 100644 --- a/Pyxform/Modules/text.c +++ b/Pyxform/Modules/text.c @@ -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 */ diff --git a/Pyxform/Modules/timer.c b/Pyxform/Modules/timer.c index d241669..66f5b2b 100644 --- a/Pyxform/Modules/timer.c +++ b/Pyxform/Modules/timer.c @@ -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 */ diff --git a/Pyxform/Modules/xforms.c b/Pyxform/Modules/xforms.c index b7183f4..c7f4cd5 100644 --- a/Pyxform/Modules/xforms.c +++ b/Pyxform/Modules/xforms.c @@ -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); } diff --git a/Pyxform/Modules/xyplot.c b/Pyxform/Modules/xyplot.c index b76be39..b15d14a 100644 --- a/Pyxform/Modules/xyplot.c +++ b/Pyxform/Modules/xyplot.c @@ -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 */ diff --git a/Pyxform/__init__.py b/Pyxform/__init__.py index c3178bd..059b10b 100644 --- a/Pyxform/__init__.py +++ b/Pyxform/__init__.py @@ -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