flmodule.c revision f1dc56632881fe4e5beed047580bf927679f3669
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
27f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum/* This code works with FORMS version 2.2a.
28f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum   FORMS can be ftp'ed from ftp.cs.ruu.nl (131.211.80.17), directory
29f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum   /pub/SGI/FORMS. */
30ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
31743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen/* A half-hearted attempt has been made to allow programs using this
32743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * module to exploit parallelism (through the threads module). No provisions
33743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * have been made for multiple threads to use this module at the same time,
34743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * though. So, a program with a forms thread and a non-forms thread will work
35743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * fine but a program with two threads using forms will probably crash (unless
36743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * the program takes precaution to ensure that only one thread can be in
37743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * this module at any time). This will have to be fixed some time.
38743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen * (A fix will probably also have to synchronise with the gl module).
39743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen */
40743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen
41c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "forms.h"
42c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
43c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "allobjects.h"
44c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "import.h"
45c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "modsupport.h"
46c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#include "structmember.h"
47ff4949eeee7f86117d4a69599777ff5564315e39Guido van Rossum#include "ceval.h"
48c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
49c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Generic Forms Objects */
50c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
51c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypedef struct {
52c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	OB_HEAD
53c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *ob_generic;
54c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	struct methodlist *ob_methods;
55c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *ob_callback;
56c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *ob_callback_arg;
57c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} genericobject;
58c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
592df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumextern typeobject GenericObjecttype; /* Forward */
602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum#define is_genericobject(g) ((g)->ob_type == &GenericObjecttype)
622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
632df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* List of all objects (XXX this should be a hash table on address...) */
64c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
65c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *allgenerics = NULL;
662df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic int nfreeslots = 0;
672df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
682df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* Add an object to the list of known objects */
69c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
70c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic void
71c7df79e47da854931474f581618435fff0dd2448Guido van Rossumknowgeneric(g)
72c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
73c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	int i, n;
752df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	/* Create the list if it doesn't already exist */
76c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (allgenerics == NULL) {
77c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		allgenerics = newlistobject(0);
78c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (allgenerics == NULL) {
79c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			err_clear();
802df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum			return; /* Too bad, live without allgenerics... */
812df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		}
822df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
832df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (nfreeslots > 0) {
842df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		/* Search the list for reusable slots (NULL items) */
852df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		/* XXX This can be made faster! */
862df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		n = getlistsize(allgenerics);
872df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		for (i = 0; i < n; i++) {
882df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum			if (getlistitem(allgenerics, i) == NULL) {
892df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum				INCREF(g);
902df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum				setlistitem(allgenerics, i, (object *)g);
912df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum				nfreeslots--;
922df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum				return;
932df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum			}
94c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
952df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		/* Strange... no free slots found... */
962df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		nfreeslots = 0;
97c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
982df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	/* No free entries, append new item to the end */
99c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	addlistitem(allgenerics, (object *)g);
100c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
101c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1022df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* Find an object in the list of known objects */
1032df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
104c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic genericobject *
105c7df79e47da854931474f581618435fff0dd2448Guido van Rossumfindgeneric(generic)
106c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *generic;
107c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
108c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int i, n;
109c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
110c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
111c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (allgenerics == NULL)
1122df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return NULL; /* No objects known yet */
113c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	n = getlistsize(allgenerics);
114c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	for (i = 0; i < n; i++) {
115c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		g = (genericobject *)getlistitem(allgenerics, i);
1162df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		if (g != NULL && g->ob_generic == generic)
117c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			return g;
118c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
119c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return NULL; /* Unknown object */
120c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
121c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
122aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum/* Remove an object from the list of known objects */
123aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
124aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumstatic void
125aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumforgetgeneric(g)
126aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	genericobject *g;
127aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
128aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	int i, n;
129aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
130aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	XDECREF(g->ob_callback);
131aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	g->ob_callback = NULL;
132aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	XDECREF(g->ob_callback_arg);
133aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	g->ob_callback_arg = NULL;
134aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (allgenerics == NULL)
135aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		return; /* No objects known yet */
136aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	n = getlistsize(allgenerics);
137aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	for (i = 0; i < n; i++) {
138aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		if (g == (genericobject *)getlistitem(allgenerics, i)) {
139aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			setlistitem(allgenerics, i, (object *)NULL);
140aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			nfreeslots++;
141aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			break;
142aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		}
143aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	}
144aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum}
145aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
1462df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum/* Called when a form is about to be freed --
1472df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum   remove all the objects that we know about from it. */
1482df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
1492df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic void
1502df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumreleaseobjects(form)
1512df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	FL_FORM *form;
1522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum{
1532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	int i, n;
1542df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	genericobject *g;
1552df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
1562df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (allgenerics == NULL)
1572df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return; /* No objects known yet */
1582df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	n = getlistsize(allgenerics);
1592df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	for (i = 0; i < n; i++) {
1602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		g = (genericobject *)getlistitem(allgenerics, i);
1612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		if (g != NULL && g->ob_generic->form == form) {
1622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum			fl_delete_object(g->ob_generic);
163aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			/* The object is now unreachable for
164aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			   do_forms and check_forms, so
165aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			   delete it from the list of known objects */
166aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			XDECREF(g->ob_callback);
167aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			g->ob_callback = NULL;
168aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			XDECREF(g->ob_callback_arg);
169aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			g->ob_callback_arg = NULL;
170aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			setlistitem(allgenerics, i, (object *)NULL);
171aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			nfreeslots++;
1722df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		}
1732df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
1742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum}
1752df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
176c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
177c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Methods of generic objects */
178c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
179c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
180c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_set_call_back(g, args)
181c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
182c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
183c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
184c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (args == NULL) {
185c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		XDECREF(g->ob_callback);
186c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		XDECREF(g->ob_callback_arg);
187c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		g->ob_callback = NULL;
188c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		g->ob_callback_arg = NULL;
189c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
190c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	else {
191c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (!is_tupleobject(args) || gettuplesize(args) != 2) {
192c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			err_badarg();
193c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			return NULL;
194c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
195c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		XDECREF(g->ob_callback);
196c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		XDECREF(g->ob_callback_arg);
197c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		g->ob_callback = gettupleitem(args, 0);
198c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		INCREF(g->ob_callback);
199c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		g->ob_callback_arg = gettupleitem(args, 1);
200c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		INCREF(g->ob_callback_arg);
201c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
202c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
203c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
204c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
205c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
206c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
207c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_call(g, args, func)
208c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
209c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
210c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	void (*func)(FL_OBJECT *);
211c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
212c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getnoarg(args))
213c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
214c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	(*func)(g->ob_generic);
215c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
216c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
217c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
218c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
219c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2202df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumgeneric_delete_object(g, args)
2212df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	genericobject *g;
2222df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	object *args;
2232df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum{
2242df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	object *res;
2252df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	res = generic_call(g, args, fl_delete_object);
226aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (res != NULL)
227aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		forgetgeneric(g);
2282df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return res;
2292df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum}
2302df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
2312df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic object *
232c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_show_object(g, args)
233c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
234c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
235c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
236c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_call(g, args, fl_show_object);
237c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
238c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
239c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
240c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_hide_object(g, args)
241c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
242c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
243c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
244c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_call(g, args, fl_hide_object);
245c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
246c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
247c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
248c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_redraw_object(g, args)
249c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
250c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
251c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
252c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_call(g, args, fl_redraw_object);
253c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
254c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
255c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
256c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_freeze_object(g, args)
257c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
258c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
259c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
260c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_call(g, args, fl_freeze_object);
261c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
262c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
263c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
264c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_unfreeze_object(g, args)
265c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
266c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
267c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
268c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_call(g, args, fl_unfreeze_object);
269c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
270c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
271f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
272f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumgeneric_activate_object(g, args)
273f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	genericobject *g;
274f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
275f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
276f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return generic_call(g, args, fl_activate_object);
277f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
278f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
279f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
280f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumgeneric_deactivate_object(g, args)
281f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	genericobject *g;
282f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
283f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
284f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return generic_call(g, args, fl_deactivate_object);
285f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
286f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
287f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
288f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumgeneric_set_object_shortcut(g, args)
289f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	genericobject *g;
290f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
291f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
292f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	char *str;
293f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	if (!getargs(args, "s", &str))
294f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum		return NULL;
295f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	fl_set_object_shortcut(g->ob_generic, str);
296f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	INCREF(None);
297f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return None;
298f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
299f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
300c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist generic_methods[] = {
301c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_call_back",	generic_set_call_back},
30232db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{"delete_object",	generic_delete_object},
303c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"show_object",		generic_show_object},
304c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"hide_object",		generic_hide_object},
305c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"redraw_object",	generic_redraw_object},
306c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"freeze_object",	generic_freeze_object},
307c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"unfreeze_object",	generic_unfreeze_object},
308f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	{"activate_object",	generic_activate_object},
309f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	{"deactivate_object",	generic_deactivate_object},
310f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	{"set_object_shortcut",	generic_set_object_shortcut},
3110374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	{NULL,			NULL}		/* sentinel */
312c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
313c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
314c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic void
315c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_dealloc(g)
316c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
317c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
3182df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_free_object(g->ob_generic);
319aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	XDECREF(g->ob_callback);
320aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	XDECREF(g->ob_callback_arg);
321c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	DEL(g);
322c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
323c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
324c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#define OFF(x) offsetof(FL_OBJECT, x)
325c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
326c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct memberlist generic_memberlist[] = {
327c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"objclass",	T_INT,		OFF(objclass),	RO},
328c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"type",	T_INT,		OFF(type),	RO},
329c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"boxtype",	T_INT,		OFF(boxtype)},
330c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"x",		T_FLOAT,	OFF(x)},
331c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"y",		T_FLOAT,	OFF(y)},
332c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"w",		T_FLOAT,	OFF(w)},
333c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"h",		T_FLOAT,	OFF(h)},
334c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"col1",	T_INT,		OFF(col1)},
335c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"col2",	T_INT,		OFF(col2)},
336c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"align",	T_INT,		OFF(align)},
337c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"lcol",	T_INT,		OFF(lcol)},
338c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"lsize",	T_FLOAT,	OFF(lsize)},
339c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	/* "label" is treated specially! */
340c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"lstyle",	T_INT,		OFF(lstyle)},
341c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"pushed",	T_INT,		OFF(pushed),	RO},
342c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"focus",	T_INT,		OFF(focus),	RO},
343c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"belowmouse",	T_INT,		OFF(belowmouse),RO},
344f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum/*	{"frozen",	T_INT,		OFF(frozen),	RO},	*/
3457066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"active",	T_INT,		OFF(active)},
3467066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"input",	T_INT,		OFF(input)},
347c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"visible",	T_INT,		OFF(visible),	RO},
3487066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"radio",	T_INT,		OFF(radio)},
3497066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"automatic",	T_INT,		OFF(automatic)},
350c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL}	/* Sentinel */
351c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
352c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
353d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum#undef OFF
354d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum
355c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
356c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_getattr(g, name)
357c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
358c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	char *name;
359c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
360c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *meth;
3612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
3622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	/* XXX Ought to special-case name "__methods__" */
363c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (g-> ob_methods) {
3640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum		meth = findmethod(g->ob_methods, (object *)g, name);
3650374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum		if (meth != NULL) return meth;
3660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum		err_clear();
367aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	}
368c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
369c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	meth = findmethod(generic_methods, (object *)g, name);
370c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (meth != NULL)
371c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return meth;
372c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	err_clear();
373c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
374c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	/* "label" is an exception, getmember only works for char pointers,
375c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	   not for char arrays */
376c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (strcmp(name, "label") == 0)
377c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return newstringobject(g->ob_generic->label);
378c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
379c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return getmember((char *)g->ob_generic, generic_memberlist, name);
380c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
381c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
382c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic int
383c7df79e47da854931474f581618435fff0dd2448Guido van Rossumgeneric_setattr(g, name, v)
384c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
385c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	char *name;
386c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *v;
387c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
388c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int ret;
389c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
390c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (v == NULL) {
391c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		err_setstr(TypeError, "can't delete forms object attributes");
3923dd8c9895ec5ffca4c8a2288b54dc209068cb434Guido van Rossum		return -1;
393c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
394c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
395c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	/* "label" is an exception: setmember doesn't set strings;
396c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	   and FORMS wants you to call a function to set the label */
397c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (strcmp(name, "label") == 0) {
398c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (!is_stringobject(v)) {
399c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			err_setstr(TypeError, "label attr must be string");
4003dd8c9895ec5ffca4c8a2288b54dc209068cb434Guido van Rossum			return -1;
401c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
402c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		fl_set_object_label(g->ob_generic, getstringvalue(v));
403c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return 0;
404c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
405c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
406c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	ret = setmember((char *)g->ob_generic, generic_memberlist, name, v);
407c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
408c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	/* Rather than calling all the various set_object_* functions,
409c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	   we call fl_redraw_object here.  This is sometimes redundant
410c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	   but I doubt that's a big problem */
411c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (ret == 0)
412c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		fl_redraw_object(g->ob_generic);
413c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
414c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return ret;
415c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
416c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
417aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumstatic object *
418aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumgeneric_repr(g)
419aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	genericobject *g;
420aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
421aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	char buf[100];
422aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	sprintf(buf, "<FORMS_object at %lx, objclass=%d>",
423aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		(long)g, g->ob_generic->objclass);
424aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return newstringobject(buf);
425aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum}
426aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
427c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypeobject GenericObjecttype = {
428c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	OB_HEAD_INIT(&Typetype)
429c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*ob_size*/
430aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	"FORMS_object",		/*tp_name*/
431c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	sizeof(genericobject),	/*tp_size*/
432c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*tp_itemsize*/
433c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	/* methods */
434c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	generic_dealloc,	/*tp_dealloc*/
435c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*tp_print*/
436c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	generic_getattr,	/*tp_getattr*/
437c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	generic_setattr,	/*tp_setattr*/
438c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*tp_compare*/
439aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	generic_repr,		/*tp_repr*/
440c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
441c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
442c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
443c7df79e47da854931474f581618435fff0dd2448Guido van Rossumnewgenericobject(generic, methods)
444c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *generic;
445c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	struct methodlist *methods;
446c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
447c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
448c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	g = NEWOBJ(genericobject, &GenericObjecttype);
449c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (g == NULL)
450c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
451c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	g-> ob_generic = generic;
452c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	g->ob_methods = methods;
453c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	g->ob_callback = NULL;
454c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	g->ob_callback_arg = NULL;
455c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	knowgeneric(g);
456c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return (object *)g;
457c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
458c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
459c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/**********************************************************************/
460c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Some common calling sequences */
461c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
462c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, float) */
463c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
464c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INf (func, obj, args)
465abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	void (*func)(FL_OBJECT *, float);
4660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
4670374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
468c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
4690374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	float parameter;
470c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
471fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args, "f", &parameter)) return NULL;
472c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
4730374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	(*func) (obj, parameter);
474c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
4750374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
4760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
477c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
478c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
479c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, float) */
480c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
481c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INfINf (func, obj, args)
482abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	void (*func)(FL_OBJECT *, float, float);
4830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
4840374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
485c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
4860374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	float par1, par2;
487c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
488fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args, "(ff)", &par1, &par2)) return NULL;
489c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
4900374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	(*func) (obj, par1, par2);
491c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
4920374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
4930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
494c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
495c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
496c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, int) */
497c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
498c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INi (func, obj, args)
499abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	void (*func)(FL_OBJECT *, int);
5000374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
5010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
502c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
5030374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	int parameter;
504c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
505fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getintarg(args, &parameter)) return NULL;
506c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
5070374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	(*func) (obj, parameter);
508c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
5090374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
5100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
511c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
512c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
513ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum/* void func (object, char) */
514ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
515ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumcall_forms_INc (func, obj, args)
516ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	void (*func)(FL_OBJECT *, int);
517ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	FL_OBJECT *obj;
518ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
519ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
520fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *a;
521ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
522fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getstrarg(args, &a)) return NULL;
523ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
524fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	(*func) (obj, a[0]);
525ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
526ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	INCREF(None);
527ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	return None;
528ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
529ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
530c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* void func (object, string) */
531c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
532c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INstr (func, obj, args)
533abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	void (*func)(FL_OBJECT *, char *);
5340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
5350374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
536aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
537fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *a;
538aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
539fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getstrarg(args, &a)) return NULL;
540c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
541fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	(*func) (obj, a);
542c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
5430374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
5440374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
545c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
546c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
547c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
548f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum/* void func (object, int, string) */
549c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
550c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INiINstr (func, obj, args)
551abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	void (*func)(FL_OBJECT *, int, char *);
5520374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
5530374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
554c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
555fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *b;
556fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	int a;
5570374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
558234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum	if (!getargs(args, "(is)", &a, &b)) return NULL;
5590374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
560fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	(*func) (obj, a, b);
5610374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
5620374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
5630374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
564c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
565c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
5660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#ifdef UNUSED
567f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum/* void func (object, int, int) */
568c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
569c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_INiINi (func, obj, args)
570f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	void (*func)(FL_OBJECT *, int, int);
5710374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
5720374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
573c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
5740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	int par1, par2;
5750374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
576234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum	if (!getargs(args, "(ii)", &par1, &par2)) return NULL;
5770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
5780374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	(*func) (obj, par1, par2);
5790374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
5800374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
5810374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
582c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
5830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#endif
584c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
585c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* int func (object) */
586c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
587c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_Ri (func, obj, args)
5880374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	int (*func)(FL_OBJECT *);
5890374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
5900374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
591c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
5920374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	int retval;
5930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
5940374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	if (!getnoarg(args)) return NULL;
5950374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
5960374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	retval = (*func) (obj);
5970374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
5980374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return newintobject ((long) retval);
599c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
600c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
601c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* char * func (object) */
602c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
603c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_Rstr (func, obj, args)
6040374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	char * (*func)(FL_OBJECT *);
6050374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
6060374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
607aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
6080374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	char *str;
6090374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
610fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getnoarg(args)) return NULL;
6110374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
6120374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	str = (*func) (obj);
6130374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
6142df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (str == NULL) {
6152df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		INCREF(None);
6162df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return None;
6172df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
6180374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return newstringobject (str);
619c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
620c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
621c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* int func (object) */
622c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
623c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_Rf (func, obj, args)
6240374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	float (*func)(FL_OBJECT *);
6250374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	FL_OBJECT *obj;
6260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
627c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
6280374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	float retval;
6290374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
6300374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	if (!getnoarg(args)) return NULL;
6310374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
6320374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	retval = (*func) (obj);
6330374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
6340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return newfloatobject (retval);
635c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
636c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
637c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
638c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_OUTfOUTf (func, obj, args)
639abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	void (*func)(FL_OBJECT *, float *, float *);
640c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *obj;
641c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
642c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
643aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	float f1, f2;
6440374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
645aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getnoarg(args)) return NULL;
6460374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
647c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	(*func) (obj, &f1, &f2);
648c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
649e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	return mkvalue("(ff)", f1, f2);
650c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
651c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
6520374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#ifdef UNUSED
653c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
654c7df79e47da854931474f581618435fff0dd2448Guido van Rossumcall_forms_OUTf (func, obj, args)
655aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	void (*func)(FL_OBJECT *, float *);
656c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *obj;
657c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
658c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
659aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	float f;
660c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
661aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getnoarg(args)) return NULL;
662c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
663c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	(*func) (obj, &f);
664c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
665c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return newfloatobject (f);
666c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
6670374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#endif
668c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
669c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/**********************************************************************/
670c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : browser */
671c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
672c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
673c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_browser_topline(g, args)
674c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
675c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
676c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
6770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args);
678c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
679c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
680c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
681c7df79e47da854931474f581618435fff0dd2448Guido van Rossumclear_browser(g, args)
682c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
683c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
684c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
6850374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return generic_call (g, args, fl_clear_browser);
686c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
687c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
688c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
689c7df79e47da854931474f581618435fff0dd2448Guido van Rossumadd_browser_line (g, args)
6900374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
6910374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
692c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
6930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args);
694c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
695c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
696c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
697c7df79e47da854931474f581618435fff0dd2448Guido van Rossumaddto_browser (g, args)
6980374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
6990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
700c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INstr (fl_addto_browser, g-> ob_generic, args);
702c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
703c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
704c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
705c7df79e47da854931474f581618435fff0dd2448Guido van Rossuminsert_browser_line (g, args)
7060374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
7070374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
708c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7090374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INiINstr (fl_insert_browser_line,
7100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum				    g-> ob_generic, args);
711c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
712c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
713c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
714c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdelete_browser_line (g, args)
715c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
716c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
717c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7180374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args);
719c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
720c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
721c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
722c7df79e47da854931474f581618435fff0dd2448Guido van Rossumreplace_browser_line (g, args)
7230374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
7240374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
725c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INiINstr (fl_replace_browser_line,
7270374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum				    g-> ob_generic, args);
728c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
729c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
730c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
731c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_browser_line(g, args)
732c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
733c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
734c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
735c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int i;
736c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	char *str;
737c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
738c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getintarg(args, &i))
739c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
740c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
741c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	str = fl_get_browser_line (g->ob_generic, i);
742c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
7432df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (str == NULL) {
7442df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		INCREF(None);
7452df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return None;
7462df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
747c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return newstringobject (str);
748c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
749c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
750c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
751c7df79e47da854931474f581618435fff0dd2448Guido van Rossumload_browser (g, args)
7520374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
7530374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
754c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
755abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	/* XXX strictly speaking this is wrong since fl_load_browser
756abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	   XXX returns int, not void */
7570374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INstr (fl_load_browser, g-> ob_generic, args);
758c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
759c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
760c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
761c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_browser_maxline(g, args)
762c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
763c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
764c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7650374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic, args);
766c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
767c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
768c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
769c7df79e47da854931474f581618435fff0dd2448Guido van Rossumselect_browser_line (g, args)
770c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
771c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
772c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7730374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_select_browser_line, g-> ob_generic, args);
774c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
775c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
776c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
777c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdeselect_browser_line (g, args)
778c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
779c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
780c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7810374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args);
782c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
783c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
784c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
785c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdeselect_browser (g, args)
786c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
787c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
788c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
7890374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return generic_call (g, args, fl_deselect_browser);
790c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
791c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
792c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
793c7df79e47da854931474f581618435fff0dd2448Guido van Rossumisselected_browser_line (g, args)
7940374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
7950374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
796c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
797c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int i, j;
7980374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
799c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getintarg(args, &i))
800c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
8010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
802c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	j = fl_isselected_browser_line (g->ob_generic, i);
8030374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
804c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return newintobject (j);
805c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
806c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
807c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
808c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_browser (g, args)
8090374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
8100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
811c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
8120374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_Ri (fl_get_browser, g-> ob_generic, args);
813c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
814c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
815c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
816c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_browser_fontsize (g, args)
817c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
818c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
819c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
8200374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args);
821c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
822c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
823c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
824c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_browser_fontstyle (g, args)
825c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
826c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
827c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
8280374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args);
829c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
830c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
831ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
832ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_browser_specialkey (g, args)
833ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	genericobject *g;
834ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
835ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
836ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args);
837ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
838ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
839c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist browser_methods[] = {
840ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_browser_topline",		set_browser_topline},
841ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"clear_browser",		clear_browser},
842ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"add_browser_line",		add_browser_line},
843ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"addto_browser",		addto_browser},
844ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"insert_browser_line",		insert_browser_line},
845ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"delete_browser_line",		delete_browser_line},
846ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"replace_browser_line",	replace_browser_line},
847ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"get_browser_line",		get_browser_line},
848ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"load_browser",		load_browser},
849ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"get_browser_maxline",		get_browser_maxline},
850ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"select_browser_line",		select_browser_line},
851ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"deselect_browser_line",	deselect_browser_line},
852ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"deselect_browser",		deselect_browser},
853ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"isselected_browser_line",	isselected_browser_line},
854ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"get_browser",			get_browser},
855ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_browser_fontsize",	set_browser_fontsize},
856ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_browser_fontstyle",	set_browser_fontstyle},
857ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_browser_specialkey",	set_browser_specialkey},
858ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{NULL,				NULL}		/* sentinel */
859c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
860c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
861c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: button */
862c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
863c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
864c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_button(g, args)
865c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
866c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
867c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
8680374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_set_button, g-> ob_generic, args);
869c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
870c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
871c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
872c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_button(g, args)
873c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
874c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
875c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
8760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_Ri (fl_get_button, g-> ob_generic, args);
877c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
878f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
879f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
880f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumget_button_numb(g, args)
881f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	genericobject *g;
882f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
883f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
884f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return call_forms_Ri (fl_get_button_numb, g-> ob_generic, args);
885f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
886f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
887ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
888ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_button_shortcut(g, args)
889ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	genericobject *g;
890ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
891ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
892ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args);
893ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
894c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
895c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist button_methods[] = {
896c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_button",		set_button},
897c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"get_button",		get_button},
898f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	{"get_button_numb",	get_button_numb},
899ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_button_shortcut",	set_button_shortcut},
900c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
901c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
902c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
903c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: choice */
904c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
905c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
906c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_choice(g, args)
907c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
908c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
909c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
9100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_set_choice, g-> ob_generic, args);
911c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
912c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
913c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
914c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_choice(g, args)
915c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
916c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
917c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
9180374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_Ri (fl_get_choice, g-> ob_generic, args);
919c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
920c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
921c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
922c7df79e47da854931474f581618435fff0dd2448Guido van Rossumclear_choice (g, args)
9230374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9240374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
925c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
9260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return generic_call (g, args, fl_clear_choice);
927c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
928c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
929c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
930c7df79e47da854931474f581618435fff0dd2448Guido van Rossumaddto_choice (g, args)
9310374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9320374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
933aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
9340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INstr (fl_addto_choice, g-> ob_generic, args);
935c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
936c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
937c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
938c7df79e47da854931474f581618435fff0dd2448Guido van Rossumreplace_choice (g, args)
9390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9400374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
941aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
9420374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args);
943c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
944c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
945c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
946c7df79e47da854931474f581618435fff0dd2448Guido van Rossumdelete_choice (g, args)
9470374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9480374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
949c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
9500374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_delete_choice, g-> ob_generic, args);
951c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
952c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
953c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
954c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_choice_text (g, args)
9550374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9560374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
957aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
9580374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_Rstr (fl_get_choice_text, g-> ob_generic, args);
959c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
960c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
961c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
962c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_choice_fontsize (g, args)
9630374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
965c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
9660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args);
967c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
968c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
969c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
970c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_choice_fontstyle (g, args)
9710374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	genericobject *g;
9720374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
973c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
9740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args);
975c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
976c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
977c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist choice_methods[] = {
978c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_choice",		set_choice},
979c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"get_choice",		get_choice},
980c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"clear_choice",	clear_choice},
981aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"addto_choice",	addto_choice},
982aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"replace_choice",	replace_choice},
983aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"delete_choice",	delete_choice},
984aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_choice_text",	get_choice_text},
985c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_choice_fontsize", set_choice_fontsize},
986c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_choice_fontstyle",set_choice_fontstyle},
987c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
988c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
989c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
990c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Clock */
991c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
992c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
993c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_clock(g, args)
994c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
995c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
996c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
997c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int i0, i1, i2;
998c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
999c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getnoarg(args))
1000c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
1001c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1002c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	fl_get_clock (g->ob_generic, &i0, &i1, &i2);
1003c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1004e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	return mkvalue("(iii)", i0, i1, i2);
1005c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1006c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1007c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist clock_methods[] = {
1008c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"get_clock",		get_clock},
1009c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1010c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1011c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1012c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* CLass : Counters */
1013c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1014c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1015c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_counter_value(g, args)
1016c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1017c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1018c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1019aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rf (fl_get_counter_value, g-> ob_generic, args);
1020c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1021c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1022c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1023c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_value (g, args)
1024c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1025c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1026c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1027aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_counter_value, g-> ob_generic, args);
1028c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1029c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1030c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1031c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_precision (g, args)
1032c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1033c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1034c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1035aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args);
1036c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1037c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1038c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1039c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_bounds (g, args)
1040c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1041c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1042c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1043aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args);
1044c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1045c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1046c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1047c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_step (g, args)
1048c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1049c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1050c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1051aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args);
1052c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1053c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1054c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1055c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_counter_return (g, args)
1056c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1057c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1058c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
10590374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return call_forms_INi (fl_set_counter_return, g-> ob_generic, args);
1060c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1061c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1062c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist counter_methods[] = {
1063ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_counter_value",		set_counter_value},
1064ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"get_counter_value",		get_counter_value},
1065ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_counter_bounds",		set_counter_bounds},
1066ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_counter_step",		set_counter_step},
1067ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_counter_precision",	set_counter_precision},
1068ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_counter_return",		set_counter_return},
1069ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{NULL,				NULL}		/* sentinel */
1070c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1071c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1072c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1073c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: Dials */
1074c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1075c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1076ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumget_dial_value(g, args)
1077c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1078c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1079c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1080aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rf (fl_get_dial_value, g-> ob_generic, args);
1081c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1082c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1083c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1084c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_dial_value (g, args)
1085c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1086c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1087c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1088aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_dial_value, g-> ob_generic, args);
1089c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1090c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1091c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1092c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_dial_bounds (g, args)
1093c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1094c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1095c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1096aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args);
1097c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1098c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1099c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1100c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_dial_bounds (g, args)
1101c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1102c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1103c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1104aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic, args);
1105c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1106c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1107ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
1108ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_dial_step (g, args)
1109ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	genericobject *g;
1110ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
1111ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
1112aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_dial_step, g-> ob_generic, args);
1113ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
1114ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
1115c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist dial_methods[] = {
1116aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_dial_value",	set_dial_value},
1117aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_dial_value",	get_dial_value},
1118aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_dial_bounds",	set_dial_bounds},
1119aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_dial_bounds",	get_dial_bounds},
1120aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_dial_step",	set_dial_step},
1121c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1122c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1123c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1124c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Input */
1125c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1126c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1127c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_input (g, args)
1128c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1129c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1130c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1131aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INstr (fl_set_input, g-> ob_generic, args);
1132c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1133c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1134c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1135c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_input (g, args)
1136c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1137c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1138c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1139aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rstr (fl_get_input, g-> ob_generic, args);
1140c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1141c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1142c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1143c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_input_color (g, args)
1144c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1145c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1146c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1147aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args);
1148c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1149c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1150ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
1151ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_input_return (g, args)
1152ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	genericobject *g;
1153ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
1154ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
1155aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INi (fl_set_input_return, g-> ob_generic, args);
1156ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
1157ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
1158c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist input_methods[] = {
1159aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_input",		set_input},
1160aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_input",		get_input},
1161aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_input_color",	set_input_color},
1162aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_input_return",	set_input_return},
1163c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1164c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1165c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1166c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1167c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class : Menu */
1168c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1169c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1170c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_menu (g, args)
1171c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1172c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1173c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1174abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	return call_forms_INstr (fl_set_menu, g-> ob_generic, args);
1175c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1176c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1177c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1178c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_menu (g, args)
1179c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1180c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1181c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1182abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	/* XXX strictly speaking this is wrong since fl_get_menu
1183abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	   XXX returns long, not int */
1184abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	return call_forms_Ri (fl_get_menu, g-> ob_generic, args);
1185c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1186c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1187c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
11888b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossumget_menu_text (g, args)
11898b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum	genericobject *g;
11908b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum	object *args;
11918b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum{
11928b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum	return call_forms_Rstr (fl_get_menu_text, g-> ob_generic, args);
11938b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum}
11948b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum
11958b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossumstatic object *
1196c7df79e47da854931474f581618435fff0dd2448Guido van Rossumaddto_menu (g, args)
1197c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1198c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1199c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1200abe5835b4f308f87db83a3ae091e3273d8705497Guido van Rossum	return call_forms_INstr (fl_addto_menu, g-> ob_generic, args);
1201c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1202c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1203c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist menu_methods[] = {
1204aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_menu",		set_menu},
1205aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_menu",		get_menu},
12068b17d6bd89cd79820c76bd88bc064e44fc03a1bdGuido van Rossum	{"get_menu_text",	get_menu_text},
1207aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"addto_menu",		addto_menu},
1208c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1209c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1210c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1211c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1212c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class: Sliders */
1213c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1214c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1215ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumget_slider_value(g, args)
1216c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1217c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1218c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1219aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rf (fl_get_slider_value, g-> ob_generic, args);
1220c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1221c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1222c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1223c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_value (g, args)
1224c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1225c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1226c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1227aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_slider_value, g-> ob_generic, args);
1228c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1229c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1230c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1231c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_bounds (g, args)
1232c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1233c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1234c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1235aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_slider_bounds, g-> ob_generic, args);
1236c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1237c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1238c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1239c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_slider_bounds (g, args)
1240c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1241c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1242c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1243c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return call_forms_OUTfOUTf(fl_get_slider_bounds, g-> ob_generic, args);
1244c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1245c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1246c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1247c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_return (g, args)
1248c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1249c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1250c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1251aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_slider_return, g-> ob_generic, args);
1252c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1253c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1254c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1255c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_size (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_size, g-> ob_generic, args);
1260c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1261c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1262c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1263c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_slider_precision (g, args)
1264c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1265c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1266c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1267aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INi (fl_set_slider_precision, g-> ob_generic, args);
1268c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1269c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1270ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
1271ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumset_slider_step (g, args)
1272ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	genericobject *g;
1273ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
1274ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
1275aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_slider_step, g-> ob_generic, args);
1276ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
1277ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
1278ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
1279c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist slider_methods[] = {
1280aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_slider_value",	set_slider_value},
1281aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_slider_value",	get_slider_value},
1282aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_slider_bounds",	set_slider_bounds},
1283aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_slider_bounds",	get_slider_bounds},
1284aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_slider_return",	set_slider_return},
1285aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_slider_size",	set_slider_size},
1286c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_slider_precision",set_slider_precision},
1287ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_slider_step",	set_slider_step},
1288c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1289c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1290c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1291c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1292c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_xvalue (g, args)
1293c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1294c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1295c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1296aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_positioner_xvalue, g-> ob_generic, args);
1297c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1298c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1299c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1300c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_xbounds (g, args)
1301c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1302c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1303c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1304aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_positioner_xbounds,
1305aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum				  g-> ob_generic, args);
1306c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1307c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1308c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1309c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_yvalue (g, args)
1310c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1311c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1312c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1313aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_positioner_yvalue, g-> ob_generic, args);
1314c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1315c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1316c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1317c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_positioner_ybounds (g, args)
1318c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1319c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1320c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1321aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INfINf (fl_set_positioner_ybounds,
1322aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum				  g-> ob_generic, args);
1323c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1324c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1325c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1326c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_xvalue (g, args)
1327c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1328c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1329c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1330aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rf (fl_get_positioner_xvalue, g-> ob_generic, args);
1331c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1332c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1333c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1334c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_xbounds (g, args)
1335c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1336c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1337c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1338aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_OUTfOUTf (fl_get_positioner_xbounds,
1339aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum				    g-> ob_generic, args);
1340c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1341c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1342c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1343c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_yvalue (g, args)
1344c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1345c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1346c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1347aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rf (fl_get_positioner_yvalue, g-> ob_generic, args);
1348c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1349c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1350c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1351c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_positioner_ybounds (g, args)
1352c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1353c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1354c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1355aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_OUTfOUTf (fl_get_positioner_ybounds,
1356aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum				    g-> ob_generic, args);
1357c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1358c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1359c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist positioner_methods[] = {
1360c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_positioner_xvalue",		set_positioner_xvalue},
1361c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_positioner_yvalue",		set_positioner_yvalue},
1362aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_positioner_xbounds",		set_positioner_xbounds},
1363aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_positioner_ybounds",		set_positioner_ybounds},
1364c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"get_positioner_xvalue",		get_positioner_xvalue},
1365c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"get_positioner_yvalue",		get_positioner_yvalue},
1366aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_positioner_xbounds",		get_positioner_xbounds},
1367aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_positioner_ybounds",		get_positioner_ybounds},
1368c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1369c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1370c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1371c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Class timer */
1372c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1373c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1374c7df79e47da854931474f581618435fff0dd2448Guido van Rossumset_timer (g, args)
1375c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1376c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1377c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1378aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_INf (fl_set_timer, g-> ob_generic, args);
1379c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1380c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1381c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1382c7df79e47da854931474f581618435fff0dd2448Guido van Rossumget_timer (g, args)
1383c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
1384c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1385c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1386aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return call_forms_Rf (fl_get_timer, g-> ob_generic, args);
1387c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1388c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1389c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist timer_methods[] = {
1390c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_timer",		set_timer},
1391c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"get_timer",		get_timer},
1392c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1393c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1394c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1395c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* Form objects */
1396c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1397c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypedef struct {
1398c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	OB_HEAD
1399c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_FORM *ob_form;
1400c7df79e47da854931474f581618435fff0dd2448Guido van Rossum} formobject;
1401c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1402c7df79e47da854931474f581618435fff0dd2448Guido van Rossumextern typeobject Formtype; /* Forward */
1403c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1404c7df79e47da854931474f581618435fff0dd2448Guido van Rossum#define is_formobject(v) ((v)->ob_type == &Formtype)
1405c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1406c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1407c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_show_form(f, args)
1408c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1409c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1410c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1411c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int place, border;
1412fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *name;
1413fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args, "(iis)", &place, &border, &name))
1414c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
1415fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	fl_show_form(f->ob_form, place, border, name);
1416c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
1417c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
1418c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1419c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1420c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1421c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_call(func, f, args)
1422c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_FORM *f;
1423c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1424c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	void (*func)(FL_FORM *);
1425c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1426c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getnoarg(args)) return NULL;
1427c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1428c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	(*func)(f);
1429c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1430c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
1431c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
1432c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1433c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1434c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
14352df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_call_INiINi(func, f, args)
1436c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_FORM *f;
1437c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1438c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	void (*func)(FL_FORM *, int, int);
1439c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1440aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	int a, b;
1441c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1442234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum	if (!getargs(args, "(ii)", &a, &b)) return NULL;
1443c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1444c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	(*func)(f, a, b);
1445c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1446c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
1447c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
1448c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1449c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1450c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1451f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumform_call_INfINf(func, f, args)
1452f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	FL_FORM *f;
1453f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
1454f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	void (*func)(FL_FORM *, float, float);
1455f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
1456f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	float a, b;
1457f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
1458f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	if (!getargs(args, "(ff)", &a, &b)) return NULL;
1459f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
1460f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	(*func)(f, a, b);
1461f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
1462f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	INCREF(None);
1463f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return None;
1464f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
1465f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
1466f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
1467c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_hide_form(f, args)
1468c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1469c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1470c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
14712df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return form_call(fl_hide_form, f-> ob_form, args);
1472c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1473c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1474c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1475c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_redraw_form(f, args)
1476c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1477c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1478aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
14792df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return form_call(fl_redraw_form, f-> ob_form, args);
1480c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1481c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1482c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
14832df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_object(f, args)
1484c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1485c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1486c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1487aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	genericobject *g;
14882df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (args == NULL || !is_genericobject(args)) {
14892df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		err_badarg();
14902df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return NULL;
14912df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
1492aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	g = (genericobject *)args;
1493aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (findgeneric(g->ob_generic) != NULL) {
1494aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		err_setstr(RuntimeError,
1495aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum			   "add_object of object already in a form");
1496aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		return NULL;
1497aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	}
1498aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	fl_add_object(f->ob_form, g->ob_generic);
1499aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	knowgeneric(g);
15002df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
15012df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	INCREF(None);
15022df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return None;
1503c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1504c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1505c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
15062df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_set_form_position(f, args)
15072df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	formobject *f;
15082df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	object *args;
15092df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum{
15102df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return form_call_INiINi(fl_set_form_position, f-> ob_form, args);
15112df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum}
15122df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
15132df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumstatic object *
1514f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumform_set_form_size(f, args)
1515f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	formobject *f;
1516f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
1517f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
1518f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return form_call_INiINi(fl_set_form_size, f-> ob_form, args);
1519f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
1520f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
1521f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
1522f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumform_scale_form(f, args)
1523f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	formobject *f;
1524f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	object *args;
1525f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum{
1526f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	return form_call_INfINf(fl_scale_form, f-> ob_form, args);
1527f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum}
1528f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum
1529f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossumstatic object *
15302df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumgeneric_add_object(f, args, func, internal_methods)
1531c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1532c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1533c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *(*func)(int, float, float, float, float, char*);
1534aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	struct methodlist *internal_methods;
1535c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
15362df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	int type;
15372df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	float x, y, w, h;
1538fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *name;
15392df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	FL_OBJECT *obj;
1540c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1541fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args,"(iffffs)", &type,&x,&y,&w,&h,&name))
15422df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return NULL;
1543aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
15442df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_addto_form (f-> ob_form);
1545aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
1546fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	obj = (*func) (type, x, y, w, h, name);
1547c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
15482df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_end_form();
1549c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
15502df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (obj == NULL) {
15512df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		err_nomem();
15522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return NULL;
15532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
1554c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
15552df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return newgenericobject (obj, internal_methods);
1556c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1557c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1558c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1559c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_button(f, args)
1560aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1561aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1562c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1563c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_add_object(f, args, fl_add_button, button_methods);
1564c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1565c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1566c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1567c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_lightbutton(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_lightbutton, button_methods);
1572c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1573c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1574c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1575c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_roundbutton(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_roundbutton, button_methods);
1580c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1581c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1582c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1583c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_menu (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_menu, menu_methods);
1588c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1589c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1590c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1591c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_slider(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_slider, slider_methods);
1596c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1597c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1598c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1599c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_add_valslider(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_valslider, slider_methods);
1604c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1605c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1606c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16072df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_dial(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_dial, dial_methods);
1612c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1613c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1614c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16152df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_counter(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_counter, counter_methods);
1620c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1621c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1622c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16232df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_clock(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_clock, clock_methods);
1628c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1629c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1630c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16312df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_box(f, args)
1632aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1633aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1634c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
16350374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return generic_add_object(f, args, fl_add_box,
16360374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum				  (struct methodlist *)NULL);
1637c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1638c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1639c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16402df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_choice(f, args)
1641aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1642aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1643c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1644c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_add_object(f, args, fl_add_choice, choice_methods);
1645c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1646c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1647c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16482df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_browser(f, args)
1649aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1650aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1651c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1652c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_add_object(f, args, fl_add_browser, browser_methods);
1653c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1654c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1655c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16562df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_positioner(f, args)
1657aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1658aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1659c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1660c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_add_object(f, args, fl_add_positioner, positioner_methods);
1661c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1662c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1663c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16642df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_input(f, args)
1665aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1666aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1667c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1668c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_add_object(f, args, fl_add_input, input_methods);
1669c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1670c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1671c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16722df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_text(f, args)
1673aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1674aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1675c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
16760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return generic_add_object(f, args, fl_add_text,
16770374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum				  (struct methodlist *)NULL);
1678c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1679c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1680c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
16812df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_add_timer(f, args)
1682aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1683aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	object *args;
1684c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1685c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return generic_add_object(f, args, fl_add_timer, timer_methods);
1686c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1687c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1688c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1689c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_freeze_form(f, args)
1690c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1691c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1692c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1693aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return form_call(fl_freeze_form, f-> ob_form, args);
1694c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1695c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1696c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1697c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_unfreeze_form(f, args)
1698c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1699c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1700c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
17012df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return form_call(fl_unfreeze_form, f-> ob_form, args);
1702c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1703c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1704c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1705c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_activate_form(f, args)
1706c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1707c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1708c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
17092df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return form_call(fl_activate_form, f-> ob_form, args);
1710c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1711c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1712c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1713c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_deactivate_form(f, args)
1714c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1715c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1716c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
17172df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return form_call(fl_deactivate_form, f-> ob_form, args);
1718c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1719c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
172075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object *
17212df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_bgn_group(f, args)
17220374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	formobject *f;
17230374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
17240374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
17252df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	FL_OBJECT *obj;
17262df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
17272df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_addto_form(f-> ob_form);
17282df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	obj = fl_bgn_group();
17292df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_end_form();
17302df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
17312df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (obj == NULL) {
17322df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		err_nomem();
17332df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return NULL;
17342df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
17352df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
17362df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return newgenericobject (obj, (struct methodlist *) NULL);
17370374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
17380374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
17390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
17402df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_end_group(f, args)
17410374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	formobject *f;
17420374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	object *args;
17430374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
17442df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_addto_form(f-> ob_form);
17450374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	fl_end_group();
17462df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_end_form();
17470374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	INCREF(None);
17480374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
17490374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
17500374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
17510374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
17522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_find_first_or_last(func, f, args)
175375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	FL_OBJECT *(*func)(FL_FORM *, int, float, float);
17540374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	formobject *f;
175575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	object *args;
175675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{
175775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	int type;
175875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	float mx, my;
175975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	FL_OBJECT *generic;
176075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	genericobject *g;
176175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
1762fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args, "(iff)", &type, &mx, &my)) return NULL;
176375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
17640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	generic = (*func) (f-> ob_form, type, mx, my);
176575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
176675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	if (generic == NULL)
176775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	{
176875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum		INCREF(None);
176975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum		return None;
177075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	}
177175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
177275cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	g = findgeneric(generic);
177375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	if (g == NULL) {
177475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum		err_setstr(RuntimeError,
17752df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum			   "forms_find_{first|last} returns unknown object");
177675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum		return NULL;
177775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	}
177875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	INCREF(g);
17792df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return (object *) g;
178075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum}
178175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
178275cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object *
17832df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_find_first(f, args)
17840374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	formobject *f;
178575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	object *args;
178675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{
17872df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_find_first_or_last(fl_find_first, f, args);
178875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum}
178975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
179075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object *
17912df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumform_find_last(f, args)
17920374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	formobject *f;
179375cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	object *args;
179475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{
17952df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_find_first_or_last(fl_find_last, f, args);
179675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum}
179775cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
17987066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object *
17997066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumform_set_object_focus(f, args)
18007066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	formobject *f;
18017066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *args;
18027066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{
18037066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	genericobject *g;
18047066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	if (args == NULL || !is_genericobject(args)) {
18057066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum		err_badarg();
18067066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum		return NULL;
18077066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	}
18087066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	g = (genericobject *)args;
18097066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	fl_set_object_focus(f->ob_form, g->ob_generic);
18107066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	INCREF(None);
18117066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	return None;
18127066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum}
18137066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum
1814c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist form_methods[] = {
1815c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* adm */
1816c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"show_form",		form_show_form},
1817c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"hide_form",		form_hide_form},
1818aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"redraw_form",		form_redraw_form},
1819aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"set_form_position",	form_set_form_position},
1820f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	{"set_form_size",	form_set_form_size},
1821f1dc56632881fe4e5beed047580bf927679f3669Guido van Rossum	{"scale_form",		form_scale_form},
1822c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"freeze_form",		form_freeze_form},
1823c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"unfreeze_form",	form_unfreeze_form},
1824c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"activate_form",	form_activate_form},
1825c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"deactivate_form",	form_deactivate_form},
18260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	{"bgn_group",		form_bgn_group},
18270374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	{"end_group",		form_end_group},
182875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	{"find_first",		form_find_first},
182975cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	{"find_last",		form_find_last},
18307066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"set_object_focus",	form_set_object_focus},
1831c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1832c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* basic objects */
1833aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_button",		form_add_button},
1834aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum/*	{"add_bitmap",		form_add_bitmap}, */
1835c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"add_lightbutton",	form_add_lightbutton},
1836aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_roundbutton",	form_add_roundbutton},
1837aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_menu",		form_add_menu},
1838aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_slider",		form_add_slider},
1839aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_positioner",	form_add_positioner},
1840aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_valslider",	form_add_valslider},
1841aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_dial",		form_add_dial},
1842aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_counter",		form_add_counter},
1843aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_box",		form_add_box},
1844aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_clock",		form_add_clock},
1845aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_choice",		form_add_choice},
1846aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_browser",		form_add_browser},
1847aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_input",		form_add_input},
1848aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_timer",		form_add_timer},
1849aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"add_text",		form_add_text},
1850c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
1851c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1852c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1853c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic void
1854c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_dealloc(f)
1855c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1856c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
18572df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	releaseobjects(f->ob_form);
1858336b591e557fe6c4ba22f01d47976967fe389decGuido van Rossum	if (f->ob_form->visible)
1859336b591e557fe6c4ba22f01d47976967fe389decGuido van Rossum		fl_hide_form(f->ob_form);
18602df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_free_form(f->ob_form);
1861c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	DEL(f);
1862c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1863c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1864d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum#define OFF(x) offsetof(FL_FORM, x)
1865d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum
186632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossumstatic struct memberlist form_memberlist[] = {
186732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{"window",	T_LONG,		OFF(window),	RO},
186832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{"w",		T_FLOAT,	OFF(w)},
186932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{"h",		T_FLOAT,	OFF(h)},
18707066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"x",		T_FLOAT,	OFF(x),		RO},
18717066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"y",		T_FLOAT,	OFF(y),		RO},
187232db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{"deactivated",	T_INT,		OFF(deactivated)},
18737066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"visible",	T_INT,		OFF(visible),	RO},
18747066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"frozen",	T_INT,		OFF(frozen),	RO},
187532db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{"doublebuf",	T_INT,		OFF(doublebuf)},
187632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	{NULL}	/* Sentinel */
187732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum};
187832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum
1879d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum#undef OFF
1880d97f048ae825d852bba1eea361ac41cb428cd3b0Guido van Rossum
1881c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1882c7df79e47da854931474f581618435fff0dd2448Guido van Rossumform_getattr(f, name)
1883c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1884c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	char *name;
1885c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
188632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	object *meth;
188732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum
188832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	meth = findmethod(form_methods, (object *)f, name);
188932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	if (meth != NULL)
189032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum		return meth;
189132db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	err_clear();
189232db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	return getmember((char *)f->ob_form, form_memberlist, name);
189332db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum}
189432db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum
189532db5e391bf06d3e745127f6eb600947e399f878Guido van Rossumstatic int
189632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossumform_setattr(f, name, v)
189732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	formobject *f;
189832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	char *name;
189932db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	object *v;
190032db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum{
190132db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	int ret;
190232db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum
190332db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	if (v == NULL) {
190432db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum		err_setstr(TypeError, "can't delete form attributes");
190532db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum		return NULL;
190632db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	}
190732db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum
190832db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	return setmember((char *)f->ob_form, form_memberlist, name, v);
1909c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1910c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1911aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumstatic object *
1912aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossumform_repr(f)
1913aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	formobject *f;
1914aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum{
1915aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	char buf[100];
1916aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	sprintf(buf, "<FORMS_form at %lx, window=%ld>",
1917aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		(long)f, f->ob_form->window);
1918aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return newstringobject(buf);
1919aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum}
1920aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
1921c7df79e47da854931474f581618435fff0dd2448Guido van Rossumtypeobject Formtype = {
1922c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	OB_HEAD_INIT(&Typetype)
1923c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*ob_size*/
1924aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	"FORMS_form",		/*tp_name*/
1925c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	sizeof(formobject),	/*tp_size*/
1926c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*tp_itemsize*/
1927c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	/* methods */
1928c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	form_dealloc,		/*tp_dealloc*/
1929c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*tp_print*/
1930c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	form_getattr,		/*tp_getattr*/
193132db5e391bf06d3e745127f6eb600947e399f878Guido van Rossum	form_setattr,		/*tp_setattr*/
1932c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	0,			/*tp_compare*/
1933aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	form_repr,		/*tp_repr*/
1934c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
1935c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1936c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1937c7df79e47da854931474f581618435fff0dd2448Guido van Rossumnewformobject(form)
1938c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_FORM *form;
1939c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1940c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	formobject *f;
1941c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	f = NEWOBJ(formobject, &Formtype);
1942c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (f == NULL)
1943c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
1944c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	f->ob_form = form;
1945c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return (object *)f;
1946c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1947c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
19482df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
1949c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* The "fl" module */
19502df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
1951c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1952c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_make_form(dummy, args)
1953c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *dummy;
1954c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1955c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1956c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int type;
1957c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	float w, h;
1958c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_FORM *form;
1959fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args, "(iff)", &type, &w, &h))
1960c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
1961c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	form = fl_bgn_form(type, w, h);
1962c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (form == NULL) {
1963c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		/* XXX Actually, cannot happen! */
1964c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		err_nomem();
1965c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
1966c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
1967c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	fl_end_form();
1968c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return newformobject(form);
1969c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
1970c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
19712bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumstatic object *
19722bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumforms_activate_all_forms(f, args)
19732bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
19742bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
19752bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum{
19762bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	fl_activate_all_forms();
19772bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	INCREF(None);
19782bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	return None;
19792bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum}
19802bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum
19812bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumstatic object *
19822bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossumforms_deactivate_all_forms(f, args)
19832bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
19842bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
19852bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum{
19862bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	fl_deactivate_all_forms();
19872bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	INCREF(None);
19882bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	return None;
19892bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum}
19902bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum
1991c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *my_event_callback = NULL;
1992c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
1993c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
1994c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_set_event_call_back(dummy, args)
1995c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *dummy;
1996c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
1997c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
1998c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	my_event_callback = args;
1999c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	XINCREF(args);
2000c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2001c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2002c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2003c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2004c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2005c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_do_or_check_forms(dummy, args, func)
2006c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *dummy;
2007c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2008c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *(*func)();
2009c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2010c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	FL_OBJECT *generic;
2011c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	genericobject *g;
2012c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *arg, *res;
2013c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2014c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getnoarg(args))
2015c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
2016c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2017c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	for (;;) {
2018aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		BGN_SAVE
2019c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		generic = (*func)();
2020743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen		END_SAVE
2021c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (generic == NULL) {
2022c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			INCREF(None);
2023c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			return None;
2024c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
2025c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (generic == FL_EVENT) {
2026c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			int dev;
2027c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			short val;
2028c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			if (my_event_callback == NULL)
20297066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum				return newintobject(-1L);
2030c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			dev = fl_qread(&val);
2031e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum			arg = mkvalue("(ih)", dev, val);
2032c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			if (arg == NULL)
2033c7df79e47da854931474f581618435fff0dd2448Guido van Rossum				return NULL;
2034c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			res = call_object(my_event_callback, arg);
2035c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			XDECREF(res);
2036c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			DECREF(arg);
2037c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			if (res == NULL)
2038c7df79e47da854931474f581618435fff0dd2448Guido van Rossum				return NULL; /* Callback raised exception */
2039c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			continue;
2040c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
2041c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		g = findgeneric(generic);
2042c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (g == NULL) {
2043a9e7dc10816dcf5eda63d3ef00930ef9d55e0675Guido van Rossum			/* Object not known to us (some dialogs cause this) */
2044b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum			continue; /* Ignore it */
2045c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
2046c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (g->ob_callback == NULL) {
2047c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			INCREF(g);
2048c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			return ((object *) g);
2049c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		}
2050e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum		arg = mkvalue("(OO)", (object *)g, g->ob_callback_arg);
2051e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum		if (arg == NULL)
2052e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum			return NULL;
2053c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		res = call_object(g->ob_callback, arg);
2054c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		XDECREF(res);
2055c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		DECREF(arg);
2056c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		if (res == NULL)
2057c7df79e47da854931474f581618435fff0dd2448Guido van Rossum			return NULL; /* Callback raised exception */
2058c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	}
2059c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2060c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2061c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
20622df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_do_forms(dummy, args)
2063c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *dummy;
2064c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2065c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
20662df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_do_or_check_forms(dummy, args, fl_do_forms);
2067c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2068c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2069c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
20702df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_check_forms(dummy, args)
2071c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *dummy;
2072c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2073c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
20742df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_do_or_check_forms(dummy, args, fl_check_forms);
2075c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2076c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
20777066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object *
20787066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_do_only_forms(dummy, args)
20797066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *dummy;
20807066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *args;
20817066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{
20827066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	return forms_do_or_check_forms(dummy, args, fl_do_only_forms);
20837066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum}
20847066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum
20857066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object *
20867066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_check_only_forms(dummy, args)
20877066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *dummy;
20887066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *args;
20897066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{
20907066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	return forms_do_or_check_forms(dummy, args, fl_check_only_forms);
20917066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum}
20927066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum
20930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#ifdef UNUSED
2094c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2095c7df79e47da854931474f581618435fff0dd2448Guido van Rossumfl_call(func, args)
2096c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2097c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	void (*func)();
2098c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2099c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getnoarg(args))
2100c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
2101c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	(*func)();
2102c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2103c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2104c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
21050374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum#endif
2106c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2107ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
2108ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumforms_set_graphics_mode(dummy, args)
2109ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *dummy;
2110ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
2111ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
2112ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	int rgbmode, doublebuf;
2113ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
2114234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum	if (!getargs(args, "(ii)", &rgbmode, &doublebuf))
2115ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum		return NULL;
2116ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	fl_set_graphics_mode(rgbmode,doublebuf);
2117ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	INCREF(None);
2118ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	return None;
2119ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
2120ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
2121ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumstatic object *
2122ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossumforms_get_rgbmode(dummy, args)
2123ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *dummy;
2124ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	object *args;
2125ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum{
21267066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	extern int fl_rgbmode;
2127ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
2128ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	if (args != NULL) {
2129ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum		err_badarg();
2130ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum		return NULL;
2131ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	}
21327066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	return newintobject((long)fl_rgbmode);
2133ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum}
21347066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum
21357066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object *
21367066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_show_errors(dummy, args)
21377066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *dummy;
21387066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *args;
21397066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{
21407066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	int show;
21417066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	if (!getargs(args, "i", &show))
21427066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum		return NULL;
21437066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	fl_show_errors(show);
21447066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	INCREF(None);
21457066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	return None;
21467066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum}
21477066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum
21487066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumstatic object *
21497066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossumforms_set_font_name(dummy, args)
21507066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *dummy;
21517066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	object *args;
21527066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum{
21537066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	int numb;
21547066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	char *name;
21557066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	if (!getargs(args, "(is)", &numb, &name))
21567066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum		return NULL;
21577066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	fl_set_font_name(numb, name);
21587066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	INCREF(None);
21597066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	return None;
21607066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum}
21617066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum
2162ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum
2163c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2164c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qdevice(self, args)
2165c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2166c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2167c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2168aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	short arg1;
2169aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "h", &arg1))
2170c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
21712df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_qdevice(arg1);
2172c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2173c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2174c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2175c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2176c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2177c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_unqdevice(self, args)
2178c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2179c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2180c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2181aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	short arg1;
2182aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "h", &arg1))
2183c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
21842df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_unqdevice(arg1);
2185c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2186c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2187c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2188c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2189c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2190c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_isqueued(self, args)
2191c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2192c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2193c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
21940374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	long retval;
2195aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	short arg1;
2196aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "h", &arg1))
2197c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
21982df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	retval = fl_isqueued(arg1);
2199c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
22000374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return newintobject(retval);
2201c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2202c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2203c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2204c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qtest(self, args)
2205c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2206c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2207c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2208c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	long retval;
22092df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	retval = fl_qtest();
22100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return newintobject(retval);
2211c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2212c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2213c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2214c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2215c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qread(self, args)
2216c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2217c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2218c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2219e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	int dev;
2220e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	short val;
2221743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	BGN_SAVE
2222e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	dev = fl_qread(&val);
2223743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	END_SAVE
2224e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	return mkvalue("(ih)", dev, val);
2225c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2226c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2227c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2228c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qreset(self, args)
2229c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2230c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2231c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2232c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getnoarg(args)) return NULL;
2233c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
22340374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	fl_qreset();
2235c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2236c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2237c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2238c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2239c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
2240c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_qenter(self, args)
2241c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2242c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2243c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2244aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	short arg1, arg2;
2245aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "(hh)", &arg1, &arg2))
2246c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
22472df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_qenter(arg1, arg2);
2248c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2249c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2250c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2251c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2252c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
22532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_color(self, args)
2254c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2255c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2256c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2257c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int arg;
2258c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2259c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getintarg(args, &arg)) return NULL;
2260c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2261c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	fl_color((short) arg);
2262c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2263c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2264c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2265c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2266c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2267c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
22682df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_mapcolor(self, args)
2269c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2270c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2271c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2272c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	int arg0, arg1, arg2, arg3;
2273c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2274fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	if (!getargs(args, "(iiii)", &arg0, &arg1, &arg2, &arg3))
2275aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum		return NULL;
2276c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2277c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	fl_mapcolor(arg0, (short) arg1, (short) arg2, (short) arg3);
2278c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2279c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2280c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2281c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2282c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2283c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
22842df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_getmcolor(self, args)
2285c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2286c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2287c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
22880374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	int arg;
22890374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	short r, g, b;
2290c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2291c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	if (!getintarg(args, &arg)) return NULL;
2292c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
22932df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_getmcolor(arg, &r, &g, &b);
2294c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2295e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	return mkvalue("(hhh)", r, g, b);
2296c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2297c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2298c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic object *
22992df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_mouse(self, args)
230075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	object *self;
230175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	object *args;
230275cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum{
2303e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	float x, y;
230475cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
230575cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum	if (!getnoarg(args)) return NULL;
230675cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
23072df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_get_mouse(&x, &y);
230875cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
2309e537240c252ff678d49451ee6f80fa934653a724Guido van Rossum	return mkvalue("(ff)", x, y);
231075cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum}
231175cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossum
231275cc8980e826d5c8759a5b001bbf7726d017607aGuido van Rossumstatic object *
2313c7df79e47da854931474f581618435fff0dd2448Guido van Rossumforms_tie(self, args)
2314c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *self;
2315c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	object *args;
2316c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2317aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	short arg1, arg2, arg3;
2318aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "(hhh)", &arg1, &arg2, &arg3))
2319c7df79e47da854931474f581618435fff0dd2448Guido van Rossum		return NULL;
23202df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	fl_tie(arg1, arg2, arg3);
2321c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	INCREF(None);
2322c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	return None;
2323c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2324c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
23250374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
23262df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_show_message(f, args)
23272bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
23282bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
23290374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
2330fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *a, *b, *c;
23310374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2332aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "(sss)", &a, &b, &c)) return NULL;
23330374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2334743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	BGN_SAVE
2335fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	fl_show_message(a, b, c);
2336743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	END_SAVE
23370374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
23382df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	INCREF(None);
23390374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	return None;
23400374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
23410374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
23420374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
2343b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossumforms_show_choice(f, args)
23442bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
23452bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
2346b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum{
2347b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	char *m1, *m2, *m3, *b1, *b2, *b3;
2348b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	int nb;
2349b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	char *format;
23507066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	long rv;
2351b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum
2352b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	if (args == NULL || !is_tupleobject(args)) {
2353b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		err_badarg();
2354b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		return NULL;
2355b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	}
2356b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	nb = gettuplesize(args) - 3;
2357b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	if (nb <= 0) {
2358b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		err_setstr(TypeError, "need at least one button label");
2359b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		return NULL;
2360b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	}
2361b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	if (is_intobject(gettupleitem(args, 3))) {
2362b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		err_setstr(TypeError,
2363b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum			   "'number-of-buttons' argument not needed");
2364b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		return NULL;
2365b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	}
2366b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	switch (nb) {
2367b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	case 1: format = "(ssss)"; break;
2368b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	case 2: format = "(sssss)"; break;
2369b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	case 3: format = "(ssssss)"; break;
2370b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	default:
2371b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		err_setstr(TypeError, "too many button labels");
2372b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		return NULL;
2373b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum	}
2374b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum
2375aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, format, &m1, &m2, &m3, &b1, &b2, &b3))
2376b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum		return NULL;
2377b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum
2378743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	BGN_SAVE
2379743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	rv = fl_show_choice(m1, m2, m3, nb, b1, b2, b3);
2380743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	END_SAVE
2381743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	return newintobject(rv);
2382b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum}
2383b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossum
2384b3a0e4c842c5dd207518a95e2c9f0e68b79e0364Guido van Rossumstatic object *
23852df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_show_question(f, args)
23862bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
23872bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
23880374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
2389fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	int ret;
2390fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *a, *b, *c;
23910374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2392aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "(sss)", &a, &b, &c)) return NULL;
23930374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2394743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	BGN_SAVE
2395fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	ret = fl_show_question(a, b, c);
2396743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	END_SAVE
2397aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
2398aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return newintobject((long) ret);
23990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24000374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24010374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
24022df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_show_input(f, args)
24032bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
24042bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
24050374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
2406aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	char *str;
2407fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *a, *b;
24080374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2409234f942aefb779efa6cfb7225e21d16a3f7e80f7Guido van Rossum	if (!getargs(args, "(ss)", &a, &b)) return NULL;
24100374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2411743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	BGN_SAVE
2412fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	str = fl_show_input(a, b);
2413743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	END_SAVE
24142df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
24152df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (str == NULL) {
24162df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		INCREF(None);
24172df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return None;
24182df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
24192df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return newstringobject(str);
24200374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24210374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24220374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
24232df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_file_selector(f, args)
24242bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
24252bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
24260374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
2427aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	char *str;
2428fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	char *a, *b, *c, *d;
24290374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2430aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	if (!getargs(args, "(ssss)", &a, &b, &c, &d)) return NULL;
24310374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2432743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	BGN_SAVE
2433fc58e58cb784fcc002fd233a8799f4b804457637Guido van Rossum	str = fl_show_file_selector(a, b, c, d);
2434743db36cd208c6f212a6b534e6bb8ee9256505adJack Jansen	END_SAVE
2435aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum
24362df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (str == NULL) {
24372df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		INCREF(None);
24382df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return None;
24392df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
2440aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	return newstringobject(str);
24410374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24420374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24430374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24440374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
24452df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_file_selector_func(args, func)
24462bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
24472bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	char *(*func)();
24480374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
24492df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	char *str;
24500374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24512df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	str = (*func) ();
24522df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum
24532df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	if (str == NULL) {
24542df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		INCREF(None);
24552df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum		return None;
24562df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	}
24572df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return newstringobject(str);
24580374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24590374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24600374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
24612df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_directory(f, args)
24622bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
24632bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
24640374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
24652df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_file_selector_func(args, fl_get_directory);
24660374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24670374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24680374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
24692df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_pattern(f, args)
24702bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
24712bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
24720374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
24732df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_file_selector_func(args, fl_get_pattern);
24740374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24750374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
24760374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossumstatic object *
24772df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossumforms_get_filename(f, args)
24782bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *f;
24792bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	object *args;
24800374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum{
24812df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	return forms_file_selector_func(args, fl_get_filename);
24820374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum}
24830374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum
2484c7df79e47da854931474f581618435fff0dd2448Guido van Rossumstatic struct methodlist forms_methods[] = {
2485c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* adm */
2486c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"make_form",		forms_make_form},
24872bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	{"activate_all_forms",	forms_activate_all_forms},
24882bac4d33683bb16050908a875b5b67818e167aa4Guido van Rossum	{"deactivate_all_forms",forms_deactivate_all_forms},
2489c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* gl support wrappers */
2490c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"qdevice",		forms_qdevice},
2491c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"unqdevice",		forms_unqdevice},
2492c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"isqueued",		forms_isqueued},
2493c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"qtest",		forms_qtest},
2494c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"qread",		forms_qread},
2495aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum/*	{"blkqread",		forms_blkqread}, */
2496c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"qreset",		forms_qreset},
2497c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"qenter",		forms_qenter},
24980374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	{"get_mouse",		forms_get_mouse},
24990374711fb331c87ee74dedea778c69ea1d3a0d81Guido van Rossum	{"tie",			forms_tie},
2500c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/*	{"new_events",		forms_new_events}, */
2501aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"color",		forms_color},
2502c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"mapcolor",		forms_mapcolor},
2503c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"getmcolor",		forms_getmcolor},
2504c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* interaction */
2505c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"do_forms",		forms_do_forms},
2506a9e7dc10816dcf5eda63d3ef00930ef9d55e0675Guido van Rossum	{"do_only_forms",	forms_do_only_forms},
2507c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"check_forms",		forms_check_forms},
2508a9e7dc10816dcf5eda63d3ef00930ef9d55e0675Guido van Rossum	{"check_only_forms",	forms_check_only_forms},
2509c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{"set_event_call_back",	forms_set_event_call_back},
2510c7df79e47da854931474f581618435fff0dd2448Guido van Rossum/* goodies */
2511aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"show_message",	forms_show_message},
2512aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"show_question",	forms_show_question},
2513aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"show_choice",		forms_show_choice},
2514aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"show_input",		forms_show_input},
2515aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"show_file_selector",	forms_file_selector},
2516aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"file_selector",	forms_file_selector}, /* BW compat */
2517aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_directory",	forms_get_directory},
2518aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_pattern",		forms_get_pattern},
2519aa7ca2dc1a50e379a8173e13edb0a640c5402276Guido van Rossum	{"get_filename",	forms_get_filename},
2520ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"set_graphics_mode",	forms_set_graphics_mode},
2521ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	{"get_rgbmode",		forms_get_rgbmode},
25227066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"show_errors",		forms_show_errors},
25237066dd75c5ee8385135541d03fb8edd8939ad740Guido van Rossum	{"set_font_name",	forms_set_font_name},
2524c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	{NULL,			NULL}		/* sentinel */
2525c7df79e47da854931474f581618435fff0dd2448Guido van Rossum};
2526c7df79e47da854931474f581618435fff0dd2448Guido van Rossum
2527c7df79e47da854931474f581618435fff0dd2448Guido van Rossumvoid
2528c7df79e47da854931474f581618435fff0dd2448Guido van Rossuminitfl()
2529c7df79e47da854931474f581618435fff0dd2448Guido van Rossum{
2530c7df79e47da854931474f581618435fff0dd2448Guido van Rossum	initmodule("fl", forms_methods);
25312df7bcca97c8501be1b4c6739ac48196b7f04975Guido van Rossum	foreground();
2532ddc0d3e0665b3ebec26a22e85f9186c472c7ca18Guido van Rossum	fl_init();
2533c7df79e47da854931474f581618435fff0dd2448Guido van Rossum}
2534