-
Notifications
You must be signed in to change notification settings - Fork 294
/
flmodule.c
2144 lines (1789 loc) · 49.3 KB
/
flmodule.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* FL module -- interface to Mark Overmars' FORMS Library. */
/* This code works with FORMS version 2.2 (if you defined
OBSOLETE_FORMS_CALLS), and 2.3.
FORMS can be ftp'ed from ftp.cs.ruu.nl (131.211.80.17), directory
/pub/SGI/FORMS. */
/* A half-hearted attempt has been made to allow programs using this
* module to exploit parallelism (through the threads module). No provisions
* have been made for multiple threads to use this module at the same time,
* though. So, a program with a forms thread and a non-forms thread will work
* fine but a program with two threads using forms will probably crash (unless
* the program takes precaution to ensure that only one thread can be in
* this module at any time). This will have to be fixed some time.
* (A fix will probably also have to synchronize with the gl module).
*/
#include "Python.h"
#include "forms.h"
#include "structmember.h"
/* Generic Forms Objects */
typedef struct {
PyObject_HEAD
FL_OBJECT *ob_generic;
PyMethodDef *ob_methods;
PyObject *ob_callback;
PyObject *ob_callback_arg;
} genericobject;
static PyTypeObject GenericObjecttype;
#define is_genericobject(g) ((g)->ob_type == &GenericObjecttype)
/* List of all objects (XXX this should be a hash table on address...) */
static PyObject *allgenerics = NULL;
static int nfreeslots = 0;
/* Add an object to the list of known objects */
static void
knowgeneric(genericobject *g)
{
int i, n;
/* Create the list if it doesn't already exist */
if (allgenerics == NULL) {
allgenerics = PyList_New(0);
if (allgenerics == NULL) {
PyErr_Clear();
return; /* Too bad, live without allgenerics... */
}
}
if (nfreeslots > 0) {
/* Search the list for reusable slots (NULL items) */
/* XXX This can be made faster! */
n = PyList_Size(allgenerics);
for (i = 0; i < n; i++) {
if (PyList_GetItem(allgenerics, i) == NULL) {
Py_INCREF(g);
PyList_SetItem(allgenerics, i, (PyObject *)g);
nfreeslots--;
return;
}
}
/* Strange... no free slots found... */
nfreeslots = 0;
}
/* No free entries, append new item to the end */
PyList_Append(allgenerics, (PyObject *)g);
}
/* Find an object in the list of known objects */
static genericobject *
findgeneric(FL_OBJECT *generic)
{
int i, n;
genericobject *g;
if (allgenerics == NULL)
return NULL; /* No objects known yet */
n = PyList_Size(allgenerics);
for (i = 0; i < n; i++) {
g = (genericobject *)PyList_GetItem(allgenerics, i);
if (g != NULL && g->ob_generic == generic)
return g;
}
return NULL; /* Unknown object */
}
/* Remove an object from the list of known objects */
static void
forgetgeneric(genericobject *g)
{
int i, n;
Py_XDECREF(g->ob_callback);
g->ob_callback = NULL;
Py_XDECREF(g->ob_callback_arg);
g->ob_callback_arg = NULL;
if (allgenerics == NULL)
return; /* No objects known yet */
n = PyList_Size(allgenerics);
for (i = 0; i < n; i++) {
if (g == (genericobject *)PyList_GetItem(allgenerics, i)) {
PyList_SetItem(allgenerics, i, (PyObject *)NULL);
nfreeslots++;
break;
}
}
}
/* Called when a form is about to be freed --
remove all the objects that we know about from it. */
static void
releaseobjects(FL_FORM *form)
{
int i, n;
genericobject *g;
if (allgenerics == NULL)
return; /* No objects known yet */
n = PyList_Size(allgenerics);
for (i = 0; i < n; i++) {
g = (genericobject *)PyList_GetItem(allgenerics, i);
if (g != NULL && g->ob_generic->form == form) {
fl_delete_object(g->ob_generic);
/* The object is now unreachable for
do_forms and check_forms, so
delete it from the list of known objects */
Py_XDECREF(g->ob_callback);
g->ob_callback = NULL;
Py_XDECREF(g->ob_callback_arg);
g->ob_callback_arg = NULL;
PyList_SetItem(allgenerics, i, (PyObject *)NULL);
nfreeslots++;
}
}
}
/* Methods of generic objects */
static PyObject *
generic_set_call_back(genericobject *g, PyObject *args)
{
if (PyTuple_GET_SIZE(args) == 0) {
Py_XDECREF(g->ob_callback);
Py_XDECREF(g->ob_callback_arg);
g->ob_callback = NULL;
g->ob_callback_arg = NULL;
}
else {
PyObject *a, *b;
if (!PyArg_UnpackTuple(args, "set_call_back", 2, 2, &a, &b)
return NULL;
Py_XDECREF(g->ob_callback);
Py_XDECREF(g->ob_callback_arg);
g->ob_callback = a;
Py_INCREF(g->ob_callback);
g->ob_callback_arg = b;
Py_INCREF(g->ob_callback_arg);
}
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
generic_call(genericobject *g, void (*func)(FL_OBJECT *))
{
(*func)(g->ob_generic);
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
generic_delete_object(genericobject *g)
{
PyObject *res;
res = generic_call(g, fl_delete_object);
if (res != NULL)
forgetgeneric(g);
return res;
}
static PyObject *
generic_show_object(genericobject *g)
{
return generic_call(g, fl_show_object);
}
static PyObject *
generic_hide_object(genericobject *g)
{
return generic_call(g, fl_hide_object);
}
static PyObject *
generic_redraw_object(genericobject *g)
{
return generic_call(g, fl_redraw_object);
}
#ifdef OBSOLETE_FORMS_CALLS
/* (un)freeze_object() are obsolete in FORMS 2.2 and unsupported
in 2.3. Since there's no foolproof way to tell which version we're
using, we omit them unconditionally. */
static PyObject *
generic_freeze_object(genericobject *g)
{
return generic_call(g, fl_freeze_object);
}
static PyObject *
generic_unfreeze_object(genericobject *g)
{
return generic_call(g, fl_unfreeze_object);
}
#endif /* OBSOLETE_FORMS_CALLS */
static PyObject *
generic_activate_object(genericobject *g)
{
return generic_call(g, fl_activate_object);
}
static PyObject *
generic_deactivate_object(genericobject *g)
{
return generic_call(g, fl_deactivate_object);
}
static PyObject *
generic_set_object_shortcut(genericobject *g, PyObject *args)
{
char *str;
if (!PyArg_ParseTuple(args, "s:set_object_shortcut", &str))
return NULL;
fl_set_object_shortcut(g->ob_generic, str);
Py_INCREF(Py_None);
return Py_None;
}
static PyMethodDef generic_methods[] = {
{"set_call_back", (PyCFunction)generic_set_call_back, METH_VARARGS},
{"delete_object", (PyCFunction)generic_delete_object, METH_NOARGS},
{"show_object", (PyCFunction)generic_show_object, METH_NOARGS},
{"hide_object", (PyCFunction)generic_hide_object, METH_NOARGS},
{"redraw_object", (PyCFunction)generic_redraw_object, METH_NOARGS},
#ifdef OBSOLETE_FORMS_CALLS
{"freeze_object", (PyCFunction)generic_freeze_object, METH_NOARGS},
{"unfreeze_object", (PyCFunction)generic_unfreeze_object, METH_NOARGS},
#endif
{"activate_object", (PyCFunction)generic_activate_object, METH_NOARGS},
{"deactivate_object", (PyCFunction)generic_deactivate_object, METH_NOARGS},
{"set_object_shortcut", (PyCFunction)generic_set_object_shortcut, METH_VARARGS},
{NULL, NULL} /* sentinel */
};
static void
generic_dealloc(genericobject *g)
{
fl_free_object(g->ob_generic);
Py_XDECREF(g->ob_callback);
Py_XDECREF(g->ob_callback_arg);
PyObject_Del(g);
}
#define OFF(x) offsetof(FL_OBJECT, x)
static struct memberlist generic_memberlist[] = {
{"objclass", T_INT, OFF(objclass), RO},
{"type", T_INT, OFF(type), RO},
{"boxtype", T_INT, OFF(boxtype)},
{"x", T_FLOAT, OFF(x)},
{"y", T_FLOAT, OFF(y)},
{"w", T_FLOAT, OFF(w)},
{"h", T_FLOAT, OFF(h)},
{"col1", T_INT, OFF(col1)},
{"col2", T_INT, OFF(col2)},
{"align", T_INT, OFF(align)},
{"lcol", T_INT, OFF(lcol)},
{"lsize", T_FLOAT, OFF(lsize)},
/* "label" is treated specially! */
{"lstyle", T_INT, OFF(lstyle)},
{"pushed", T_INT, OFF(pushed), RO},
{"focus", T_INT, OFF(focus), RO},
{"belowmouse", T_INT, OFF(belowmouse),RO},
/* {"frozen", T_INT, OFF(frozen), RO}, */
{"active", T_INT, OFF(active)},
{"input", T_INT, OFF(input)},
{"visible", T_INT, OFF(visible), RO},
{"radio", T_INT, OFF(radio)},
{"automatic", T_INT, OFF(automatic)},
{NULL} /* Sentinel */
};
#undef OFF
static PyObject *
generic_getattr(genericobject *g, char *name)
{
PyObject *meth;
/* XXX Ought to special-case name "__methods__" */
if (g-> ob_methods) {
meth = Py_FindMethod(g->ob_methods, (PyObject *)g, name);
if (meth != NULL) return meth;
PyErr_Clear();
}
meth = Py_FindMethod(generic_methods, (PyObject *)g, name);
if (meth != NULL)
return meth;
PyErr_Clear();
/* "label" is an exception, getmember only works for char pointers,
not for char arrays */
if (strcmp(name, "label") == 0)
return PyString_FromString(g->ob_generic->label);
return PyMember_Get((char *)g->ob_generic, generic_memberlist, name);
}
static int
generic_setattr(genericobject *g, char *name, PyObject *v)
{
int ret;
if (v == NULL) {
PyErr_SetString(PyExc_TypeError,
"can't delete forms object attributes");
return -1;
}
/* "label" is an exception: setmember doesn't set strings;
and FORMS wants you to call a function to set the label */
if (strcmp(name, "label") == 0) {
if (!PyString_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"label attr must be string");
return -1;
}
fl_set_object_label(g->ob_generic, PyString_AsString(v));
return 0;
}
ret = PyMember_Set((char *)g->ob_generic, generic_memberlist, name, v);
/* Rather than calling all the various set_object_* functions,
we call fl_redraw_object here. This is sometimes redundant
but I doubt that's a big problem */
if (ret == 0)
fl_redraw_object(g->ob_generic);
return ret;
}
static PyObject *
generic_repr(genericobject *g)
{
char buf[100];
PyOS_snprintf(buf, sizeof(buf), "<FORMS_object at %p, objclass=%d>",
g, g->ob_generic->objclass);
return PyString_FromString(buf);
}
static PyTypeObject GenericObjecttype = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
"fl.FORMS_object", /*tp_name*/
sizeof(genericobject), /*tp_size*/
0, /*tp_itemsize*/
/* methods */
(destructor)generic_dealloc, /*tp_dealloc*/
0, /*tp_print*/
(getattrfunc)generic_getattr, /*tp_getattr*/
(setattrfunc)generic_setattr, /*tp_setattr*/
0, /*tp_compare*/
(reprfunc)generic_repr, /*tp_repr*/
};
static PyObject *
newgenericobject(FL_OBJECT *generic, PyMethodDef *methods)
{
genericobject *g;
g = PyObject_New(genericobject, &GenericObjecttype);
if (g == NULL)
return NULL;
g-> ob_generic = generic;
g->ob_methods = methods;
g->ob_callback = NULL;
g->ob_callback_arg = NULL;
knowgeneric(g);
return (PyObject *)g;
}
/**********************************************************************/
/* Some common calling sequences */
/* void func (object, float) */
static PyObject *
call_forms_INf (void (*func)(FL_OBJECT *, float), FL_OBJECT *obj, PyObject *args)
{
float parameter;
if (!PyArg_Parse(args, "f", ¶meter)) return NULL;
(*func) (obj, parameter);
Py_INCREF(Py_None);
return Py_None;
}
/* void func (object, float) */
static PyObject *
call_forms_INfINf (void (*func)(FL_OBJECT *, float, float), FL_OBJECT *obj, PyObject *args)
{
float par1, par2;
if (!PyArg_Parse(args, "(ff)", &par1, &par2)) return NULL;
(*func) (obj, par1, par2);
Py_INCREF(Py_None);
return Py_None;
}
/* void func (object, int) */
static PyObject *
call_forms_INi (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args)
{
int parameter;
if (!PyArg_Parse(args, "i", ¶meter)) return NULL;
(*func) (obj, parameter);
Py_INCREF(Py_None);
return Py_None;
}
/* void func (object, char) */
static PyObject *
call_forms_INc (void (*func)(FL_OBJECT *, int), FL_OBJECT *obj, PyObject *args)
{
char *a;
if (!PyArg_Parse(args, "s", &a)) return NULL;
(*func) (obj, a[0]);
Py_INCREF(Py_None);
return Py_None;
}
/* void func (object, string) */
static PyObject *
call_forms_INstr (void (*func)(FL_OBJECT *, char *), FL_OBJECT *obj, PyObject *args)
{
char *a;
if (!PyArg_Parse(args, "s", &a)) return NULL;
(*func) (obj, a);
Py_INCREF(Py_None);
return Py_None;
}
/* void func (object, int, string) */
static PyObject *
call_forms_INiINstr (void (*func)(FL_OBJECT *, int, char *), FL_OBJECT *obj, PyObject *args)
{
char *b;
int a;
if (!PyArg_Parse(args, "(is)", &a, &b)) return NULL;
(*func) (obj, a, b);
Py_INCREF(Py_None);
return Py_None;
}
#ifdef UNUSED
/* void func (object, int, int) */
static PyObject *
call_forms_INiINi (void (*func)(FL_OBJECT *, int, int), FL_OBJECT *obj, PyObject *args)
{
int par1, par2;
if (!PyArg_Parse(args, "(ii)", &par1, &par2)) return NULL;
(*func) (obj, par1, par2);
Py_INCREF(Py_None);
return Py_None;
}
#endif
/* int func (object) */
static PyObject *
call_forms_Ri (int (*func)(FL_OBJECT *), FL_OBJECT *obj)
{
int retval;
retval = (*func) (obj);
return PyInt_FromLong ((long) retval);
}
/* char * func (object) */
static PyObject *
call_forms_Rstr (char * (*func)(FL_OBJECT *), FL_OBJECT *obj)
{
char *str;
str = (*func) (obj);
if (str == NULL) {
Py_INCREF(Py_None);
return Py_None;
}
return PyString_FromString (str);
}
/* int func (object) */
static PyObject *
call_forms_Rf (float (*func)(FL_OBJECT *), FL_OBJECT *obj)
{
float retval;
retval = (*func) (obj);
return PyFloat_FromDouble (retval);
}
static PyObject *
call_forms_OUTfOUTf (void (*func)(FL_OBJECT *, float *, float *), FL_OBJECT *obj)
{
float f1, f2;
(*func) (obj, &f1, &f2);
return Py_BuildValue("(ff)", f1, f2);
}
#ifdef UNUSED
static PyObject *
call_forms_OUTf (void (*func)(FL_OBJECT *, float *), FL_OBJECT *obj)
{
float f;
(*func) (obj, &f);
return PyFloat_FromDouble (f);
}
#endif
/**********************************************************************/
/* Class : browser */
static PyObject *
set_browser_topline(genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_browser_topline, g-> ob_generic, args);
}
static PyObject *
clear_browser(genericobject *g)
{
return generic_call (g, fl_clear_browser);
}
static PyObject *
add_browser_line (genericobject *g, PyObject *args)
{
return call_forms_INstr (fl_add_browser_line, g-> ob_generic, args);
}
static PyObject *
addto_browser (genericobject *g, PyObject *args)
{
return call_forms_INstr (fl_addto_browser, g-> ob_generic, args);
}
static PyObject *
insert_browser_line (genericobject *g, PyObject *args)
{
return call_forms_INiINstr (fl_insert_browser_line,
g-> ob_generic, args);
}
static PyObject *
delete_browser_line (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_delete_browser_line, g-> ob_generic, args);
}
static PyObject *
replace_browser_line (genericobject *g, PyObject *args)
{
return call_forms_INiINstr (fl_replace_browser_line,
g-> ob_generic, args);
}
static PyObject *
get_browser_line(genericobject *g, PyObject *args)
{
int i;
char *str;
if (!PyArg_Parse(args, "i", &i))
return NULL;
str = fl_get_browser_line (g->ob_generic, i);
if (str == NULL) {
Py_INCREF(Py_None);
return Py_None;
}
return PyString_FromString (str);
}
static PyObject *
load_browser (genericobject *g, PyObject *args)
{
/* XXX strictly speaking this is wrong since fl_load_browser
XXX returns int, not void */
return call_forms_INstr (fl_load_browser, g-> ob_generic, args);
}
static PyObject *
get_browser_maxline(genericobject *g)
{
return call_forms_Ri (fl_get_browser_maxline, g-> ob_generic);
}
static PyObject *
select_browser_line (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_select_browser_line, g-> ob_generic, args);
}
static PyObject *
deselect_browser_line (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_deselect_browser_line, g-> ob_generic, args);
}
static PyObject *
deselect_browser (genericobject *g)
{
return generic_call (g, fl_deselect_browser);
}
static PyObject *
isselected_browser_line (genericobject *g, PyObject *args)
{
int i, j;
if (!PyArg_Parse(args, "i", &i))
return NULL;
j = fl_isselected_browser_line (g->ob_generic, i);
return PyInt_FromLong (j);
}
static PyObject *
get_browser (genericobject *g)
{
return call_forms_Ri (fl_get_browser, g-> ob_generic);
}
static PyObject *
set_browser_fontsize (genericobject *g, PyObject *args)
{
return call_forms_INf (fl_set_browser_fontsize, g-> ob_generic, args);
}
static PyObject *
set_browser_fontstyle (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_browser_fontstyle, g-> ob_generic, args);
}
static PyObject *
set_browser_specialkey (genericobject *g, PyObject *args)
{
return call_forms_INc(fl_set_browser_specialkey, g-> ob_generic, args);
}
static PyMethodDef browser_methods[] = {
{"set_browser_topline", (PyCFunction)set_browser_topline,
METH_OLDARGS},
{"clear_browser", (PyCFunction)clear_browser,
METH_NOARGS},
{"add_browser_line", (PyCFunction)add_browser_line,
METH_OLDARGS},
{"addto_browser", (PyCFunction)addto_browser,
METH_OLDARGS},
{"insert_browser_line", (PyCFunction)insert_browser_line,
METH_OLDARGS},
{"delete_browser_line", (PyCFunction)delete_browser_line,
METH_OLDARGS},
{"replace_browser_line", (PyCFunction)replace_browser_line,
METH_OLDARGS},
{"get_browser_line", (PyCFunction)get_browser_line,
METH_OLDARGS},
{"load_browser", (PyCFunction)load_browser,
METH_OLDARGS},
{"get_browser_maxline", (PyCFunction)get_browser_maxline,
METH_NOARGS,}
{"select_browser_line", (PyCFunction)select_browser_line,
METH_OLDARGS},
{"deselect_browser_line", (PyCFunction)deselect_browser_line,
METH_OLDARGS},
{"deselect_browser", (PyCFunction)deselect_browser,
METH_NOARGS,}
{"isselected_browser_line", (PyCFunction)isselected_browser_line,
METH_OLDARGS},
{"get_browser", (PyCFunction)get_browser,
METH_NOARGS,}
{"set_browser_fontsize", (PyCFunction)set_browser_fontsize,
METH_OLDARGS},
{"set_browser_fontstyle", (PyCFunction)set_browser_fontstyle,
METH_OLDARGS},
{"set_browser_specialkey", (PyCFunction)set_browser_specialkey,
METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
/* Class: button */
static PyObject *
set_button(genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_button, g-> ob_generic, args);
}
static PyObject *
get_button(genericobject *g)
{
return call_forms_Ri (fl_get_button, g-> ob_generic);
}
static PyObject *
get_button_numb(genericobject *g)
{
return call_forms_Ri (fl_get_button_numb, g-> ob_generic);
}
static PyObject *
set_button_shortcut(genericobject *g, PyObject *args)
{
return call_forms_INstr (fl_set_button_shortcut, g-> ob_generic, args);
}
static PyMethodDef button_methods[] = {
{"set_button", (PyCFunction)set_button, METH_OLDARGS},
{"get_button", (PyCFunction)get_button, METH_NOARGS},
{"get_button_numb", (PyCFunction)get_button_numb, METH_NOARGS},
{"set_button_shortcut", (PyCFunction)set_button_shortcut, METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
/* Class: choice */
static PyObject *
set_choice(genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_choice, g-> ob_generic, args);
}
static PyObject *
get_choice(genericobject *g)
{
return call_forms_Ri (fl_get_choice, g-> ob_generic);
}
static PyObject *
clear_choice (genericobject *g)
{
return generic_call (g, fl_clear_choice);
}
static PyObject *
addto_choice (genericobject *g, PyObject *args)
{
return call_forms_INstr (fl_addto_choice, g-> ob_generic, args);
}
static PyObject *
replace_choice (genericobject *g, PyObject *args)
{
return call_forms_INiINstr (fl_replace_choice, g-> ob_generic, args);
}
static PyObject *
delete_choice (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_delete_choice, g-> ob_generic, args);
}
static PyObject *
get_choice_text (genericobject *g)
{
return call_forms_Rstr (fl_get_choice_text, g-> ob_generic);
}
static PyObject *
set_choice_fontsize (genericobject *g, PyObject *args)
{
return call_forms_INf (fl_set_choice_fontsize, g-> ob_generic, args);
}
static PyObject *
set_choice_fontstyle (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_choice_fontstyle, g-> ob_generic, args);
}
static PyMethodDef choice_methods[] = {
{"set_choice", (PyCFunction)set_choice, METH_OLDARGS},
{"get_choice", (PyCFunction)get_choice, METH_NOARGS},
{"clear_choice", (PyCFunction)clear_choice, METH_NOARGS},
{"addto_choice", (PyCFunction)addto_choice, METH_OLDARGS},
{"replace_choice", (PyCFunction)replace_choice, METH_OLDARGS},
{"delete_choice", (PyCFunction)delete_choice, METH_OLDARGS},
{"get_choice_text", (PyCFunction)get_choice_text, METH_NOARGS},
{"set_choice_fontsize", (PyCFunction)set_choice_fontsize, METH_OLDARGS},
{"set_choice_fontstyle",(PyCFunction)set_choice_fontstyle, METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
/* Class : Clock */
static PyObject *
get_clock(genericobject *g)
{
int i0, i1, i2;
fl_get_clock (g->ob_generic, &i0, &i1, &i2);
return Py_BuildValue("(iii)", i0, i1, i2);
}
static PyMethodDef clock_methods[] = {
{"get_clock", (PyCFunction)get_clock, METH_NOARGS},
{NULL, NULL} /* sentinel */
};
/* CLass : Counters */
static PyObject *
get_counter_value(genericobject *g)
{
return call_forms_Rf (fl_get_counter_value, g-> ob_generic);
}
static PyObject *
set_counter_value (genericobject *g, PyObject *args)
{
return call_forms_INf (fl_set_counter_value, g-> ob_generic, args);
}
static PyObject *
set_counter_precision (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_counter_precision, g-> ob_generic, args);
}
static PyObject *
set_counter_bounds (genericobject *g, PyObject *args)
{
return call_forms_INfINf (fl_set_counter_bounds, g-> ob_generic, args);
}
static PyObject *
set_counter_step (genericobject *g, PyObject *args)
{
return call_forms_INfINf (fl_set_counter_step, g-> ob_generic, args);
}
static PyObject *
set_counter_return (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_counter_return, g-> ob_generic, args);
}
static PyMethodDef counter_methods[] = {
{"set_counter_value", (PyCFunction)set_counter_value,
METH_OLDARGS},
{"get_counter_value", (PyCFunction)get_counter_value,
METH_NOARGS},
{"set_counter_bounds", (PyCFunction)set_counter_bounds,
METH_OLDARGS},
{"set_counter_step", (PyCFunction)set_counter_step,
METH_OLDARGS},
{"set_counter_precision", (PyCFunction)set_counter_precision,
METH_OLDARGS},
{"set_counter_return", (PyCFunction)set_counter_return,
METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
/* Class: Dials */
static PyObject *
get_dial_value(genericobject *g)
{
return call_forms_Rf (fl_get_dial_value, g-> ob_generic);
}
static PyObject *
set_dial_value (genericobject *g, PyObject *args)
{
return call_forms_INf (fl_set_dial_value, g-> ob_generic, args);
}
static PyObject *
set_dial_bounds (genericobject *g, PyObject *args)
{
return call_forms_INfINf (fl_set_dial_bounds, g-> ob_generic, args);
}
static PyObject *
get_dial_bounds (genericobject *g)
{
return call_forms_OUTfOUTf (fl_get_dial_bounds, g-> ob_generic);
}
static PyObject *
set_dial_step (genericobject *g, PyObject *args)
{
return call_forms_INf (fl_set_dial_step, g-> ob_generic, args);
}
static PyMethodDef dial_methods[] = {
{"set_dial_value", (PyCFunction)set_dial_value, METH_OLDARGS},
{"get_dial_value", (PyCFunction)get_dial_value, METH_NOARGS},
{"set_dial_bounds", (PyCFunction)set_dial_bounds, METH_OLDARGS},
{"get_dial_bounds", (PyCFunction)get_dial_bounds, METH_NOARGS},
{"set_dial_step", (PyCFunction)set_dial_step, METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
/* Class : Input */
static PyObject *
set_input (genericobject *g, PyObject *args)
{
return call_forms_INstr (fl_set_input, g-> ob_generic, args);
}
static PyObject *
get_input (genericobject *g)
{
return call_forms_Rstr (fl_get_input, g-> ob_generic);
}
static PyObject *
set_input_color (genericobject *g, PyObject *args)
{
return call_forms_INfINf (fl_set_input_color, g-> ob_generic, args);
}
static PyObject *
set_input_return (genericobject *g, PyObject *args)
{
return call_forms_INi (fl_set_input_return, g-> ob_generic, args);
}
static PyMethodDef input_methods[] = {
{"set_input", (PyCFunction)set_input, METH_OLDARGS},
{"get_input", (PyCFunction)get_input, METH_NOARGS},
{"set_input_color", (PyCFunction)set_input_color, METH_OLDARGS},
{"set_input_return", (PyCFunction)set_input_return, METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
/* Class : Menu */
static PyObject *
set_menu (genericobject *g, PyObject *args)
{
return call_forms_INstr (fl_set_menu, g-> ob_generic, args);
}