Merge alpha100 branch back to main trunk
diff --git a/Include/accessobject.h b/Include/accessobject.h
index 31b7190..fd8c2e9 100644
--- a/Include/accessobject.h
+++ b/Include/accessobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/allobjects.h b/Include/allobjects.h
index 17d6dd2..2b361c1 100644
--- a/Include/allobjects.h
+++ b/Include/allobjects.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -30,6 +30,10 @@
/* "allobjects.c" -- Source for precompiled header "allobjects.h" */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifdef THINK_C
#define macintosh
#endif
@@ -37,7 +41,7 @@
#include <stdio.h>
#include <string.h>
-#include "PROTO.h"
+#include "myproto.h"
#include "object.h"
#include "objimpl.h"
diff --git a/Include/assert.h b/Include/assert.h
index dbce369..d007eca 100644
--- a/Include/assert.h
+++ b/Include/assert.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -28,7 +28,13 @@
******************************************************************/
+#ifdef MPW /* This is for MPW's File command */
+
+#define assert(e) { if (!(e)) { printf("### Python: Assertion failed:\n\
+ File %s; Line %d\n", __FILE__, __LINE__); abort(); } }
+#else
#define assert(e) { if (!(e)) { printf("Assertion failed\n"); abort(); } }
+#endif
#ifdef __cplusplus
}
diff --git a/Include/bitset.h b/Include/bitset.h
index f7dbe8f..6fa5be6 100644
--- a/Include/bitset.h
+++ b/Include/bitset.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/bltinmodule.h b/Include/bltinmodule.h
index 0c8ecc2..e4f47e0 100644
--- a/Include/bltinmodule.h
+++ b/Include/bltinmodule.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -31,6 +31,7 @@
/* Built-in module interface */
extern object *getbuiltin PROTO((object *));
+extern int setbuiltin PROTO((char *, object *));
#ifdef __cplusplus
}
diff --git a/Include/ceval.h b/Include/ceval.h
index 1c830c3..3b16085 100644
--- a/Include/ceval.h
+++ b/Include/ceval.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -35,6 +35,7 @@
object *getglobals PROTO((void));
object *getlocals PROTO((void));
object *getowner PROTO((void));
+object *getframe PROTO((void));
void printtraceback PROTO((object *));
void flushline PROTO((void));
@@ -87,7 +88,7 @@
extern object *save_thread PROTO((void));
extern void restore_thread PROTO((object *));
-#ifdef USE_THREAD
+#ifdef WITH_THREAD
#define BGN_SAVE { \
object *_save; \
@@ -97,14 +98,14 @@
#define END_SAVE restore_thread(_save); \
}
-#else /* !USE_THREAD */
+#else /* !WITH_THREAD */
#define BGN_SAVE {
#define RET_SAVE
#define RES_SAVE
#define END_SAVE }
-#endif /* !USE_THREAD */
+#endif /* !WITH_THREAD */
#ifdef __cplusplus
}
diff --git a/Include/cgensupport.h b/Include/cgensupport.h
index 8472b03..4b295b3 100644
--- a/Include/cgensupport.h
+++ b/Include/cgensupport.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -35,7 +35,7 @@
#define mknewlongobject(x) newintobject(x)
#define mknewshortobject(x) newintobject((long)x)
#define mknewfloatobject(x) newfloatobject(x)
-#define mknewcharobject(c) mkvalue("c", c)
+#define mknewcharobject(ch) mkvalue("c", ch)
extern int getiobjectarg PROTO((object *args, int nargs, int i, object **p_a));
extern int getilongarg PROTO((object *args, int nargs, int i, long *p_a));
diff --git a/Include/classobject.h b/Include/classobject.h
index a244ef8..bd6cc1d 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/compile.h b/Include/compile.h
index a23fea1..4526523 100644
--- a/Include/compile.h
+++ b/Include/compile.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/dictobject.h b/Include/dictobject.h
index f1df1ef..4afed79 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/errcode.h b/Include/errcode.h
index d2a2ac6..e8db943 100644
--- a/Include/errcode.h
+++ b/Include/errcode.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -29,11 +29,15 @@
******************************************************************/
/* Error codes passed around between file input, tokenizer, parser and
- interpreter. This was necessary so we can turn them into Python
- exceptions at a higher level. */
+ interpreter. This is necessary so we can turn them into Python
+ exceptions at a higher level. Note that some errors have a
+ slightly different meaning when passed from the tokenizer to the
+ parser than when passed from the parser to the interpreter; e.g.
+ the parser only returns E_EOF when it hits EOF immediately, and it
+ never returns E_OK. */
#define E_OK 10 /* No error */
-#define E_EOF 11 /* (Unexpected) EOF read */
+#define E_EOF 11 /* End Of File */
#define E_INTR 12 /* Interrupted */
#define E_TOKEN 13 /* Bad token */
#define E_SYNTAX 14 /* Syntax error */
diff --git a/Include/errors.h b/Include/errors.h
index 2444ee1..050ff19 100755
--- a/Include/errors.h
+++ b/Include/errors.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -33,7 +33,7 @@
void err_set PROTO((object *));
void err_setval PROTO((object *, object *));
void err_setstr PROTO((object *, char *));
-int err_occurred PROTO((void));
+object *err_occurred PROTO((void));
void err_get PROTO((object **, object **));
void err_clear PROTO((void));
@@ -64,12 +64,13 @@
extern int err_badarg PROTO((void));
extern object *err_nomem PROTO((void));
extern object *err_errno PROTO((object *));
-extern void err_input PROTO((int));
extern void err_badcall PROTO((void));
extern object *err_getexc PROTO((void));
+extern int sigcheck PROTO((void)); /* In sigcheck.c or signalmodule.c */
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/eval.h b/Include/eval.h
index 91e2374..ed33d44 100644
--- a/Include/eval.h
+++ b/Include/eval.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/fileobject.h b/Include/fileobject.h
index 00e4ca9..c52a6aa 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -35,6 +35,7 @@
#define is_fileobject(op) ((op)->ob_type == &Filetype)
extern object *newfileobject PROTO((char *, char *));
+extern void setfilebufsize PROTO((object *, int));
extern object *newopenfileobject
PROTO((FILE *, char *, char *, int (*)FPROTO((FILE *))));
extern FILE *getfilefile PROTO((object *));
diff --git a/Include/floatobject.h b/Include/floatobject.h
index dad1fe1..1d0484f 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/frameobject.h b/Include/frameobject.h
index 5eeb2ad..2458881 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -52,6 +52,7 @@
int f_iblock; /* index in f_blockstack */
int f_lasti; /* Last instruction if called */
int f_lineno; /* Current line number */
+ object *f_trace; /* Trace function */
} frameobject;
@@ -70,11 +71,11 @@
/* List access macros */
#ifdef NDEBUG
-#define GETITEM(v, i) GETLISTITEM((listobject *)(v), (i))
+#define GETITEM(v, i) GETTUPLEITEM((tupleobject *)(v), (i))
#define GETITEMNAME(v, i) GETSTRINGVALUE((stringobject *)GETITEM((v), (i)))
#else
-#define GETITEM(v, i) getlistitem((v), (i))
-#define GETITEMNAME(v, i) getstringvalue(getlistitem((v), (i)))
+#define GETITEM(v, i) gettupleitem((v), (i))
+#define GETITEMNAME(v, i) getstringvalue(GETITEM(v, i))
#endif
#define GETUSTRINGVALUE(s) ((unsigned char *)GETSTRINGVALUE(s))
@@ -95,6 +96,11 @@
object **extend_stack PROTO((frameobject *, int, int));
+/* Conversions between "fast locals" and locals in dictionary */
+
+void locals_2_fast PROTO((frameobject *, int));
+void fast_2_locals PROTO((frameobject *));
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/funcobject.h b/Include/funcobject.h
index ffe2996..84b0dcf 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -35,6 +35,8 @@
object *func_code;
object *func_globals;
object *func_name;
+ int func_argcount;
+ object *func_argdefs;
} funcobject;
extern typeobject Functype;
@@ -44,6 +46,8 @@
extern object *newfuncobject PROTO((object *, object *));
extern object *getfunccode PROTO((object *));
extern object *getfuncglobals PROTO((object *));
+extern object *getfuncargstuff PROTO((object *, int *));
+extern int setfuncargstuff PROTO((object *, int, object *));
#ifdef __cplusplus
}
diff --git a/Include/grammar.h b/Include/grammar.h
index 506304f..f2e008f 100644
--- a/Include/grammar.h
+++ b/Include/grammar.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -34,7 +34,7 @@
/* A label of an arc */
-typedef struct _label {
+typedef struct {
int lb_type;
char *lb_str;
} label;
@@ -43,21 +43,21 @@
/* A list of labels */
-typedef struct _labellist {
+typedef struct {
int ll_nlabels;
label *ll_label;
} labellist;
/* An arc from one state to another */
-typedef struct _arc {
+typedef struct {
short a_lbl; /* Label of this arc */
short a_arrow; /* State where this arc goes to */
} arc;
/* A state in a DFA */
-typedef struct _state {
+typedef struct {
int s_narcs;
arc *s_arc; /* Array of arcs */
@@ -70,7 +70,7 @@
/* A DFA */
-typedef struct _dfa {
+typedef struct {
int d_type; /* Non-terminal this represents */
char *d_name; /* For printing */
int d_initial; /* Initial state */
@@ -81,7 +81,7 @@
/* A grammar */
-typedef struct _grammar {
+typedef struct {
int g_ndfas;
dfa *g_dfa; /* Array of DFAs */
labellist g_ll;
diff --git a/Include/import.h b/Include/import.h
index d960c9f..c335995 100644
--- a/Include/import.h
+++ b/Include/import.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/intobject.h b/Include/intobject.h
index 7b778e9..2ede41e 100644
--- a/Include/intobject.h
+++ b/Include/intobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/intrcheck.h b/Include/intrcheck.h
index 7f1b526..2914a6a 100644
--- a/Include/intrcheck.h
+++ b/Include/intrcheck.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/listobject.h b/Include/listobject.h
index 7af8058..610096b 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -62,6 +62,7 @@
extern object *getlistslice PROTO((object *, int, int));
extern int setlistslice PROTO((object *, int, int, object *));
extern int sortlist PROTO((object *));
+extern object *listtuple PROTO((object *));
/* Macro, trading safety for speed */
#define GETLISTITEM(op, i) ((op)->ob_item[i])
diff --git a/Include/longintrepr.h b/Include/longintrepr.h
index 2188153..b8d279d 100644
--- a/Include/longintrepr.h
+++ b/Include/longintrepr.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/longobject.h b/Include/longobject.h
index 1b048fd..ce2cd0b 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -42,6 +42,7 @@
extern double dgetlongvalue PROTO((object *));
object *long_scan PROTO((char *, int));
+object *long_escan PROTO((char *, char **, int));
#ifdef __cplusplus
}
diff --git a/Include/mappingobject.h b/Include/mappingobject.h
index 7d006dd..8844c77 100644
--- a/Include/mappingobject.h
+++ b/Include/mappingobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/marshal.h b/Include/marshal.h
index 7823f5c..e086e84 100644
--- a/Include/marshal.h
+++ b/Include/marshal.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/metagrammar.h b/Include/metagrammar.h
index d22f458..8248aed 100644
--- a/Include/metagrammar.h
+++ b/Include/metagrammar.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 0252334..1ef19aa 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/modsupport.h b/Include/modsupport.h
index f476f13..a1f3f1c 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -30,21 +30,28 @@
/* Module support interface */
-#ifdef HAVE_PROTOTYPES
-#define USE_STDARG
+#ifdef HAVE_STDARG_PROTOTYPES
+
+#include <stdarg.h>
+
+extern int getargs PROTO((object *, char *, ...));
+extern object *mkvalue PROTO((char *, ...));
+
+#else
+
+#include <varargs.h>
+
+/* Better to have no prototypes at all for varargs functions in this case */
+extern int getargs();
+extern object *mkvalue();
+
#endif
-#ifdef USE_STDARG
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
+extern int vgetargs PROTO((object *, char *, va_list));
+extern object *vmkvalue PROTO((char *, va_list));
extern object *initmodule PROTO((char *, struct methodlist *));
-extern int getargs PROTO((object *, char *, ...));
-extern int vgetargs PROTO((object *, char *, va_list));
-extern object *mkvalue PROTO((char *, ...));
-extern object *vmkvalue PROTO((char *, va_list));
+extern object *initmodule2 PROTO((char *, struct methodlist *, object *));
/* The following are obsolete -- use getargs directly! */
#define getnoarg(v) getargs(v, "")
diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index b4c0cdf..0605d31 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/mymalloc.h b/Include/mymalloc.h
index 24e2125..ea676c3 100644
--- a/Include/mymalloc.h
+++ b/Include/mymalloc.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -32,41 +32,35 @@
#ifdef macintosh
#define ANY void
-#ifndef THINK_C_3_0
-#define HAVE_STDLIB
-#endif
-#endif
-
-#ifdef sun
-/* Maybe not for very old versions of SunOS ? */
-#define HAVE_STDLIB
-#endif
-
-#ifdef sgi
-#define HAVE_STDLIB
#endif
#ifdef __STDC__
#define ANY void
-#define HAVE_STDLIB
#endif
#ifdef __TURBOC__
#define ANY void
-#define HAVE_STDLIB
#endif
#ifdef __GNUC__
#define ANY void
-#define HAVE_STDLIB
#endif
#ifndef ANY
#define ANY char
#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else /* !HAVE_STDLIB */
+extern ANY *malloc PROTO((size_t));
+extern ANY *calloc PROTO((size_t, size_t));
+extern ANY *realloc PROTO((ANY *, size_t));
+extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */
+#endif /* !HAVE_STDLIB */
+
#ifndef NULL
-#define NULL 0
+#define NULL ((ANY *)0)
#endif
/* XXX Always allocate one extra byte, since some malloc's return NULL
@@ -80,17 +74,6 @@
#define DEL(p) free((ANY *)p)
#define XDEL(p) if ((p) == NULL) ; else DEL(p)
-#ifdef HAVE_STDLIB
-#include <stdlib.h>
-#define MALLARG size_t
-#else
-#define MALLARG size_t
-extern ANY *malloc PROTO((MALLARG));
-extern ANY *calloc PROTO((MALLARG, MALLARG));
-extern ANY *realloc PROTO((ANY *, MALLARG));
-extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/Include/myproto.h b/Include/myproto.h
index e6de60e..6862755 100644
--- a/Include/myproto.h
+++ b/Include/myproto.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/myselect.h b/Include/myselect.h
index 174da11..e4f2b28 100644
--- a/Include/myselect.h
+++ b/Include/myselect.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -28,38 +28,28 @@
******************************************************************/
-/* Common definitions for files that use the BSD select system call.
- This is so complicated because every UNIX variant requires that
- you include a different set of headers. Customizing this one file
- should be easier than patching each of the files using select()... */
+/* Include file for users of select() */
+/* NB caller must include <sys/types.h> */
-/* XXX You may have to include some of these only if not already included */
-#include <sys/types.h>
-#include <sys/time.h> /* Implies <time.h> everywhere, as far as I know */
-#include <sys/param.h>
+#ifdef HAVE_SYS_SELECT_H
-
-/* Hacks for various systems that need hand-holding... */
-
-#ifdef _SEQUENT_
#include <sys/select.h>
-/* Sequent doesn't seem to define struct timezone anywhere?!?! */
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-#endif
-#ifdef _AIX /* I *think* this works */
-/* AIX defines fd_set in a separate file. Sigh... */
-#include <sys/select.h>
-#endif
+#ifdef SYS_SELECT_WITH_SYS_TIME
+#include "mytime.h"
+#else /* !SYS_SELECT_WITH_SYS_TIME */
+#include <time.h>
+#endif /* !SYS_SELECT_WITH_SYS_TIME */
+#else /* !HAVE_SYS_SELECT_H */
+#include "mytime.h"
-/* (Very) old versions of BSD don't define the FD_* set of macros.
- The following will usually do... */
+#endif /* !HAVE_SYS_SELECT_H */
+
+/* If the fd manipulation macros aren't defined,
+ here is a set that should do the job */
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
@@ -67,12 +57,12 @@
#ifndef FD_SET
-typedef long fd_mask;
+typedef long fd_mask;
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
-#endif
+#endif /* howmany */
typedef struct fd_set {
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
diff --git a/Include/mytime.h b/Include/mytime.h
index fd263d6..e175d5a 100644
--- a/Include/mytime.h
+++ b/Include/mytime.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/node.h b/Include/node.h
index 84238df..24019a6 100644
--- a/Include/node.h
+++ b/Include/node.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/object.h b/Include/object.h
index 24989bf..416ca77 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -133,48 +133,66 @@
method blocks.
*/
+typedef object * (*unaryfunc) PROTO((object *));
+typedef object * (*binaryfunc) PROTO((object *, object *));
+typedef int (*inquiry) PROTO((object *));
+typedef int (*coercion) PROTO((object **, object **));
+typedef object *(*intargfunc) PROTO((object *, int));
+typedef object *(*intintargfunc) PROTO((object *, int, int));
+typedef int(*intobjargproc) PROTO((object *, int, object *));
+typedef int(*intintobjargproc) PROTO((object *, int, int, object *));
+typedef int(*objobjargproc) PROTO((object *, object *, object *));
+
typedef struct {
- object *(*nb_add) FPROTO((object *, object *));
- object *(*nb_subtract) FPROTO((object *, object *));
- object *(*nb_multiply) FPROTO((object *, object *));
- object *(*nb_divide) FPROTO((object *, object *));
- object *(*nb_remainder) FPROTO((object *, object *));
- object *(*nb_divmod) FPROTO((object *, object *));
- object *(*nb_power) FPROTO((object *, object *));
- object *(*nb_negative) FPROTO((object *));
- object *(*nb_positive) FPROTO((object *));
- object *(*nb_absolute) FPROTO((object *));
- int (*nb_nonzero) FPROTO((object *));
- object *(*nb_invert) FPROTO((object *));
- object *(*nb_lshift) FPROTO((object *, object *));
- object *(*nb_rshift) FPROTO((object *, object *));
- object *(*nb_and) FPROTO((object *, object *));
- object *(*nb_xor) FPROTO((object *, object *));
- object *(*nb_or) FPROTO((object *, object *));
- int (*nb_coerce) FPROTO((object **, object **));
- object *(*nb_int) FPROTO((object *));
- object *(*nb_long) FPROTO((object *));
- object *(*nb_float) FPROTO((object *));
- object *(*nb_oct) FPROTO((object *));
- object *(*nb_hex) FPROTO((object *));
+ binaryfunc nb_add;
+ binaryfunc nb_subtract;
+ binaryfunc nb_multiply;
+ binaryfunc nb_divide;
+ binaryfunc nb_remainder;
+ binaryfunc nb_divmod;
+ binaryfunc nb_power;
+ unaryfunc nb_negative;
+ unaryfunc nb_positive;
+ unaryfunc nb_absolute;
+ inquiry nb_nonzero;
+ unaryfunc nb_invert;
+ binaryfunc nb_lshift;
+ binaryfunc nb_rshift;
+ binaryfunc nb_and;
+ binaryfunc nb_xor;
+ binaryfunc nb_or;
+ coercion nb_coerce;
+ unaryfunc nb_int;
+ unaryfunc nb_long;
+ unaryfunc nb_float;
+ unaryfunc nb_oct;
+ unaryfunc nb_hex;
} number_methods;
typedef struct {
- int (*sq_length) FPROTO((object *));
- object *(*sq_concat) FPROTO((object *, object *));
- object *(*sq_repeat) FPROTO((object *, int));
- object *(*sq_item) FPROTO((object *, int));
- object *(*sq_slice) FPROTO((object *, int, int));
- int (*sq_ass_item) FPROTO((object *, int, object *));
- int (*sq_ass_slice) FPROTO((object *, int, int, object *));
+ inquiry sq_length;
+ binaryfunc sq_concat;
+ intargfunc sq_repeat;
+ intargfunc sq_item;
+ intintargfunc sq_slice;
+ intobjargproc sq_ass_item;
+ intintobjargproc sq_ass_slice;
} sequence_methods;
typedef struct {
- int (*mp_length) FPROTO((object *));
- object *(*mp_subscript) FPROTO((object *, object *));
- int (*mp_ass_subscript) FPROTO((object *, object *, object *));
+ inquiry mp_length;
+ binaryfunc mp_subscript;
+ objobjargproc mp_ass_subscript;
} mapping_methods;
+typedef void (*destructor) PROTO((object *));
+typedef int (*printfunc) PROTO((object *, FILE *, int));
+typedef object *(*getattrfunc) PROTO((object *, char *));
+typedef int (*setattrfunc) PROTO((object *, char *, object *));
+typedef int (*cmpfunc) PROTO((object *, object *));
+typedef object *(*reprfunc) PROTO((object *));
+typedef long (*hashfunc) PROTO((object *));
+
typedef struct _typeobject {
OB_VARHEAD
char *tp_name; /* For printing */
@@ -182,12 +200,12 @@
/* Methods to implement standard operations */
- void (*tp_dealloc) FPROTO((object *));
- int (*tp_print) FPROTO((object *, FILE *, int));
- object *(*tp_getattr) FPROTO((object *, char *));
- int (*tp_setattr) FPROTO((object *, char *, object *));
- int (*tp_compare) FPROTO((object *, object *));
- object *(*tp_repr) FPROTO((object *));
+ destructor tp_dealloc;
+ printfunc tp_print;
+ getattrfunc tp_getattr;
+ setattrfunc tp_setattr;
+ cmpfunc tp_compare;
+ reprfunc tp_repr;
/* Method suites for standard classes */
@@ -197,7 +215,8 @@
/* More standard operations (at end for binary compatibility) */
- long (*tp_hash) FPROTO((object *));
+ hashfunc tp_hash;
+ binaryfunc tp_call;
#ifdef COUNT_ALLOCS
/* these must be last */
int tp_alloc;
@@ -327,6 +346,29 @@
/*
+A common programming style in Python requires the forward declaration
+of static, initialized structures, e.g. for a typeobject that is used
+by the functions whose address must be used in the initializer.
+Some compilers (notably SCO ODT 3.0, I seem to remember early AIX as
+well) botch this if you use the static keyword for both declarations
+(they allocate two objects, and use the first, uninitialized one until
+the second declaration is encountered). Therefore, the forward
+declaration should use the 'forwardstatic' keyword. This expands to
+static on most systems, but to extern on a few. The actual storage
+and name will still be static because the second declaration is
+static, so no linker visible symbols will be generated. (Standard C
+compilers take offense to the extern forward declaration of a static
+object, so I can't just put extern in all cases. :-( )
+*/
+
+#ifdef BAD_STATIC_FORWARD
+#define staticforward extern
+#else
+#define staticforward static
+#endif /* BAD_STATIC_FORWARD */
+
+
+/*
123456789-123456789-123456789-123456789-123456789-123456789-123456789-12
More conventions
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 25f8b94..c904cf8 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/opcode.h b/Include/opcode.h
index 53ce333..b6a42cc 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -119,6 +119,8 @@
#define LOAD_LOCAL 115 /* Index in name list */
#define LOAD_GLOBAL 116 /* Index in name list */
+#define SET_FUNC_ARGS 117 /* Argcount */
+
#define SETUP_LOOP 120 /* Target address (absolute) */
#define SETUP_EXCEPT 121 /* "" */
#define SETUP_FINALLY 122 /* "" */
diff --git a/Include/osdefs.h b/Include/osdefs.h
index 5ff75ba..c84043f 100644
--- a/Include/osdefs.h
+++ b/Include/osdefs.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -36,7 +36,7 @@
#define DELIM ' '
#endif
-#ifdef MSDOS
+#if defined(MSDOS) || defined(NT)
#define SEP '\\'
#define MAXPATHLEN 256
#define DELIM ';'
diff --git a/Include/parsetok.h b/Include/parsetok.h
index 9150cd6..b27cf4e 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -30,9 +30,17 @@
/* Parser-tokenizer link interface */
-extern int parsestring PROTO((char *, grammar *, int, node **_ret));
-extern int parsefile PROTO((FILE *, char *, grammar *, int,
- char *, char *, node **));
+typedef struct {
+ int error;
+ char *filename;
+ int lineno;
+ int offset;
+ char *text;
+} perrdetail;
+
+extern node *parsestring PROTO((char *, grammar *, int, perrdetail *));
+extern node *parsefile PROTO((FILE *, char *, grammar *, int,
+ char *, char *, perrdetail *));
#ifdef __cplusplus
}
diff --git a/Include/pgenheaders.h b/Include/pgenheaders.h
index 8395960..8a0b079 100644
--- a/Include/pgenheaders.h
+++ b/Include/pgenheaders.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -31,9 +31,12 @@
/* Include files and extern declarations used by most of the parser.
This is a precompiled header for THINK C. */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifdef THINK_C
#define macintosh
-/* #define THINK_C_3_0 /*** TURN THIS ON FOR THINK C 3.0 ***/
#endif
#include <stdio.h>
@@ -44,17 +47,11 @@
#undef label
#endif
-#ifdef THINK_C_3_0
-#include <proto.h>
-#endif
-
-#ifdef macintosh
-#ifndef THINK_C_3_0
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#endif
-#include "PROTO.h"
+#include "myproto.h"
#include "mymalloc.h"
extern void fatal PROTO((char *));
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index 2444ee1..050ff19 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -33,7 +33,7 @@
void err_set PROTO((object *));
void err_setval PROTO((object *, object *));
void err_setstr PROTO((object *, char *));
-int err_occurred PROTO((void));
+object *err_occurred PROTO((void));
void err_get PROTO((object **, object **));
void err_clear PROTO((void));
@@ -64,12 +64,13 @@
extern int err_badarg PROTO((void));
extern object *err_nomem PROTO((void));
extern object *err_errno PROTO((object *));
-extern void err_input PROTO((int));
extern void err_badcall PROTO((void));
extern object *err_getexc PROTO((void));
+extern int sigcheck PROTO((void)); /* In sigcheck.c or signalmodule.c */
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
index e25a3de..1f357cd 100644
--- a/Include/pythonrun.h
+++ b/Include/pythonrun.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -39,8 +39,8 @@
int run_tty_1 PROTO((FILE *, char *));
int run_tty_loop PROTO((FILE *, char *));
-int parse_string PROTO((char *, int, struct _node **));
-int parse_file PROTO((FILE *, char *, int, struct _node **));
+struct _node *parse_string PROTO((char *, int));
+struct _node *parse_file PROTO((FILE *, char *, int));
object *run_string PROTO((char *, int, object *, object *));
object *run_file PROTO((FILE *, char *, int, object *, object *));
@@ -51,6 +51,8 @@
void goaway PROTO((int));
+void cleanup PROTO((void));
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/pythread.h b/Include/pythread.h
index 806882f..680b7fb 100644
--- a/Include/pythread.h
+++ b/Include/pythread.h
@@ -1,6 +1,9 @@
#ifndef _THREAD_H_included
#define _THREAD_H_included
+#define NO_EXIT_PROG /* don't define exit_prog() */
+ /* (the result is no use of signals on SGI) */
+
#ifndef PROTO
#if defined(__STDC__) || defined(__cplusplus)
#define PROTO(args) args
@@ -20,6 +23,7 @@
int start_new_thread PROTO((void (*)(void *), void *));
void exit_thread PROTO((void));
void _exit_thread PROTO((void));
+long get_thread_ident PROTO((void));
type_lock allocate_lock PROTO((void));
void free_lock PROTO((type_lock));
@@ -33,8 +37,10 @@
void down_sema PROTO((type_sema));
void up_sema PROTO((type_sema));
+#ifndef NO_EXIT_PROG
void exit_prog PROTO((int));
void _exit_prog PROTO((int));
+#endif
#ifdef __cplusplus
}
diff --git a/Include/rangeobject.h b/Include/rangeobject.h
index 39d20c6..9befd9b 100644
--- a/Include/rangeobject.h
+++ b/Include/rangeobject.h
@@ -1,5 +1,5 @@
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/rename1.h b/Include/rename1.h
index cfad02b..1e944a0 100755
--- a/Include/rename1.h
+++ b/Include/rename1.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/stringobject.h b/Include/stringobject.h
index fa2e8a1..6896a55 100644
--- a/Include/stringobject.h
+++ b/Include/stringobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
@@ -66,6 +66,7 @@
extern unsigned int getstringsize PROTO((object *));
extern char *getstringvalue PROTO((object *));
extern void joinstring PROTO((object **, object *));
+extern void joinstring_decref PROTO((object **, object *));
extern int resizestring PROTO((object **, int));
extern object *formatstring PROTO((object *, object *));
diff --git a/Include/structmember.h b/Include/structmember.h
index 2462aa7..6bd9e72 100644
--- a/Include/structmember.h
+++ b/Include/structmember.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/sysmodule.h b/Include/sysmodule.h
index f6e4d08..93e3a51 100644
--- a/Include/sysmodule.h
+++ b/Include/sysmodule.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/thread.h b/Include/thread.h
index 806882f..680b7fb 100644
--- a/Include/thread.h
+++ b/Include/thread.h
@@ -1,6 +1,9 @@
#ifndef _THREAD_H_included
#define _THREAD_H_included
+#define NO_EXIT_PROG /* don't define exit_prog() */
+ /* (the result is no use of signals on SGI) */
+
#ifndef PROTO
#if defined(__STDC__) || defined(__cplusplus)
#define PROTO(args) args
@@ -20,6 +23,7 @@
int start_new_thread PROTO((void (*)(void *), void *));
void exit_thread PROTO((void));
void _exit_thread PROTO((void));
+long get_thread_ident PROTO((void));
type_lock allocate_lock PROTO((void));
void free_lock PROTO((type_lock));
@@ -33,8 +37,10 @@
void down_sema PROTO((type_sema));
void up_sema PROTO((type_sema));
+#ifndef NO_EXIT_PROG
void exit_prog PROTO((int));
void _exit_prog PROTO((int));
+#endif
#ifdef __cplusplus
}
diff --git a/Include/token.h b/Include/token.h
index 6939cc8..9281773 100644
--- a/Include/token.h
+++ b/Include/token.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/traceback.h b/Include/traceback.h
index 07c0c1e..f86306d 100644
--- a/Include/traceback.h
+++ b/Include/traceback.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index 9897f6d..b422a40 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -5,7 +5,7 @@
#endif
/***********************************************************
-Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum,
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
Amsterdam, The Netherlands.
All Rights Reserved