* 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
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
object *import_module PROTO((char *name));
object *reload_module PROTO((object *m));
void doneimport PROTO((void));
+
+extern struct {
+ char *name;
+ void (*initfunc)();
+} inittab[];
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
#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
#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
#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 <stdio.h>
#include "PROTO.h"
#include "mymalloc.h"
+#include "osdefs.h"
#include "patchlevel.h"
}
#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();
char *path = getenv("PYTHONPATH");
char *defpath = PYTHONPATH;
char *buf;
+ char *p;
int n;
if (path == 0 || *path == '\0')
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 */
}
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
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 *
/**********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
}
static struct methodlist xx_methods[] = {
- "demo", xx_demo,
+ {"demo", xx_demo},
{NULL, NULL} /* sentinel */
};
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
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 *
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/* Initialize built-in modules when first imported */
-extern struct {
- char *name;
- void (*initfunc)();
-} inittab[];
-
static int
init_builtin(name)
char *name;
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
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()
{
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);
+/***********************************************************
+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