Mercurial > cpython-lru_cache-weakref
annotate Modules/flmodule.c @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | 65d2d8e67da3 |
| children | 65cb261f7736 |
| rev | line source |
|---|---|
| 328 | 1 /********************************************************** |
|
2061
172ba04a5191
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
|
172ba04a5191
Added 1995 to copyright message.
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
3 The Netherlands. |
| 328 | 4 |
| 5 All Rights Reserved | |
| 6 | |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
| 328 | 9 provided that the above copyright notice appear in all copies and that |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
| 328 | 11 supporting documentation, and that the names of Stichting Mathematisch |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
12 Centrum or CWI or Corporation for National Research Initiatives or |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
13 CNRI not be used in advertising or publicity pertaining to |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
14 distribution of the software without specific, written prior |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
15 permission. |
| 328 | 16 |
|
4503
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
17 While CWI is the initial source for this software, a modified version |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
18 is made available by the Corporation for National Research Initiatives |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
19 (CNRI) at the Internet address ftp://ftp.python.org. |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
20 |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
65d2d8e67da3
New permission notice, includes CNRI.
Guido van Rossum <guido@python.org>
parents:
4297
diff
changeset
|
28 PERFORMANCE OF THIS SOFTWARE. |
| 328 | 29 |
| 30 ******************************************************************/ | |
| 31 | |
| 32 /* FL module -- interface to Mark Overmars' FORMS Library. */ | |
| 33 | |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
34 /* This code works with FORMS version 2.2a. |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
35 FORMS can be ftp'ed from ftp.cs.ruu.nl (131.211.80.17), directory |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
36 /pub/SGI/FORMS. */ |
| 469 | 37 |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
38 /* A half-hearted attempt has been made to allow programs using this |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
39 * module to exploit parallelism (through the threads module). No provisions |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
40 * have been made for multiple threads to use this module at the same time, |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
41 * though. So, a program with a forms thread and a non-forms thread will work |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
42 * fine but a program with two threads using forms will probably crash (unless |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
43 * the program takes precaution to ensure that only one thread can be in |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
44 * this module at any time). This will have to be fixed some time. |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
45 * (A fix will probably also have to synchronise with the gl module). |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
46 */ |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
47 |
| 328 | 48 #include "forms.h" |
| 49 | |
| 50 #include "allobjects.h" | |
| 51 #include "import.h" | |
| 52 #include "modsupport.h" | |
| 53 #include "structmember.h" | |
| 926 | 54 #include "ceval.h" |
| 328 | 55 |
| 56 /* Generic Forms Objects */ | |
| 57 | |
| 58 typedef struct { | |
| 59 OB_HEAD | |
| 60 FL_OBJECT *ob_generic; | |
| 61 struct methodlist *ob_methods; | |
| 62 object *ob_callback; | |
| 63 object *ob_callback_arg; | |
| 64 } genericobject; | |
| 65 | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
66 staticforward typeobject GenericObjecttype; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
67 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
68 #define is_genericobject(g) ((g)->ob_type == &GenericObjecttype) |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
69 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
70 /* List of all objects (XXX this should be a hash table on address...) */ |
| 328 | 71 |
| 72 static object *allgenerics = NULL; | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
73 static int nfreeslots = 0; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
74 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
75 /* Add an object to the list of known objects */ |
| 328 | 76 |
| 77 static void | |
| 78 knowgeneric(g) | |
| 79 genericobject *g; | |
| 80 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
81 int i, n; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
82 /* Create the list if it doesn't already exist */ |
| 328 | 83 if (allgenerics == NULL) { |
| 84 allgenerics = newlistobject(0); | |
| 85 if (allgenerics == NULL) { | |
| 86 err_clear(); | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
87 return; /* Too bad, live without allgenerics... */ |
| 328 | 88 } |
| 89 } | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
90 if (nfreeslots > 0) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
91 /* Search the list for reusable slots (NULL items) */ |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
92 /* XXX This can be made faster! */ |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
93 n = getlistsize(allgenerics); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
94 for (i = 0; i < n; i++) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
95 if (getlistitem(allgenerics, i) == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
96 INCREF(g); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
97 setlistitem(allgenerics, i, (object *)g); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
98 nfreeslots--; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
99 return; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
100 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
101 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
102 /* Strange... no free slots found... */ |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
103 nfreeslots = 0; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
104 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
105 /* No free entries, append new item to the end */ |
| 328 | 106 addlistitem(allgenerics, (object *)g); |
| 107 } | |
| 108 | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
109 /* Find an object in the list of known objects */ |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
110 |
| 328 | 111 static genericobject * |
| 112 findgeneric(generic) | |
| 113 FL_OBJECT *generic; | |
| 114 { | |
| 115 int i, n; | |
| 116 genericobject *g; | |
| 117 | |
| 118 if (allgenerics == NULL) | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
119 return NULL; /* No objects known yet */ |
| 328 | 120 n = getlistsize(allgenerics); |
| 121 for (i = 0; i < n; i++) { | |
| 122 g = (genericobject *)getlistitem(allgenerics, i); | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
123 if (g != NULL && g->ob_generic == generic) |
| 328 | 124 return g; |
| 125 } | |
| 126 return NULL; /* Unknown object */ | |
| 127 } | |
| 128 | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
129 /* Remove an object from the list of known objects */ |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
130 |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
131 static void |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
132 forgetgeneric(g) |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
133 genericobject *g; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
134 { |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
135 int i, n; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
136 |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
137 XDECREF(g->ob_callback); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
138 g->ob_callback = NULL; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
139 XDECREF(g->ob_callback_arg); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
140 g->ob_callback_arg = NULL; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
141 if (allgenerics == NULL) |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
142 return; /* No objects known yet */ |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
143 n = getlistsize(allgenerics); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
144 for (i = 0; i < n; i++) { |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
145 if (g == (genericobject *)getlistitem(allgenerics, i)) { |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
146 setlistitem(allgenerics, i, (object *)NULL); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
147 nfreeslots++; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
148 break; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
149 } |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
150 } |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
151 } |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
152 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
153 /* Called when a form is about to be freed -- |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
154 remove all the objects that we know about from it. */ |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
155 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
156 static void |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
157 releaseobjects(form) |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
158 FL_FORM *form; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
159 { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
160 int i, n; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
161 genericobject *g; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
162 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
163 if (allgenerics == NULL) |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
164 return; /* No objects known yet */ |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
165 n = getlistsize(allgenerics); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
166 for (i = 0; i < n; i++) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
167 g = (genericobject *)getlistitem(allgenerics, i); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
168 if (g != NULL && g->ob_generic->form == form) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
169 fl_delete_object(g->ob_generic); |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
170 /* The object is now unreachable for |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
171 do_forms and check_forms, so |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
172 delete it from the list of known objects */ |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
173 XDECREF(g->ob_callback); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
174 g->ob_callback = NULL; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
175 XDECREF(g->ob_callback_arg); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
176 g->ob_callback_arg = NULL; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
177 setlistitem(allgenerics, i, (object *)NULL); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
178 nfreeslots++; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
179 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
180 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
181 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
182 |
| 328 | 183 |
| 184 /* Methods of generic objects */ | |
| 185 | |
| 186 static object * | |
| 187 generic_set_call_back(g, args) | |
| 188 genericobject *g; | |
| 189 object *args; | |
| 190 { | |
| 191 if (args == NULL) { | |
| 192 XDECREF(g->ob_callback); | |
| 193 XDECREF(g->ob_callback_arg); | |
| 194 g->ob_callback = NULL; | |
| 195 g->ob_callback_arg = NULL; | |
| 196 } | |
| 197 else { | |
| 198 if (!is_tupleobject(args) || gettuplesize(args) != 2) { | |
| 199 err_badarg(); | |
| 200 return NULL; | |
| 201 } | |
| 202 XDECREF(g->ob_callback); | |
| 203 XDECREF(g->ob_callback_arg); | |
| 204 g->ob_callback = gettupleitem(args, 0); | |
| 205 INCREF(g->ob_callback); | |
| 206 g->ob_callback_arg = gettupleitem(args, 1); | |
| 207 INCREF(g->ob_callback_arg); | |
| 208 } | |
| 209 INCREF(None); | |
| 210 return None; | |
| 211 } | |
| 212 | |
| 213 static object * | |
| 214 generic_call(g, args, func) | |
| 215 genericobject *g; | |
| 216 object *args; | |
| 217 void (*func)(FL_OBJECT *); | |
| 218 { | |
| 219 if (!getnoarg(args)) | |
| 220 return NULL; | |
| 221 (*func)(g->ob_generic); | |
| 222 INCREF(None); | |
| 223 return None; | |
| 224 } | |
| 225 | |
| 226 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
227 generic_delete_object(g, args) |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
228 genericobject *g; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
229 object *args; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
230 { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
231 object *res; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
232 res = generic_call(g, args, fl_delete_object); |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
233 if (res != NULL) |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
234 forgetgeneric(g); |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
235 return res; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
236 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
237 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
238 static object * |
| 328 | 239 generic_show_object(g, args) |
| 240 genericobject *g; | |
| 241 object *args; | |
| 242 { | |
| 243 return generic_call(g, args, fl_show_object); | |
| 244 } | |
| 245 | |
| 246 static object * | |
| 247 generic_hide_object(g, args) | |
| 248 genericobject *g; | |
| 249 object *args; | |
| 250 { | |
| 251 return generic_call(g, args, fl_hide_object); | |
| 252 } | |
| 253 | |
| 254 static object * | |
| 255 generic_redraw_object(g, args) | |
| 256 genericobject *g; | |
| 257 object *args; | |
| 258 { | |
| 259 return generic_call(g, args, fl_redraw_object); | |
| 260 } | |
| 261 | |
| 262 static object * | |
| 263 generic_freeze_object(g, args) | |
| 264 genericobject *g; | |
| 265 object *args; | |
| 266 { | |
| 267 return generic_call(g, args, fl_freeze_object); | |
| 268 } | |
| 269 | |
| 270 static object * | |
| 271 generic_unfreeze_object(g, args) | |
| 272 genericobject *g; | |
| 273 object *args; | |
| 274 { | |
| 275 return generic_call(g, args, fl_unfreeze_object); | |
| 276 } | |
| 277 | |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
278 static object * |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
279 generic_activate_object(g, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
280 genericobject *g; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
281 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
282 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
283 return generic_call(g, args, fl_activate_object); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
284 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
285 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
286 static object * |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
287 generic_deactivate_object(g, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
288 genericobject *g; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
289 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
290 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
291 return generic_call(g, args, fl_deactivate_object); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
292 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
293 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
294 static object * |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
295 generic_set_object_shortcut(g, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
296 genericobject *g; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
297 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
298 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
299 char *str; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
300 if (!getargs(args, "s", &str)) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
301 return NULL; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
302 fl_set_object_shortcut(g->ob_generic, str); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
303 INCREF(None); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
304 return None; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
305 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
306 |
| 328 | 307 static struct methodlist generic_methods[] = { |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
308 {"set_call_back", (method)generic_set_call_back}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
309 {"delete_object", (method)generic_delete_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
310 {"show_object", (method)generic_show_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
311 {"hide_object", (method)generic_hide_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
312 {"redraw_object", (method)generic_redraw_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
313 {"freeze_object", (method)generic_freeze_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
314 {"unfreeze_object", (method)generic_unfreeze_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
315 {"activate_object", (method)generic_activate_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
316 {"deactivate_object", (method)generic_deactivate_object}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
317 {"set_object_shortcut", (method)generic_set_object_shortcut}, |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
318 {NULL, NULL} /* sentinel */ |
| 328 | 319 }; |
| 320 | |
| 321 static void | |
| 322 generic_dealloc(g) | |
| 323 genericobject *g; | |
| 324 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
325 fl_free_object(g->ob_generic); |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
326 XDECREF(g->ob_callback); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
327 XDECREF(g->ob_callback_arg); |
| 328 | 328 DEL(g); |
| 329 } | |
| 330 | |
| 331 #define OFF(x) offsetof(FL_OBJECT, x) | |
| 332 | |
| 333 static struct memberlist generic_memberlist[] = { | |
| 334 {"objclass", T_INT, OFF(objclass), RO}, | |
| 335 {"type", T_INT, OFF(type), RO}, | |
| 336 {"boxtype", T_INT, OFF(boxtype)}, | |
| 337 {"x", T_FLOAT, OFF(x)}, | |
| 338 {"y", T_FLOAT, OFF(y)}, | |
| 339 {"w", T_FLOAT, OFF(w)}, | |
| 340 {"h", T_FLOAT, OFF(h)}, | |
| 341 {"col1", T_INT, OFF(col1)}, | |
| 342 {"col2", T_INT, OFF(col2)}, | |
| 343 {"align", T_INT, OFF(align)}, | |
| 344 {"lcol", T_INT, OFF(lcol)}, | |
| 345 {"lsize", T_FLOAT, OFF(lsize)}, | |
| 346 /* "label" is treated specially! */ | |
| 347 {"lstyle", T_INT, OFF(lstyle)}, | |
| 348 {"pushed", T_INT, OFF(pushed), RO}, | |
| 349 {"focus", T_INT, OFF(focus), RO}, | |
| 350 {"belowmouse", T_INT, OFF(belowmouse),RO}, | |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
351 /* {"frozen", T_INT, OFF(frozen), RO}, */ |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
352 {"active", T_INT, OFF(active)}, |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
353 {"input", T_INT, OFF(input)}, |
| 328 | 354 {"visible", T_INT, OFF(visible), RO}, |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
355 {"radio", T_INT, OFF(radio)}, |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
356 {"automatic", T_INT, OFF(automatic)}, |
| 328 | 357 {NULL} /* Sentinel */ |
| 358 }; | |
| 359 | |
|
442
17f4cdf28959
Fixed duplicate use of OFF macro.
Guido van Rossum <guido@python.org>
parents:
437
diff
changeset
|
360 #undef OFF |
|
17f4cdf28959
Fixed duplicate use of OFF macro.
Guido van Rossum <guido@python.org>
parents:
437
diff
changeset
|
361 |
| 328 | 362 static object * |
| 363 generic_getattr(g, name) | |
| 364 genericobject *g; | |
| 365 char *name; | |
| 366 { | |
| 367 object *meth; | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
368 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
369 /* XXX Ought to special-case name "__methods__" */ |
| 328 | 370 if (g-> ob_methods) { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
371 meth = findmethod(g->ob_methods, (object *)g, name); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
372 if (meth != NULL) return meth; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
373 err_clear(); |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
374 } |
| 328 | 375 |
| 376 meth = findmethod(generic_methods, (object *)g, name); | |
| 377 if (meth != NULL) | |
| 378 return meth; | |
| 379 err_clear(); | |
| 380 | |
| 381 /* "label" is an exception, getmember only works for char pointers, | |
| 382 not for char arrays */ | |
| 383 if (strcmp(name, "label") == 0) | |
| 384 return newstringobject(g->ob_generic->label); | |
| 385 | |
| 386 return getmember((char *)g->ob_generic, generic_memberlist, name); | |
| 387 } | |
| 388 | |
| 389 static int | |
| 390 generic_setattr(g, name, v) | |
| 391 genericobject *g; | |
| 392 char *name; | |
| 393 object *v; | |
| 394 { | |
| 395 int ret; | |
| 396 | |
| 397 if (v == NULL) { | |
| 398 err_setstr(TypeError, "can't delete forms object attributes"); | |
|
890
b3d639ad666d
fixed bugs in generic_setattr (returned NULL instead of
Guido van Rossum <guido@python.org>
parents:
812
diff
changeset
|
399 return -1; |
| 328 | 400 } |
| 401 | |
| 402 /* "label" is an exception: setmember doesn't set strings; | |
| 403 and FORMS wants you to call a function to set the label */ | |
| 404 if (strcmp(name, "label") == 0) { | |
| 405 if (!is_stringobject(v)) { | |
| 406 err_setstr(TypeError, "label attr must be string"); | |
|
890
b3d639ad666d
fixed bugs in generic_setattr (returned NULL instead of
Guido van Rossum <guido@python.org>
parents:
812
diff
changeset
|
407 return -1; |
| 328 | 408 } |
| 409 fl_set_object_label(g->ob_generic, getstringvalue(v)); | |
| 410 return 0; | |
| 411 } | |
| 412 | |
| 413 ret = setmember((char *)g->ob_generic, generic_memberlist, name, v); | |
| 414 | |
| 415 /* Rather than calling all the various set_object_* functions, | |
| 416 we call fl_redraw_object here. This is sometimes redundant | |
| 417 but I doubt that's a big problem */ | |
| 418 if (ret == 0) | |
| 419 fl_redraw_object(g->ob_generic); | |
| 420 | |
| 421 return ret; | |
| 422 } | |
| 423 | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
424 static object * |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
425 generic_repr(g) |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
426 genericobject *g; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
427 { |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
428 char buf[100]; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
429 sprintf(buf, "<FORMS_object at %lx, objclass=%d>", |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
430 (long)g, g->ob_generic->objclass); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
431 return newstringobject(buf); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
432 } |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
433 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
434 static typeobject GenericObjecttype = { |
| 328 | 435 OB_HEAD_INIT(&Typetype) |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
436 0, /*ob_size*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
437 "FORMS_object", /*tp_name*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
438 sizeof(genericobject), /*tp_size*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
439 0, /*tp_itemsize*/ |
| 328 | 440 /* methods */ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
441 (destructor)generic_dealloc, /*tp_dealloc*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
442 0, /*tp_print*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
443 (getattrfunc)generic_getattr, /*tp_getattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
444 (setattrfunc)generic_setattr, /*tp_setattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
445 0, /*tp_compare*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
446 (reprfunc)generic_repr, /*tp_repr*/ |
| 328 | 447 }; |
| 448 | |
| 449 static object * | |
| 450 newgenericobject(generic, methods) | |
| 451 FL_OBJECT *generic; | |
| 452 struct methodlist *methods; | |
| 453 { | |
| 454 genericobject *g; | |
| 455 g = NEWOBJ(genericobject, &GenericObjecttype); | |
| 456 if (g == NULL) | |
| 457 return NULL; | |
| 458 g-> ob_generic = generic; | |
| 459 g->ob_methods = methods; | |
| 460 g->ob_callback = NULL; | |
| 461 g->ob_callback_arg = NULL; | |
| 462 knowgeneric(g); | |
| 463 return (object *)g; | |
| 464 } | |
| 465 | |
| 466 /**********************************************************************/ | |
| 467 /* Some common calling sequences */ | |
| 468 | |
| 469 /* void func (object, float) */ | |
| 470 static object * | |
| 471 call_forms_INf (func, obj, args) | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
472 void (*func)(FL_OBJECT *, float); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
473 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
474 object *args; |
| 328 | 475 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
476 float parameter; |
| 328 | 477 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
478 if (!getargs(args, "f", ¶meter)) return NULL; |
| 328 | 479 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
480 (*func) (obj, parameter); |
| 328 | 481 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
482 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
483 return None; |
| 328 | 484 } |
| 485 | |
| 486 /* void func (object, float) */ | |
| 487 static object * | |
| 488 call_forms_INfINf (func, obj, args) | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
489 void (*func)(FL_OBJECT *, float, float); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
490 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
491 object *args; |
| 328 | 492 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
493 float par1, par2; |
| 328 | 494 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
495 if (!getargs(args, "(ff)", &par1, &par2)) return NULL; |
| 328 | 496 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
497 (*func) (obj, par1, par2); |
| 328 | 498 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
499 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
500 return None; |
| 328 | 501 } |
| 502 | |
| 503 /* void func (object, int) */ | |
| 504 static object * | |
| 505 call_forms_INi (func, obj, args) | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
506 void (*func)(FL_OBJECT *, int); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
507 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
508 object *args; |
| 328 | 509 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
510 int parameter; |
| 328 | 511 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
512 if (!getintarg(args, ¶meter)) return NULL; |
| 328 | 513 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
514 (*func) (obj, parameter); |
| 328 | 515 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
516 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
517 return None; |
| 328 | 518 } |
| 519 | |
| 469 | 520 /* void func (object, char) */ |
| 521 static object * | |
| 522 call_forms_INc (func, obj, args) | |
| 523 void (*func)(FL_OBJECT *, int); | |
| 524 FL_OBJECT *obj; | |
| 525 object *args; | |
| 526 { | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
527 char *a; |
| 469 | 528 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
529 if (!getstrarg(args, &a)) return NULL; |
| 469 | 530 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
531 (*func) (obj, a[0]); |
| 469 | 532 |
| 533 INCREF(None); | |
| 534 return None; | |
| 535 } | |
| 536 | |
| 328 | 537 /* void func (object, string) */ |
| 538 static object * | |
| 539 call_forms_INstr (func, obj, args) | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
540 void (*func)(FL_OBJECT *, char *); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
541 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
542 object *args; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
543 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
544 char *a; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
545 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
546 if (!getstrarg(args, &a)) return NULL; |
| 328 | 547 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
548 (*func) (obj, a); |
| 328 | 549 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
550 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
551 return None; |
| 328 | 552 } |
| 553 | |
| 554 | |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
555 /* void func (object, int, string) */ |
| 328 | 556 static object * |
| 557 call_forms_INiINstr (func, obj, args) | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
558 void (*func)(FL_OBJECT *, int, char *); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
559 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
560 object *args; |
| 328 | 561 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
562 char *b; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
563 int a; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
564 |
|
1313
6ee380349c84
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents:
1262
diff
changeset
|
565 if (!getargs(args, "(is)", &a, &b)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
566 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
567 (*func) (obj, a, b); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
568 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
569 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
570 return None; |
| 328 | 571 } |
| 572 | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
573 #ifdef UNUSED |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
574 /* void func (object, int, int) */ |
| 328 | 575 static object * |
| 576 call_forms_INiINi (func, obj, args) | |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
577 void (*func)(FL_OBJECT *, int, int); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
578 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
579 object *args; |
| 328 | 580 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
581 int par1, par2; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
582 |
|
1313
6ee380349c84
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents:
1262
diff
changeset
|
583 if (!getargs(args, "(ii)", &par1, &par2)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
584 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
585 (*func) (obj, par1, par2); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
586 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
587 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
588 return None; |
| 328 | 589 } |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
590 #endif |
| 328 | 591 |
| 592 /* int func (object) */ | |
| 593 static object * | |
| 594 call_forms_Ri (func, obj, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
595 int (*func)(FL_OBJECT *); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
596 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
597 object *args; |
| 328 | 598 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
599 int retval; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
600 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
601 if (!getnoarg(args)) return NULL; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
602 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
603 retval = (*func) (obj); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
604 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
605 return newintobject ((long) retval); |
| 328 | 606 } |
| 607 | |
| 608 /* char * func (object) */ | |
| 609 static object * | |
| 610 call_forms_Rstr (func, obj, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
611 char * (*func)(FL_OBJECT *); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
612 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
613 object *args; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
614 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
615 char *str; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
616 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
617 if (!getnoarg(args)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
618 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
619 str = (*func) (obj); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
620 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
621 if (str == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
622 INCREF(None); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
623 return None; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
624 } |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
625 return newstringobject (str); |
| 328 | 626 } |
| 627 | |
| 628 /* int func (object) */ | |
| 629 static object * | |
| 630 call_forms_Rf (func, obj, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
631 float (*func)(FL_OBJECT *); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
632 FL_OBJECT *obj; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
633 object *args; |
| 328 | 634 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
635 float retval; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
636 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
637 if (!getnoarg(args)) return NULL; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
638 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
639 retval = (*func) (obj); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
640 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
641 return newfloatobject (retval); |
| 328 | 642 } |
| 643 | |
| 644 static object * | |
| 645 call_forms_OUTfOUTf (func, obj, args) | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
646 void (*func)(FL_OBJECT *, float *, float *); |
| 328 | 647 FL_OBJECT *obj; |
| 648 object *args; | |
| 649 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
650 float f1, f2; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
651 |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
652 if (!getnoarg(args)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
653 |
| 328 | 654 (*func) (obj, &f1, &f2); |
| 655 | |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
656 return mkvalue("(ff)", f1, f2); |
| 328 | 657 } |
| 658 | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
659 #ifdef UNUSED |
| 328 | 660 static object * |
| 661 call_forms_OUTf (func, obj, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
662 void (*func)(FL_OBJECT *, float *); |
| 328 | 663 FL_OBJECT *obj; |
| 664 object *args; | |
| 665 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
666 float f; |
| 328 | 667 |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
668 if (!getnoarg(args)) return NULL; |
| 328 | 669 |
| 670 (*func) (obj, &f); | |
| 671 | |
| 672 return newfloatobject (f); | |
| 673 } | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
674 #endif |
| 328 | 675 |
| 676 /**********************************************************************/ | |
| 677 /* Class : browser */ | |
| 678 | |
| 679 static object * | |
| 680 set_browser_topline(g, args) | |
| 681 genericobject *g; | |
| 682 object *args; | |
| 683 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
684 return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args); |
| 328 | 685 } |
| 686 | |
| 687 static object * | |
| 688 clear_browser(g, args) | |
| 689 genericobject *g; | |
| 690 object *args; | |
| 691 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
692 return generic_call (g, args, fl_clear_browser); |
| 328 | 693 } |
| 694 | |
| 695 static object * | |
| 696 add_browser_line (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
697 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
698 object *args; |
| 328 | 699 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
700 return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args); |
| 328 | 701 } |
| 702 | |
| 703 static object * | |
| 704 addto_browser (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
705 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
706 object *args; |
| 328 | 707 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
708 return call_forms_INstr (fl_addto_browser, g-> ob_generic, args); |
| 328 | 709 } |
| 710 | |
| 711 static object * | |
| 712 insert_browser_line (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
713 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
714 object *args; |
| 328 | 715 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
716 return call_forms_INiINstr (fl_insert_browser_line, |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
717 g-> ob_generic, args); |
| 328 | 718 } |
| 719 | |
| 720 static object * | |
| 721 delete_browser_line (g, args) | |
| 722 genericobject *g; | |
| 723 object *args; | |
| 724 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
725 return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args); |
| 328 | 726 } |
| 727 | |
| 728 static object * | |
| 729 replace_browser_line (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
730 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
731 object *args; |
| 328 | 732 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
733 return call_forms_INiINstr (fl_replace_browser_line, |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
734 g-> ob_generic, args); |
| 328 | 735 } |
| 736 | |
| 737 static object * | |
| 738 get_browser_line(g, args) | |
| 739 genericobject *g; | |
| 740 object *args; | |
| 741 { | |
| 742 int i; | |
| 743 char *str; | |
| 744 | |
| 745 if (!getintarg(args, &i)) | |
| 746 return NULL; | |
| 747 | |
| 748 str = fl_get_browser_line (g->ob_generic, i); | |
| 749 | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
750 if (str == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
751 INCREF(None); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
752 return None; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
753 } |
| 328 | 754 return newstringobject (str); |
| 755 } | |
| 756 | |
| 757 static object * | |
| 758 load_browser (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
759 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
760 object *args; |
| 328 | 761 { |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
762 /* XXX strictly speaking this is wrong since fl_load_browser |
|
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
763 XXX returns int, not void */ |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
764 return call_forms_INstr (fl_load_browser, g-> ob_generic, args); |
| 328 | 765 } |
| 766 | |
| 767 static object * | |
| 768 get_browser_maxline(g, args) | |
| 769 genericobject *g; | |
| 770 object *args; | |
| 771 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
772 return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic, args); |
| 328 | 773 } |
| 774 | |
| 775 static object * | |
| 776 select_browser_line (g, args) | |
| 777 genericobject *g; | |
| 778 object *args; | |
| 779 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
780 return call_forms_INi (fl_select_browser_line, g-> ob_generic, args); |
| 328 | 781 } |
| 782 | |
| 783 static object * | |
| 784 deselect_browser_line (g, args) | |
| 785 genericobject *g; | |
| 786 object *args; | |
| 787 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
788 return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args); |
| 328 | 789 } |
| 790 | |
| 791 static object * | |
| 792 deselect_browser (g, args) | |
| 793 genericobject *g; | |
| 794 object *args; | |
| 795 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
796 return generic_call (g, args, fl_deselect_browser); |
| 328 | 797 } |
| 798 | |
| 799 static object * | |
| 800 isselected_browser_line (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
801 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
802 object *args; |
| 328 | 803 { |
| 804 int i, j; | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
805 |
| 328 | 806 if (!getintarg(args, &i)) |
| 807 return NULL; | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
808 |
| 328 | 809 j = fl_isselected_browser_line (g->ob_generic, i); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
810 |
| 328 | 811 return newintobject (j); |
| 812 } | |
| 813 | |
| 814 static object * | |
| 815 get_browser (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
816 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
817 object *args; |
| 328 | 818 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
819 return call_forms_Ri (fl_get_browser, g-> ob_generic, args); |
| 328 | 820 } |
| 821 | |
| 822 static object * | |
| 823 set_browser_fontsize (g, args) | |
| 824 genericobject *g; | |
| 825 object *args; | |
| 826 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
827 return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args); |
| 328 | 828 } |
| 829 | |
| 830 static object * | |
| 831 set_browser_fontstyle (g, args) | |
| 832 genericobject *g; | |
| 833 object *args; | |
| 834 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
835 return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args); |
| 328 | 836 } |
| 837 | |
| 469 | 838 static object * |
| 839 set_browser_specialkey (g, args) | |
| 840 genericobject *g; | |
| 841 object *args; | |
| 842 { | |
| 843 return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args); | |
| 844 } | |
| 845 | |
| 328 | 846 static struct methodlist browser_methods[] = { |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
847 {"set_browser_topline", (method)set_browser_topline}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
848 {"clear_browser", (method)clear_browser}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
849 {"add_browser_line", (method)add_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
850 {"addto_browser", (method)addto_browser}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
851 {"insert_browser_line", (method)insert_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
852 {"delete_browser_line", (method)delete_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
853 {"replace_browser_line", (method)replace_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
854 {"get_browser_line", (method)get_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
855 {"load_browser", (method)load_browser}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
856 {"get_browser_maxline", (method)get_browser_maxline}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
857 {"select_browser_line", (method)select_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
858 {"deselect_browser_line", (method)deselect_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
859 {"deselect_browser", (method)deselect_browser}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
860 {"isselected_browser_line", (method)isselected_browser_line}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
861 {"get_browser", (method)get_browser}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
862 {"set_browser_fontsize", (method)set_browser_fontsize}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
863 {"set_browser_fontstyle", (method)set_browser_fontstyle}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
864 {"set_browser_specialkey", (method)set_browser_specialkey}, |
| 469 | 865 {NULL, NULL} /* sentinel */ |
| 328 | 866 }; |
| 867 | |
| 868 /* Class: button */ | |
| 869 | |
| 870 static object * | |
| 871 set_button(g, args) | |
| 872 genericobject *g; | |
| 873 object *args; | |
| 874 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
875 return call_forms_INi (fl_set_button, g-> ob_generic, args); |
| 328 | 876 } |
| 877 | |
| 878 static object * | |
| 879 get_button(g, args) | |
| 880 genericobject *g; | |
| 881 object *args; | |
| 882 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
883 return call_forms_Ri (fl_get_button, g-> ob_generic, args); |
| 328 | 884 } |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
885 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
886 static object * |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
887 get_button_numb(g, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
888 genericobject *g; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
889 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
890 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
891 return call_forms_Ri (fl_get_button_numb, g-> ob_generic, args); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
892 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
893 |
| 469 | 894 static object * |
| 895 set_button_shortcut(g, args) | |
| 896 genericobject *g; | |
| 897 object *args; | |
| 898 { | |
| 899 return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args); | |
| 900 } | |
| 328 | 901 |
| 902 static struct methodlist button_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
903 {"set_button", (method)set_button}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
904 {"get_button", (method)get_button}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
905 {"get_button_numb", (method)get_button_numb}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
906 {"set_button_shortcut", (method)set_button_shortcut}, |
| 328 | 907 {NULL, NULL} /* sentinel */ |
| 908 }; | |
| 909 | |
| 910 /* Class: choice */ | |
| 911 | |
| 912 static object * | |
| 913 set_choice(g, args) | |
| 914 genericobject *g; | |
| 915 object *args; | |
| 916 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
917 return call_forms_INi (fl_set_choice, g-> ob_generic, args); |
| 328 | 918 } |
| 919 | |
| 920 static object * | |
| 921 get_choice(g, args) | |
| 922 genericobject *g; | |
| 923 object *args; | |
| 924 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
925 return call_forms_Ri (fl_get_choice, g-> ob_generic, args); |
| 328 | 926 } |
| 927 | |
| 928 static object * | |
| 929 clear_choice (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
930 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
931 object *args; |
| 328 | 932 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
933 return generic_call (g, args, fl_clear_choice); |
| 328 | 934 } |
| 935 | |
| 936 static object * | |
| 937 addto_choice (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
938 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
939 object *args; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
940 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
941 return call_forms_INstr (fl_addto_choice, g-> ob_generic, args); |
| 328 | 942 } |
| 943 | |
| 944 static object * | |
| 945 replace_choice (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
946 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
947 object *args; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
948 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
949 return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args); |
| 328 | 950 } |
| 951 | |
| 952 static object * | |
| 953 delete_choice (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
954 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
955 object *args; |
| 328 | 956 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
957 return call_forms_INi (fl_delete_choice, g-> ob_generic, args); |
| 328 | 958 } |
| 959 | |
| 960 static object * | |
| 961 get_choice_text (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
962 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
963 object *args; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
964 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
965 return call_forms_Rstr (fl_get_choice_text, g-> ob_generic, args); |
| 328 | 966 } |
| 967 | |
| 968 static object * | |
| 969 set_choice_fontsize (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
970 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
971 object *args; |
| 328 | 972 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
973 return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args); |
| 328 | 974 } |
| 975 | |
| 976 static object * | |
| 977 set_choice_fontstyle (g, args) | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
978 genericobject *g; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
979 object *args; |
| 328 | 980 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
981 return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args); |
| 328 | 982 } |
| 983 | |
| 984 static struct methodlist choice_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
985 {"set_choice", (method)set_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
986 {"get_choice", (method)get_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
987 {"clear_choice", (method)clear_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
988 {"addto_choice", (method)addto_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
989 {"replace_choice", (method)replace_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
990 {"delete_choice", (method)delete_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
991 {"get_choice_text", (method)get_choice_text}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
992 {"set_choice_fontsize", (method)set_choice_fontsize}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
993 {"set_choice_fontstyle",(method)set_choice_fontstyle}, |
| 328 | 994 {NULL, NULL} /* sentinel */ |
| 995 }; | |
| 996 | |
| 997 /* Class : Clock */ | |
| 998 | |
| 999 static object * | |
| 1000 get_clock(g, args) | |
| 1001 genericobject *g; | |
| 1002 object *args; | |
| 1003 { | |
| 1004 int i0, i1, i2; | |
| 1005 | |
| 1006 if (!getnoarg(args)) | |
| 1007 return NULL; | |
| 1008 | |
| 1009 fl_get_clock (g->ob_generic, &i0, &i1, &i2); | |
| 1010 | |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
1011 return mkvalue("(iii)", i0, i1, i2); |
| 328 | 1012 } |
| 1013 | |
| 1014 static struct methodlist clock_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1015 {"get_clock", (method)get_clock}, |
| 328 | 1016 {NULL, NULL} /* sentinel */ |
| 1017 }; | |
| 1018 | |
| 1019 /* CLass : Counters */ | |
| 1020 | |
| 1021 static object * | |
| 1022 get_counter_value(g, args) | |
| 1023 genericobject *g; | |
| 1024 object *args; | |
| 1025 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1026 return call_forms_Rf (fl_get_counter_value, g-> ob_generic, args); |
| 328 | 1027 } |
| 1028 | |
| 1029 static object * | |
| 1030 set_counter_value (g, args) | |
| 1031 genericobject *g; | |
| 1032 object *args; | |
| 1033 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1034 return call_forms_INf (fl_set_counter_value, g-> ob_generic, args); |
| 328 | 1035 } |
| 1036 | |
| 1037 static object * | |
| 1038 set_counter_precision (g, args) | |
| 1039 genericobject *g; | |
| 1040 object *args; | |
| 1041 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1042 return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args); |
| 328 | 1043 } |
| 1044 | |
| 1045 static object * | |
| 1046 set_counter_bounds (g, args) | |
| 1047 genericobject *g; | |
| 1048 object *args; | |
| 1049 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1050 return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args); |
| 328 | 1051 } |
| 1052 | |
| 1053 static object * | |
| 1054 set_counter_step (g, args) | |
| 1055 genericobject *g; | |
| 1056 object *args; | |
| 1057 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1058 return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args); |
| 328 | 1059 } |
| 1060 | |
| 1061 static object * | |
| 1062 set_counter_return (g, args) | |
| 1063 genericobject *g; | |
| 1064 object *args; | |
| 1065 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1066 return call_forms_INi (fl_set_counter_return, g-> ob_generic, args); |
| 328 | 1067 } |
| 1068 | |
| 1069 static struct methodlist counter_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1070 {"set_counter_value", (method)set_counter_value}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1071 {"get_counter_value", (method)get_counter_value}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1072 {"set_counter_bounds", (method)set_counter_bounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1073 {"set_counter_step", (method)set_counter_step}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1074 {"set_counter_precision", (method)set_counter_precision}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1075 {"set_counter_return", (method)set_counter_return}, |
| 469 | 1076 {NULL, NULL} /* sentinel */ |
| 328 | 1077 }; |
| 1078 | |
| 1079 | |
| 1080 /* Class: Dials */ | |
| 1081 | |
| 1082 static object * | |
| 469 | 1083 get_dial_value(g, args) |
| 328 | 1084 genericobject *g; |
| 1085 object *args; | |
| 1086 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1087 return call_forms_Rf (fl_get_dial_value, g-> ob_generic, args); |
| 328 | 1088 } |
| 1089 | |
| 1090 static object * | |
| 1091 set_dial_value (g, args) | |
| 1092 genericobject *g; | |
| 1093 object *args; | |
| 1094 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1095 return call_forms_INf (fl_set_dial_value, g-> ob_generic, args); |
| 328 | 1096 } |
| 1097 | |
| 1098 static object * | |
| 1099 set_dial_bounds (g, args) | |
| 1100 genericobject *g; | |
| 1101 object *args; | |
| 1102 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1103 return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args); |
| 328 | 1104 } |
| 1105 | |
| 1106 static object * | |
| 1107 get_dial_bounds (g, args) | |
| 1108 genericobject *g; | |
| 1109 object *args; | |
| 1110 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1111 return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic, args); |
| 328 | 1112 } |
| 1113 | |
| 469 | 1114 static object * |
| 1115 set_dial_step (g, args) | |
| 1116 genericobject *g; | |
| 1117 object *args; | |
| 1118 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1119 return call_forms_INf (fl_set_dial_step, g-> ob_generic, args); |
| 469 | 1120 } |
| 1121 | |
| 328 | 1122 static struct methodlist dial_methods[] = { |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1123 {"set_dial_value", (method)set_dial_value}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1124 {"get_dial_value", (method)get_dial_value}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1125 {"set_dial_bounds", (method)set_dial_bounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1126 {"get_dial_bounds", (method)get_dial_bounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1127 {"set_dial_step", (method)set_dial_step}, |
| 328 | 1128 {NULL, NULL} /* sentinel */ |
| 1129 }; | |
| 1130 | |
| 1131 /* Class : Input */ | |
| 1132 | |
| 1133 static object * | |
| 1134 set_input (g, args) | |
| 1135 genericobject *g; | |
| 1136 object *args; | |
| 1137 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1138 return call_forms_INstr (fl_set_input, g-> ob_generic, args); |
| 328 | 1139 } |
| 1140 | |
| 1141 static object * | |
| 1142 get_input (g, args) | |
| 1143 genericobject *g; | |
| 1144 object *args; | |
| 1145 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1146 return call_forms_Rstr (fl_get_input, g-> ob_generic, args); |
| 328 | 1147 } |
| 1148 | |
| 1149 static object * | |
| 1150 set_input_color (g, args) | |
| 1151 genericobject *g; | |
| 1152 object *args; | |
| 1153 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1154 return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args); |
| 328 | 1155 } |
| 1156 | |
| 469 | 1157 static object * |
| 1158 set_input_return (g, args) | |
| 1159 genericobject *g; | |
| 1160 object *args; | |
| 1161 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1162 return call_forms_INi (fl_set_input_return, g-> ob_generic, args); |
| 469 | 1163 } |
| 1164 | |
| 328 | 1165 static struct methodlist input_methods[] = { |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1166 {"set_input", (method)set_input}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1167 {"get_input", (method)get_input}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1168 {"set_input_color", (method)set_input_color}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1169 {"set_input_return", (method)set_input_return}, |
| 328 | 1170 {NULL, NULL} /* sentinel */ |
| 1171 }; | |
| 1172 | |
| 1173 | |
| 1174 /* Class : Menu */ | |
| 1175 | |
| 1176 static object * | |
| 1177 set_menu (g, args) | |
| 1178 genericobject *g; | |
| 1179 object *args; | |
| 1180 { | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
1181 return call_forms_INstr (fl_set_menu, g-> ob_generic, args); |
| 328 | 1182 } |
| 1183 | |
| 1184 static object * | |
| 1185 get_menu (g, args) | |
| 1186 genericobject *g; | |
| 1187 object *args; | |
| 1188 { | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
1189 /* XXX strictly speaking this is wrong since fl_get_menu |
|
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
1190 XXX returns long, not int */ |
|
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
1191 return call_forms_Ri (fl_get_menu, g-> ob_generic, args); |
| 328 | 1192 } |
| 1193 | |
| 1194 static object * | |
|
1262
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1195 get_menu_text (g, args) |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1196 genericobject *g; |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1197 object *args; |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1198 { |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1199 return call_forms_Rstr (fl_get_menu_text, g-> ob_generic, args); |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1200 } |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1201 |
|
f820e6917f07
Changes to speed up local variables enormously, by avoiding dictionary
Guido van Rossum <guido@python.org>
parents:
1252
diff
changeset
|
1202 static object * |
| 328 | 1203 addto_menu (g, args) |
| 1204 genericobject *g; | |
| 1205 object *args; | |
| 1206 { | |
|
331
21c266f7eca1
Fixed almost all list errors.
Guido van Rossum <guido@python.org>
parents:
330
diff
changeset
|
1207 return call_forms_INstr (fl_addto_menu, g-> ob_generic, args); |
| 328 | 1208 } |
| 1209 | |
| 1210 static struct methodlist menu_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1211 {"set_menu", (method)set_menu}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1212 {"get_menu", (method)get_menu}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1213 {"get_menu_text", (method)get_menu_text}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1214 {"addto_menu", (method)addto_menu}, |
| 328 | 1215 {NULL, NULL} /* sentinel */ |
| 1216 }; | |
| 1217 | |
| 1218 | |
| 1219 /* Class: Sliders */ | |
| 1220 | |
| 1221 static object * | |
| 469 | 1222 get_slider_value(g, args) |
| 328 | 1223 genericobject *g; |
| 1224 object *args; | |
| 1225 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1226 return call_forms_Rf (fl_get_slider_value, g-> ob_generic, args); |
| 328 | 1227 } |
| 1228 | |
| 1229 static object * | |
| 1230 set_slider_value (g, args) | |
| 1231 genericobject *g; | |
| 1232 object *args; | |
| 1233 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1234 return call_forms_INf (fl_set_slider_value, g-> ob_generic, args); |
| 328 | 1235 } |
| 1236 | |
| 1237 static object * | |
| 1238 set_slider_bounds (g, args) | |
| 1239 genericobject *g; | |
| 1240 object *args; | |
| 1241 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1242 return call_forms_INfINf (fl_set_slider_bounds, g-> ob_generic, args); |
| 328 | 1243 } |
| 1244 | |
| 1245 static object * | |
| 1246 get_slider_bounds (g, args) | |
| 1247 genericobject *g; | |
| 1248 object *args; | |
| 1249 { | |
| 1250 return call_forms_OUTfOUTf(fl_get_slider_bounds, g-> ob_generic, args); | |
| 1251 } | |
| 1252 | |
| 1253 static object * | |
| 1254 set_slider_return (g, args) | |
| 1255 genericobject *g; | |
| 1256 object *args; | |
| 1257 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1258 return call_forms_INf (fl_set_slider_return, g-> ob_generic, args); |
| 328 | 1259 } |
| 1260 | |
| 1261 static object * | |
| 1262 set_slider_size (g, args) | |
| 1263 genericobject *g; | |
| 1264 object *args; | |
| 1265 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1266 return call_forms_INf (fl_set_slider_size, g-> ob_generic, args); |
| 328 | 1267 } |
| 1268 | |
| 1269 static object * | |
| 1270 set_slider_precision (g, args) | |
| 1271 genericobject *g; | |
| 1272 object *args; | |
| 1273 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1274 return call_forms_INi (fl_set_slider_precision, g-> ob_generic, args); |
| 328 | 1275 } |
| 1276 | |
| 469 | 1277 static object * |
| 1278 set_slider_step (g, args) | |
| 1279 genericobject *g; | |
| 1280 object *args; | |
| 1281 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1282 return call_forms_INf (fl_set_slider_step, g-> ob_generic, args); |
| 469 | 1283 } |
| 1284 | |
| 1285 | |
| 328 | 1286 static struct methodlist slider_methods[] = { |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1287 {"set_slider_value", (method)set_slider_value}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1288 {"get_slider_value", (method)get_slider_value}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1289 {"set_slider_bounds", (method)set_slider_bounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1290 {"get_slider_bounds", (method)get_slider_bounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1291 {"set_slider_return", (method)set_slider_return}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1292 {"set_slider_size", (method)set_slider_size}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1293 {"set_slider_precision",(method)set_slider_precision}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1294 {"set_slider_step", (method)set_slider_step}, |
| 328 | 1295 {NULL, NULL} /* sentinel */ |
| 1296 }; | |
| 1297 | |
| 1298 static object * | |
| 1299 set_positioner_xvalue (g, args) | |
| 1300 genericobject *g; | |
| 1301 object *args; | |
| 1302 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1303 return call_forms_INf (fl_set_positioner_xvalue, g-> ob_generic, args); |
| 328 | 1304 } |
| 1305 | |
| 1306 static object * | |
| 1307 set_positioner_xbounds (g, args) | |
| 1308 genericobject *g; | |
| 1309 object *args; | |
| 1310 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1311 return call_forms_INfINf (fl_set_positioner_xbounds, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1312 g-> ob_generic, args); |
| 328 | 1313 } |
| 1314 | |
| 1315 static object * | |
| 1316 set_positioner_yvalue (g, args) | |
| 1317 genericobject *g; | |
| 1318 object *args; | |
| 1319 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1320 return call_forms_INf (fl_set_positioner_yvalue, g-> ob_generic, args); |
| 328 | 1321 } |
| 1322 | |
| 1323 static object * | |
| 1324 set_positioner_ybounds (g, args) | |
| 1325 genericobject *g; | |
| 1326 object *args; | |
| 1327 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1328 return call_forms_INfINf (fl_set_positioner_ybounds, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1329 g-> ob_generic, args); |
| 328 | 1330 } |
| 1331 | |
| 1332 static object * | |
| 1333 get_positioner_xvalue (g, args) | |
| 1334 genericobject *g; | |
| 1335 object *args; | |
| 1336 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1337 return call_forms_Rf (fl_get_positioner_xvalue, g-> ob_generic, args); |
| 328 | 1338 } |
| 1339 | |
| 1340 static object * | |
| 1341 get_positioner_xbounds (g, args) | |
| 1342 genericobject *g; | |
| 1343 object *args; | |
| 1344 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1345 return call_forms_OUTfOUTf (fl_get_positioner_xbounds, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1346 g-> ob_generic, args); |
| 328 | 1347 } |
| 1348 | |
| 1349 static object * | |
| 1350 get_positioner_yvalue (g, args) | |
| 1351 genericobject *g; | |
| 1352 object *args; | |
| 1353 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1354 return call_forms_Rf (fl_get_positioner_yvalue, g-> ob_generic, args); |
| 328 | 1355 } |
| 1356 | |
| 1357 static object * | |
| 1358 get_positioner_ybounds (g, args) | |
| 1359 genericobject *g; | |
| 1360 object *args; | |
| 1361 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1362 return call_forms_OUTfOUTf (fl_get_positioner_ybounds, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1363 g-> ob_generic, args); |
| 328 | 1364 } |
| 1365 | |
| 1366 static struct methodlist positioner_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1367 {"set_positioner_xvalue", (method)set_positioner_xvalue}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1368 {"set_positioner_yvalue", (method)set_positioner_yvalue}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1369 {"set_positioner_xbounds", (method)set_positioner_xbounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1370 {"set_positioner_ybounds", (method)set_positioner_ybounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1371 {"get_positioner_xvalue", (method)get_positioner_xvalue}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1372 {"get_positioner_yvalue", (method)get_positioner_yvalue}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1373 {"get_positioner_xbounds", (method)get_positioner_xbounds}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1374 {"get_positioner_ybounds", (method)get_positioner_ybounds}, |
| 328 | 1375 {NULL, NULL} /* sentinel */ |
| 1376 }; | |
| 1377 | |
| 1378 /* Class timer */ | |
| 1379 | |
| 1380 static object * | |
| 1381 set_timer (g, args) | |
| 1382 genericobject *g; | |
| 1383 object *args; | |
| 1384 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1385 return call_forms_INf (fl_set_timer, g-> ob_generic, args); |
| 328 | 1386 } |
| 1387 | |
| 1388 static object * | |
| 1389 get_timer (g, args) | |
| 1390 genericobject *g; | |
| 1391 object *args; | |
| 1392 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1393 return call_forms_Rf (fl_get_timer, g-> ob_generic, args); |
| 328 | 1394 } |
| 1395 | |
| 1396 static struct methodlist timer_methods[] = { | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1397 {"set_timer", (method)set_timer}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1398 {"get_timer", (method)get_timer}, |
| 328 | 1399 {NULL, NULL} /* sentinel */ |
| 1400 }; | |
| 1401 | |
| 1402 /* Form objects */ | |
| 1403 | |
| 1404 typedef struct { | |
| 1405 OB_HEAD | |
| 1406 FL_FORM *ob_form; | |
| 1407 } formobject; | |
| 1408 | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1409 staticforward typeobject Formtype; |
| 328 | 1410 |
| 1411 #define is_formobject(v) ((v)->ob_type == &Formtype) | |
| 1412 | |
| 1413 static object * | |
| 1414 form_show_form(f, args) | |
| 1415 formobject *f; | |
| 1416 object *args; | |
| 1417 { | |
| 1418 int place, border; | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1419 char *name; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1420 if (!getargs(args, "(iis)", &place, &border, &name)) |
| 328 | 1421 return NULL; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1422 fl_show_form(f->ob_form, place, border, name); |
| 328 | 1423 INCREF(None); |
| 1424 return None; | |
| 1425 } | |
| 1426 | |
| 1427 static object * | |
| 1428 form_call(func, f, args) | |
| 1429 FL_FORM *f; | |
| 1430 object *args; | |
| 1431 void (*func)(FL_FORM *); | |
| 1432 { | |
| 1433 if (!getnoarg(args)) return NULL; | |
| 1434 | |
| 1435 (*func)(f); | |
| 1436 | |
| 1437 INCREF(None); | |
| 1438 return None; | |
| 1439 } | |
| 1440 | |
| 1441 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1442 form_call_INiINi(func, f, args) |
| 328 | 1443 FL_FORM *f; |
| 1444 object *args; | |
| 1445 void (*func)(FL_FORM *, int, int); | |
| 1446 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1447 int a, b; |
| 328 | 1448 |
|
1313
6ee380349c84
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents:
1262
diff
changeset
|
1449 if (!getargs(args, "(ii)", &a, &b)) return NULL; |
| 328 | 1450 |
| 1451 (*func)(f, a, b); | |
| 1452 | |
| 1453 INCREF(None); | |
| 1454 return None; | |
| 1455 } | |
| 1456 | |
| 1457 static object * | |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1458 form_call_INfINf(func, f, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1459 FL_FORM *f; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1460 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1461 void (*func)(FL_FORM *, float, float); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1462 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1463 float a, b; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1464 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1465 if (!getargs(args, "(ff)", &a, &b)) return NULL; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1466 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1467 (*func)(f, a, b); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1468 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1469 INCREF(None); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1470 return None; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1471 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1472 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1473 static object * |
| 328 | 1474 form_hide_form(f, args) |
| 1475 formobject *f; | |
| 1476 object *args; | |
| 1477 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1478 return form_call(fl_hide_form, f-> ob_form, args); |
| 328 | 1479 } |
| 1480 | |
| 1481 static object * | |
| 1482 form_redraw_form(f, args) | |
| 1483 formobject *f; | |
| 1484 object *args; | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1485 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1486 return form_call(fl_redraw_form, f-> ob_form, args); |
| 328 | 1487 } |
| 1488 | |
| 1489 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1490 form_add_object(f, args) |
| 328 | 1491 formobject *f; |
| 1492 object *args; | |
| 1493 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1494 genericobject *g; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1495 if (args == NULL || !is_genericobject(args)) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1496 err_badarg(); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1497 return NULL; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1498 } |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1499 g = (genericobject *)args; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1500 if (findgeneric(g->ob_generic) != NULL) { |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1501 err_setstr(RuntimeError, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1502 "add_object of object already in a form"); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1503 return NULL; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1504 } |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1505 fl_add_object(f->ob_form, g->ob_generic); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1506 knowgeneric(g); |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1507 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1508 INCREF(None); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1509 return None; |
| 328 | 1510 } |
| 1511 | |
| 1512 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1513 form_set_form_position(f, args) |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1514 formobject *f; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1515 object *args; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1516 { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1517 return form_call_INiINi(fl_set_form_position, f-> ob_form, args); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1518 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1519 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1520 static object * |
|
1319
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1521 form_set_form_size(f, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1522 formobject *f; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1523 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1524 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1525 return form_call_INiINi(fl_set_form_size, f-> ob_form, args); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1526 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1527 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1528 static object * |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1529 form_scale_form(f, args) |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1530 formobject *f; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1531 object *args; |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1532 { |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1533 return form_call_INfINf(fl_scale_form, f-> ob_form, args); |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1534 } |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1535 |
|
cd397266dc1c
* Makefile: added all: and default: targets.
Guido van Rossum <guido@python.org>
parents:
1313
diff
changeset
|
1536 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1537 generic_add_object(f, args, func, internal_methods) |
| 328 | 1538 formobject *f; |
| 1539 object *args; | |
| 1540 FL_OBJECT *(*func)(int, float, float, float, float, char*); | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1541 struct methodlist *internal_methods; |
| 328 | 1542 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1543 int type; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1544 float x, y, w, h; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1545 char *name; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1546 FL_OBJECT *obj; |
| 328 | 1547 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1548 if (!getargs(args,"(iffffs)", &type,&x,&y,&w,&h,&name)) |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1549 return NULL; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1550 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1551 fl_addto_form (f-> ob_form); |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1552 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1553 obj = (*func) (type, x, y, w, h, name); |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1554 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1555 fl_end_form(); |
| 328 | 1556 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1557 if (obj == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1558 err_nomem(); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1559 return NULL; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1560 } |
| 328 | 1561 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1562 return newgenericobject (obj, internal_methods); |
| 328 | 1563 } |
| 1564 | |
| 1565 static object * | |
| 1566 form_add_button(f, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1567 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1568 object *args; |
| 328 | 1569 { |
| 1570 return generic_add_object(f, args, fl_add_button, button_methods); | |
| 1571 } | |
| 1572 | |
| 1573 static object * | |
| 1574 form_add_lightbutton(f, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1575 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1576 object *args; |
| 328 | 1577 { |
| 1578 return generic_add_object(f, args, fl_add_lightbutton, button_methods); | |
| 1579 } | |
| 1580 | |
| 1581 static object * | |
| 1582 form_add_roundbutton(f, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1583 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1584 object *args; |
| 328 | 1585 { |
| 1586 return generic_add_object(f, args, fl_add_roundbutton, button_methods); | |
| 1587 } | |
| 1588 | |
| 1589 static object * | |
| 1590 form_add_menu (f, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1591 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1592 object *args; |
| 328 | 1593 { |
| 1594 return generic_add_object(f, args, fl_add_menu, menu_methods); | |
| 1595 } | |
| 1596 | |
| 1597 static object * | |
| 1598 form_add_slider(f, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1599 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1600 object *args; |
| 328 | 1601 { |
| 1602 return generic_add_object(f, args, fl_add_slider, slider_methods); | |
| 1603 } | |
| 1604 | |
| 1605 static object * | |
| 1606 form_add_valslider(f, args) | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1607 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1608 object *args; |
| 328 | 1609 { |
| 1610 return generic_add_object(f, args, fl_add_valslider, slider_methods); | |
| 1611 } | |
| 1612 | |
| 1613 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1614 form_add_dial(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1615 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1616 object *args; |
| 328 | 1617 { |
| 1618 return generic_add_object(f, args, fl_add_dial, dial_methods); | |
| 1619 } | |
| 1620 | |
| 1621 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1622 form_add_counter(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1623 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1624 object *args; |
| 328 | 1625 { |
| 1626 return generic_add_object(f, args, fl_add_counter, counter_methods); | |
| 1627 } | |
| 1628 | |
| 1629 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1630 form_add_clock(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1631 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1632 object *args; |
| 328 | 1633 { |
| 1634 return generic_add_object(f, args, fl_add_clock, clock_methods); | |
| 1635 } | |
| 1636 | |
| 1637 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1638 form_add_box(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1639 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1640 object *args; |
| 328 | 1641 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1642 return generic_add_object(f, args, fl_add_box, |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1643 (struct methodlist *)NULL); |
| 328 | 1644 } |
| 1645 | |
| 1646 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1647 form_add_choice(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1648 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1649 object *args; |
| 328 | 1650 { |
| 1651 return generic_add_object(f, args, fl_add_choice, choice_methods); | |
| 1652 } | |
| 1653 | |
| 1654 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1655 form_add_browser(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1656 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1657 object *args; |
| 328 | 1658 { |
| 1659 return generic_add_object(f, args, fl_add_browser, browser_methods); | |
| 1660 } | |
| 1661 | |
| 1662 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1663 form_add_positioner(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1664 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1665 object *args; |
| 328 | 1666 { |
| 1667 return generic_add_object(f, args, fl_add_positioner, positioner_methods); | |
| 1668 } | |
| 1669 | |
| 1670 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1671 form_add_input(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1672 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1673 object *args; |
| 328 | 1674 { |
| 1675 return generic_add_object(f, args, fl_add_input, input_methods); | |
| 1676 } | |
| 1677 | |
| 1678 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1679 form_add_text(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1680 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1681 object *args; |
| 328 | 1682 { |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1683 return generic_add_object(f, args, fl_add_text, |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1684 (struct methodlist *)NULL); |
| 328 | 1685 } |
| 1686 | |
| 1687 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1688 form_add_timer(f, args) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1689 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1690 object *args; |
| 328 | 1691 { |
| 1692 return generic_add_object(f, args, fl_add_timer, timer_methods); | |
| 1693 } | |
| 1694 | |
| 1695 static object * | |
| 1696 form_freeze_form(f, args) | |
| 1697 formobject *f; | |
| 1698 object *args; | |
| 1699 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1700 return form_call(fl_freeze_form, f-> ob_form, args); |
| 328 | 1701 } |
| 1702 | |
| 1703 static object * | |
| 1704 form_unfreeze_form(f, args) | |
| 1705 formobject *f; | |
| 1706 object *args; | |
| 1707 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1708 return form_call(fl_unfreeze_form, f-> ob_form, args); |
| 328 | 1709 } |
| 1710 | |
| 1711 static object * | |
| 1712 form_activate_form(f, args) | |
| 1713 formobject *f; | |
| 1714 object *args; | |
| 1715 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1716 return form_call(fl_activate_form, f-> ob_form, args); |
| 328 | 1717 } |
| 1718 | |
| 1719 static object * | |
| 1720 form_deactivate_form(f, args) | |
| 1721 formobject *f; | |
| 1722 object *args; | |
| 1723 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1724 return form_call(fl_deactivate_form, f-> ob_form, args); |
| 328 | 1725 } |
| 1726 | |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1727 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1728 form_bgn_group(f, args) |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1729 formobject *f; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1730 object *args; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1731 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1732 FL_OBJECT *obj; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1733 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1734 fl_addto_form(f-> ob_form); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1735 obj = fl_bgn_group(); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1736 fl_end_form(); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1737 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1738 if (obj == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1739 err_nomem(); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1740 return NULL; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1741 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1742 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1743 return newgenericobject (obj, (struct methodlist *) NULL); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1744 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1745 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1746 static object * |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1747 form_end_group(f, args) |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1748 formobject *f; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1749 object *args; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1750 { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1751 fl_addto_form(f-> ob_form); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1752 fl_end_group(); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1753 fl_end_form(); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1754 INCREF(None); |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1755 return None; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1756 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1757 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1758 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1759 forms_find_first_or_last(func, f, args) |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1760 FL_OBJECT *(*func)(FL_FORM *, int, float, float); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1761 formobject *f; |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1762 object *args; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1763 { |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1764 int type; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1765 float mx, my; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1766 FL_OBJECT *generic; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1767 genericobject *g; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1768 |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1769 if (!getargs(args, "(iff)", &type, &mx, &my)) return NULL; |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1770 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1771 generic = (*func) (f-> ob_form, type, mx, my); |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1772 |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1773 if (generic == NULL) |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1774 { |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1775 INCREF(None); |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1776 return None; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1777 } |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1778 |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1779 g = findgeneric(generic); |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1780 if (g == NULL) { |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1781 err_setstr(RuntimeError, |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1782 "forms_find_{first|last} returns unknown object"); |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1783 return NULL; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1784 } |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1785 INCREF(g); |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1786 return (object *) g; |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1787 } |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1788 |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1789 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1790 form_find_first(f, args) |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1791 formobject *f; |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1792 object *args; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1793 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1794 return forms_find_first_or_last(fl_find_first, f, args); |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1795 } |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1796 |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1797 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1798 form_find_last(f, args) |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
1799 formobject *f; |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1800 object *args; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1801 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1802 return forms_find_first_or_last(fl_find_last, f, args); |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1803 } |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
1804 |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1805 static object * |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1806 form_set_object_focus(f, args) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1807 formobject *f; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1808 object *args; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1809 { |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1810 genericobject *g; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1811 if (args == NULL || !is_genericobject(args)) { |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1812 err_badarg(); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1813 return NULL; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1814 } |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1815 g = (genericobject *)args; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1816 fl_set_object_focus(f->ob_form, g->ob_generic); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1817 INCREF(None); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1818 return None; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1819 } |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1820 |
| 328 | 1821 static struct methodlist form_methods[] = { |
| 1822 /* adm */ | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1823 {"show_form", (method)form_show_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1824 {"hide_form", (method)form_hide_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1825 {"redraw_form", (method)form_redraw_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1826 {"set_form_position", (method)form_set_form_position}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1827 {"set_form_size", (method)form_set_form_size}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1828 {"scale_form", (method)form_scale_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1829 {"freeze_form", (method)form_freeze_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1830 {"unfreeze_form", (method)form_unfreeze_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1831 {"activate_form", (method)form_activate_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1832 {"deactivate_form", (method)form_deactivate_form}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1833 {"bgn_group", (method)form_bgn_group}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1834 {"end_group", (method)form_end_group}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1835 {"find_first", (method)form_find_first}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1836 {"find_last", (method)form_find_last}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1837 {"set_object_focus", (method)form_set_object_focus}, |
| 328 | 1838 |
| 1839 /* basic objects */ | |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1840 {"add_button", (method)form_add_button}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1841 /* {"add_bitmap", (method)form_add_bitmap}, */ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1842 {"add_lightbutton", (method)form_add_lightbutton}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1843 {"add_roundbutton", (method)form_add_roundbutton}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1844 {"add_menu", (method)form_add_menu}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1845 {"add_slider", (method)form_add_slider}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1846 {"add_positioner", (method)form_add_positioner}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1847 {"add_valslider", (method)form_add_valslider}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1848 {"add_dial", (method)form_add_dial}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1849 {"add_counter", (method)form_add_counter}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1850 {"add_box", (method)form_add_box}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1851 {"add_clock", (method)form_add_clock}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1852 {"add_choice", (method)form_add_choice}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1853 {"add_browser", (method)form_add_browser}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1854 {"add_input", (method)form_add_input}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1855 {"add_timer", (method)form_add_timer}, |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1856 {"add_text", (method)form_add_text}, |
| 328 | 1857 {NULL, NULL} /* sentinel */ |
| 1858 }; | |
| 1859 | |
| 1860 static void | |
| 1861 form_dealloc(f) | |
| 1862 formobject *f; | |
| 1863 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1864 releaseobjects(f->ob_form); |
|
812
94ea6ea7f7d5
in form_dealloc, only hide the form if it's visible
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
1865 if (f->ob_form->visible) |
|
94ea6ea7f7d5
in form_dealloc, only hide the form if it's visible
Guido van Rossum <guido@python.org>
parents:
795
diff
changeset
|
1866 fl_hide_form(f->ob_form); |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1867 fl_free_form(f->ob_form); |
| 328 | 1868 DEL(f); |
| 1869 } | |
| 1870 | |
|
442
17f4cdf28959
Fixed duplicate use of OFF macro.
Guido van Rossum <guido@python.org>
parents:
437
diff
changeset
|
1871 #define OFF(x) offsetof(FL_FORM, x) |
|
17f4cdf28959
Fixed duplicate use of OFF macro.
Guido van Rossum <guido@python.org>
parents:
437
diff
changeset
|
1872 |
|
437
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1873 static struct memberlist form_memberlist[] = { |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1874 {"window", T_LONG, OFF(window), RO}, |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1875 {"w", T_FLOAT, OFF(w)}, |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1876 {"h", T_FLOAT, OFF(h)}, |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1877 {"x", T_FLOAT, OFF(x), RO}, |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1878 {"y", T_FLOAT, OFF(y), RO}, |
|
437
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1879 {"deactivated", T_INT, OFF(deactivated)}, |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1880 {"visible", T_INT, OFF(visible), RO}, |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
1881 {"frozen", T_INT, OFF(frozen), RO}, |
|
437
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1882 {"doublebuf", T_INT, OFF(doublebuf)}, |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1883 {NULL} /* Sentinel */ |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1884 }; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1885 |
|
442
17f4cdf28959
Fixed duplicate use of OFF macro.
Guido van Rossum <guido@python.org>
parents:
437
diff
changeset
|
1886 #undef OFF |
|
17f4cdf28959
Fixed duplicate use of OFF macro.
Guido van Rossum <guido@python.org>
parents:
437
diff
changeset
|
1887 |
| 328 | 1888 static object * |
| 1889 form_getattr(f, name) | |
| 1890 formobject *f; | |
| 1891 char *name; | |
| 1892 { | |
|
437
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1893 object *meth; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1894 |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1895 meth = findmethod(form_methods, (object *)f, name); |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1896 if (meth != NULL) |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1897 return meth; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1898 err_clear(); |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1899 return getmember((char *)f->ob_form, form_memberlist, name); |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1900 } |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1901 |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1902 static int |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1903 form_setattr(f, name, v) |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1904 formobject *f; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1905 char *name; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1906 object *v; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1907 { |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1908 int ret; |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1909 |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1910 if (v == NULL) { |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1911 err_setstr(TypeError, "can't delete form attributes"); |
|
4297
cf9a97bfc023
Correct typo: return -1 for error, not NULL
Guido van Rossum <guido@python.org>
parents:
2061
diff
changeset
|
1912 return -1; |
|
437
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1913 } |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1914 |
|
402a59ad2493
Finally added form attributes.
Guido van Rossum <guido@python.org>
parents:
392
diff
changeset
|
1915 return setmember((char *)f->ob_form, form_memberlist, name, v); |
| 328 | 1916 } |
| 1917 | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1918 static object * |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1919 form_repr(f) |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1920 formobject *f; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1921 { |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1922 char buf[100]; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1923 sprintf(buf, "<FORMS_form at %lx, window=%ld>", |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1924 (long)f, f->ob_form->window); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1925 return newstringobject(buf); |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1926 } |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
1927 |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1928 static typeobject Formtype = { |
| 328 | 1929 OB_HEAD_INIT(&Typetype) |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1930 0, /*ob_size*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1931 "FORMS_form", /*tp_name*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1932 sizeof(formobject), /*tp_size*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1933 0, /*tp_itemsize*/ |
| 328 | 1934 /* methods */ |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1935 (destructor)form_dealloc, /*tp_dealloc*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1936 0, /*tp_print*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1937 (getattrfunc)form_getattr, /*tp_getattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1938 (setattrfunc)form_setattr, /*tp_setattr*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1939 0, /*tp_compare*/ |
|
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1482
diff
changeset
|
1940 (reprfunc)form_repr, /*tp_repr*/ |
| 328 | 1941 }; |
| 1942 | |
| 1943 static object * | |
| 1944 newformobject(form) | |
| 1945 FL_FORM *form; | |
| 1946 { | |
| 1947 formobject *f; | |
| 1948 f = NEWOBJ(formobject, &Formtype); | |
| 1949 if (f == NULL) | |
| 1950 return NULL; | |
| 1951 f->ob_form = form; | |
| 1952 return (object *)f; | |
| 1953 } | |
| 1954 | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1955 |
| 328 | 1956 /* The "fl" module */ |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
1957 |
| 328 | 1958 static object * |
| 1959 forms_make_form(dummy, args) | |
| 1960 object *dummy; | |
| 1961 object *args; | |
| 1962 { | |
| 1963 int type; | |
| 1964 float w, h; | |
| 1965 FL_FORM *form; | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
1966 if (!getargs(args, "(iff)", &type, &w, &h)) |
| 328 | 1967 return NULL; |
| 1968 form = fl_bgn_form(type, w, h); | |
| 1969 if (form == NULL) { | |
| 1970 /* XXX Actually, cannot happen! */ | |
| 1971 err_nomem(); | |
| 1972 return NULL; | |
| 1973 } | |
| 1974 fl_end_form(); | |
| 1975 return newformobject(form); | |
| 1976 } | |
| 1977 | |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1978 static object * |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1979 forms_activate_all_forms(f, args) |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1980 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1981 object *args; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1982 { |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1983 fl_activate_all_forms(); |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1984 INCREF(None); |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1985 return None; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1986 } |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1987 |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1988 static object * |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1989 forms_deactivate_all_forms(f, args) |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1990 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1991 object *args; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1992 { |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1993 fl_deactivate_all_forms(); |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1994 INCREF(None); |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1995 return None; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1996 } |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
1997 |
| 328 | 1998 static object *my_event_callback = NULL; |
| 1999 | |
| 2000 static object * | |
| 2001 forms_set_event_call_back(dummy, args) | |
| 2002 object *dummy; | |
| 2003 object *args; | |
| 2004 { | |
|
1328
e2deca983008
forms_set_event_call_back: argument of None resets event callback to NULL.
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
2005 if (args == None) |
|
e2deca983008
forms_set_event_call_back: argument of None resets event callback to NULL.
Guido van Rossum <guido@python.org>
parents:
1319
diff
changeset
|
2006 args = NULL; |
| 328 | 2007 my_event_callback = args; |
| 2008 XINCREF(args); | |
| 2009 INCREF(None); | |
| 2010 return None; | |
| 2011 } | |
| 2012 | |
| 2013 static object * | |
| 2014 forms_do_or_check_forms(dummy, args, func) | |
| 2015 object *dummy; | |
| 2016 object *args; | |
| 2017 FL_OBJECT *(*func)(); | |
| 2018 { | |
| 2019 FL_OBJECT *generic; | |
| 2020 genericobject *g; | |
| 2021 object *arg, *res; | |
| 2022 | |
| 2023 if (!getnoarg(args)) | |
| 2024 return NULL; | |
| 2025 | |
| 2026 for (;;) { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2027 BGN_SAVE |
| 328 | 2028 generic = (*func)(); |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2029 END_SAVE |
| 328 | 2030 if (generic == NULL) { |
| 2031 INCREF(None); | |
| 2032 return None; | |
| 2033 } | |
| 2034 if (generic == FL_EVENT) { | |
| 2035 int dev; | |
| 2036 short val; | |
| 2037 if (my_event_callback == NULL) | |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2038 return newintobject(-1L); |
| 328 | 2039 dev = fl_qread(&val); |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2040 arg = mkvalue("(ih)", dev, val); |
| 328 | 2041 if (arg == NULL) |
| 2042 return NULL; | |
| 2043 res = call_object(my_event_callback, arg); | |
| 2044 XDECREF(res); | |
| 2045 DECREF(arg); | |
| 2046 if (res == NULL) | |
| 2047 return NULL; /* Callback raised exception */ | |
| 2048 continue; | |
| 2049 } | |
| 2050 g = findgeneric(generic); | |
| 2051 if (g == NULL) { | |
|
1079
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
2052 /* Object not known to us (some dialogs cause this) */ |
|
712
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2053 continue; /* Ignore it */ |
| 328 | 2054 } |
| 2055 if (g->ob_callback == NULL) { | |
| 2056 INCREF(g); | |
| 2057 return ((object *) g); | |
| 2058 } | |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2059 arg = mkvalue("(OO)", (object *)g, g->ob_callback_arg); |
|
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2060 if (arg == NULL) |
|
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2061 return NULL; |
| 328 | 2062 res = call_object(g->ob_callback, arg); |
| 2063 XDECREF(res); | |
| 2064 DECREF(arg); | |
| 2065 if (res == NULL) | |
| 2066 return NULL; /* Callback raised exception */ | |
| 2067 } | |
| 2068 } | |
| 2069 | |
| 2070 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2071 forms_do_forms(dummy, args) |
| 328 | 2072 object *dummy; |
| 2073 object *args; | |
| 2074 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2075 return forms_do_or_check_forms(dummy, args, fl_do_forms); |
| 328 | 2076 } |
| 2077 | |
| 2078 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2079 forms_check_forms(dummy, args) |
| 328 | 2080 object *dummy; |
| 2081 object *args; | |
| 2082 { | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2083 return forms_do_or_check_forms(dummy, args, fl_check_forms); |
| 328 | 2084 } |
| 2085 | |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2086 static object * |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2087 forms_do_only_forms(dummy, args) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2088 object *dummy; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2089 object *args; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2090 { |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2091 return forms_do_or_check_forms(dummy, args, fl_do_only_forms); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2092 } |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2093 |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2094 static object * |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2095 forms_check_only_forms(dummy, args) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2096 object *dummy; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2097 object *args; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2098 { |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2099 return forms_do_or_check_forms(dummy, args, fl_check_only_forms); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2100 } |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2101 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2102 #ifdef UNUSED |
| 328 | 2103 static object * |
| 2104 fl_call(func, args) | |
| 2105 object *args; | |
| 2106 void (*func)(); | |
| 2107 { | |
| 2108 if (!getnoarg(args)) | |
| 2109 return NULL; | |
| 2110 (*func)(); | |
| 2111 INCREF(None); | |
| 2112 return None; | |
| 2113 } | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2114 #endif |
| 328 | 2115 |
| 469 | 2116 static object * |
| 2117 forms_set_graphics_mode(dummy, args) | |
| 2118 object *dummy; | |
| 2119 object *args; | |
| 2120 { | |
| 2121 int rgbmode, doublebuf; | |
| 2122 | |
|
1313
6ee380349c84
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents:
1262
diff
changeset
|
2123 if (!getargs(args, "(ii)", &rgbmode, &doublebuf)) |
| 469 | 2124 return NULL; |
| 2125 fl_set_graphics_mode(rgbmode,doublebuf); | |
| 2126 INCREF(None); | |
| 2127 return None; | |
| 2128 } | |
| 2129 | |
| 2130 static object * | |
| 2131 forms_get_rgbmode(dummy, args) | |
| 2132 object *dummy; | |
| 2133 object *args; | |
| 2134 { | |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2135 extern int fl_rgbmode; |
| 469 | 2136 |
| 2137 if (args != NULL) { | |
| 2138 err_badarg(); | |
| 2139 return NULL; | |
| 2140 } | |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2141 return newintobject((long)fl_rgbmode); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2142 } |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2143 |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2144 static object * |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2145 forms_show_errors(dummy, args) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2146 object *dummy; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2147 object *args; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2148 { |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2149 int show; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2150 if (!getargs(args, "i", &show)) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2151 return NULL; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2152 fl_show_errors(show); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2153 INCREF(None); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2154 return None; |
| 469 | 2155 } |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2156 |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2157 static object * |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2158 forms_set_font_name(dummy, args) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2159 object *dummy; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2160 object *args; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2161 { |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2162 int numb; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2163 char *name; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2164 if (!getargs(args, "(is)", &numb, &name)) |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2165 return NULL; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2166 fl_set_font_name(numb, name); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2167 INCREF(None); |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2168 return None; |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2169 } |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2170 |
| 469 | 2171 |
| 328 | 2172 static object * |
| 2173 forms_qdevice(self, args) | |
| 2174 object *self; | |
| 2175 object *args; | |
| 2176 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2177 short arg1; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2178 if (!getargs(args, "h", &arg1)) |
| 328 | 2179 return NULL; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2180 fl_qdevice(arg1); |
| 328 | 2181 INCREF(None); |
| 2182 return None; | |
| 2183 } | |
| 2184 | |
| 2185 static object * | |
| 2186 forms_unqdevice(self, args) | |
| 2187 object *self; | |
| 2188 object *args; | |
| 2189 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2190 short arg1; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2191 if (!getargs(args, "h", &arg1)) |
| 328 | 2192 return NULL; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2193 fl_unqdevice(arg1); |
| 328 | 2194 INCREF(None); |
| 2195 return None; | |
| 2196 } | |
| 2197 | |
| 2198 static object * | |
| 2199 forms_isqueued(self, args) | |
| 2200 object *self; | |
| 2201 object *args; | |
| 2202 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2203 long retval; |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2204 short arg1; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2205 if (!getargs(args, "h", &arg1)) |
| 328 | 2206 return NULL; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2207 retval = fl_isqueued(arg1); |
| 328 | 2208 |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2209 return newintobject(retval); |
| 328 | 2210 } |
| 2211 | |
| 2212 static object * | |
| 2213 forms_qtest(self, args) | |
| 2214 object *self; | |
| 2215 object *args; | |
| 2216 { | |
| 2217 long retval; | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2218 retval = fl_qtest(); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2219 return newintobject(retval); |
| 328 | 2220 } |
| 2221 | |
| 2222 | |
| 2223 static object * | |
| 2224 forms_qread(self, args) | |
| 2225 object *self; | |
| 2226 object *args; | |
| 2227 { | |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2228 int dev; |
|
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2229 short val; |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2230 BGN_SAVE |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2231 dev = fl_qread(&val); |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2232 END_SAVE |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2233 return mkvalue("(ih)", dev, val); |
| 328 | 2234 } |
| 2235 | |
| 2236 static object * | |
| 2237 forms_qreset(self, args) | |
| 2238 object *self; | |
| 2239 object *args; | |
| 2240 { | |
| 2241 if (!getnoarg(args)) return NULL; | |
| 2242 | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2243 fl_qreset(); |
| 328 | 2244 INCREF(None); |
| 2245 return None; | |
| 2246 } | |
| 2247 | |
| 2248 static object * | |
| 2249 forms_qenter(self, args) | |
| 2250 object *self; | |
| 2251 object *args; | |
| 2252 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2253 short arg1, arg2; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2254 if (!getargs(args, "(hh)", &arg1, &arg2)) |
| 328 | 2255 return NULL; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2256 fl_qenter(arg1, arg2); |
| 328 | 2257 INCREF(None); |
| 2258 return None; | |
| 2259 } | |
| 2260 | |
| 2261 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2262 forms_color(self, args) |
| 328 | 2263 object *self; |
| 2264 object *args; | |
| 2265 { | |
| 2266 int arg; | |
| 2267 | |
| 2268 if (!getintarg(args, &arg)) return NULL; | |
| 2269 | |
| 2270 fl_color((short) arg); | |
| 2271 | |
| 2272 INCREF(None); | |
| 2273 return None; | |
| 2274 } | |
| 2275 | |
| 2276 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2277 forms_mapcolor(self, args) |
| 328 | 2278 object *self; |
| 2279 object *args; | |
| 2280 { | |
| 2281 int arg0, arg1, arg2, arg3; | |
| 2282 | |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2283 if (!getargs(args, "(iiii)", &arg0, &arg1, &arg2, &arg3)) |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2284 return NULL; |
| 328 | 2285 |
| 2286 fl_mapcolor(arg0, (short) arg1, (short) arg2, (short) arg3); | |
| 2287 | |
| 2288 INCREF(None); | |
| 2289 return None; | |
| 2290 } | |
| 2291 | |
| 2292 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2293 forms_getmcolor(self, args) |
| 328 | 2294 object *self; |
| 2295 object *args; | |
| 2296 { | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2297 int arg; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2298 short r, g, b; |
| 328 | 2299 |
| 2300 if (!getintarg(args, &arg)) return NULL; | |
| 2301 | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2302 fl_getmcolor(arg, &r, &g, &b); |
| 328 | 2303 |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2304 return mkvalue("(hhh)", r, g, b); |
| 328 | 2305 } |
| 2306 | |
| 2307 static object * | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2308 forms_get_mouse(self, args) |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2309 object *self; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2310 object *args; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2311 { |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2312 float x, y; |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2313 |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2314 if (!getnoarg(args)) return NULL; |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2315 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2316 fl_get_mouse(&x, &y); |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2317 |
|
1252
c4cd0d9d8281
* Changed many files to use mkvalue() instead of newtupleobject().
Guido van Rossum <guido@python.org>
parents:
1079
diff
changeset
|
2318 return mkvalue("(ff)", x, y); |
|
329
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2319 } |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2320 |
|
f21cb7b53f6c
Adde get_mouse and find_first/find_last (by robertl)
Guido van Rossum <guido@python.org>
parents:
328
diff
changeset
|
2321 static object * |
| 328 | 2322 forms_tie(self, args) |
| 2323 object *self; | |
| 2324 object *args; | |
| 2325 { | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2326 short arg1, arg2, arg3; |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2327 if (!getargs(args, "(hhh)", &arg1, &arg2, &arg3)) |
| 328 | 2328 return NULL; |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2329 fl_tie(arg1, arg2, arg3); |
| 328 | 2330 INCREF(None); |
| 2331 return None; | |
| 2332 } | |
| 2333 | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2334 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2335 forms_show_message(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2336 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2337 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2338 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2339 char *a, *b, *c; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2340 |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2341 if (!getargs(args, "(sss)", &a, &b, &c)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2342 |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2343 BGN_SAVE |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2344 fl_show_message(a, b, c); |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2345 END_SAVE |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2346 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2347 INCREF(None); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2348 return None; |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2349 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2350 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2351 static object * |
|
712
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2352 forms_show_choice(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2353 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2354 object *args; |
|
712
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2355 { |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2356 char *m1, *m2, *m3, *b1, *b2, *b3; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2357 int nb; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2358 char *format; |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2359 long rv; |
|
712
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2360 |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2361 if (args == NULL || !is_tupleobject(args)) { |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2362 err_badarg(); |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2363 return NULL; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2364 } |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2365 nb = gettuplesize(args) - 3; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2366 if (nb <= 0) { |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2367 err_setstr(TypeError, "need at least one button label"); |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2368 return NULL; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2369 } |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2370 if (is_intobject(gettupleitem(args, 3))) { |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2371 err_setstr(TypeError, |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2372 "'number-of-buttons' argument not needed"); |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2373 return NULL; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2374 } |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2375 switch (nb) { |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2376 case 1: format = "(ssss)"; break; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2377 case 2: format = "(sssss)"; break; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2378 case 3: format = "(ssssss)"; break; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2379 default: |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2380 err_setstr(TypeError, "too many button labels"); |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2381 return NULL; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2382 } |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2383 |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2384 if (!getargs(args, format, &m1, &m2, &m3, &b1, &b2, &b3)) |
|
712
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2385 return NULL; |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2386 |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2387 BGN_SAVE |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2388 rv = fl_show_choice(m1, m2, m3, nb, b1, b2, b3); |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2389 END_SAVE |
|
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2390 return newintobject(rv); |
|
712
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2391 } |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2392 |
|
00cdb8dedd6f
Implemented show_choice(); moved items around a little bit.
Guido van Rossum <guido@python.org>
parents:
635
diff
changeset
|
2393 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2394 forms_show_question(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2395 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2396 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2397 { |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2398 int ret; |
|
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2399 char *a, *b, *c; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2400 |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2401 if (!getargs(args, "(sss)", &a, &b, &c)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2402 |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2403 BGN_SAVE |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2404 ret = fl_show_question(a, b, c); |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2405 END_SAVE |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2406 |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2407 return newintobject((long) ret); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2408 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2409 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2410 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2411 forms_show_input(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2412 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2413 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2414 { |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2415 char *str; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2416 char *a, *b; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2417 |
|
1313
6ee380349c84
* Added gmtime/localtime/mktime and SYSV timezone globals to timemodule.c.
Guido van Rossum <guido@python.org>
parents:
1262
diff
changeset
|
2418 if (!getargs(args, "(ss)", &a, &b)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2419 |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2420 BGN_SAVE |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2421 str = fl_show_input(a, b); |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2422 END_SAVE |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2423 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2424 if (str == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2425 INCREF(None); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2426 return None; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2427 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2428 return newstringobject(str); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2429 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2430 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2431 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2432 forms_file_selector(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2433 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2434 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2435 { |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2436 char *str; |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2437 char *a, *b, *c, *d; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2438 |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2439 if (!getargs(args, "(ssss)", &a, &b, &c, &d)) return NULL; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2440 |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2441 BGN_SAVE |
|
635
784a09a52375
Use getargs() function.
Guido van Rossum <guido@python.org>
parents:
486
diff
changeset
|
2442 str = fl_show_file_selector(a, b, c, d); |
|
947
260d96db112f
Modified to allow other threads to run in a multithreaded environment.
Jack Jansen <jack.jansen@cwi.nl>
parents:
926
diff
changeset
|
2443 END_SAVE |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2444 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2445 if (str == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2446 INCREF(None); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2447 return None; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2448 } |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2449 return newstringobject(str); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2450 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2451 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2452 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2453 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2454 forms_file_selector_func(args, func) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2455 object *args; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2456 char *(*func)(); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2457 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2458 char *str; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2459 |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2460 str = (*func) (); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2461 |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2462 if (str == NULL) { |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2463 INCREF(None); |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2464 return None; |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2465 } |
|
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2466 return newstringobject(str); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2467 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2468 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2469 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2470 forms_get_directory(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2471 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2472 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2473 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2474 return forms_file_selector_func(args, fl_get_directory); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2475 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2476 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2477 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2478 forms_get_pattern(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2479 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2480 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2481 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2482 return forms_file_selector_func(args, fl_get_pattern); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2483 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2484 |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2485 static object * |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2486 forms_get_filename(f, args) |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2487 object *f; |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2488 object *args; |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2489 { |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2490 return forms_file_selector_func(args, fl_get_filename); |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2491 } |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2492 |
| 328 | 2493 static struct methodlist forms_methods[] = { |
| 2494 /* adm */ | |
| 2495 {"make_form", forms_make_form}, | |
|
726
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2496 {"activate_all_forms", forms_activate_all_forms}, |
|
e8c6fa9118eb
Added forms_(de)activate_all_forms functions; minor lay-out fixes.
Guido van Rossum <guido@python.org>
parents:
714
diff
changeset
|
2497 {"deactivate_all_forms",forms_deactivate_all_forms}, |
| 328 | 2498 /* gl support wrappers */ |
| 2499 {"qdevice", forms_qdevice}, | |
| 2500 {"unqdevice", forms_unqdevice}, | |
| 2501 {"isqueued", forms_isqueued}, | |
| 2502 {"qtest", forms_qtest}, | |
| 2503 {"qread", forms_qread}, | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2504 /* {"blkqread", forms_blkqread}, */ |
| 328 | 2505 {"qreset", forms_qreset}, |
| 2506 {"qenter", forms_qenter}, | |
|
330
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2507 {"get_mouse", forms_get_mouse}, |
|
1807d60e6231
Lots of cosmetic changes.
Guido van Rossum <guido@python.org>
parents:
329
diff
changeset
|
2508 {"tie", forms_tie}, |
| 328 | 2509 /* {"new_events", forms_new_events}, */ |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2510 {"color", forms_color}, |
| 328 | 2511 {"mapcolor", forms_mapcolor}, |
| 2512 {"getmcolor", forms_getmcolor}, | |
| 2513 /* interaction */ | |
| 2514 {"do_forms", forms_do_forms}, | |
|
1079
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
2515 {"do_only_forms", forms_do_only_forms}, |
| 328 | 2516 {"check_forms", forms_check_forms}, |
|
1079
e4c6a0dd5c2b
* bltinmodule.c: added built-in function cmp(a, b)
Guido van Rossum <guido@python.org>
parents:
1051
diff
changeset
|
2517 {"check_only_forms", forms_check_only_forms}, |
| 328 | 2518 {"set_event_call_back", forms_set_event_call_back}, |
| 2519 /* goodies */ | |
|
1020
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2520 {"show_message", forms_show_message}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2521 {"show_question", forms_show_question}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2522 {"show_choice", forms_show_choice}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2523 {"show_input", forms_show_input}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2524 {"show_file_selector", forms_file_selector}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2525 {"file_selector", forms_file_selector}, /* BW compat */ |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2526 {"get_directory", forms_get_directory}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2527 {"get_pattern", forms_get_pattern}, |
|
7442b20c43fd
Use getargs() everywhere now. Standardize lay-out yet more (an ongoing
Guido van Rossum <guido@python.org>
parents:
947
diff
changeset
|
2528 {"get_filename", forms_get_filename}, |
| 469 | 2529 {"set_graphics_mode", forms_set_graphics_mode}, |
| 2530 {"get_rgbmode", forms_get_rgbmode}, | |
|
1051
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2531 {"show_errors", forms_show_errors}, |
|
f54e64c8b9b7
* Makefile: added IMGFILE; moved some stuff around.
Guido van Rossum <guido@python.org>
parents:
1020
diff
changeset
|
2532 {"set_font_name", forms_set_font_name}, |
| 328 | 2533 {NULL, NULL} /* sentinel */ |
| 2534 }; | |
| 2535 | |
| 2536 void | |
| 2537 initfl() | |
| 2538 { | |
| 2539 initmodule("fl", forms_methods); | |
|
392
f33a3f69dfcb
Done a little bit about garbage collection.
Guido van Rossum <guido@python.org>
parents:
376
diff
changeset
|
2540 foreground(); |
| 469 | 2541 fl_init(); |
| 328 | 2542 } |
