flmodule.c revision 234f942aefb779efa6cfb7225e21d16a3f7e80f7
1c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/********************************************************** 2e537240c252ff678d49451ee6f80fa934653a724Guido van RossumCopyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, 3e537240c252ff678d49451ee6f80fa934653a724Guido van RossumAmsterdam, The Netherlands. 4c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 5c7df79e47da854931474f581618435fff0dd2448Guido van Rossum All Rights Reserved 6c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 7c7df79e47da854931474f581618435fff0dd2448Guido van RossumPermission to use, copy, modify, and distribute this software and its 8c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdocumentation for any purpose and without fee is hereby granted, 9c7df79e47da854931474f581618435fff0dd2448Guido van Rossumprovided that the above copyright notice appear in all copies and that 10c7df79e47da854931474f581618435fff0dd2448Guido van Rossumboth that copyright notice and this permission notice appear in 11c7df79e47da854931474f581618435fff0dd2448Guido van Rossumsupporting documentation, and that the names of Stichting Mathematisch 12c7df79e47da854931474f581618435fff0dd2448Guido van RossumCentrum or CWI not be used in advertising or publicity pertaining to 13c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdistribution of the software without specific, written prior permission. 14c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 15c7df79e47da854931474f581618435fff0dd2448Guido van RossumSTICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO 16c7df79e47da854931474f581618435fff0dd2448Guido van RossumTHIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 17c7df79e47da854931474f581618435fff0dd2448Guido van RossumFITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE 18c7df79e47da854931474f581618435fff0dd2448Guido van RossumFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19c7df79e47da854931474f581618435fff0dd2448Guido van RossumWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 20c7df79e47da854931474f581618435fff0dd2448Guido van RossumACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 21c7df79e47da854931474f581618435fff0dd2448Guido van RossumOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 23c7df79e47da854931474f581618435fff0dd2448Guido van Rossum******************************************************************/ 24c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 25c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* FL module -- interface to Mark Overmars' FORMS Library. */ 26c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 27ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum/* As distributed, this code works with FORMS 2.0. 28ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum If you #define the symbol FL_V15 it will work with FORMS 1.5 (I hope), 29ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum and possibly also with previous versions. 30ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum (You must also edit FL.py to set _v15 to 1.) */ 31ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 32743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen/* A half-hearted attempt has been made to allow programs using this 33743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * module to exploit parallelism (through the threads module). No provisions 34743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * have been made for multiple threads to use this module at the same time, 35743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * though. So, a program with a forms thread and a non-forms thread will work 36743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * fine but a program with two threads using forms will probably crash (unless 37743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * the program takes precaution to ensure that only one thread can be in 38743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * this module at any time). This will have to be fixed some time. 39743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * (A fix will probably also have to synchronise with the gl module). 40743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen */ 41743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen 42c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "forms.h" 43c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 44c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "allobjects.h" 45c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "import.h" 46c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "modsupport.h" 47c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "structmember.h" 48ff4949eeee7f86117d4a69599777ff5564315e39Guido van Rossum#include "ceval.h" 49c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 50c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Generic Forms Objects */ 51c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 52c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypedef struct { 53c7df79e47da854931474f581618435fff0dd2448Guido van Rossum OB_HEAD 54c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *ob_generic; 55c7df79e47da854931474f581618435fff0dd2448Guido van Rossum struct methodlist *ob_methods; 56c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *ob_callback; 57c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *ob_callback_arg; 58c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} genericobject; 59c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumextern typeobject GenericObjecttype; /* Forward */ 612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum#define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) 632df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 642df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* List of all objects (XXX this should be a hash table on address...) */ 65c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 66c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *allgenerics = NULL; 672df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic int nfreeslots = 0; 682df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 692df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* Add an object to the list of known objects */ 70c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 71c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic void 72c7df79e47da854931474f581618435fff0dd2448Guido van Rossumknowgeneric(g) 73c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 74c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 752df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum int i, n; 762df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum /* Create the list if it doesn't already exist */ 77c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (allgenerics == NULL) { 78c7df79e47da854931474f581618435fff0dd2448Guido van Rossum allgenerics = newlistobject(0); 79c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (allgenerics == NULL) { 80c7df79e47da854931474f581618435fff0dd2448Guido van Rossum err_clear(); 812df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return; /* Too bad, live without allgenerics... */ 822df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 832df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 842df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (nfreeslots > 0) { 852df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum /* Search the list for reusable slots (NULL items) */ 862df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum /* XXX This can be made faster! */ 872df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum n = getlistsize(allgenerics); 882df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum for (i = 0; i < n; i++) { 892df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (getlistitem(allgenerics, i) == NULL) { 902df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(g); 912df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum setlistitem(allgenerics, i, (object *)g); 922df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum nfreeslots--; 932df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return; 942df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 95c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 962df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum /* Strange... no free slots found... */ 972df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum nfreeslots = 0; 98c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 992df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum /* No free entries, append new item to the end */ 100c7df79e47da854931474f581618435fff0dd2448Guido van Rossum addlistitem(allgenerics, (object *)g); 101c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 102c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1032df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* Find an object in the list of known objects */ 1042df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 105c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic genericobject * 106c7df79e47da854931474f581618435fff0dd2448Guido van Rossumfindgeneric(generic) 107c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *generic; 108c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 109c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int i, n; 110c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 111c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 112c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (allgenerics == NULL) 1132df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return NULL; /* No objects known yet */ 114c7df79e47da854931474f581618435fff0dd2448Guido van Rossum n = getlistsize(allgenerics); 115c7df79e47da854931474f581618435fff0dd2448Guido van Rossum for (i = 0; i < n; i++) { 116c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g = (genericobject *)getlistitem(allgenerics, i); 1172df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (g != NULL && g->ob_generic == generic) 118c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return g; 119c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 120c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; /* Unknown object */ 121c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 122c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 123aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum/* Remove an object from the list of known objects */ 124aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 125aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumstatic void 126aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumforgetgeneric(g) 127aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum genericobject *g; 128aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 129aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum int i, n; 130aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 131aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum XDECREF(g->ob_callback); 132aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g->ob_callback = NULL; 133aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum XDECREF(g->ob_callback_arg); 134aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g->ob_callback_arg = NULL; 135aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (allgenerics == NULL) 136aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return; /* No objects known yet */ 137aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum n = getlistsize(allgenerics); 138aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum for (i = 0; i < n; i++) { 139aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (g == (genericobject *)getlistitem(allgenerics, i)) { 140aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum setlistitem(allgenerics, i, (object *)NULL); 141aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum nfreeslots++; 142aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum break; 143aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum } 144aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum } 145aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum} 146aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 1472df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* Called when a form is about to be freed -- 1482df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum remove all the objects that we know about from it. */ 1492df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 1502df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic void 1512df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumreleaseobjects(form) 1522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum FL_FORM *form; 1532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum{ 1542df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum int i, n; 1552df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum genericobject *g; 1562df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 1572df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (allgenerics == NULL) 1582df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return; /* No objects known yet */ 1592df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum n = getlistsize(allgenerics); 1602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum for (i = 0; i < n; i++) { 1612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum g = (genericobject *)getlistitem(allgenerics, i); 1622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (g != NULL && g->ob_generic->form == form) { 1632df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_delete_object(g->ob_generic); 164aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum /* The object is now unreachable for 165aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum do_forms and check_forms, so 166aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum delete it from the list of known objects */ 167aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum XDECREF(g->ob_callback); 168aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g->ob_callback = NULL; 169aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum XDECREF(g->ob_callback_arg); 170aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g->ob_callback_arg = NULL; 171aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum setlistitem(allgenerics, i, (object *)NULL); 172aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum nfreeslots++; 1732df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 1742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 1752df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum} 1762df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 177c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 178c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Methods of generic objects */ 179c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 180c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 181c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_set_call_back(g, args) 182c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 183c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 184c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 185c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (args == NULL) { 186c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XDECREF(g->ob_callback); 187c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XDECREF(g->ob_callback_arg); 188c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_callback = NULL; 189c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_callback_arg = NULL; 190c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 191c7df79e47da854931474f581618435fff0dd2448Guido van Rossum else { 192c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!is_tupleobject(args) || gettuplesize(args) != 2) { 193c7df79e47da854931474f581618435fff0dd2448Guido van Rossum err_badarg(); 194c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 195c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 196c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XDECREF(g->ob_callback); 197c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XDECREF(g->ob_callback_arg); 198c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_callback = gettupleitem(args, 0); 199c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(g->ob_callback); 200c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_callback_arg = gettupleitem(args, 1); 201c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(g->ob_callback_arg); 202c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 203c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 204c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 205c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 206c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 207c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 208c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_call(g, args, func) 209c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 210c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 211c7df79e47da854931474f581618435fff0dd2448Guido van Rossum void (*func)(FL_OBJECT *); 212c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 213c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getnoarg(args)) 214c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 215c7df79e47da854931474f581618435fff0dd2448Guido van Rossum (*func)(g->ob_generic); 216c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 217c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 218c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 219c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 220c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2212df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumgeneric_delete_object(g, args) 2222df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum genericobject *g; 2232df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum object *args; 2242df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum{ 2252df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum object *res; 2262df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum res = generic_call(g, args, fl_delete_object); 227aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (res != NULL) 228aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum forgetgeneric(g); 2292df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return res; 2302df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum} 2312df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 2322df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic object * 233c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_show_object(g, args) 234c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 235c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 236c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 237c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_call(g, args, fl_show_object); 238c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 239c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 240c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 241c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_hide_object(g, args) 242c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 243c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 244c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 245c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_call(g, args, fl_hide_object); 246c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 247c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 248c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 249c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_redraw_object(g, args) 250c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 251c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 252c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 253c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_call(g, args, fl_redraw_object); 254c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 255c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 256c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 257c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_freeze_object(g, args) 258c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 259c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 260c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 261c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_call(g, args, fl_freeze_object); 262c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 263c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 264c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 265c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_unfreeze_object(g, args) 266c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 267c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 268c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 269c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_call(g, args, fl_unfreeze_object); 270c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 271c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 272c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist generic_methods[] = { 273c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_call_back", generic_set_call_back}, 27432db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {"delete_object", generic_delete_object}, 275c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"show_object", generic_show_object}, 276c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"hide_object", generic_hide_object}, 277c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"redraw_object", generic_redraw_object}, 278c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"freeze_object", generic_freeze_object}, 279c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"unfreeze_object", generic_unfreeze_object}, 280c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#if 0 281c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"handle_object", generic_handle_object}, 282c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"handle_object_direct",generic_handle_object_direct}, 283c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#endif 2840374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum {NULL, NULL} /* sentinel */ 285c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 286c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 287c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic void 288c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_dealloc(g) 289c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 290c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2912df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_free_object(g->ob_generic); 292aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum XDECREF(g->ob_callback); 293aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum XDECREF(g->ob_callback_arg); 294c7df79e47da854931474f581618435fff0dd2448Guido van Rossum DEL(g); 295c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 296c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 297c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#define OFF(x) offsetof(FL_OBJECT, x) 298c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 299c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct memberlist generic_memberlist[] = { 300c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"objclass", T_INT, OFF(objclass), RO}, 301c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"type", T_INT, OFF(type), RO}, 302c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"boxtype", T_INT, OFF(boxtype)}, 303c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"x", T_FLOAT, OFF(x)}, 304c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"y", T_FLOAT, OFF(y)}, 305c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"w", T_FLOAT, OFF(w)}, 306c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"h", T_FLOAT, OFF(h)}, 307c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"col1", T_INT, OFF(col1)}, 308c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"col2", T_INT, OFF(col2)}, 309c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"align", T_INT, OFF(align)}, 310c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"lcol", T_INT, OFF(lcol)}, 311c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"lsize", T_FLOAT, OFF(lsize)}, 312c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* "label" is treated specially! */ 313c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"lstyle", T_INT, OFF(lstyle)}, 314c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"pushed", T_INT, OFF(pushed), RO}, 315c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"focus", T_INT, OFF(focus), RO}, 316c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"belowmouse", T_INT, OFF(belowmouse),RO}, 317c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"frozen", T_INT, OFF(frozen), RO}, 3187066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"active", T_INT, OFF(active)}, 3197066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"input", T_INT, OFF(input)}, 320c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"visible", T_INT, OFF(visible), RO}, 3217066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"radio", T_INT, OFF(radio)}, 3227066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"automatic", T_INT, OFF(automatic)}, 323c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL} /* Sentinel */ 324c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 325c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 326d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum#undef OFF 327d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum 328c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 329c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_getattr(g, name) 330c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 331c7df79e47da854931474f581618435fff0dd2448Guido van Rossum char *name; 332c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 333c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *meth; 3342df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 3352df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum /* XXX Ought to special-case name "__methods__" */ 336c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (g-> ob_methods) { 3370374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum meth = findmethod(g->ob_methods, (object *)g, name); 3380374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum if (meth != NULL) return meth; 3390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum err_clear(); 340aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum } 341c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 342c7df79e47da854931474f581618435fff0dd2448Guido van Rossum meth = findmethod(generic_methods, (object *)g, name); 343c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (meth != NULL) 344c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return meth; 345c7df79e47da854931474f581618435fff0dd2448Guido van Rossum err_clear(); 346c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 347c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* "label" is an exception, getmember only works for char pointers, 348c7df79e47da854931474f581618435fff0dd2448Guido van Rossum not for char arrays */ 349c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (strcmp(name, "label") == 0) 350c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return newstringobject(g->ob_generic->label); 351c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 352c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return getmember((char *)g->ob_generic, generic_memberlist, name); 353c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 354c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 355c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic int 356c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_setattr(g, name, v) 357c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 358c7df79e47da854931474f581618435fff0dd2448Guido van Rossum char *name; 359c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *v; 360c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 361c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int ret; 362c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 363c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (v == NULL) { 364c7df79e47da854931474f581618435fff0dd2448Guido van Rossum err_setstr(TypeError, "can't delete forms object attributes"); 3653dd8c9895ec5ffca4c8a2288b54dc209068cb434Guido van Rossum return -1; 366c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 367c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 368c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* "label" is an exception: setmember doesn't set strings; 369c7df79e47da854931474f581618435fff0dd2448Guido van Rossum and FORMS wants you to call a function to set the label */ 370c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (strcmp(name, "label") == 0) { 371c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!is_stringobject(v)) { 372c7df79e47da854931474f581618435fff0dd2448Guido van Rossum err_setstr(TypeError, "label attr must be string"); 3733dd8c9895ec5ffca4c8a2288b54dc209068cb434Guido van Rossum return -1; 374c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 375c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_set_object_label(g->ob_generic, getstringvalue(v)); 376c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return 0; 377c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 378c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 379c7df79e47da854931474f581618435fff0dd2448Guido van Rossum ret = setmember((char *)g->ob_generic, generic_memberlist, name, v); 380c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 381c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* Rather than calling all the various set_object_* functions, 382c7df79e47da854931474f581618435fff0dd2448Guido van Rossum we call fl_redraw_object here. This is sometimes redundant 383c7df79e47da854931474f581618435fff0dd2448Guido van Rossum but I doubt that's a big problem */ 384c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (ret == 0) 385c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_redraw_object(g->ob_generic); 386c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 387c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return ret; 388c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 389c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 390aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumstatic object * 391aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumgeneric_repr(g) 392aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum genericobject *g; 393aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 394aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum char buf[100]; 395aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum sprintf(buf, "<FORMS_object at %lx, objclass=%d>", 396aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum (long)g, g->ob_generic->objclass); 397aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return newstringobject(buf); 398aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum} 399aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 400c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypeobject GenericObjecttype = { 401c7df79e47da854931474f581618435fff0dd2448Guido van Rossum OB_HEAD_INIT(&Typetype) 402c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*ob_size*/ 403aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum "FORMS_object", /*tp_name*/ 404c7df79e47da854931474f581618435fff0dd2448Guido van Rossum sizeof(genericobject), /*tp_size*/ 405c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*tp_itemsize*/ 406c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* methods */ 407c7df79e47da854931474f581618435fff0dd2448Guido van Rossum generic_dealloc, /*tp_dealloc*/ 408c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*tp_print*/ 409c7df79e47da854931474f581618435fff0dd2448Guido van Rossum generic_getattr, /*tp_getattr*/ 410c7df79e47da854931474f581618435fff0dd2448Guido van Rossum generic_setattr, /*tp_setattr*/ 411c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*tp_compare*/ 412aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum generic_repr, /*tp_repr*/ 413c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 414c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 415c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 416c7df79e47da854931474f581618435fff0dd2448Guido van Rossumnewgenericobject(generic, methods) 417c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *generic; 418c7df79e47da854931474f581618435fff0dd2448Guido van Rossum struct methodlist *methods; 419c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 420c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 421c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g = NEWOBJ(genericobject, &GenericObjecttype); 422c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (g == NULL) 423c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 424c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g-> ob_generic = generic; 425c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_methods = methods; 426c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_callback = NULL; 427c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g->ob_callback_arg = NULL; 428c7df79e47da854931474f581618435fff0dd2448Guido van Rossum knowgeneric(g); 429c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return (object *)g; 430c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 431c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 432c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/**********************************************************************/ 433c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Some common calling sequences */ 434c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 435c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, float) */ 436c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 437c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INf (func, obj, args) 438abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, float); 4390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 4400374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 441c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 4420374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum float parameter; 443c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 444fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "f", ¶meter)) return NULL; 445c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 4460374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum (*func) (obj, parameter); 447c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 4480374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 4490374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 450c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 451c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 452c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, float) */ 453c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 454c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INfINf (func, obj, args) 455abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, float, float); 4560374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 4570374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 458c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 4590374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum float par1, par2; 460c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 461fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "(ff)", &par1, &par2)) return NULL; 462c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 4630374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum (*func) (obj, par1, par2); 464c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 4650374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 4660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 467c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 468c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 469c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, int) */ 470c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 471c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INi (func, obj, args) 472abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, int); 4730374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 4740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 475c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 4760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum int parameter; 477c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 478fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getintarg(args, ¶meter)) return NULL; 479c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 4800374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum (*func) (obj, parameter); 481c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 4820374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 4830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 484c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 485c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 486ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum/* void func (object, char) */ 487ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 488ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumcall_forms_INc (func, obj, args) 489ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum void (*func)(FL_OBJECT *, int); 490ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum FL_OBJECT *obj; 491ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 492ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 493fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *a; 494ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 495fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getstrarg(args, &a)) return NULL; 496ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 497fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum (*func) (obj, a[0]); 498ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 499ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum INCREF(None); 500ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum return None; 501ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 502ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 503c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, string) */ 504c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 505c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INstr (func, obj, args) 506abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, char *); 5070374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 5080374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 509aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 510fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *a; 511aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 512fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getstrarg(args, &a)) return NULL; 513c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 514fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum (*func) (obj, a); 515c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 5160374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 5170374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 518c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 519c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 520c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 521c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* voide func (object, int, string) */ 522c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 523c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INiINstr (func, obj, args) 524abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, int, char *); 5250374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 5260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 527c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 528fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *b; 529fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum int a; 5300374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 531234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum if (!getargs(args, "(is)", &a, &b)) return NULL; 5320374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 533fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum (*func) (obj, a, b); 5340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5350374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 5360374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 537c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 538c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 5390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#ifdef UNUSED 540c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, float) */ 541c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 542c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INiINi (func, obj, args) 543abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, float, float); 5440374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 5450374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 546c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 5470374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum int par1, par2; 5480374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 549234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum if (!getargs(args, "(ii)", &par1, &par2)) return NULL; 5500374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5510374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum (*func) (obj, par1, par2); 5520374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5530374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 5540374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 555c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 5560374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#endif 557c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 558c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* int func (object) */ 559c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 560c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_Ri (func, obj, args) 5610374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum int (*func)(FL_OBJECT *); 5620374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 5630374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 564c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 5650374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum int retval; 5660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5670374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum if (!getnoarg(args)) return NULL; 5680374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5690374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum retval = (*func) (obj); 5700374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5710374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return newintobject ((long) retval); 572c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 573c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 574c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* char * func (object) */ 575c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 576c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_Rstr (func, obj, args) 5770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum char * (*func)(FL_OBJECT *); 5780374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 5790374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 580aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 5810374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum char *str; 5820374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 583fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getnoarg(args)) return NULL; 5840374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5850374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum str = (*func) (obj); 5860374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 5872df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (str == NULL) { 5882df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 5892df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return None; 5902df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 5910374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return newstringobject (str); 592c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 593c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 594c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* int func (object) */ 595c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 596c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_Rf (func, obj, args) 5970374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum float (*func)(FL_OBJECT *); 5980374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum FL_OBJECT *obj; 5990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 600c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum float retval; 6020374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 6030374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum if (!getnoarg(args)) return NULL; 6040374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 6050374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum retval = (*func) (obj); 6060374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 6070374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return newfloatobject (retval); 608c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 609c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 610c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 611c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_OUTfOUTf (func, obj, args) 612abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum void (*func)(FL_OBJECT *, float *, float *); 613c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *obj; 614c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 615c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 616aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum float f1, f2; 6170374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 618aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getnoarg(args)) return NULL; 6190374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 620c7df79e47da854931474f581618435fff0dd2448Guido van Rossum (*func) (obj, &f1, &f2); 621c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 622e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum return mkvalue("(ff)", f1, f2); 623c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 624c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 6250374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#ifdef UNUSED 626c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 627c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_OUTf (func, obj, args) 628aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum void (*func)(FL_OBJECT *, float *); 629c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *obj; 630c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 631c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 632aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum float f; 633c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 634aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getnoarg(args)) return NULL; 635c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 636c7df79e47da854931474f581618435fff0dd2448Guido van Rossum (*func) (obj, &f); 637c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 638c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return newfloatobject (f); 639c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 6400374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#endif 641c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 642c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/**********************************************************************/ 643c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : browser */ 644c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 645c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 646c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_browser_topline(g, args) 647c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 648c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 649c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6500374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args); 651c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 652c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 653c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 654c7df79e47da854931474f581618435fff0dd2448Guido van Rossumclear_browser(g, args) 655c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 656c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 657c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6580374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return generic_call (g, args, fl_clear_browser); 659c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 660c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 661c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 662c7df79e47da854931474f581618435fff0dd2448Guido van Rossumadd_browser_line (g, args) 6630374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 6640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 665c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args); 667c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 668c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 669c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 670c7df79e47da854931474f581618435fff0dd2448Guido van Rossumaddto_browser (g, args) 6710374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 6720374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 673c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INstr (fl_addto_browser, g-> ob_generic, args); 675c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 676c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 677c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 678c7df79e47da854931474f581618435fff0dd2448Guido van Rossuminsert_browser_line (g, args) 6790374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 6800374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 681c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6820374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INiINstr (fl_insert_browser_line, 6830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum g-> ob_generic, args); 684c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 685c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 686c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 687c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdelete_browser_line (g, args) 688c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 689c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 690c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6910374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args); 692c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 693c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 694c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 695c7df79e47da854931474f581618435fff0dd2448Guido van Rossumreplace_browser_line (g, args) 6960374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 6970374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 698c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 6990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INiINstr (fl_replace_browser_line, 7000374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum g-> ob_generic, args); 701c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 702c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 703c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 704c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_browser_line(g, args) 705c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 706c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 707c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 708c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int i; 709c7df79e47da854931474f581618435fff0dd2448Guido van Rossum char *str; 710c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 711c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getintarg(args, &i)) 712c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 713c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 714c7df79e47da854931474f581618435fff0dd2448Guido van Rossum str = fl_get_browser_line (g->ob_generic, i); 715c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 7162df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (str == NULL) { 7172df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 7182df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return None; 7192df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 720c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return newstringobject (str); 721c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 722c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 723c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 724c7df79e47da854931474f581618435fff0dd2448Guido van Rossumload_browser (g, args) 7250374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 7260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 727c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 728abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum /* XXX strictly speaking this is wrong since fl_load_browser 729abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum XXX returns int, not void */ 7300374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INstr (fl_load_browser, g-> ob_generic, args); 731c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 732c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 733c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 734c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_browser_maxline(g, args) 735c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 736c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 737c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 7380374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic, args); 739c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 740c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 741c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 742c7df79e47da854931474f581618435fff0dd2448Guido van Rossumselect_browser_line (g, args) 743c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 744c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 745c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 7460374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_select_browser_line, g-> ob_generic, args); 747c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 748c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 749c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 750c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdeselect_browser_line (g, args) 751c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 752c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 753c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 7540374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args); 755c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 756c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 757c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 758c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdeselect_browser (g, args) 759c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 760c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 761c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 7620374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return generic_call (g, args, fl_deselect_browser); 763c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 764c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 765c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 766c7df79e47da854931474f581618435fff0dd2448Guido van Rossumisselected_browser_line (g, args) 7670374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 7680374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 769c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 770c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int i, j; 7710374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 772c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getintarg(args, &i)) 773c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 7740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 775c7df79e47da854931474f581618435fff0dd2448Guido van Rossum j = fl_isselected_browser_line (g->ob_generic, i); 7760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 777c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return newintobject (j); 778c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 779c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 780c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 781c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_browser (g, args) 7820374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 7830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 784c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 7850374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_Ri (fl_get_browser, g-> ob_generic, args); 786c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 787c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 788c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 789c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_browser_fontsize (g, args) 790c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 791c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 792c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 7930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args); 794c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 795c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 796c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 797c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_browser_fontstyle (g, args) 798c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 799c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 800c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 8010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args); 802c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 803c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 804ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 805ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_browser_specialkey (g, args) 806ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum genericobject *g; 807ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 808ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 809ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args); 810ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 811ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 812c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist browser_methods[] = { 813ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_browser_topline", set_browser_topline}, 814ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"clear_browser", clear_browser}, 815ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"add_browser_line", add_browser_line}, 816ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"addto_browser", addto_browser}, 817ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"insert_browser_line", insert_browser_line}, 818ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"delete_browser_line", delete_browser_line}, 819ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"replace_browser_line", replace_browser_line}, 820ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"get_browser_line", get_browser_line}, 821ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"load_browser", load_browser}, 822ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"get_browser_maxline", get_browser_maxline}, 823ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"select_browser_line", select_browser_line}, 824ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"deselect_browser_line", deselect_browser_line}, 825ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"deselect_browser", deselect_browser}, 826ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"isselected_browser_line", isselected_browser_line}, 827ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"get_browser", get_browser}, 828ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_browser_fontsize", set_browser_fontsize}, 829ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_browser_fontstyle", set_browser_fontstyle}, 830ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_browser_specialkey", set_browser_specialkey}, 831ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {NULL, NULL} /* sentinel */ 832c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 833c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 834c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: button */ 835c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 836c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 837c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_button(g, args) 838c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 839c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 840c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 8410374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_set_button, g-> ob_generic, args); 842c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 843c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 844c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 845c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_button(g, args) 846c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 847c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 848c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 8490374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_Ri (fl_get_button, g-> ob_generic, args); 850c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 851ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 852ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_button_shortcut(g, args) 853ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum genericobject *g; 854ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 855ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 856ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args); 857ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 858c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 859c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist button_methods[] = { 860c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_button", set_button}, 861c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"get_button", get_button}, 862ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 863ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_button_shortcut", set_button_shortcut}, 864ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 865c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 866c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 867c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 868c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: choice */ 869c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 870c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 871c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_choice(g, args) 872c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 873c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 874c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 8750374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_set_choice, g-> ob_generic, args); 876c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 877c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 878c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 879c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_choice(g, args) 880c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 881c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 882c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 8830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_Ri (fl_get_choice, g-> ob_generic, args); 884c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 885c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 886c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 887c7df79e47da854931474f581618435fff0dd2448Guido van Rossumclear_choice (g, args) 8880374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 8890374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 890c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 8910374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return generic_call (g, args, fl_clear_choice); 892c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 893c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 894c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 895c7df79e47da854931474f581618435fff0dd2448Guido van Rossumaddto_choice (g, args) 8960374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 8970374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 898aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 8990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INstr (fl_addto_choice, g-> ob_generic, args); 900c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 901c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 902c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 903c7df79e47da854931474f581618435fff0dd2448Guido van Rossumreplace_choice (g, args) 9040374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 9050374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 906aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 9070374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args); 908c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 909c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 910c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 911c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdelete_choice (g, args) 9120374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 9130374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 914c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 9150374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_delete_choice, g-> ob_generic, args); 916c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 917c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 918c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 919c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_choice_text (g, args) 9200374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 9210374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 922aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 9230374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_Rstr (fl_get_choice_text, g-> ob_generic, args); 924c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 925c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 926c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 927c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_choice_fontsize (g, args) 9280374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 9290374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 930c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 9310374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args); 932c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 933c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 934c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 935c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_choice_fontstyle (g, args) 9360374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum genericobject *g; 9370374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 938c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 9390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args); 940c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 941c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 942c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist choice_methods[] = { 943c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_choice", set_choice}, 944c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"get_choice", get_choice}, 945c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"clear_choice", clear_choice}, 946aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"addto_choice", addto_choice}, 947aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"replace_choice", replace_choice}, 948aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"delete_choice", delete_choice}, 949aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_choice_text", get_choice_text}, 950c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_choice_fontsize", set_choice_fontsize}, 951c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_choice_fontstyle",set_choice_fontstyle}, 952c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 953c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 954c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 955c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Clock */ 956c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 957c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 958c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_clock(g, args) 959c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 960c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 961c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 962c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int i0, i1, i2; 963c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 964c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getnoarg(args)) 965c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 966c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 967c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_get_clock (g->ob_generic, &i0, &i1, &i2); 968c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 969e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum return mkvalue("(iii)", i0, i1, i2); 970c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 971c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 972c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist clock_methods[] = { 973c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"get_clock", get_clock}, 974c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 975c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 976c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 977c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* CLass : Counters */ 978c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 979c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 980c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_counter_value(g, args) 981c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 982c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 983c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 984aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rf (fl_get_counter_value, g-> ob_generic, args); 985c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 986c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 987c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 988c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_value (g, args) 989c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 990c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 991c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 992aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_counter_value, g-> ob_generic, args); 993c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 994c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 995c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 996c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_precision (g, args) 997c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 998c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 999c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1000aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args); 1001c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1002c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1003c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1004c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_bounds (g, args) 1005c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1006c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1007c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1008aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args); 1009c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1010c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1011c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1012c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_step (g, args) 1013c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1014c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1015c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1016aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args); 1017c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1018c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1019c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1020c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_return (g, args) 1021c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1022c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1023c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 10240374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return call_forms_INi (fl_set_counter_return, g-> ob_generic, args); 1025c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1026c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1027c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist counter_methods[] = { 1028ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_counter_value", set_counter_value}, 1029ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"get_counter_value", get_counter_value}, 1030ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_counter_bounds", set_counter_bounds}, 1031ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_counter_step", set_counter_step}, 1032ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_counter_precision", set_counter_precision}, 1033ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_counter_return", set_counter_return}, 1034ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {NULL, NULL} /* sentinel */ 1035c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1036c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1037ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1038c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Defaults */ 1039c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1040c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1041c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_default(g, args) 1042c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1043c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1044c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 10450374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum char c; 1046c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 10470374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum if (!getnoarg(args)) return NULL; 1048c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 10490374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum c = fl_get_default (g->ob_generic); 1050c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1051234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum return mkvalue("c", c); 1052c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1053c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1054c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist default_methods[] = { 1055aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_default", get_default}, 1056c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1057c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1058ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1059c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1060c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1061c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: Dials */ 1062c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1063ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1064c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1065c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_dial (g, args) 1066c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1067c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1068c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1069c7df79e47da854931474f581618435fff0dd2448Guido van Rossum float f1, f2, f3; 1070c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1071fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "(fff)", &f1, &f2, &f3)) 1072c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 1073c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_set_dial (g->ob_generic, f1, f2, f3); 1074c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 1075c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 1076c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1077ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1078c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1079c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1080ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumget_dial_value(g, args) 1081c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1082c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1083c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1084aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rf (fl_get_dial_value, g-> ob_generic, args); 1085c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1086c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1087c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1088c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_dial_value (g, args) 1089c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1090c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1091c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1092aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_dial_value, g-> ob_generic, args); 1093c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1094c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1095c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1096c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_dial_bounds (g, args) 1097c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1098c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1099c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1100aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args); 1101c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1102c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1103c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1104c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_dial_bounds (g, args) 1105c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1106c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1107c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1108aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic, args); 1109c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1110c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1111ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 1112ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 1113ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_dial_step (g, args) 1114ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum genericobject *g; 1115ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 1116ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 1117aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_dial_step, g-> ob_generic, args); 1118ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 1119ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 1120ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 1121c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist dial_methods[] = { 1122ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1123aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_dial", set_dial}, 1124aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_dial", get_dial_value}, 1125ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1126aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_dial_value", set_dial_value}, 1127aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_dial_value", get_dial_value}, 1128aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_dial_bounds", set_dial_bounds}, 1129aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_dial_bounds", get_dial_bounds}, 1130ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 1131aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_dial_step", set_dial_step}, 1132ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 1133c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1134c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1135c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1136c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Input */ 1137c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1138c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1139c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_input (g, args) 1140c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1141c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1142c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1143aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INstr (fl_set_input, g-> ob_generic, args); 1144c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1145c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1146c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1147c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_input (g, args) 1148c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1149c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1150c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1151aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rstr (fl_get_input, g-> ob_generic, args); 1152c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1153c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1154c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1155c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_input_color (g, args) 1156c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1157c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1158c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1159aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args); 1160c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1161c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1162ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 1163ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 1164ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_input_return (g, args) 1165ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum genericobject *g; 1166ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 1167ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 1168aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INi (fl_set_input_return, g-> ob_generic, args); 1169ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 1170ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 1171ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 1172c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist input_methods[] = { 1173aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_input", set_input}, 1174aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_input", get_input}, 1175aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_input_color", set_input_color}, 1176ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 1177aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_input_return", set_input_return}, 1178ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 1179c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1180c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1181c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1182c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1183c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Menu */ 1184c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1185c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1186c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_menu (g, args) 1187c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1188c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1189c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1190abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum return call_forms_INstr (fl_set_menu, g-> ob_generic, args); 1191c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1192c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1193c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1194c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_menu (g, args) 1195c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1196c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1197c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1198abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum /* XXX strictly speaking this is wrong since fl_get_menu 1199abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum XXX returns long, not int */ 1200abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum return call_forms_Ri (fl_get_menu, g-> ob_generic, args); 1201c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1202c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1203c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 12048b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossumget_menu_text (g, args) 12058b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum genericobject *g; 12068b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum object *args; 12078b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum{ 12088b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum return call_forms_Rstr (fl_get_menu_text, g-> ob_generic, args); 12098b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum} 12108b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum 12118b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossumstatic object * 1212c7df79e47da854931474f581618435fff0dd2448Guido van Rossumaddto_menu (g, args) 1213c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1214c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1215c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1216abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum return call_forms_INstr (fl_addto_menu, g-> ob_generic, args); 1217c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1218c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1219c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist menu_methods[] = { 1220aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_menu", set_menu}, 1221aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_menu", get_menu}, 12228b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum {"get_menu_text", get_menu_text}, 1223aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"addto_menu", addto_menu}, 1224c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1225c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1226c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1227c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1228c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: Sliders */ 1229c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1230ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1231c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1232c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider (g, args) 1233c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1234c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1235c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1236c7df79e47da854931474f581618435fff0dd2448Guido van Rossum float f1, f2, f3; 1237c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1238fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!args(args, "(fff)", &f1, &f2, &f3)) 1239c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 1240c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_set_slider (g->ob_generic, f1, f2, f3); 1241c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 1242c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 1243c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1244ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1245c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1246c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1247ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumget_slider_value(g, args) 1248c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1249c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1250c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1251aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rf (fl_get_slider_value, g-> ob_generic, args); 1252c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1253c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1254c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1255c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_value (g, args) 1256c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1257c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1258c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1259aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_slider_value, g-> ob_generic, args); 1260c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1261c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1262c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1263c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_bounds (g, args) 1264c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1265c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1266c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1267aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_slider_bounds, g-> ob_generic, args); 1268c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1269c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1270c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1271c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_slider_bounds (g, args) 1272c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1273c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1274c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1275c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return call_forms_OUTfOUTf(fl_get_slider_bounds, g-> ob_generic, args); 1276c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1277c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1278c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1279c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_return (g, args) 1280c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1281c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1282c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1283aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_slider_return, g-> ob_generic, args); 1284c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1285c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1286c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1287c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_size (g, args) 1288c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1289c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1290c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1291aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_slider_size, g-> ob_generic, args); 1292c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1293c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1294c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1295c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_precision (g, args) 1296c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1297c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1298c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1299aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INi (fl_set_slider_precision, g-> ob_generic, args); 1300c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1301c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1302ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 1303ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 1304ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_slider_step (g, args) 1305ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum genericobject *g; 1306ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 1307ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 1308aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_slider_step, g-> ob_generic, args); 1309ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 1310ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 1311ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 1312ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 1313c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist slider_methods[] = { 1314ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1315c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_slider", set_slider}, 1316ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"get_slider", get_slider_value}, 1317ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1318aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_slider_value", set_slider_value}, 1319aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_slider_value", get_slider_value}, 1320aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_slider_bounds", set_slider_bounds}, 1321aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_slider_bounds", get_slider_bounds}, 1322aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_slider_return", set_slider_return}, 1323aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_slider_size", set_slider_size}, 1324c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_slider_precision",set_slider_precision}, 1325ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 1326ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_slider_step", set_slider_step}, 1327ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 1328c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1329c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1330c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1331c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1332c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_xvalue (g, args) 1333c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1334c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1335c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1336aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_positioner_xvalue, g-> ob_generic, args); 1337c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1338c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1339c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1340c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_xbounds (g, args) 1341c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1342c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1343c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1344aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_positioner_xbounds, 1345aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g-> ob_generic, args); 1346c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1347c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1348c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1349c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_yvalue (g, args) 1350c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1351c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1352c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1353aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_positioner_yvalue, g-> ob_generic, args); 1354c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1355c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1356c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1357c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_ybounds (g, args) 1358c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1359c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1360c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1361aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INfINf (fl_set_positioner_ybounds, 1362aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g-> ob_generic, args); 1363c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1364c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1365c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1366c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_xvalue (g, args) 1367c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1368c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1369c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1370aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rf (fl_get_positioner_xvalue, g-> ob_generic, args); 1371c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1372c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1373c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1374c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_xbounds (g, args) 1375c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1376c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1377c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1378aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_OUTfOUTf (fl_get_positioner_xbounds, 1379aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g-> ob_generic, args); 1380c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1381c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1382c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1383c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_yvalue (g, args) 1384c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1385c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1386c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1387aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rf (fl_get_positioner_yvalue, g-> ob_generic, args); 1388c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1389c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1390c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1391c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_ybounds (g, args) 1392c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1393c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1394c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1395aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_OUTfOUTf (fl_get_positioner_ybounds, 1396aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g-> ob_generic, args); 1397c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1398c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1399c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist positioner_methods[] = { 1400c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_positioner_xvalue", set_positioner_xvalue}, 1401c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_positioner_yvalue", set_positioner_yvalue}, 1402aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_positioner_xbounds", set_positioner_xbounds}, 1403aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_positioner_ybounds", set_positioner_ybounds}, 1404c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"get_positioner_xvalue", get_positioner_xvalue}, 1405c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"get_positioner_yvalue", get_positioner_yvalue}, 1406aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_positioner_xbounds", get_positioner_xbounds}, 1407aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_positioner_ybounds", get_positioner_ybounds}, 1408c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1409c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1410c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1411c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class timer */ 1412c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1413c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1414c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_timer (g, args) 1415c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1416c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1417c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1418aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_INf (fl_set_timer, g-> ob_generic, args); 1419c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1420c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1421c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1422c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_timer (g, args) 1423c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 1424c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1425c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1426aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return call_forms_Rf (fl_get_timer, g-> ob_generic, args); 1427c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1428c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1429c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist timer_methods[] = { 1430c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_timer", set_timer}, 1431c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"get_timer", get_timer}, 1432c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1433c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1434c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1435c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Form objects */ 1436c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1437c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypedef struct { 1438c7df79e47da854931474f581618435fff0dd2448Guido van Rossum OB_HEAD 1439c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_FORM *ob_form; 1440c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} formobject; 1441c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1442c7df79e47da854931474f581618435fff0dd2448Guido van Rossumextern typeobject Formtype; /* Forward */ 1443c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1444c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#define is_formobject(v) ((v)->ob_type == &Formtype) 1445c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1446c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1447c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_show_form(f, args) 1448c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1449c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1450c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1451c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int place, border; 1452fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *name; 1453fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "(iis)", &place, &border, &name)) 1454c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 1455fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum fl_show_form(f->ob_form, place, border, name); 1456c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 1457c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 1458c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1459c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1460c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1461c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_call(func, f, args) 1462c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_FORM *f; 1463c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1464c7df79e47da854931474f581618435fff0dd2448Guido van Rossum void (*func)(FL_FORM *); 1465c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1466c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getnoarg(args)) return NULL; 1467c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1468c7df79e47da854931474f581618435fff0dd2448Guido van Rossum (*func)(f); 1469c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1470c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 1471c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 1472c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1473c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1474c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 14752df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_call_INiINi(func, f, args) 1476c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_FORM *f; 1477c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1478c7df79e47da854931474f581618435fff0dd2448Guido van Rossum void (*func)(FL_FORM *, int, int); 1479c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1480aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum int a, b; 1481c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1482234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum if (!getargs(args, "(ii)", &a, &b)) return NULL; 1483c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1484c7df79e47da854931474f581618435fff0dd2448Guido van Rossum (*func)(f, a, b); 1485c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1486c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 1487c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 1488c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1489c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1490c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1491c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_hide_form(f, args) 1492c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1493c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1494c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 14952df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call(fl_hide_form, f-> ob_form, args); 1496c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1497c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1498c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1499c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_redraw_form(f, args) 1500c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1501c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1502aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 15032df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call(fl_redraw_form, f-> ob_form, args); 1504c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1505c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1506c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 15072df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_object(f, args) 1508c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1509c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1510c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1511aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum genericobject *g; 15122df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (args == NULL || !is_genericobject(args)) { 15132df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum err_badarg(); 15142df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return NULL; 15152df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 1516aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum g = (genericobject *)args; 1517aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (findgeneric(g->ob_generic) != NULL) { 1518aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum err_setstr(RuntimeError, 1519aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum "add_object of object already in a form"); 1520aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return NULL; 1521aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum } 1522aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum fl_add_object(f->ob_form, g->ob_generic); 1523aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum knowgeneric(g); 15242df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 15252df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 15262df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return None; 1527c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1528c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1529c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 15302df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_set_form_position(f, args) 15312df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum formobject *f; 15322df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum object *args; 15332df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum{ 15342df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call_INiINi(fl_set_form_position, f-> ob_form, args); 15352df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum} 15362df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 15372df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic object * 15382df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumgeneric_add_object(f, args, func, internal_methods) 1539c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1540c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1541c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *(*func)(int, float, float, float, float, char*); 1542aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum struct methodlist *internal_methods; 1543c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 15442df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum int type; 15452df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum float x, y, w, h; 1546fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *name; 15472df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum FL_OBJECT *obj; 1548c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1549fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args,"(iffffs)", &type,&x,&y,&w,&h,&name)) 15502df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return NULL; 1551aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 15522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_addto_form (f-> ob_form); 1553aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 1554fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum obj = (*func) (type, x, y, w, h, name); 1555c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 15562df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_end_form(); 1557c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 15582df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (obj == NULL) { 15592df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum err_nomem(); 15602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return NULL; 15612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 1562c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 15632df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return newgenericobject (obj, internal_methods); 1564c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1565c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1566c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1567c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_button(f, args) 1568aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1569aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1570c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1571c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_button, button_methods); 1572c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1573c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1574c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1575c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_lightbutton(f, args) 1576aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1577aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1578c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1579c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_lightbutton, button_methods); 1580c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1581c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1582c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1583c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_roundbutton(f, args) 1584aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1585aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1586c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1587c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_roundbutton, button_methods); 1588c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1589c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1590c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1591c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_menu (f, args) 1592aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1593aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1594c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1595c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_menu, menu_methods); 1596c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1597c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1598c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1599c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_slider(f, args) 1600aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1601aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1602c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1603c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_slider, slider_methods); 1604c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1605c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1606c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1607c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_valslider(f, args) 1608aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1609aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1610c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1611c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_valslider, slider_methods); 1612c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1613c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1614c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16152df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_dial(f, args) 1616aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1617aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1618c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1619c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_dial, dial_methods); 1620c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1621c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1622c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16232df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_counter(f, args) 1624aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1625aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1626c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1627c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_counter, counter_methods); 1628c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1629c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1630ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1631c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16322df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_default(f, args) 1633aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1634aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1635c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1636c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_default, default_methods); 1637c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1638ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1639c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1640c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16412df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_clock(f, args) 1642aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1643aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1644c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1645c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_clock, clock_methods); 1646c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1647c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1648c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16492df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_box(f, args) 1650aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1651aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1652c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 16530374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return generic_add_object(f, args, fl_add_box, 16540374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum (struct methodlist *)NULL); 1655c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1656c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1657c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16582df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_choice(f, args) 1659aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1660aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1661c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1662c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_choice, choice_methods); 1663c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1664c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1665c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16662df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_browser(f, args) 1667aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1668aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1669c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1670c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_browser, browser_methods); 1671c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1672c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1673c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_positioner(f, args) 1675aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1676aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1677c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1678c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_positioner, positioner_methods); 1679c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1680c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1681c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16822df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_input(f, args) 1683aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1684aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1685c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1686c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_input, input_methods); 1687c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1688c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1689c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16902df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_text(f, args) 1691aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1692aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1693c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 16940374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return generic_add_object(f, args, fl_add_text, 16950374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum (struct methodlist *)NULL); 1696c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1697c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1698c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 16992df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_timer(f, args) 1700aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1701aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum object *args; 1702c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1703c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return generic_add_object(f, args, fl_add_timer, timer_methods); 1704c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1705c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1706c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1707c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_freeze_form(f, args) 1708c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1709c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1710c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1711aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return form_call(fl_freeze_form, f-> ob_form, args); 1712c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1713c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1714c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1715c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_unfreeze_form(f, args) 1716c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1717c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1718c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 17192df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call(fl_unfreeze_form, f-> ob_form, args); 1720c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1721c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1722ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1723c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1724c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_remove_form(f, args) 1725c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1726c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1727c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 17282df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call(fl_remove_form, f-> ob_form, args); 1729c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1730ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1731c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1732c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1733c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_activate_form(f, args) 1734c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1735c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1736c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 17372df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call(fl_activate_form, f-> ob_form, args); 1738c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1739c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1740c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1741c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_deactivate_form(f, args) 1742c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1743c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1744c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 17452df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return form_call(fl_deactivate_form, f-> ob_form, args); 1746c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1747c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 174875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object * 17492df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_bgn_group(f, args) 17500374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum formobject *f; 17510374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 17520374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 17532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum FL_OBJECT *obj; 17542df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 17552df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_addto_form(f-> ob_form); 17562df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum obj = fl_bgn_group(); 17572df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_end_form(); 17582df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 17592df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (obj == NULL) { 17602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum err_nomem(); 17612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return NULL; 17622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 17632df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 17642df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return newgenericobject (obj, (struct methodlist *) NULL); 17650374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 17660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 17670374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 17682df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_end_group(f, args) 17690374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum formobject *f; 17700374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum object *args; 17710374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 17722df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_addto_form(f-> ob_form); 17730374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum fl_end_group(); 17742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_end_form(); 17750374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum INCREF(None); 17760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 17770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 17780374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 17790374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 17802df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_find_first_or_last(func, f, args) 178175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum FL_OBJECT *(*func)(FL_FORM *, int, float, float); 17820374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum formobject *f; 178375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum object *args; 178475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{ 178575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum int type; 178675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum float mx, my; 178775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum FL_OBJECT *generic; 178875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum genericobject *g; 178975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 1790fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "(iff)", &type, &mx, &my)) return NULL; 179175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 17920374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum generic = (*func) (f-> ob_form, type, mx, my); 179375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 179475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum if (generic == NULL) 179575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum { 179675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum INCREF(None); 179775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum return None; 179875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum } 179975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 180075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum g = findgeneric(generic); 180175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum if (g == NULL) { 180275cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum err_setstr(RuntimeError, 18032df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum "forms_find_{first|last} returns unknown object"); 180475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum return NULL; 180575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum } 180675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum INCREF(g); 18072df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return (object *) g; 180875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum} 180975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 181075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object * 18112df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_find_first(f, args) 18120374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum formobject *f; 181375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum object *args; 181475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{ 18152df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_find_first_or_last(fl_find_first, f, args); 181675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum} 181775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 181875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object * 18192df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_find_last(f, args) 18200374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum formobject *f; 182175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum object *args; 182275cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{ 18232df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_find_first_or_last(fl_find_last, f, args); 182475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum} 182575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 18267066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object * 18277066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumform_set_object_focus(f, args) 18287066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum formobject *f; 18297066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *args; 18307066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{ 18317066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum genericobject *g; 18327066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum if (args == NULL || !is_genericobject(args)) { 18337066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum err_badarg(); 18347066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return NULL; 18357066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum } 18367066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum g = (genericobject *)args; 18377066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum fl_set_object_focus(f->ob_form, g->ob_generic); 18387066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum INCREF(None); 18397066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return None; 18407066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum} 18417066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum 1842c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist form_methods[] = { 1843c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* adm */ 1844c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"show_form", form_show_form}, 1845c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"hide_form", form_hide_form}, 1846aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"redraw_form", form_redraw_form}, 1847aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"set_form_position", form_set_form_position}, 1848c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"freeze_form", form_freeze_form}, 1849c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"unfreeze_form", form_unfreeze_form}, 1850ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1851c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"remove_form", form_remove_form}, 1852ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1853c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"activate_form", form_activate_form}, 1854c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"deactivate_form", form_deactivate_form}, 18550374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum {"bgn_group", form_bgn_group}, 18560374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum {"end_group", form_end_group}, 185775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum {"find_first", form_find_first}, 185875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum {"find_last", form_find_last}, 18597066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"set_object_focus", form_set_object_focus}, 1860c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1861c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* basic objects */ 1862aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_button", form_add_button}, 1863aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum/* {"add_bitmap", form_add_bitmap}, */ 1864c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"add_lightbutton", form_add_lightbutton}, 1865aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_roundbutton", form_add_roundbutton}, 1866aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_menu", form_add_menu}, 1867aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_slider", form_add_slider}, 1868aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_positioner", form_add_positioner}, 1869aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_valslider", form_add_valslider}, 1870aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_dial", form_add_dial}, 1871aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_counter", form_add_counter}, 1872ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifdef FL_V15 1873aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_default", form_add_default}, 1874ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* FL_V15 */ 1875aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_box", form_add_box}, 1876aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_clock", form_add_clock}, 1877aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_choice", form_add_choice}, 1878aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_browser", form_add_browser}, 1879aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_input", form_add_input}, 1880aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_timer", form_add_timer}, 1881aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"add_text", form_add_text}, 1882c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 1883c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1884c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1885c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic void 1886c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_dealloc(f) 1887c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1888c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 18892df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum releaseobjects(f->ob_form); 1890336b591e557fe6c4ba22f01d47976967fe389decGuido van Rossum if (f->ob_form->visible) 1891336b591e557fe6c4ba22f01d47976967fe389decGuido van Rossum fl_hide_form(f->ob_form); 18922df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_free_form(f->ob_form); 1893c7df79e47da854931474f581618435fff0dd2448Guido van Rossum DEL(f); 1894c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1895c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1896d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum#define OFF(x) offsetof(FL_FORM, x) 1897d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum 189832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossumstatic struct memberlist form_memberlist[] = { 189932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {"window", T_LONG, OFF(window), RO}, 190032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {"w", T_FLOAT, OFF(w)}, 190132db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {"h", T_FLOAT, OFF(h)}, 19027066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"x", T_FLOAT, OFF(x), RO}, 19037066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"y", T_FLOAT, OFF(y), RO}, 190432db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {"deactivated", T_INT, OFF(deactivated)}, 19057066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"visible", T_INT, OFF(visible), RO}, 19067066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"frozen", T_INT, OFF(frozen), RO}, 190732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {"doublebuf", T_INT, OFF(doublebuf)}, 190832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum {NULL} /* Sentinel */ 190932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum}; 191032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum 1911d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum#undef OFF 1912d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum 1913c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1914c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_getattr(f, name) 1915c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1916c7df79e47da854931474f581618435fff0dd2448Guido van Rossum char *name; 1917c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 191832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum object *meth; 191932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum 192032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum meth = findmethod(form_methods, (object *)f, name); 192132db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum if (meth != NULL) 192232db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum return meth; 192332db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum err_clear(); 192432db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum return getmember((char *)f->ob_form, form_memberlist, name); 192532db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum} 192632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum 192732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossumstatic int 192832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossumform_setattr(f, name, v) 192932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum formobject *f; 193032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum char *name; 193132db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum object *v; 193232db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum{ 193332db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum int ret; 193432db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum 193532db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum if (v == NULL) { 193632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum err_setstr(TypeError, "can't delete form attributes"); 193732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum return NULL; 193832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum } 193932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum 194032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum return setmember((char *)f->ob_form, form_memberlist, name, v); 1941c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1942c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1943aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumstatic object * 1944aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumform_repr(f) 1945aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum formobject *f; 1946aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{ 1947aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum char buf[100]; 1948aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum sprintf(buf, "<FORMS_form at %lx, window=%ld>", 1949aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum (long)f, f->ob_form->window); 1950aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return newstringobject(buf); 1951aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum} 1952aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 1953c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypeobject Formtype = { 1954c7df79e47da854931474f581618435fff0dd2448Guido van Rossum OB_HEAD_INIT(&Typetype) 1955c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*ob_size*/ 1956aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum "FORMS_form", /*tp_name*/ 1957c7df79e47da854931474f581618435fff0dd2448Guido van Rossum sizeof(formobject), /*tp_size*/ 1958c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*tp_itemsize*/ 1959c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* methods */ 1960c7df79e47da854931474f581618435fff0dd2448Guido van Rossum form_dealloc, /*tp_dealloc*/ 1961c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*tp_print*/ 1962c7df79e47da854931474f581618435fff0dd2448Guido van Rossum form_getattr, /*tp_getattr*/ 196332db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum form_setattr, /*tp_setattr*/ 1964c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 0, /*tp_compare*/ 1965aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum form_repr, /*tp_repr*/ 1966c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 1967c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 1968c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1969c7df79e47da854931474f581618435fff0dd2448Guido van Rossumnewformobject(form) 1970c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_FORM *form; 1971c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1972c7df79e47da854931474f581618435fff0dd2448Guido van Rossum formobject *f; 1973c7df79e47da854931474f581618435fff0dd2448Guido van Rossum f = NEWOBJ(formobject, &Formtype); 1974c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (f == NULL) 1975c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 1976c7df79e47da854931474f581618435fff0dd2448Guido van Rossum f->ob_form = form; 1977c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return (object *)f; 1978c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 1979c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 19802df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 1981c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* The "fl" module */ 19822df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 1983c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 1984c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_make_form(dummy, args) 1985c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *dummy; 1986c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 1987c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 1988c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int type; 1989c7df79e47da854931474f581618435fff0dd2448Guido van Rossum float w, h; 1990c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_FORM *form; 1991fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "(iff)", &type, &w, &h)) 1992c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 1993c7df79e47da854931474f581618435fff0dd2448Guido van Rossum form = fl_bgn_form(type, w, h); 1994c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (form == NULL) { 1995c7df79e47da854931474f581618435fff0dd2448Guido van Rossum /* XXX Actually, cannot happen! */ 1996c7df79e47da854931474f581618435fff0dd2448Guido van Rossum err_nomem(); 1997c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 1998c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 1999c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_end_form(); 2000c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return newformobject(form); 2001c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2002c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 20032bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumstatic object * 20042bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumforms_activate_all_forms(f, args) 20052bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 20062bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 20072bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum{ 20082bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum fl_activate_all_forms(); 20092bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum INCREF(None); 20102bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum return None; 20112bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum} 20122bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum 20132bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumstatic object * 20142bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumforms_deactivate_all_forms(f, args) 20152bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 20162bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 20172bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum{ 20182bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum fl_deactivate_all_forms(); 20192bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum INCREF(None); 20202bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum return None; 20212bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum} 20222bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum 2023c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *my_event_callback = NULL; 2024c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2025c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2026c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_set_event_call_back(dummy, args) 2027c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *dummy; 2028c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2029c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2030c7df79e47da854931474f581618435fff0dd2448Guido van Rossum my_event_callback = args; 2031c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XINCREF(args); 2032c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2033c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2034c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2035c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2036c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2037c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_do_or_check_forms(dummy, args, func) 2038c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *dummy; 2039c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2040c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *(*func)(); 2041c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2042c7df79e47da854931474f581618435fff0dd2448Guido van Rossum FL_OBJECT *generic; 2043c7df79e47da854931474f581618435fff0dd2448Guido van Rossum genericobject *g; 2044c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *arg, *res; 2045c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2046c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getnoarg(args)) 2047c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 2048c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2049c7df79e47da854931474f581618435fff0dd2448Guido van Rossum for (;;) { 2050aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum BGN_SAVE 2051c7df79e47da854931474f581618435fff0dd2448Guido van Rossum generic = (*func)(); 2052743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 2053c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (generic == NULL) { 2054c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2055c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2056c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 2057c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (generic == FL_EVENT) { 2058c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int dev; 2059c7df79e47da854931474f581618435fff0dd2448Guido van Rossum short val; 2060c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (my_event_callback == NULL) 20617066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return newintobject(-1L); 2062c7df79e47da854931474f581618435fff0dd2448Guido van Rossum dev = fl_qread(&val); 2063e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum arg = mkvalue("(ih)", dev, val); 2064c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (arg == NULL) 2065c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 2066c7df79e47da854931474f581618435fff0dd2448Guido van Rossum res = call_object(my_event_callback, arg); 2067c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XDECREF(res); 2068c7df79e47da854931474f581618435fff0dd2448Guido van Rossum DECREF(arg); 2069c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (res == NULL) 2070c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; /* Callback raised exception */ 2071c7df79e47da854931474f581618435fff0dd2448Guido van Rossum continue; 2072c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 2073c7df79e47da854931474f581618435fff0dd2448Guido van Rossum g = findgeneric(generic); 2074c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (g == NULL) { 2075a9e7dc10816dcf5eda63d3ef00930ef9d55e0675Guido van Rossum /* Object not known to us (some dialogs cause this) */ 2076b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum continue; /* Ignore it */ 2077c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 2078c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (g->ob_callback == NULL) { 2079c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(g); 2080c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return ((object *) g); 2081c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 2082e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum arg = mkvalue("(OO)", (object *)g, g->ob_callback_arg); 2083e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum if (arg == NULL) 2084e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum return NULL; 2085c7df79e47da854931474f581618435fff0dd2448Guido van Rossum res = call_object(g->ob_callback, arg); 2086c7df79e47da854931474f581618435fff0dd2448Guido van Rossum XDECREF(res); 2087c7df79e47da854931474f581618435fff0dd2448Guido van Rossum DECREF(arg); 2088c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (res == NULL) 2089c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; /* Callback raised exception */ 2090c7df79e47da854931474f581618435fff0dd2448Guido van Rossum } 2091c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2092c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2093c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 20942df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_do_forms(dummy, args) 2095c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *dummy; 2096c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2097c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 20982df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_do_or_check_forms(dummy, args, fl_do_forms); 2099c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2100c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2101c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 21022df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_check_forms(dummy, args) 2103c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *dummy; 2104c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2105c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 21062df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_do_or_check_forms(dummy, args, fl_check_forms); 2107c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2108c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 21097066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object * 21107066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_do_only_forms(dummy, args) 21117066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *dummy; 21127066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *args; 21137066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{ 21147066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return forms_do_or_check_forms(dummy, args, fl_do_only_forms); 21157066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum} 21167066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum 21177066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object * 21187066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_check_only_forms(dummy, args) 21197066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *dummy; 21207066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *args; 21217066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{ 21227066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return forms_do_or_check_forms(dummy, args, fl_check_only_forms); 21237066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum} 21247066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum 21250374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#ifdef UNUSED 2126c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2127c7df79e47da854931474f581618435fff0dd2448Guido van Rossumfl_call(func, args) 2128c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2129c7df79e47da854931474f581618435fff0dd2448Guido van Rossum void (*func)(); 2130c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2131c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getnoarg(args)) 2132c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 2133c7df79e47da854931474f581618435fff0dd2448Guido van Rossum (*func)(); 2134c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2135c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2136c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 21370374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#endif 2138c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2139ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 2140ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 2141ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumforms_set_graphics_mode(dummy, args) 2142ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *dummy; 2143ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 2144ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 2145ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum int rgbmode, doublebuf; 2146ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 2147234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum if (!getargs(args, "(ii)", &rgbmode, &doublebuf)) 2148ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum return NULL; 2149ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum fl_set_graphics_mode(rgbmode,doublebuf); 2150ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum INCREF(None); 2151ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum return None; 2152ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 2153ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 2154ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object * 2155ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumforms_get_rgbmode(dummy, args) 2156ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *dummy; 2157ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum object *args; 2158ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{ 21597066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum extern int fl_rgbmode; 2160ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 2161ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum if (args != NULL) { 2162ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum err_badarg(); 2163ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum return NULL; 2164ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum } 21657066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return newintobject((long)fl_rgbmode); 2166ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum} 21677066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum 21687066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object * 21697066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_show_errors(dummy, args) 21707066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *dummy; 21717066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *args; 21727066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{ 21737066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum int show; 21747066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum if (!getargs(args, "i", &show)) 21757066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return NULL; 21767066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum fl_show_errors(show); 21777066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum INCREF(None); 21787066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return None; 21797066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum} 21807066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum 21817066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object * 21827066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_set_font_name(dummy, args) 21837066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *dummy; 21847066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum object *args; 21857066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{ 21867066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum int numb; 21877066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum char *name; 21887066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum if (!getargs(args, "(is)", &numb, &name)) 21897066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return NULL; 21907066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum fl_set_font_name(numb, name); 21917066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum INCREF(None); 21927066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum return None; 21937066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum} 21947066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum 2195ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 2196ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 2197ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum 2198c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2199c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qdevice(self, args) 2200c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2201c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2202c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2203aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum short arg1; 2204aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "h", &arg1)) 2205c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 22062df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_qdevice(arg1); 2207c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2208c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2209c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2210c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2211c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2212c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_unqdevice(self, args) 2213c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2214c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2215c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2216aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum short arg1; 2217aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "h", &arg1)) 2218c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 22192df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_unqdevice(arg1); 2220c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2221c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2222c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2223c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2224c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2225c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_isqueued(self, args) 2226c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2227c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2228c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 22290374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum long retval; 2230aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum short arg1; 2231aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "h", &arg1)) 2232c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 22332df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum retval = fl_isqueued(arg1); 2234c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 22350374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return newintobject(retval); 2236c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2237c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2238c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2239c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qtest(self, args) 2240c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2241c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2242c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2243c7df79e47da854931474f581618435fff0dd2448Guido van Rossum long retval; 22442df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum retval = fl_qtest(); 22450374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return newintobject(retval); 2246c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2247c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2248c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2249c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2250c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qread(self, args) 2251c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2252c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2253c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2254e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum int dev; 2255e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum short val; 2256743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen BGN_SAVE 2257e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum dev = fl_qread(&val); 2258743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 2259e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum return mkvalue("(ih)", dev, val); 2260c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2261c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2262c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2263c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qreset(self, args) 2264c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2265c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2266c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2267c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getnoarg(args)) return NULL; 2268c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 22690374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum fl_qreset(); 2270c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2271c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2272c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2273c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2274c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 2275c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qenter(self, args) 2276c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2277c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2278c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2279aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum short arg1, arg2; 2280aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "(hh)", &arg1, &arg2)) 2281c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 22822df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_qenter(arg1, arg2); 2283c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2284c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2285c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2286c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2287c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 22882df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_color(self, args) 2289c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2290c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2291c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2292c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int arg; 2293c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2294c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getintarg(args, &arg)) return NULL; 2295c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2296c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_color((short) arg); 2297c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2298c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2299c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2300c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2301c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2302c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 23032df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_mapcolor(self, args) 2304c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2305c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2306c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2307c7df79e47da854931474f581618435fff0dd2448Guido van Rossum int arg0, arg1, arg2, arg3; 2308c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2309fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum if (!getargs(args, "(iiii)", &arg0, &arg1, &arg2, &arg3)) 2310aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return NULL; 2311c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2312c7df79e47da854931474f581618435fff0dd2448Guido van Rossum fl_mapcolor(arg0, (short) arg1, (short) arg2, (short) arg3); 2313c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2314c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2315c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2316c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2317c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2318c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 23192df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_getmcolor(self, args) 2320c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2321c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2322c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 23230374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum int arg; 23240374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum short r, g, b; 2325c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2326c7df79e47da854931474f581618435fff0dd2448Guido van Rossum if (!getintarg(args, &arg)) return NULL; 2327c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 23282df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_getmcolor(arg, &r, &g, &b); 2329c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2330e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum return mkvalue("(hhh)", r, g, b); 2331c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2332c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2333c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object * 23342df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_mouse(self, args) 233575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum object *self; 233675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum object *args; 233775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{ 2338e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum float x, y; 233975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 234075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum if (!getnoarg(args)) return NULL; 234175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 23422df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_get_mouse(&x, &y); 234375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 2344e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum return mkvalue("(ff)", x, y); 234575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum} 234675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum 234775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object * 2348c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_tie(self, args) 2349c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *self; 2350c7df79e47da854931474f581618435fff0dd2448Guido van Rossum object *args; 2351c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2352aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum short arg1, arg2, arg3; 2353aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "(hhh)", &arg1, &arg2, &arg3)) 2354c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return NULL; 23552df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum fl_tie(arg1, arg2, arg3); 2356c7df79e47da854931474f581618435fff0dd2448Guido van Rossum INCREF(None); 2357c7df79e47da854931474f581618435fff0dd2448Guido van Rossum return None; 2358c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2359c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 23600374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 23612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_show_message(f, args) 23622bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 23632bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 23640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 2365fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *a, *b, *c; 23660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2367aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "(sss)", &a, &b, &c)) return NULL; 23680374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2369743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen BGN_SAVE 2370fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum fl_show_message(a, b, c); 2371743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 23720374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 23732df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 23740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum return None; 23750374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 23760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 23770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 2378b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossumforms_show_choice(f, args) 23792bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 23802bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 2381b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum{ 2382b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum char *m1, *m2, *m3, *b1, *b2, *b3; 2383b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum int nb; 2384b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum char *format; 23857066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum long rv; 2386b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum 2387b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum if (args == NULL || !is_tupleobject(args)) { 2388b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum err_badarg(); 2389b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum return NULL; 2390b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum } 2391b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum nb = gettuplesize(args) - 3; 2392b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum if (nb <= 0) { 2393b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum err_setstr(TypeError, "need at least one button label"); 2394b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum return NULL; 2395b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum } 2396b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum if (is_intobject(gettupleitem(args, 3))) { 2397b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum err_setstr(TypeError, 2398b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum "'number-of-buttons' argument not needed"); 2399b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum return NULL; 2400b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum } 2401b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum switch (nb) { 2402b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum case 1: format = "(ssss)"; break; 2403b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum case 2: format = "(sssss)"; break; 2404b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum case 3: format = "(ssssss)"; break; 2405b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum default: 2406b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum err_setstr(TypeError, "too many button labels"); 2407b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum return NULL; 2408b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum } 2409b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum 2410aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, format, &m1, &m2, &m3, &b1, &b2, &b3)) 2411b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum return NULL; 2412b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum 2413743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen BGN_SAVE 2414743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen rv = fl_show_choice(m1, m2, m3, nb, b1, b2, b3); 2415743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 2416743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen return newintobject(rv); 2417b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum} 2418b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum 2419b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossumstatic object * 24202df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_show_question(f, args) 24212bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 24222bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 24230374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 2424fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum int ret; 2425fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *a, *b, *c; 24260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2427aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "(sss)", &a, &b, &c)) return NULL; 24280374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2429743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen BGN_SAVE 2430fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum ret = fl_show_question(a, b, c); 2431743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 2432aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 2433aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return newintobject((long) ret); 24340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 24350374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 24360374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 24372df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_show_input(f, args) 24382bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 24392bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 24400374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 2441aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum char *str; 2442fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *a, *b; 24430374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2444234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum if (!getargs(args, "(ss)", &a, &b)) return NULL; 24450374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2446743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen BGN_SAVE 2447fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum str = fl_show_input(a, b); 2448743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 24492df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 24502df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (str == NULL) { 24512df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 24522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return None; 24532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 24542df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return newstringobject(str); 24550374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 24560374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 24570374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 24582df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_file_selector(f, args) 24592bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 24602bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 24610374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 2462aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum char *str; 2463fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum char *a, *b, *c, *d; 24640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2465aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum if (!getargs(args, "(ssss)", &a, &b, &c, &d)) return NULL; 24660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2467743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen BGN_SAVE 2468fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum str = fl_show_file_selector(a, b, c, d); 2469743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen END_SAVE 2470aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum 24712df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (str == NULL) { 24722df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 24732df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return None; 24742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 2475aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum return newstringobject(str); 24760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 24770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 24780374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 24790374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 24802df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_file_selector_func(args, func) 24812bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 24822bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum char *(*func)(); 24830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 24842df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum char *str; 24850374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 24862df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum str = (*func) (); 24872df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum 24882df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum if (str == NULL) { 24892df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum INCREF(None); 24902df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return None; 24912df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum } 24922df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return newstringobject(str); 24930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 24940374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 24950374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 24962df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_directory(f, args) 24972bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 24982bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 24990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 25002df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_file_selector_func(args, fl_get_directory); 25010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 25020374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 25030374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 25042df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_pattern(f, args) 25052bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 25062bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 25070374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 25082df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_file_selector_func(args, fl_get_pattern); 25090374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 25100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 25110374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object * 25122df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_filename(f, args) 25132bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *f; 25142bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum object *args; 25150374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{ 25162df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum return forms_file_selector_func(args, fl_get_filename); 25170374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum} 25180374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum 2519c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist forms_methods[] = { 2520c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* adm */ 2521c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"make_form", forms_make_form}, 25222bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum {"activate_all_forms", forms_activate_all_forms}, 25232bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum {"deactivate_all_forms",forms_deactivate_all_forms}, 2524c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* gl support wrappers */ 2525c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"qdevice", forms_qdevice}, 2526c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"unqdevice", forms_unqdevice}, 2527c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"isqueued", forms_isqueued}, 2528c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"qtest", forms_qtest}, 2529c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"qread", forms_qread}, 2530aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum/* {"blkqread", forms_blkqread}, */ 2531c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"qreset", forms_qreset}, 2532c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"qenter", forms_qenter}, 25330374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum {"get_mouse", forms_get_mouse}, 25340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum {"tie", forms_tie}, 2535c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* {"new_events", forms_new_events}, */ 2536aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"color", forms_color}, 2537c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"mapcolor", forms_mapcolor}, 2538c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"getmcolor", forms_getmcolor}, 2539c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* interaction */ 2540c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"do_forms", forms_do_forms}, 2541a9e7dc10816dcf5eda63d3ef00930ef9d55e0675Guido van Rossum {"do_only_forms", forms_do_only_forms}, 2542c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"check_forms", forms_check_forms}, 2543a9e7dc10816dcf5eda63d3ef00930ef9d55e0675Guido van Rossum {"check_only_forms", forms_check_only_forms}, 2544c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {"set_event_call_back", forms_set_event_call_back}, 2545c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* goodies */ 2546aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"show_message", forms_show_message}, 2547aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"show_question", forms_show_question}, 2548aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"show_choice", forms_show_choice}, 2549aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"show_input", forms_show_input}, 2550aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"show_file_selector", forms_file_selector}, 2551aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"file_selector", forms_file_selector}, /* BW compat */ 2552aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_directory", forms_get_directory}, 2553aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_pattern", forms_get_pattern}, 2554aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum {"get_filename", forms_get_filename}, 2555ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 2556ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"set_graphics_mode", forms_set_graphics_mode}, 2557ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum {"get_rgbmode", forms_get_rgbmode}, 25587066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"show_errors", forms_show_errors}, 25597066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum {"set_font_name", forms_set_font_name}, 2560ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 2561c7df79e47da854931474f581618435fff0dd2448Guido van Rossum {NULL, NULL} /* sentinel */ 2562c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}; 2563c7df79e47da854931474f581618435fff0dd2448Guido van Rossum 2564c7df79e47da854931474f581618435fff0dd2448Guido van Rossumvoid 2565c7df79e47da854931474f581618435fff0dd2448Guido van Rossuminitfl() 2566c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{ 2567c7df79e47da854931474f581618435fff0dd2448Guido van Rossum initmodule("fl", forms_methods); 25682df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum foreground(); 2569ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#ifndef FL_V15 2570ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum fl_init(); 2571ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum#endif /* !FL_V15 */ 2572c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} 2573