diff options
-rw-r--r-- | Modules/flmodule.c | 87 | ||||
-rw-r--r-- | Modules/posixmodule.c | 44 | ||||
-rw-r--r-- | Modules/stdwinmodule.c | 14 | ||||
-rw-r--r-- | Objects/classobject.c | 26 | ||||
-rw-r--r-- | Objects/fileobject.c | 20 | ||||
-rw-r--r-- | Objects/listobject.c | 2 | ||||
-rw-r--r-- | Objects/longobject.c | 17 | ||||
-rw-r--r-- | Objects/methodobject.c | 19 | ||||
-rw-r--r-- | Objects/moduleobject.c | 13 | ||||
-rw-r--r-- | Objects/object.c | 13 | ||||
-rw-r--r-- | Objects/typeobject.c | 13 |
11 files changed, 126 insertions, 142 deletions
diff --git a/Modules/flmodule.c b/Modules/flmodule.c index 7a8d014..34f0121 100644 --- a/Modules/flmodule.c +++ b/Modules/flmodule.c @@ -315,11 +315,11 @@ static struct memberlist generic_memberlist[] = { {"focus", T_INT, OFF(focus), RO}, {"belowmouse", T_INT, OFF(belowmouse),RO}, {"frozen", T_INT, OFF(frozen), RO}, - {"active", T_INT, OFF(active), RO}, - {"input", T_INT, OFF(input), RO}, + {"active", T_INT, OFF(active)}, + {"input", T_INT, OFF(input)}, {"visible", T_INT, OFF(visible), RO}, - {"radio", T_INT, OFF(radio), RO}, - {"automatic", T_INT, OFF(automatic), RO}, + {"radio", T_INT, OFF(radio)}, + {"automatic", T_INT, OFF(automatic)}, {NULL} /* Sentinel */ }; @@ -1827,6 +1827,22 @@ form_find_last(f, args) return forms_find_first_or_last(fl_find_last, f, args); } +static object * +form_set_object_focus(f, args) + formobject *f; + object *args; +{ + genericobject *g; + if (args == NULL || !is_genericobject(args)) { + err_badarg(); + return NULL; + } + g = (genericobject *)args; + fl_set_object_focus(f->ob_form, g->ob_generic); + INCREF(None); + return None; +} + static struct methodlist form_methods[] = { /* adm */ {"show_form", form_show_form}, @@ -1844,6 +1860,7 @@ static struct methodlist form_methods[] = { {"end_group", form_end_group}, {"find_first", form_find_first}, {"find_last", form_find_last}, + {"set_object_focus", form_set_object_focus}, /* basic objects */ {"add_button", form_add_button}, @@ -1886,11 +1903,11 @@ static struct memberlist form_memberlist[] = { {"window", T_LONG, OFF(window), RO}, {"w", T_FLOAT, OFF(w)}, {"h", T_FLOAT, OFF(h)}, - {"x", T_FLOAT, OFF(x)}, - {"y", T_FLOAT, OFF(y)}, + {"x", T_FLOAT, OFF(x), RO}, + {"y", T_FLOAT, OFF(y), RO}, {"deactivated", T_INT, OFF(deactivated)}, - {"visible", T_INT, OFF(visible)}, - {"frozen", T_INT, OFF(frozen)}, + {"visible", T_INT, OFF(visible), RO}, + {"frozen", T_INT, OFF(frozen), RO}, {"doublebuf", T_INT, OFF(doublebuf)}, {NULL} /* Sentinel */ }; @@ -2045,7 +2062,7 @@ forms_do_or_check_forms(dummy, args, func) int dev; short val; if (my_event_callback == NULL) - return newintobject(-1); + return newintobject(-1L); dev = fl_qread(&val); arg = newtupleobject(2); if (arg == NULL) @@ -2100,6 +2117,22 @@ forms_check_forms(dummy, args) return forms_do_or_check_forms(dummy, args, fl_check_forms); } +static object * +forms_do_only_forms(dummy, args) + object *dummy; + object *args; +{ + return forms_do_or_check_forms(dummy, args, fl_do_only_forms); +} + +static object * +forms_check_only_forms(dummy, args) + object *dummy; + object *args; +{ + return forms_do_or_check_forms(dummy, args, fl_check_only_forms); +} + #ifdef UNUSED static object * fl_call(func, args) @@ -2134,14 +2167,42 @@ forms_get_rgbmode(dummy, args) object *dummy; object *args; { - extern fl_rgbmode; + extern int fl_rgbmode; if (args != NULL) { err_badarg(); return NULL; } - return newintobject(fl_rgbmode); + return newintobject((long)fl_rgbmode); } + +static object * +forms_show_errors(dummy, args) + object *dummy; + object *args; +{ + int show; + if (!getargs(args, "i", &show)) + return NULL; + fl_show_errors(show); + INCREF(None); + return None; +} + +static object * +forms_set_font_name(dummy, args) + object *dummy; + object *args; +{ + int numb; + char *name; + if (!getargs(args, "(is)", &numb, &name)) + return NULL; + fl_set_font_name(numb, name); + INCREF(None); + return None; +} + #endif /* !FL_V15 */ @@ -2355,7 +2416,7 @@ forms_show_choice(f, args) char *m1, *m2, *m3, *b1, *b2, *b3; int nb; char *format; - int rv; + long rv; if (args == NULL || !is_tupleobject(args)) { err_badarg(); @@ -2526,6 +2587,8 @@ static struct methodlist forms_methods[] = { #ifndef FL_V15 {"set_graphics_mode", forms_set_graphics_mode}, {"get_rgbmode", forms_get_rgbmode}, + {"show_errors", forms_show_errors}, + {"set_font_name", forms_set_font_name}, #endif /* !FL_V15 */ {NULL, NULL} /* sentinel */ }; diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0bc0f91..a263f1b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -819,7 +819,7 @@ posix_times(self, args) errno = 0; c = times(&t); if (c == (clock_t) -1) { - err_errno(IOError); + err_errno(PosixError); return NULL; } tuple = newtupleobject(4); @@ -847,8 +847,10 @@ posix_setsid(self, args) { if (!getnoarg(args)) return NULL; - if (setsid() < 0) + if (setsid() < 0) { err_errno(PosixError); + return NULL; + } INCREF(None); return None; } @@ -861,12 +863,46 @@ posix_setpgid(self, args) int pid, pgrp; if (!getargs(args, "(ii)", &pid, &pgrp)) return NULL; - if (setpgid(pid, pgrp) < 0) + if (setpgid(pid, pgrp) < 0) { err_errno(PosixError); + return NULL; + } INCREF(None); return None; } +static object * +posix_tcgetpgrp(self, args) + object *self; + object *args; +{ + int fd, pgid; + if (!getargs(args, "i", &fd)) + return NULL; + pgid = tcgetpgrp(fd); + if (pgid < 0) { + err_errno(PosixError); + return NULL; + } + return newintobject((long)pgid); +} + +static object * +posix_tcsetpgrp(self, args) + object *self; + object *args; +{ + int fd, pgid; + if (!getargs(args, "(ii)", &fd, &pgid)) + return NULL; + if (tcsetpgrp(fd, pgid) < 0) { + err_errno(PosixError); + return NULL; + } + INCREF(None); + return None; +} + #endif /* DO_PG */ @@ -919,6 +955,8 @@ static struct methodlist posix_methods[] = { #ifdef DO_PG {"setsid", posix_setsid}, {"setpgid", posix_setpgid}, + {"tcgetpgrp", posix_tcgetpgrp}, + {"tcsetpgrp", posix_tcsetpgrp}, #endif {NULL, NULL} /* Sentinel */ diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c index 8b3812b..a33366d 100644 --- a/Modules/stdwinmodule.c +++ b/Modules/stdwinmodule.c @@ -1311,18 +1311,6 @@ window_dealloc(wp) free((char *)wp); } -static int -window_print(wp, fp, flags) - windowobject *wp; - FILE *fp; - int flags; -{ - fprintf(fp, "<%s window titled '%s'>", - wp->w_win == NULL ? "closed" : "open", - getstringvalue(wp->w_title)); - return 0; -} - static object * window_close(wp, args) windowobject *wp; @@ -1684,7 +1672,7 @@ typeobject Windowtype = { 0, /*tp_itemsize*/ /* methods */ window_dealloc, /*tp_dealloc*/ - window_print, /*tp_print*/ + 0, /*tp_print*/ window_getattr, /*tp_getattr*/ window_setattr, /*tp_setattr*/ 0, /*tp_compare*/ diff --git a/Objects/classobject.c b/Objects/classobject.c index 9026968..e3b12c6 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -261,30 +261,6 @@ instance_setattr(inst, name, v) return dictinsert(inst->in_attr, name, v); } -int -instance_print(inst, fp, flags) - instanceobject *inst; - FILE *fp; - int flags; -{ - object *func, *repr; - int ret; - - func = instance_getattr(inst, "__repr__"); - if (func == NULL) { - err_clear(); - fprintf(fp, "<instance object at %lx>", (long)inst); - return 0; - } - repr = call_object(func, (object *)NULL); - DECREF(func); - if (repr == NULL) - return -1; - ret = printobject(repr, fp, flags | PRINT_RAW); - DECREF(repr); - return ret; -} - object * instance_repr(inst) instanceobject *inst; @@ -753,7 +729,7 @@ typeobject Instancetype = { sizeof(instanceobject), 0, instance_dealloc, /*tp_dealloc*/ - instance_print, /*tp_print*/ + 0, /*tp_print*/ instance_getattr, /*tp_getattr*/ instance_setattr, /*tp_setattr*/ instance_compare, /*tp_compare*/ diff --git a/Objects/fileobject.c b/Objects/fileobject.c index e649792..dd47905 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -132,29 +132,11 @@ file_dealloc(f) free((char *)f); } -static int -file_print(f, fp, flags) - fileobject *f; - FILE *fp; - int flags; -{ - fprintf(fp, "<%s file ", f->f_fp == NULL ? "closed" : "open"); - if (printobject(f->f_name, fp, flags) != 0) - return -1; - fprintf(fp, ", mode "); - if (printobject(f->f_mode, fp, flags) != 0) - return -1; - fprintf(fp, ">"); - return 0; -} - static object * file_repr(f) fileobject *f; { char buf[300]; - /* XXX This differs from file_print if the filename contains - quotes or other funny characters. */ sprintf(buf, "<%s file '%.256s', mode '%.10s'>", f->f_fp == NULL ? "closed" : "open", getstringvalue(f->f_name), @@ -535,7 +517,7 @@ typeobject Filetype = { sizeof(fileobject), 0, file_dealloc, /*tp_dealloc*/ - file_print, /*tp_print*/ + 0, /*tp_print*/ file_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ diff --git a/Objects/listobject.c b/Objects/listobject.c index ba44c3d..d403a5e 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -600,7 +600,7 @@ listindex(self, args) } for (i = 0; i < self->ob_size; i++) { if (cmpobject(self->ob_item[i], args) == 0) - return newintobject(i); + return newintobject((long)i); } err_setstr(ValueError, "list.index(x): x not in list"); return NULL; diff --git a/Objects/longobject.c b/Objects/longobject.c index 25b4c64..84fc552 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -581,21 +581,6 @@ long_dealloc(v) DEL(v); } -/* ARGSUSED */ -static int -long_print(v, fp, flags) - object *v; - FILE *fp; - int flags; /* Not used but required by interface */ -{ - stringobject *str = (stringobject *) long_format(v, 10); - if (str == NULL) - return -1; - fprintf(fp, "%s", GETSTRINGVALUE(str)); - DECREF(str); - return 0; -} - static object * long_repr(v) object *v; @@ -1347,7 +1332,7 @@ typeobject Longtype = { sizeof(longobject) - sizeof(digit), sizeof(digit), long_dealloc, /*tp_dealloc*/ - long_print, /*tp_print*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ (int (*) FPROTO((object *, object *))) diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 3b7c016..d0b29c7 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -99,21 +99,6 @@ meth_dealloc(m) free((char *)m); } -/* ARGSUSED */ -static int -meth_print(m, fp, flags) - methodobject *m; - FILE *fp; - int flags; /* Not used but required by interface */ -{ - if (m->m_self == NULL) - fprintf(fp, "<built-in function '%s'>", m->m_name); - else - fprintf(fp, "<built-in method '%s' of some %s object>", - m->m_name, m->m_self->ob_type->tp_name); - return 0; -} - static object * meth_repr(m) methodobject *m; @@ -131,11 +116,11 @@ meth_repr(m) typeobject Methodtype = { OB_HEAD_INIT(&Typetype) 0, - "method", + "builtin_function_or_method", sizeof(methodobject), 0, meth_dealloc, /*tp_dealloc*/ - meth_print, /*tp_print*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index aedba35..9733a77 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -83,17 +83,6 @@ module_dealloc(m) free((char *)m); } -/* ARGSUSED */ -static int -module_print(m, fp, flags) - moduleobject *m; - FILE *fp; - int flags; /* Not used but required by interface */ -{ - fprintf(fp, "<module '%s'>", getstringvalue(m->md_name)); - return 0; -} - static object * module_repr(m) moduleobject *m; @@ -153,7 +142,7 @@ typeobject Moduletype = { sizeof(moduleobject), /*tp_size*/ 0, /*tp_itemsize*/ module_dealloc, /*tp_dealloc*/ - module_print, /*tp_print*/ + 0, /*tp_print*/ module_getattr, /*tp_getattr*/ module_setattr, /*tp_setattr*/ 0, /*tp_compare*/ diff --git a/Objects/object.c b/Objects/object.c index 16053a9..707dd58 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -207,17 +207,6 @@ so there is exactly one (which is indestructible, by the way). */ /* ARGSUSED */ -static int -none_print(op, fp, flags) - object *op; - FILE *fp; - int flags; -{ - fprintf(fp, "None"); - return 0; -} - -/* ARGSUSED */ static object * none_repr(op) object *op; @@ -232,7 +221,7 @@ static typeobject Notype = { 0, 0, 0, /*tp_dealloc*/ /*never called*/ - none_print, /*tp_print*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ diff --git a/Objects/typeobject.c b/Objects/typeobject.c index e72f34c..f78d280 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -28,17 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* Type object implementation */ -/* ARGSUSED */ -static int -type_print(v, fp, flags) - typeobject *v; - FILE *fp; - int flags; -{ - fprintf(fp, "<type '%s'>", v->tp_name); - return 0; -} - static object * type_repr(v) typeobject *v; @@ -55,7 +44,7 @@ typeobject Typetype = { sizeof(typeobject), /* Basic object size */ 0, /* Item size for varobject */ 0, /*tp_dealloc*/ - type_print, /*tp_print*/ + 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ |