From 34679b7661873ec65e5157ddd1ea2be8269632d0 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 26 Jan 1993 13:33:44 +0000 Subject: [PATCH] * Added Fixcprt.py: script to fix copyright message. * various modules: added 1993 to copyright. * thread.c: added copyright notice. * ceval.c: minor change to error message for "+" * stdwinmodule.c: check for error from wfetchcolor * config.c: MS-DOS fixes (define PYTHONPATH, use DELIM, use osdefs.h) * Add declaration of inittab to import.h * sysmodule.c: added sys.builtin_module_names * xxmodule.c, xxobject.c: fix minor errors --- Include/allobjects.h | 4 ++-- Include/import.h | 9 +++++++-- Modules/audioop.c | 4 ++-- Modules/config.c.in | 34 ++++++++++++++++++++++++++++------ Modules/imageop.c | 4 ++-- Modules/imgfile.c | 4 ++-- Modules/rotormodule.c | 4 ++-- Modules/stdwinmodule.c | 10 +++++++++- Modules/svmodule.c | 4 ++-- Modules/threadmodule.c | 4 ++-- Modules/xxmodule.c | 4 ++-- Objects/fileobject.c | 4 ++-- Objects/listobject.c | 4 ++-- Objects/longobject.c | 4 ++-- Objects/xxobject.c | 6 +++--- Python/ceval.c | 10 ++++------ Python/import.c | 9 ++------- Python/modsupport.c | 4 ++-- Python/sysmodule.c | 23 +++++++++++++++++++++-- Python/thread.c | 24 ++++++++++++++++++++++++ 20 files changed, 122 insertions(+), 51 deletions(-) diff --git a/Include/allobjects.h b/Include/allobjects.h index 34232fd5830..d7a03331fc7 100644 --- a/Include/allobjects.h +++ b/Include/allobjects.h @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Include/import.h b/Include/import.h index 39f6d9620bb..c934fe59ae3 100644 --- a/Include/import.h +++ b/Include/import.h @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -29,3 +29,8 @@ object *add_module PROTO((char *name)); object *import_module PROTO((char *name)); object *reload_module PROTO((object *m)); void doneimport PROTO((void)); + +extern struct { + char *name; + void (*initfunc)(); +} inittab[]; diff --git a/Modules/audioop.c b/Modules/audioop.c index c938eea010b..301b4940077 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Modules/config.c.in b/Modules/config.c.in index 11e2cdd7e16..549d14f82ec 100644 --- a/Modules/config.c.in +++ b/Modules/config.c.in @@ -28,7 +28,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define USE_MARSHAL 1 /* This is linked anyway */ #define USE_MATH 1 #define USE_STRUCT 1 -#define USE_STROP 1 #define USE_TIME 1 #ifdef macintosh @@ -36,8 +35,8 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define USE_IMAGEOP 1 #define USE_MAC 1 #define USE_REGEX 1 -#define USE_ROTOR 1 #define USE_STDWIN 1 /* You may turn this off */ +#define USE_STROP #endif #ifdef unix @@ -48,10 +47,18 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define USE_SOCKET 1 #endif +#ifdef MSDOS +#define USE_POSIX 1 /* Subset defined in posixmodule.c */ +#define USE_REGEX 1 +#define USE_STROP 1 +#define USE_PC 1 +#endif + #include #include "PROTO.h" #include "mymalloc.h" +#include "osdefs.h" #include "patchlevel.h" @@ -116,12 +123,25 @@ donecalls() } #ifndef PYTHONPATH + #ifdef macintosh /* On the Mac, the search path is a space-separated list of directories */ #define PYTHONPATH ": :lib :demo" -#else /* !macintosh */ +#endif /* macintosh */ + +#ifdef unix #define PYTHONPATH ".:/usr/local/lib/python" -#endif /* !macintosh */ +#endif /* unix */ + +#ifdef MSDOS +/* In MS-DOS, the delimiter is a semicolon */ +#define PYTHONPATH ".;C\\python\\lib" +#endif /* MSDOS */ + +#ifndef PYTHONPATH +ERROR; ERROR; On what kind of system are you?; +#endif + #endif /* !PYTHONPATH */ extern char *getenv(); @@ -135,6 +155,7 @@ getpythonpath() char *path = getenv("PYTHONPATH"); char *defpath = PYTHONPATH; char *buf; + char *p; int n; if (path == 0 || *path == '\0') @@ -144,8 +165,9 @@ getpythonpath() if (buf == NULL) return path; /* XXX too bad -- but not likely */ strcpy(buf, path); - strcat(buf, ":"); - strcat(buf, defpath); + p = buf + strlen(buf); + *p++ = DELIM; + strcpy(p, defpath); return buf; #endif /* !macintosh */ } diff --git a/Modules/imageop.c b/Modules/imageop.c index 9c0107b3378..49301b79832 100644 --- a/Modules/imageop.c +++ b/Modules/imageop.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Modules/imgfile.c b/Modules/imgfile.c index 075fc461105..7783083aaf8 100644 --- a/Modules/imgfile.c +++ b/Modules/imgfile.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c index f16acd03c5f..4e9afd8deb1 100644 --- a/Modules/rotormodule.c +++ b/Modules/rotormodule.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c index 62e9b47941b..77ba6ec81d5 100644 --- a/Modules/stdwinmodule.c +++ b/Modules/stdwinmodule.c @@ -2119,9 +2119,17 @@ stdwin_fetchcolor(self, args) object *args; { char *colorname; + COLOR color; if (!getstrarg(args, &colorname)) return NULL; - return newintobject((long)wfetchcolor(colorname)); + color = wfetchcolor(colorname); +#ifdef BADCOLOR + if (color == BADCOLOR) { + err_setstr(StdwinError, "color name not found"); + return NULL; + } +#endif + return newintobject((long)color); } static object * diff --git a/Modules/svmodule.c b/Modules/svmodule.c index 6df8b9504a9..0d144732dbd 100644 --- a/Modules/svmodule.c +++ b/Modules/svmodule.c @@ -1,6 +1,6 @@ /********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c index 123c4d30c88..7a5f29d4f44 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Modules/xxmodule.c b/Modules/xxmodule.c index 070a6222cbb..cf6481efcd2 100644 --- a/Modules/xxmodule.c +++ b/Modules/xxmodule.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 1c0598bf566..faf7e861414 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Objects/listobject.c b/Objects/listobject.c index d7d140f5131..474932fd190 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Objects/longobject.c b/Objects/longobject.c index 85d1c661459..4c5ede54829 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Objects/xxobject.c b/Objects/xxobject.c index 8471893e22a..2d03cfddc67 100644 --- a/Objects/xxobject.c +++ b/Objects/xxobject.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -80,7 +80,7 @@ xx_demo(self, args) } static struct methodlist xx_methods[] = { - "demo", xx_demo, + {"demo", xx_demo}, {NULL, NULL} /* sentinel */ }; diff --git a/Python/ceval.c b/Python/ceval.c index a46fd362afe..b28f17c6d83 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -1577,10 +1577,8 @@ add(v, w) DECREF(w); return x; } - else { - err_setstr(TypeError, "+ not supported by operands"); - return NULL; - } + err_setstr(TypeError, "bad operand type(s) for +"); + return NULL; } static object * diff --git a/Python/import.c b/Python/import.c index 44f6d7bdceb..da9422b27d3 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -395,11 +395,6 @@ doneimport() /* Initialize built-in modules when first imported */ -extern struct { - char *name; - void (*initfunc)(); -} inittab[]; - static int init_builtin(name) char *name; diff --git a/Python/modsupport.c b/Python/modsupport.c index 1f281266c9f..f92739aac50 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 5dff38ef793..2ad8a266bb6 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1,6 +1,6 @@ /*********************************************************** -Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The -Netherlands. +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. All Rights Reserved @@ -154,6 +154,23 @@ static struct methodlist sys_methods[] = { static object *sysin, *sysout, *syserr; +static object * +list_builtin_module_names() +{ + object *list = newlistobject(0); + int i; + if (list == NULL) + return NULL; + for (i = 0; inittab[i].name != NULL; i++) { + object *name = newstringobject(inittab[i].name); + if (name == NULL) + break; + addlistitem(list, name); + DECREF(name); + } + return list; +} + void initsys() { @@ -175,6 +192,8 @@ initsys() dictinsert(sysdict, "stderr", syserr); dictinsert(sysdict, "version", v); dictinsert(sysdict, "modules", get_modules()); + dictinsert(sysdict, "builtin_module_names", + list_builtin_module_names()); if (err_occurred()) fatal("can't insert sys.* objects in sys dict"); DECREF(v); diff --git a/Python/thread.c b/Python/thread.c index 44f28968776..56ef137278b 100644 --- a/Python/thread.c +++ b/Python/thread.c @@ -1,3 +1,27 @@ +/*********************************************************** +Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, +Amsterdam, The Netherlands. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the names of Stichting Mathematisch +Centrum or CWI not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior permission. + +STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE +FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +******************************************************************/ + #include "thread.h" #ifdef DEBUG