Mass ANSIfication of function definitions. Doesn't cover all 'extern'

declarations yet, those come later.
This commit is contained in:
Thomas Wouters 2000-07-22 18:47:25 +00:00
parent 0452d1f316
commit f70ef4f860
45 changed files with 704 additions and 1526 deletions

View file

@ -17,8 +17,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <ctype.h> #include <ctype.h>
double atof(s) double atof(char *s)
char *s;
{ {
double a = 0.0; double a = 0.0;
int e = 0; int e = 0;

View file

@ -32,9 +32,7 @@ static PyObject *filterstring(PyObject *, PyObject *);
static PyObject *filtertuple (PyObject *, PyObject *); static PyObject *filtertuple (PyObject *, PyObject *);
static PyObject * static PyObject *
builtin___import__(self, args) builtin___import__(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
PyObject *globals = NULL; PyObject *globals = NULL;
@ -60,9 +58,7 @@ fromlist is not empty.";
static PyObject * static PyObject *
builtin_abs(self, args) builtin_abs(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -78,9 +74,7 @@ Return the absolute value of the argument.";
static PyObject * static PyObject *
builtin_apply(self, args) builtin_apply(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *func, *alist = NULL, *kwdict = NULL; PyObject *func, *alist = NULL, *kwdict = NULL;
PyObject *t = NULL, *retval = NULL; PyObject *t = NULL, *retval = NULL;
@ -120,9 +114,7 @@ Note that classes are callable, as are instances with a __call__() method.";
static PyObject * static PyObject *
builtin_buffer(self, args) builtin_buffer(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *ob; PyObject *ob;
int offset = 0; int offset = 0;
@ -143,9 +135,7 @@ extend to the end of the target object (or with the specified size).";
static PyObject * static PyObject *
builtin_unicode(self, args) builtin_unicode(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
char *encoding = NULL; char *encoding = NULL;
@ -165,9 +155,7 @@ errors, defining the error handling, to 'strict'.";
static PyObject * static PyObject *
builtin_callable(self, args) builtin_callable(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -184,9 +172,7 @@ Note that classes are callable, as are instances with a __call__() method.";
static PyObject * static PyObject *
builtin_filter(self, args) builtin_filter(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *func, *seq, *result; PyObject *func, *seq, *result;
PySequenceMethods *sqf; PySequenceMethods *sqf;
@ -291,9 +277,7 @@ is true. If function is None, return a list of items that are true.";
static PyObject * static PyObject *
builtin_chr(self, args) builtin_chr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
long x; long x;
char s[1]; char s[1];
@ -316,9 +300,7 @@ Return a string of one character with ordinal i; 0 <= i < 256.";
static PyObject * static PyObject *
builtin_unichr(self, args) builtin_unichr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
long x; long x;
Py_UNICODE s[1]; Py_UNICODE s[1];
@ -341,9 +323,7 @@ Return a Unicode string of one character with ordinal i; 0 <= i < 65536.";
static PyObject * static PyObject *
builtin_cmp(self, args) builtin_cmp(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *a, *b; PyObject *a, *b;
int c; int c;
@ -362,9 +342,7 @@ Return negative if x<y, zero if x==y, positive if x>y.";
static PyObject * static PyObject *
builtin_coerce(self, args) builtin_coerce(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v, *w; PyObject *v, *w;
PyObject *res; PyObject *res;
@ -387,9 +365,7 @@ containing the coerced values. When they can't be coerced, return None.";
static PyObject * static PyObject *
builtin_compile(self, args) builtin_compile(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *str; char *str;
char *filename; char *filename;
@ -425,8 +401,7 @@ single (interactive) statement, or 'eval' to compile an expression.";
#ifndef WITHOUT_COMPLEX #ifndef WITHOUT_COMPLEX
static PyObject * static PyObject *
complex_from_string(v) complex_from_string(PyObject *v)
PyObject *v;
{ {
extern double strtod(const char *, char **); extern double strtod(const char *, char **);
const char *s, *start; const char *s, *start;
@ -579,9 +554,7 @@ complex_from_string(v)
} }
static PyObject * static PyObject *
builtin_complex(self, args) builtin_complex(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *r, *i, *tmp; PyObject *r, *i, *tmp;
PyNumberMethods *nbr, *nbi = NULL; PyNumberMethods *nbr, *nbi = NULL;
@ -672,9 +645,7 @@ This is equivalent to (real + imag*1j) where imag defaults to 0.";
#endif #endif
static PyObject * static PyObject *
builtin_dir(self, args) builtin_dir(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
static char *attrlist[] = {"__members__", "__methods__", NULL}; static char *attrlist[] = {"__members__", "__methods__", NULL};
PyObject *v = NULL, *l = NULL, *m = NULL; PyObject *v = NULL, *l = NULL, *m = NULL;
@ -748,9 +719,7 @@ returned. For other types or arguments, this may list members or methods.";
static PyObject * static PyObject *
builtin_divmod(self, args) builtin_divmod(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v, *w; PyObject *v, *w;
@ -766,9 +735,7 @@ Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.";
static PyObject * static PyObject *
builtin_eval(self, args) builtin_eval(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *cmd; PyObject *cmd;
PyObject *globals = Py_None, *locals = Py_None; PyObject *globals = Py_None, *locals = Py_None;
@ -820,9 +787,7 @@ globals and locals. If only globals is given, locals defaults to it.";
static PyObject * static PyObject *
builtin_execfile(self, args) builtin_execfile(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *filename; char *filename;
PyObject *globals = Py_None, *locals = Py_None; PyObject *globals = Py_None, *locals = Py_None;
@ -869,9 +834,7 @@ globals and locals. If only globals is given, locals defaults to it.";
static PyObject * static PyObject *
builtin_getattr(self, args) builtin_getattr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v, *result, *dflt = NULL; PyObject *v, *result, *dflt = NULL;
PyObject *name; PyObject *name;
@ -896,9 +859,7 @@ exist; without it, an exception is raised in that case.";
static PyObject * static PyObject *
builtin_globals(self, args) builtin_globals(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *d; PyObject *d;
@ -916,9 +877,7 @@ Return the dictionary containing the current scope's global variables.";
static PyObject * static PyObject *
builtin_hasattr(self, args) builtin_hasattr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
PyObject *name; PyObject *name;
@ -944,9 +903,7 @@ Return whether the object has an attribute with the given name.\n\
static PyObject * static PyObject *
builtin_id(self, args) builtin_id(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -963,9 +920,7 @@ simultaneously existing objects. (Hint: it's the object's memory address.)";
static PyObject * static PyObject *
builtin_map(self, args) builtin_map(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
typedef struct { typedef struct {
PyObject *seq; PyObject *seq;
@ -1130,9 +1085,7 @@ the items of the sequence (or a list of tuples if more than one sequence).";
static PyObject * static PyObject *
builtin_setattr(self, args) builtin_setattr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
PyObject *name; PyObject *name;
@ -1154,9 +1107,7 @@ Set a named attribute on an object; setattr(x, 'y', v) is equivalent to\n\
static PyObject * static PyObject *
builtin_delattr(self, args) builtin_delattr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
PyObject *name; PyObject *name;
@ -1177,9 +1128,7 @@ Delete a named attribute on an object; delattr(x, 'y') is equivalent to\n\
static PyObject * static PyObject *
builtin_hash(self, args) builtin_hash(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
long x; long x;
@ -1200,9 +1149,7 @@ the same hash value. The reverse is not necessarily true, but likely.";
static PyObject * static PyObject *
builtin_hex(self, args) builtin_hex(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
PyNumberMethods *nb; PyNumberMethods *nb;
@ -1228,9 +1175,7 @@ Return the hexadecimal representation of an integer or long integer.";
static PyObject *builtin_raw_input(PyObject *, PyObject *); static PyObject *builtin_raw_input(PyObject *, PyObject *);
static PyObject * static PyObject *
builtin_input(self, args) builtin_input(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *line; PyObject *line;
char *str; char *str;
@ -1263,9 +1208,7 @@ Equivalent to eval(raw_input(prompt)).";
static PyObject * static PyObject *
builtin_intern(self, args) builtin_intern(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *s; PyObject *s;
if (!PyArg_ParseTuple(args, "S:intern", &s)) if (!PyArg_ParseTuple(args, "S:intern", &s))
@ -1285,9 +1228,7 @@ same value.";
static PyObject * static PyObject *
builtin_int(self, args) builtin_int(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
int base = -909; /* unlikely! */ int base = -909; /* unlikely! */
@ -1320,9 +1261,7 @@ non-string.";
static PyObject * static PyObject *
builtin_long(self, args) builtin_long(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
int base = -909; /* unlikely! */ int base = -909; /* unlikely! */
@ -1356,9 +1295,7 @@ converting a non-string.";
static PyObject * static PyObject *
builtin_float(self, args) builtin_float(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -1376,9 +1313,7 @@ Convert a string or number to a floating point number, if possible.";
static PyObject * static PyObject *
builtin_len(self, args) builtin_len(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
long res; long res;
@ -1398,9 +1333,7 @@ Return the number of items of a sequence or mapping.";
static PyObject * static PyObject *
builtin_list(self, args) builtin_list(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -1416,9 +1349,7 @@ Return a new list whose items are the same as those of the argument sequence.";
static PyObject * static PyObject *
builtin_slice(self, args) builtin_slice(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *start, *stop, *step; PyObject *start, *stop, *step;
@ -1443,9 +1374,7 @@ Create a slice object. This is used for slicing by the Numeric extensions.";
static PyObject * static PyObject *
builtin_locals(self, args) builtin_locals(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *d; PyObject *d;
@ -1463,9 +1392,7 @@ Return the dictionary containing the current scope's local variables.";
static PyObject * static PyObject *
min_max(args, sign) min_max(PyObject *args, int sign)
PyObject *args;
int sign;
{ {
int i; int i;
PyObject *v, *w, *x; PyObject *v, *w, *x;
@ -1516,9 +1443,7 @@ min_max(args, sign)
} }
static PyObject * static PyObject *
builtin_min(self, v) builtin_min(PyObject *self, PyObject *v)
PyObject *self;
PyObject *v;
{ {
return min_max(v, -1); return min_max(v, -1);
} }
@ -1532,9 +1457,7 @@ With two or more arguments, return the smallest argument.";
static PyObject * static PyObject *
builtin_max(self, v) builtin_max(PyObject *self, PyObject *v)
PyObject *self;
PyObject *v;
{ {
return min_max(v, 1); return min_max(v, 1);
} }
@ -1548,9 +1471,7 @@ With two or more arguments, return the largest argument.";
static PyObject * static PyObject *
builtin_oct(self, args) builtin_oct(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
PyNumberMethods *nb; PyNumberMethods *nb;
@ -1573,9 +1494,7 @@ Return the octal representation of an integer or long integer.";
static PyObject * static PyObject *
builtin_open(self, args) builtin_open(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
char *mode = "r"; char *mode = "r";
@ -1603,9 +1522,7 @@ buffered, and larger numbers specify the buffer size.";
static PyObject * static PyObject *
builtin_ord(self, args) builtin_ord(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *obj; PyObject *obj;
long ord; long ord;
@ -1644,9 +1561,7 @@ Return the integer ordinal of a one character string.";
static PyObject * static PyObject *
builtin_pow(self, args) builtin_pow(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v, *w, *z = Py_None; PyObject *v, *w, *z = Py_None;
@ -1695,9 +1610,7 @@ get_len_of_range(lo, hi, step)
} }
static PyObject * static PyObject *
builtin_range(self, args) builtin_range(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
long ilow = 0, ihigh = 0, istep = 1; long ilow = 0, ihigh = 0, istep = 1;
long bign; long bign;
@ -1757,9 +1670,7 @@ These are exactly the valid indices for a list of 4 elements.";
static PyObject * static PyObject *
builtin_xrange(self, args) builtin_xrange(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
long ilow = 0, ihigh = 0, istep = 1; long ilow = 0, ihigh = 0, istep = 1;
long n; long n;
@ -1801,9 +1712,7 @@ than range() but more memory efficient.";
static PyObject * static PyObject *
builtin_raw_input(self, args) builtin_raw_input(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v = NULL; PyObject *v = NULL;
PyObject *f; PyObject *f;
@ -1880,9 +1789,7 @@ is printed without a trailing newline before reading.";
static PyObject * static PyObject *
builtin_reduce(self, args) builtin_reduce(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *seq, *func, *result = NULL; PyObject *seq, *func, *result = NULL;
PySequenceMethods *sqf; PySequenceMethods *sqf;
@ -1956,9 +1863,7 @@ sequence is empty.";
static PyObject * static PyObject *
builtin_reload(self, args) builtin_reload(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -1974,9 +1879,7 @@ Reload the module. The module must have been successfully imported before.";
static PyObject * static PyObject *
builtin_repr(self, args) builtin_repr(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -1993,9 +1896,7 @@ For most object types, eval(repr(object)) == object.";
static PyObject * static PyObject *
builtin_round(self, args) builtin_round(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
double x; double x;
double f; double f;
@ -2031,9 +1932,7 @@ This always returns a floating point number. Precision may be negative.";
static PyObject * static PyObject *
builtin_str(self, args) builtin_str(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -2050,9 +1949,7 @@ If the argument is a string, the return value is the same object.";
static PyObject * static PyObject *
builtin_tuple(self, args) builtin_tuple(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -2069,9 +1966,7 @@ If the argument is a tuple, the return value is the same object.";
static PyObject * static PyObject *
builtin_type(self, args) builtin_type(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v; PyObject *v;
@ -2089,9 +1984,7 @@ Return the type of the object.";
static PyObject * static PyObject *
builtin_vars(self, args) builtin_vars(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *v = NULL; PyObject *v = NULL;
PyObject *d; PyObject *d;
@ -2126,11 +2019,7 @@ Without arguments, equivalent to locals().\n\
With an argument, equivalent to object.__dict__."; With an argument, equivalent to object.__dict__.";
static int static int
abstract_issubclass(derived, cls, err, first) abstract_issubclass(PyObject *derived, PyObject *cls, char *err, int first)
PyObject *derived;
PyObject *cls;
char *err;
int first;
{ {
static PyObject *__bases__ = NULL; static PyObject *__bases__ = NULL;
PyObject *bases; PyObject *bases;
@ -2177,9 +2066,7 @@ abstract_issubclass(derived, cls, err, first)
} }
static PyObject * static PyObject *
builtin_isinstance(self, args) builtin_isinstance(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *inst; PyObject *inst;
PyObject *cls; PyObject *cls;
@ -2238,9 +2125,7 @@ With a type as second argument, return whether that is the object's type.";
static PyObject * static PyObject *
builtin_issubclass(self, args) builtin_issubclass(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *derived; PyObject *derived;
PyObject *cls; PyObject *cls;
@ -2336,7 +2221,7 @@ static char builtin_doc[] =
Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices."; Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices.";
PyObject * PyObject *
_PyBuiltin_Init() _PyBuiltin_Init(void)
{ {
PyObject *mod, *dict, *debug; PyObject *mod, *dict, *debug;
mod = Py_InitModule4("__builtin__", builtin_methods, mod = Py_InitModule4("__builtin__", builtin_methods,
@ -2362,9 +2247,7 @@ _PyBuiltin_Init()
/* Helper for filter(): filter a tuple through a function */ /* Helper for filter(): filter a tuple through a function */
static PyObject * static PyObject *
filtertuple(func, tuple) filtertuple(PyObject *func, PyObject *tuple)
PyObject *func;
PyObject *tuple;
{ {
PyObject *result; PyObject *result;
register int i, j; register int i, j;
@ -2420,9 +2303,7 @@ Fail_1:
/* Helper for filter(): filter a string through a function */ /* Helper for filter(): filter a string through a function */
static PyObject * static PyObject *
filterstring(func, strobj) filterstring(PyObject *func, PyObject *strobj)
PyObject *func;
PyObject *strobj;
{ {
PyObject *result; PyObject *result;
register int i, j; register int i, j;

View file

@ -99,7 +99,7 @@ static PyThread_type_lock interpreter_lock = 0;
static long main_thread = 0; static long main_thread = 0;
void void
PyEval_InitThreads() PyEval_InitThreads(void)
{ {
if (interpreter_lock) if (interpreter_lock)
return; return;
@ -110,20 +110,19 @@ PyEval_InitThreads()
} }
void void
PyEval_AcquireLock() PyEval_AcquireLock(void)
{ {
PyThread_acquire_lock(interpreter_lock, 1); PyThread_acquire_lock(interpreter_lock, 1);
} }
void void
PyEval_ReleaseLock() PyEval_ReleaseLock(void)
{ {
PyThread_release_lock(interpreter_lock); PyThread_release_lock(interpreter_lock);
} }
void void
PyEval_AcquireThread(tstate) PyEval_AcquireThread(PyThreadState *tstate)
PyThreadState *tstate;
{ {
if (tstate == NULL) if (tstate == NULL)
Py_FatalError("PyEval_AcquireThread: NULL new thread state"); Py_FatalError("PyEval_AcquireThread: NULL new thread state");
@ -134,8 +133,7 @@ PyEval_AcquireThread(tstate)
} }
void void
PyEval_ReleaseThread(tstate) PyEval_ReleaseThread(PyThreadState *tstate)
PyThreadState *tstate;
{ {
if (tstate == NULL) if (tstate == NULL)
Py_FatalError("PyEval_ReleaseThread: NULL thread state"); Py_FatalError("PyEval_ReleaseThread: NULL thread state");
@ -150,7 +148,7 @@ PyEval_ReleaseThread(tstate)
with and without threads: */ with and without threads: */
PyThreadState * PyThreadState *
PyEval_SaveThread() PyEval_SaveThread(void)
{ {
PyThreadState *tstate = PyThreadState_Swap(NULL); PyThreadState *tstate = PyThreadState_Swap(NULL);
if (tstate == NULL) if (tstate == NULL)
@ -163,8 +161,7 @@ PyEval_SaveThread()
} }
void void
PyEval_RestoreThread(tstate) PyEval_RestoreThread(PyThreadState *tstate)
PyThreadState *tstate;
{ {
if (tstate == NULL) if (tstate == NULL)
Py_FatalError("PyEval_RestoreThread: NULL tstate"); Py_FatalError("PyEval_RestoreThread: NULL tstate");
@ -221,9 +218,7 @@ static volatile int pendinglast = 0;
static volatile int things_to_do = 0; static volatile int things_to_do = 0;
int int
Py_AddPendingCall(func, arg) Py_AddPendingCall(int (*func)(ANY *), ANY *arg)
int (*func)(ANY *);
ANY *arg;
{ {
static int busy = 0; static int busy = 0;
int i, j; int i, j;
@ -247,7 +242,7 @@ Py_AddPendingCall(func, arg)
} }
int int
Py_MakePendingCalls() Py_MakePendingCalls(void)
{ {
static int busy = 0; static int busy = 0;
#ifdef WITH_THREAD #ifdef WITH_THREAD
@ -294,10 +289,7 @@ static int unpack_sequence(PyObject *, int, PyObject **);
PyObject * PyObject *
PyEval_EvalCode(co, globals, locals) PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals)
PyCodeObject *co;
PyObject *globals;
PyObject *locals;
{ {
return eval_code2(co, return eval_code2(co,
globals, locals, globals, locals,
@ -315,18 +307,9 @@ PyEval_EvalCode(co, globals, locals)
#endif #endif
static PyObject * static PyObject *
eval_code2(co, globals, locals, eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals,
args, argcount, kws, kwcount, defs, defcount, owner) PyObject **args, int argcount, PyObject **kws, int kwcount,
PyCodeObject *co; PyObject **defs, int defcount, PyObject *owner)
PyObject *globals;
PyObject *locals;
PyObject **args;
int argcount;
PyObject **kws; /* length: 2*kwcount */
int kwcount;
PyObject **defs;
int defcount;
PyObject *owner;
{ {
#ifdef DXPAIRS #ifdef DXPAIRS
int lastopcode = 0; int lastopcode = 0;
@ -1920,11 +1903,7 @@ eval_code2(co, globals, locals,
} }
static void static void
set_exc_info(tstate, type, value, tb) set_exc_info(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb)
PyThreadState *tstate;
PyObject *type;
PyObject *value;
PyObject *tb;
{ {
PyFrameObject *frame; PyFrameObject *frame;
PyObject *tmp_type, *tmp_value, *tmp_tb; PyObject *tmp_type, *tmp_value, *tmp_tb;
@ -1970,8 +1949,7 @@ set_exc_info(tstate, type, value, tb)
} }
static void static void
reset_exc_info(tstate) reset_exc_info(PyThreadState *tstate)
PyThreadState *tstate;
{ {
PyFrameObject *frame; PyFrameObject *frame;
PyObject *tmp_type, *tmp_value, *tmp_tb; PyObject *tmp_type, *tmp_value, *tmp_tb;
@ -2009,8 +1987,7 @@ reset_exc_info(tstate)
/* Logic for the raise statement (too complicated for inlining). /* Logic for the raise statement (too complicated for inlining).
This *consumes* a reference count to each of its arguments. */ This *consumes* a reference count to each of its arguments. */
static enum why_code static enum why_code
do_raise(type, value, tb) do_raise(PyObject *type, PyObject *value, PyObject *tb)
PyObject *type, *value, *tb;
{ {
if (type == NULL) { if (type == NULL) {
/* Reraise */ /* Reraise */
@ -2109,10 +2086,7 @@ do_raise(type, value, tb)
} }
static int static int
unpack_sequence(v, argcnt, sp) unpack_sequence(PyObject *v, int argcnt, PyObject **sp)
PyObject *v;
int argcnt;
PyObject **sp;
{ {
int i; int i;
PyObject *w; PyObject *w;
@ -2148,9 +2122,7 @@ finally:
#ifdef LLTRACE #ifdef LLTRACE
static int static int
prtrace(v, str) prtrace(PyObject *v, char *str)
PyObject *v;
char *str;
{ {
printf("%s ", str); printf("%s ", str);
if (PyObject_Print(v, stdout, 0) != 0) if (PyObject_Print(v, stdout, 0) != 0)
@ -2161,9 +2133,7 @@ prtrace(v, str)
#endif #endif
static void static void
call_exc_trace(p_trace, p_newtrace, f) call_exc_trace(PyObject **p_trace, PyObject **p_newtrace, PyFrameObject *f)
PyObject **p_trace, **p_newtrace;
PyFrameObject *f;
{ {
PyObject *type, *value, *traceback, *arg; PyObject *type, *value, *traceback, *arg;
int err; int err;
@ -2188,16 +2158,15 @@ call_exc_trace(p_trace, p_newtrace, f)
} }
} }
/* PyObject **p_trace: in/out; may not be NULL;
may not point to NULL variable initially
PyObject **p_newtrace: in/out; may be NULL;
may point to NULL variable;
may be same variable as p_newtrace */
static int static int
call_trace(p_trace, p_newtrace, f, msg, arg) call_trace(PyObject **p_trace, PyObject **p_newtrace, PyFrameObject *f,
PyObject **p_trace; /* in/out; may not be NULL; char *msg, PyObject *arg)
may not point to NULL variable initially */
PyObject **p_newtrace; /* in/out; may be NULL;
may point to NULL variable;
may be same variable as p_newtrace */
PyFrameObject *f;
char *msg;
PyObject *arg;
{ {
PyThreadState *tstate = f->f_tstate; PyThreadState *tstate = f->f_tstate;
PyObject *args, *what; PyObject *args, *what;
@ -2267,7 +2236,7 @@ call_trace(p_trace, p_newtrace, f, msg, arg)
} }
PyObject * PyObject *
PyEval_GetBuiltins() PyEval_GetBuiltins(void)
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
PyFrameObject *current_frame = tstate->frame; PyFrameObject *current_frame = tstate->frame;
@ -2278,7 +2247,7 @@ PyEval_GetBuiltins()
} }
PyObject * PyObject *
PyEval_GetLocals() PyEval_GetLocals(void)
{ {
PyFrameObject *current_frame = PyThreadState_Get()->frame; PyFrameObject *current_frame = PyThreadState_Get()->frame;
if (current_frame == NULL) if (current_frame == NULL)
@ -2288,7 +2257,7 @@ PyEval_GetLocals()
} }
PyObject * PyObject *
PyEval_GetGlobals() PyEval_GetGlobals(void)
{ {
PyFrameObject *current_frame = PyThreadState_Get()->frame; PyFrameObject *current_frame = PyThreadState_Get()->frame;
if (current_frame == NULL) if (current_frame == NULL)
@ -2298,21 +2267,21 @@ PyEval_GetGlobals()
} }
PyObject * PyObject *
PyEval_GetFrame() PyEval_GetFrame(void)
{ {
PyFrameObject *current_frame = PyThreadState_Get()->frame; PyFrameObject *current_frame = PyThreadState_Get()->frame;
return (PyObject *)current_frame; return (PyObject *)current_frame;
} }
int int
PyEval_GetRestricted() PyEval_GetRestricted(void)
{ {
PyFrameObject *current_frame = PyThreadState_Get()->frame; PyFrameObject *current_frame = PyThreadState_Get()->frame;
return current_frame == NULL ? 0 : current_frame->f_restricted; return current_frame == NULL ? 0 : current_frame->f_restricted;
} }
int int
Py_FlushLine() Py_FlushLine(void)
{ {
PyObject *f = PySys_GetObject("stdout"); PyObject *f = PySys_GetObject("stdout");
if (f == NULL) if (f == NULL)
@ -2330,9 +2299,7 @@ Py_FlushLine()
/* for backward compatibility: export this interface */ /* for backward compatibility: export this interface */
PyObject * PyObject *
PyEval_CallObject(func, arg) PyEval_CallObject(PyObject *func, PyObject *arg)
PyObject *func;
PyObject *arg;
{ {
return PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL); return PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL);
} }
@ -2340,10 +2307,7 @@ PyEval_CallObject(func, arg)
PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)
PyObject * PyObject *
PyEval_CallObjectWithKeywords(func, arg, kw) PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw)
PyObject *func;
PyObject *arg;
PyObject *kw;
{ {
ternaryfunc call; ternaryfunc call;
PyObject *result; PyObject *result;
@ -2382,10 +2346,7 @@ PyEval_CallObjectWithKeywords(func, arg, kw)
} }
static PyObject * static PyObject *
call_builtin(func, arg, kw) call_builtin(PyObject *func, PyObject *arg, PyObject *kw)
PyObject *func;
PyObject *arg;
PyObject *kw;
{ {
if (PyCFunction_Check(func)) { if (PyCFunction_Check(func)) {
PyCFunction meth = PyCFunction_GetFunction(func); PyCFunction meth = PyCFunction_GetFunction(func);
@ -2428,10 +2389,7 @@ call_builtin(func, arg, kw)
} }
static PyObject * static PyObject *
call_function(func, arg, kw) call_function(PyObject *func, PyObject *arg, PyObject *kw)
PyObject *func;
PyObject *arg;
PyObject *kw;
{ {
PyObject *class = NULL; /* == owner */ PyObject *class = NULL; /* == owner */
PyObject *argdefs; PyObject *argdefs;
@ -2549,8 +2507,7 @@ call_function(func, arg, kw)
"standard sequence type does not support step size other than one" "standard sequence type does not support step size other than one"
static PyObject * static PyObject *
loop_subscript(v, w) loop_subscript(PyObject *v, PyObject *w)
PyObject *v, *w;
{ {
PySequenceMethods *sq = v->ob_type->tp_as_sequence; PySequenceMethods *sq = v->ob_type->tp_as_sequence;
int i; int i;
@ -2572,9 +2529,7 @@ loop_subscript(v, w)
and error. Returns 1 on success.*/ and error. Returns 1 on success.*/
int int
_PyEval_SliceIndex(v, pi) _PyEval_SliceIndex(PyObject *v, int *pi)
PyObject *v;
int *pi;
{ {
if (v != NULL) { if (v != NULL) {
long x; long x;
@ -2627,8 +2582,7 @@ _PyEval_SliceIndex(v, pi)
} }
static PyObject * static PyObject *
apply_slice(u, v, w) /* return u[v:w] */ apply_slice(PyObject *u, PyObject *v, PyObject *w) /* return u[v:w] */
PyObject *u, *v, *w;
{ {
int ilow = 0, ihigh = INT_MAX; int ilow = 0, ihigh = INT_MAX;
if (!_PyEval_SliceIndex(v, &ilow)) if (!_PyEval_SliceIndex(v, &ilow))
@ -2639,8 +2593,7 @@ apply_slice(u, v, w) /* return u[v:w] */
} }
static int static int
assign_slice(u, v, w, x) /* u[v:w] = x */ assign_slice(PyObject *u, PyObject *v, PyObject *w, PyObject *x) /* u[v:w] = x */
PyObject *u, *v, *w, *x;
{ {
int ilow = 0, ihigh = INT_MAX; int ilow = 0, ihigh = INT_MAX;
if (!_PyEval_SliceIndex(v, &ilow)) if (!_PyEval_SliceIndex(v, &ilow))
@ -2654,10 +2607,7 @@ assign_slice(u, v, w, x) /* u[v:w] = x */
} }
static PyObject * static PyObject *
cmp_outcome(op, v, w) cmp_outcome(int op, register PyObject *v, register PyObject *w)
int op;
register PyObject *v;
register PyObject *w;
{ {
register int cmp; register int cmp;
register int res = 0; register int res = 0;
@ -2699,10 +2649,7 @@ cmp_outcome(op, v, w)
} }
static int static int
import_from(locals, v, name) import_from(PyObject *locals, PyObject *v, PyObject *name)
PyObject *locals;
PyObject *v;
PyObject *name;
{ {
PyObject *w, *x; PyObject *w, *x;
if (!PyModule_Check(v)) { if (!PyModule_Check(v)) {
@ -2741,10 +2688,7 @@ import_from(locals, v, name)
} }
static PyObject * static PyObject *
build_class(methods, bases, name) build_class(PyObject *methods, PyObject *bases, PyObject *name)
PyObject *methods; /* dictionary */
PyObject *bases; /* tuple containing classes */
PyObject *name; /* string */
{ {
int i, n; int i, n;
if (!PyTuple_Check(bases)) { if (!PyTuple_Check(bases)) {
@ -2806,11 +2750,8 @@ build_class(methods, bases, name)
} }
static int static int
exec_statement(f, prog, globals, locals) exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals,
PyFrameObject *f; PyObject *locals)
PyObject *prog;
PyObject *globals;
PyObject *locals;
{ {
int n; int n;
PyObject *v; PyObject *v;
@ -2874,9 +2815,7 @@ exec_statement(f, prog, globals, locals)
/* Hack for ni.py */ /* Hack for ni.py */
static PyObject * static PyObject *
find_from_args(f, nexti) find_from_args(PyFrameObject *f, int nexti)
PyFrameObject *f;
int nexti;
{ {
int opcode; int opcode;
int oparg; int oparg;
@ -2914,8 +2853,7 @@ find_from_args(f, nexti)
#ifdef DYNAMIC_EXECUTION_PROFILE #ifdef DYNAMIC_EXECUTION_PROFILE
PyObject * PyObject *
getarray(a) getarray(long a[256])
long a[256];
{ {
int i; int i;
PyObject *l = PyList_New(256); PyObject *l = PyList_New(256);
@ -2934,8 +2872,7 @@ getarray(a)
} }
PyObject * PyObject *
_Py_GetDXProfile(self, args) _Py_GetDXProfile(PyObject *self, PyObject *args)
PyObject *self, *args;
{ {
#ifndef DXPAIRS #ifndef DXPAIRS
return getarray(dxp); return getarray(dxp);

View file

@ -36,7 +36,7 @@ static int import_encodings_called = 0;
*/ */
static static
int import_encodings() int import_encodings(void)
{ {
PyObject *mod; PyObject *mod;
@ -419,7 +419,7 @@ PyObject *PyCodec_Decode(PyObject *object,
return NULL; return NULL;
} }
void _PyCodecRegistry_Init() void _PyCodecRegistry_Init(void)
{ {
if (_PyCodec_SearchPath == NULL) if (_PyCodec_SearchPath == NULL)
_PyCodec_SearchPath = PyList_New(0); _PyCodec_SearchPath = PyList_New(0);
@ -430,7 +430,7 @@ void _PyCodecRegistry_Init()
Py_FatalError("can't initialize codec registry"); Py_FatalError("can't initialize codec registry");
} }
void _PyCodecRegistry_Fini() void _PyCodecRegistry_Fini(void)
{ {
Py_XDECREF(_PyCodec_SearchPath); Py_XDECREF(_PyCodec_SearchPath);
_PyCodec_SearchPath = NULL; _PyCodec_SearchPath = NULL;

File diff suppressed because it is too large Load diff

View file

@ -16,8 +16,7 @@
#define BADEXIT -1 #define BADEXIT -1
int int
dup2(fd1, fd2) dup2(int fd1, int fd2)
int fd1, fd2;
{ {
if (fd1 != fd2) { if (fd1 != fd2) {
if (fcntl(fd1, F_GETFL) < 0) if (fcntl(fd1, F_GETFL) < 0)

View file

@ -42,8 +42,7 @@ const struct filedescr _PyImport_DynLoadFiletab[] = {
}; };
static int static int
aix_getoldmodules(modlistptr) aix_getoldmodules(void **modlistptr)
void **modlistptr;
{ {
register ModulePtr modptr, prevmodptr; register ModulePtr modptr, prevmodptr;
register struct ld_info *ldiptr; register struct ld_info *ldiptr;
@ -115,9 +114,7 @@ aix_getoldmodules(modlistptr)
} }
static int static int
aix_bindnewmodule(newmoduleptr, modlistptr) aix_bindnewmodule(void *newmoduleptr, void *modlistptr)
void *newmoduleptr;
void *modlistptr;
{ {
register ModulePtr modptr; register ModulePtr modptr;
@ -131,8 +128,7 @@ aix_bindnewmodule(newmoduleptr, modlistptr)
} }
static void static void
aix_loaderror(pathname) aix_loaderror(char *pathname)
char *pathname;
{ {
char *message[1024], errbuf[1024]; char *message[1024], errbuf[1024];

View file

@ -30,10 +30,7 @@ extern char *strerror(int);
#endif #endif
void void
PyErr_Restore(type, value, traceback) PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback)
PyObject *type;
PyObject *value;
PyObject *traceback;
{ {
PyThreadState *tstate = PyThreadState_GET(); PyThreadState *tstate = PyThreadState_GET();
PyObject *oldtype, *oldvalue, *oldtraceback; PyObject *oldtype, *oldvalue, *oldtraceback;
@ -60,9 +57,7 @@ PyErr_Restore(type, value, traceback)
} }
void void
PyErr_SetObject(exception, value) PyErr_SetObject(PyObject *exception, PyObject *value)
PyObject *exception;
PyObject *value;
{ {
Py_XINCREF(exception); Py_XINCREF(exception);
Py_XINCREF(value); Py_XINCREF(value);
@ -70,16 +65,13 @@ PyErr_SetObject(exception, value)
} }
void void
PyErr_SetNone(exception) PyErr_SetNone(PyObject *exception)
PyObject *exception;
{ {
PyErr_SetObject(exception, (PyObject *)NULL); PyErr_SetObject(exception, (PyObject *)NULL);
} }
void void
PyErr_SetString(exception, string) PyErr_SetString(PyObject *exception, const char *string)
PyObject *exception;
const char *string;
{ {
PyObject *value = PyString_FromString(string); PyObject *value = PyString_FromString(string);
PyErr_SetObject(exception, value); PyErr_SetObject(exception, value);
@ -88,7 +80,7 @@ PyErr_SetString(exception, string)
PyObject * PyObject *
PyErr_Occurred() PyErr_Occurred(void)
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
@ -97,8 +89,7 @@ PyErr_Occurred()
int int
PyErr_GivenExceptionMatches(err, exc) PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc)
PyObject *err, *exc;
{ {
if (err == NULL || exc == NULL) { if (err == NULL || exc == NULL) {
/* maybe caused by "import exceptions" that failed early on */ /* maybe caused by "import exceptions" that failed early on */
@ -129,8 +120,7 @@ PyErr_GivenExceptionMatches(err, exc)
int int
PyErr_ExceptionMatches(exc) PyErr_ExceptionMatches(PyObject *exc)
PyObject *exc;
{ {
return PyErr_GivenExceptionMatches(PyErr_Occurred(), exc); return PyErr_GivenExceptionMatches(PyErr_Occurred(), exc);
} }
@ -140,10 +130,7 @@ PyErr_ExceptionMatches(exc)
eval_code2(), do_raise(), and PyErr_Print() eval_code2(), do_raise(), and PyErr_Print()
*/ */
void void
PyErr_NormalizeException(exc, val, tb) PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
PyObject **exc;
PyObject **val;
PyObject **tb;
{ {
PyObject *type = *exc; PyObject *type = *exc;
PyObject *value = *val; PyObject *value = *val;
@ -213,10 +200,7 @@ finally:
void void
PyErr_Fetch(p_type, p_value, p_traceback) PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback)
PyObject **p_type;
PyObject **p_value;
PyObject **p_traceback;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
@ -230,7 +214,7 @@ PyErr_Fetch(p_type, p_value, p_traceback)
} }
void void
PyErr_Clear() PyErr_Clear(void)
{ {
PyErr_Restore(NULL, NULL, NULL); PyErr_Restore(NULL, NULL, NULL);
} }
@ -238,7 +222,7 @@ PyErr_Clear()
/* Convenience functions to set a type error exception and return 0 */ /* Convenience functions to set a type error exception and return 0 */
int int
PyErr_BadArgument() PyErr_BadArgument(void)
{ {
PyErr_SetString(PyExc_TypeError, PyErr_SetString(PyExc_TypeError,
"illegal argument type for built-in operation"); "illegal argument type for built-in operation");
@ -246,7 +230,7 @@ PyErr_BadArgument()
} }
PyObject * PyObject *
PyErr_NoMemory() PyErr_NoMemory(void)
{ {
/* raise the pre-allocated instance if it still exists */ /* raise the pre-allocated instance if it still exists */
if (PyExc_MemoryErrorInst) if (PyExc_MemoryErrorInst)
@ -261,9 +245,7 @@ PyErr_NoMemory()
} }
PyObject * PyObject *
PyErr_SetFromErrnoWithFilename(exc, filename) PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename)
PyObject *exc;
char *filename;
{ {
PyObject *v; PyObject *v;
char *s; char *s;
@ -326,8 +308,7 @@ PyErr_SetFromErrnoWithFilename(exc, filename)
PyObject * PyObject *
PyErr_SetFromErrno(exc) PyErr_SetFromErrno(PyObject *exc)
PyObject *exc;
{ {
return PyErr_SetFromErrnoWithFilename(exc, NULL); return PyErr_SetFromErrnoWithFilename(exc, NULL);
} }
@ -335,7 +316,7 @@ PyErr_SetFromErrno(exc)
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
/* Windows specific error code handling */ /* Windows specific error code handling */
PyObject *PyErr_SetFromWindowsErrWithFilename( PyObject *PyErr_SetFromWindowsErrWithFilename(
int ierr, int ierr,
const char *filename) const char *filename)
{ {
int len; int len;
@ -378,32 +359,20 @@ PyObject *PyErr_SetFromWindowsErr(int ierr)
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
void void
PyErr_BadInternalCall() PyErr_BadInternalCall(void)
{ {
PyErr_SetString(PyExc_SystemError, PyErr_SetString(PyExc_SystemError,
"bad argument to internal function"); "bad argument to internal function");
} }
#ifdef HAVE_STDARG_PROTOTYPES
PyObject * PyObject *
PyErr_Format(PyObject *exception, const char *format, ...) PyErr_Format(PyObject *exception, const char *format, ...)
#else
PyObject *
PyErr_Format(exception, format, va_alist)
PyObject *exception;
const char *format;
va_dcl
#endif
{ {
va_list vargs; va_list vargs;
char buffer[500]; /* Caller is responsible for limiting the format */ char buffer[500]; /* Caller is responsible for limiting the format */
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format); va_start(vargs, format);
#else
va_start(vargs);
#endif
vsprintf(buffer, format, vargs); vsprintf(buffer, format, vargs);
PyErr_SetString(exception, buffer); PyErr_SetString(exception, buffer);
@ -412,10 +381,7 @@ PyErr_Format(exception, format, va_alist)
PyObject * PyObject *
PyErr_NewException(name, base, dict) PyErr_NewException(char *name, PyObject *base, PyObject *dict)
char *name; /* modulename.classname */
PyObject *base;
PyObject *dict;
{ {
char *dot; char *dot;
PyObject *modulename = NULL; PyObject *modulename = NULL;

View file

@ -30,9 +30,7 @@ extern int PyInitFrozenExtensions();
/* Main program */ /* Main program */
int int
Py_FrozenMain(argc, argv) Py_FrozenMain(int argc, char **argv)
int argc;
char **argv;
{ {
char *p; char *p;
int n, sts; int n, sts;

View file

@ -43,54 +43,24 @@ static int vgetargskeywords(PyObject *, PyObject *,
char *, char **, va_list *); char *, char **, va_list *);
static char *skipitem(char **, va_list *); static char *skipitem(char **, va_list *);
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS2 */
int PyArg_Parse(PyObject *args, char *format, ...) int PyArg_Parse(PyObject *args, char *format, ...)
#else
/* VARARGS */
int PyArg_Parse(va_alist) va_dcl
#endif
{ {
int retval; int retval;
va_list va; va_list va;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format); va_start(va, format);
#else
PyObject *args;
char *format;
va_start(va);
args = va_arg(va, PyObject *);
format = va_arg(va, char *);
#endif
retval = vgetargs1(args, format, &va, 1); retval = vgetargs1(args, format, &va, 1);
va_end(va); va_end(va);
return retval; return retval;
} }
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS2 */
int PyArg_ParseTuple(PyObject *args, char *format, ...) int PyArg_ParseTuple(PyObject *args, char *format, ...)
#else
/* VARARGS */
int PyArg_ParseTuple(va_alist) va_dcl
#endif
{ {
int retval; int retval;
va_list va; va_list va;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format); va_start(va, format);
#else
PyObject *args;
char *format;
va_start(va);
args = va_arg(va, PyObject *);
format = va_arg(va, char *);
#endif
retval = vgetargs1(args, format, &va, 0); retval = vgetargs1(args, format, &va, 0);
va_end(va); va_end(va);
return retval; return retval;
@ -98,10 +68,7 @@ int PyArg_ParseTuple(va_alist) va_dcl
int int
PyArg_VaParse(args, format, va) PyArg_VaParse(PyObject *args, char *format, va_list va)
PyObject *args;
char *format;
va_list va;
{ {
va_list lva; va_list lva;
@ -116,11 +83,7 @@ PyArg_VaParse(args, format, va)
static int static int
vgetargs1(args, format, p_va, compat) vgetargs1(PyObject *args, char *format, va_list *p_va, int compat)
PyObject *args;
char *format;
va_list *p_va;
int compat;
{ {
char msgbuf[256]; char msgbuf[256];
int levels[32]; int levels[32];
@ -254,12 +217,7 @@ vgetargs1(args, format, p_va, compat)
static void static void
seterror(iarg, msg, levels, fname, message) seterror(int iarg, char *msg, int *levels, char *fname, char *message)
int iarg;
char *msg;
int *levels;
char *fname;
char *message;
{ {
char buf[256]; char buf[256];
int i; int i;
@ -309,13 +267,8 @@ seterror(iarg, msg, levels, fname, message)
*/ */
static char * static char *
converttuple(arg, p_format, p_va, levels, msgbuf, toplevel) converttuple(PyObject *arg, char **p_format, va_list *p_va, int *levels,
PyObject *arg; char *msgbuf, int toplevel)
char **p_format;
va_list *p_va;
int *levels;
char *msgbuf;
int toplevel;
{ {
int level = 0; int level = 0;
int n = 0; int n = 0;
@ -378,12 +331,8 @@ converttuple(arg, p_format, p_va, levels, msgbuf, toplevel)
/* Convert a single item. */ /* Convert a single item. */
static char * static char *
convertitem(arg, p_format, p_va, levels, msgbuf) convertitem(PyObject *arg, char **p_format, va_list *p_va, int *levels,
PyObject *arg; char *msgbuf)
char **p_format;
va_list *p_va;
int *levels;
char *msgbuf;
{ {
char *msg; char *msg;
char *format = *p_format; char *format = *p_format;
@ -409,11 +358,7 @@ convertitem(arg, p_format, p_va, levels, msgbuf)
by appending ", <actual argument type>" to error message. */ by appending ", <actual argument type>" to error message. */
static char * static char *
convertsimple(arg, p_format, p_va, msgbuf) convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf)
PyObject *arg;
char **p_format;
va_list *p_va;
char *msgbuf;
{ {
char *msg = convertsimple1(arg, p_format, p_va); char *msg = convertsimple1(arg, p_format, p_va);
if (msg != NULL) { if (msg != NULL) {
@ -436,10 +381,7 @@ PyObject *_PyUnicode_AsUTF8String(PyObject *unicode,
Don't call if a tuple is expected. */ Don't call if a tuple is expected. */
static char * static char *
convertsimple1(arg, p_format, p_va) convertsimple1(PyObject *arg, char **p_format, va_list *p_va)
PyObject *arg;
char **p_format;
va_list *p_va;
{ {
char *format = *p_format; char *format = *p_format;
char c = *format++; char c = *format++;
@ -961,34 +903,15 @@ convertsimple1(arg, p_format, p_va)
/* Support for keyword arguments donated by /* Support for keyword arguments donated by
Geoff Philbrick <philbric@delphi.hks.com> */ Geoff Philbrick <philbric@delphi.hks.com> */
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS2 */
int PyArg_ParseTupleAndKeywords(PyObject *args, int PyArg_ParseTupleAndKeywords(PyObject *args,
PyObject *keywords, PyObject *keywords,
char *format, char *format,
char **kwlist, ...) char **kwlist, ...)
#else
/* VARARGS */
int PyArg_ParseTupleAndKeywords(va_alist) va_dcl
#endif
{ {
int retval; int retval;
va_list va; va_list va;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, kwlist); va_start(va, kwlist);
#else
PyObject *args;
PyObject *keywords;
char *format;
char **kwlist;
va_start(va);
args = va_arg(va, PyObject *);
keywords = va_arg(va, PyObject *);
format = va_arg(va, char *);
kwlist = va_arg(va, char **);
#endif
retval = vgetargskeywords(args, keywords, format, kwlist, &va); retval = vgetargskeywords(args, keywords, format, kwlist, &va);
va_end(va); va_end(va);
return retval; return retval;
@ -996,12 +919,8 @@ int PyArg_ParseTupleAndKeywords(va_alist) va_dcl
static int static int
vgetargskeywords(args, keywords, format, kwlist, p_va) vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
PyObject *args; char **kwlist, va_list *p_va)
PyObject *keywords;
char *format;
char **kwlist;
va_list *p_va;
{ {
char msgbuf[256]; char msgbuf[256];
int levels[32]; int levels[32];
@ -1204,9 +1123,7 @@ vgetargskeywords(args, keywords, format, kwlist, p_va)
static char * static char *
skipitem(p_format, p_va) skipitem(char **p_format, va_list *p_va)
char **p_format;
va_list *p_va;
{ {
char *format = *p_format; char *format = *p_format;
char c = *format++; char c = *format++;

View file

@ -31,7 +31,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif /* !COMPILER */ #endif /* !COMPILER */
const char * const char *
Py_GetCompiler() Py_GetCompiler(void)
{ {
return COMPILER; return COMPILER;
} }

View file

@ -23,7 +23,7 @@ static char cprt[] =
Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)"; Copyright 1995-2000 Corporation for National Research Initiatives (CNRI)";
const char * const char *
Py_GetCopyright() Py_GetCopyright(void)
{ {
return cprt; return cprt;
} }

View file

@ -26,12 +26,10 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#define MAXPATHLEN 1024 #define MAXPATHLEN 1024
#endif #endif
extern char *getwd(); extern char *getwd(char *);
char * char *
getcwd(buf, size) getcwd(char *buf, int size)
char *buf;
int size;
{ {
char localbuf[MAXPATHLEN+1]; char localbuf[MAXPATHLEN+1];
char *ret; char *ret;
@ -62,9 +60,7 @@ getcwd(buf, size)
#endif #endif
char * char *
getcwd(buf, size) getcwd(char *buf, int size)
char *buf;
int size;
{ {
FILE *fp; FILE *fp;
char *p; char *p;

View file

@ -26,9 +26,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif #endif
time_t time_t
PyOS_GetLastModificationTime(path, fp) PyOS_GetLastModificationTime(char *path, FILE *fp)
char *path;
FILE *fp;
{ {
struct stat st; struct stat st;
if (fstat(fileno(fp), &st) != 0) if (fstat(fileno(fp), &st) != 0)

View file

@ -41,12 +41,9 @@ char * optarg = NULL; /* optional argument */
#ifndef __BEOS__ #ifndef __BEOS__
int getopt(argc,argv,optstring) int getopt(int argc, char *argv[], char optstring[])
int argc;
char *argv[];
char optstring[];
#else #else
int getopt( int argc, char *const *argv, const char *optstring ) int getopt(int argc, char *const *argv, const char *optstring)
#endif #endif
{ {
static char *opt_ptr = ""; static char *opt_ptr = "";

View file

@ -15,7 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif #endif
const char * const char *
Py_GetPlatform() Py_GetPlatform(void)
{ {
return PLATFORM; return PLATFORM;
} }

View file

@ -15,7 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "patchlevel.h" #include "patchlevel.h"
const char * const char *
Py_GetVersion() Py_GetVersion(void)
{ {
static char version[250]; static char version[250];
sprintf(version, "%.80s (%.80s) %.80s", PY_VERSION, sprintf(version, "%.80s (%.80s) %.80s", PY_VERSION,

View file

@ -4,9 +4,7 @@
#include "myproto.h" #include "myproto.h"
#include "mymath.h" #include "mymath.h"
double hypot(x, y) double hypot(double x, double y)
double x;
double y;
{ {
double yx; double yx;

View file

@ -55,7 +55,8 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif #endif
extern time_t PyOS_GetLastModificationTime(); /* In getmtime.c */ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
/* In getmtime.c */
/* Magic word to reject .pyc files generated by other Python versions */ /* Magic word to reject .pyc files generated by other Python versions */
/* Change for each incompatible change */ /* Change for each incompatible change */
@ -65,7 +66,7 @@ extern time_t PyOS_GetLastModificationTime(); /* In getmtime.c */
/* XXX Perhaps the magic number should be frozen and a version field /* XXX Perhaps the magic number should be frozen and a version field
added to the .pyc file header? */ added to the .pyc file header? */
/* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */ /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
#define MAGIC (50428 | ((long)'\r'<<16) | ((long)'\n'<<24)) #define MAGIC (50715 | ((long)'\r'<<16) | ((long)'\n'<<24))
/* Magic word as global; note that _PyImport_Init() can change the /* Magic word as global; note that _PyImport_Init() can change the
value of this global to accommodate for alterations of how the value of this global to accommodate for alterations of how the
@ -91,7 +92,7 @@ static const struct filedescr _PyImport_StandardFiletab[] = {
/* Initialize things */ /* Initialize things */
void void
_PyImport_Init() _PyImport_Init(void)
{ {
const struct filedescr *scan; const struct filedescr *scan;
struct filedescr *filetab; struct filedescr *filetab;
@ -131,7 +132,7 @@ _PyImport_Init()
} }
void void
_PyImport_Fini() _PyImport_Fini(void)
{ {
Py_XDECREF(extensions); Py_XDECREF(extensions);
extensions = NULL; extensions = NULL;
@ -151,7 +152,7 @@ static long import_lock_thread = -1;
static int import_lock_level = 0; static int import_lock_level = 0;
static void static void
lock_import() lock_import(void)
{ {
long me = PyThread_get_thread_ident(); long me = PyThread_get_thread_ident();
if (me == -1) if (me == -1)
@ -172,7 +173,7 @@ lock_import()
} }
static void static void
unlock_import() unlock_import(void)
{ {
long me = PyThread_get_thread_ident(); long me = PyThread_get_thread_ident();
if (me == -1) if (me == -1)
@ -196,7 +197,7 @@ unlock_import()
/* Helper for sys */ /* Helper for sys */
PyObject * PyObject *
PyImport_GetModuleDict() PyImport_GetModuleDict(void)
{ {
PyInterpreterState *interp = PyThreadState_Get()->interp; PyInterpreterState *interp = PyThreadState_Get()->interp;
if (interp->modules == NULL) if (interp->modules == NULL)
@ -224,7 +225,7 @@ static char* sys_files[] = {
/* Un-initialize things, as good as we can */ /* Un-initialize things, as good as we can */
void void
PyImport_Cleanup() PyImport_Cleanup(void)
{ {
int pos, ndone; int pos, ndone;
char *name; char *name;
@ -357,7 +358,7 @@ PyImport_Cleanup()
/* Helper for pythonrun.c -- return magic number */ /* Helper for pythonrun.c -- return magic number */
long long
PyImport_GetMagicNumber() PyImport_GetMagicNumber(void)
{ {
return pyc_magic; return pyc_magic;
} }
@ -374,9 +375,7 @@ PyImport_GetMagicNumber()
_PyImport_FindExtension(). */ _PyImport_FindExtension(). */
PyObject * PyObject *
_PyImport_FixupExtension(name, filename) _PyImport_FixupExtension(char *name, char *filename)
char *name;
char *filename;
{ {
PyObject *modules, *mod, *dict, *copy; PyObject *modules, *mod, *dict, *copy;
if (extensions == NULL) { if (extensions == NULL) {
@ -403,9 +402,7 @@ _PyImport_FixupExtension(name, filename)
} }
PyObject * PyObject *
_PyImport_FindExtension(name, filename) _PyImport_FindExtension(char *name, char *filename)
char *name;
char *filename;
{ {
PyObject *dict, *mod, *mdict, *result; PyObject *dict, *mod, *mdict, *result;
if (extensions == NULL) if (extensions == NULL)
@ -437,8 +434,7 @@ _PyImport_FindExtension(name, filename)
'NEW' REFERENCE! */ 'NEW' REFERENCE! */
PyObject * PyObject *
PyImport_AddModule(name) PyImport_AddModule(char *name)
char *name;
{ {
PyObject *modules = PyImport_GetModuleDict(); PyObject *modules = PyImport_GetModuleDict();
PyObject *m; PyObject *m;
@ -463,18 +459,13 @@ PyImport_AddModule(name)
WITH INCREMENTED REFERENCE COUNT */ WITH INCREMENTED REFERENCE COUNT */
PyObject * PyObject *
PyImport_ExecCodeModule(name, co) PyImport_ExecCodeModule(char *name, PyObject *co)
char *name;
PyObject *co;
{ {
return PyImport_ExecCodeModuleEx(name, co, (char *)NULL); return PyImport_ExecCodeModuleEx(name, co, (char *)NULL);
} }
PyObject * PyObject *
PyImport_ExecCodeModuleEx(name, co, pathname) PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname)
char *name;
PyObject *co;
char *pathname;
{ {
PyObject *modules = PyImport_GetModuleDict(); PyObject *modules = PyImport_GetModuleDict();
PyObject *m, *d, *v; PyObject *m, *d, *v;
@ -527,10 +518,7 @@ PyImport_ExecCodeModuleEx(name, co, pathname)
Doesn't set an exception. */ Doesn't set an exception. */
static char * static char *
make_compiled_pathname(pathname, buf, buflen) make_compiled_pathname(char *pathname, char *buf, size_t buflen)
char *pathname;
char *buf;
size_t buflen;
{ {
size_t len; size_t len;
@ -552,10 +540,7 @@ make_compiled_pathname(pathname, buf, buflen)
Doesn't set an exception. */ Doesn't set an exception. */
static FILE * static FILE *
check_compiled_module(pathname, mtime, cpathname) check_compiled_module(char *pathname, long mtime, char *cpathname)
char *pathname;
long mtime;
char *cpathname;
{ {
FILE *fp; FILE *fp;
long magic; long magic;
@ -587,9 +572,7 @@ check_compiled_module(pathname, mtime, cpathname)
/* Read a code object from a file and check it for validity */ /* Read a code object from a file and check it for validity */
static PyCodeObject * static PyCodeObject *
read_compiled_module(cpathname, fp) read_compiled_module(char *cpathname, FILE *fp)
char *cpathname;
FILE *fp;
{ {
PyObject *co; PyObject *co;
@ -610,10 +593,7 @@ read_compiled_module(cpathname, fp)
module object WITH INCREMENTED REFERENCE COUNT */ module object WITH INCREMENTED REFERENCE COUNT */
static PyObject * static PyObject *
load_compiled_module(name, cpathname, fp) load_compiled_module(char *name, char *cpathname, FILE *fp)
char *name;
char *cpathname;
FILE *fp;
{ {
long magic; long magic;
PyCodeObject *co; PyCodeObject *co;
@ -641,9 +621,7 @@ load_compiled_module(name, cpathname, fp)
/* Parse a source file and return the corresponding code object */ /* Parse a source file and return the corresponding code object */
static PyCodeObject * static PyCodeObject *
parse_source_module(pathname, fp) parse_source_module(char *pathname, FILE *fp)
char *pathname;
FILE *fp;
{ {
PyCodeObject *co; PyCodeObject *co;
node *n; node *n;
@ -664,10 +642,7 @@ parse_source_module(pathname, fp)
remove the file. */ remove the file. */
static void static void
write_compiled_module(co, cpathname, mtime) write_compiled_module(PyCodeObject *co, char *cpathname, long mtime)
PyCodeObject *co;
char *cpathname;
long mtime;
{ {
FILE *fp; FILE *fp;
@ -708,10 +683,7 @@ write_compiled_module(co, cpathname, mtime)
byte-compiled file, use that instead. */ byte-compiled file, use that instead. */
static PyObject * static PyObject *
load_source_module(name, pathname, fp) load_source_module(char *name, char *pathname, FILE *fp)
char *name;
char *pathname;
FILE *fp;
{ {
time_t mtime; time_t mtime;
FILE *fpc; FILE *fpc;
@ -772,9 +744,7 @@ static struct _frozen *find_frozen(char *name);
REFERENCE COUNT */ REFERENCE COUNT */
static PyObject * static PyObject *
load_package(name, pathname) load_package(char *name, char *pathname)
char *name;
char *pathname;
{ {
PyObject *m, *d, *file, *path; PyObject *m, *d, *file, *path;
int err; int err;
@ -827,8 +797,7 @@ load_package(name, pathname)
/* Helper to test for built-in module */ /* Helper to test for built-in module */
static int static int
is_builtin(name) is_builtin(char *name)
char *name;
{ {
int i; int i;
for (i = 0; PyImport_Inittab[i].name != NULL; i++) { for (i = 0; PyImport_Inittab[i].name != NULL; i++) {
@ -858,13 +827,8 @@ static int check_case(char *, int, int, char *);
static int find_init_module(char *); /* Forward */ static int find_init_module(char *); /* Forward */
static struct filedescr * static struct filedescr *
find_module(realname, path, buf, buflen, p_fp) find_module(char *realname, PyObject *path, char *buf, size_t buflen,
char *realname; FILE **p_fp)
PyObject *path;
/* Output parameters: */
char *buf;
size_t buflen;
FILE **p_fp;
{ {
int i, npath; int i, npath;
size_t len, namelen; size_t len, namelen;
@ -1037,8 +1001,7 @@ find_module(realname, path, buf, buflen, p_fp)
#include <ctype.h> #include <ctype.h>
static int static int
allcaps8x3(s) allcaps8x3(char *s)
char *s;
{ {
/* Return 1 if s is an 8.3 filename in ALLCAPS */ /* Return 1 if s is an 8.3 filename in ALLCAPS */
char c; char c;
@ -1176,8 +1139,7 @@ check_case(char *buf, int len, int namelen, char *name)
#ifdef HAVE_STAT #ifdef HAVE_STAT
/* Helper to look for __init__.py or __init__.py[co] in potential package */ /* Helper to look for __init__.py or __init__.py[co] in potential package */
static int static int
find_init_module(buf) find_init_module(char *buf)
char *buf;
{ {
size_t save_len = strlen(buf); size_t save_len = strlen(buf);
size_t i = save_len; size_t i = save_len;
@ -1212,11 +1174,7 @@ static int init_builtin(char *); /* Forward */
its module object WITH INCREMENTED REFERENCE COUNT */ its module object WITH INCREMENTED REFERENCE COUNT */
static PyObject * static PyObject *
load_module(name, fp, buf, type) load_module(char *name, FILE *fp, char *buf, int type)
char *name;
FILE *fp;
char *buf;
int type;
{ {
PyObject *modules; PyObject *modules;
PyObject *m; PyObject *m;
@ -1312,8 +1270,7 @@ load_module(name, fp, buf, type)
an exception set if the initialization failed. */ an exception set if the initialization failed. */
static int static int
init_builtin(name) init_builtin(char *name)
char *name;
{ {
struct _inittab *p; struct _inittab *p;
PyObject *mod; PyObject *mod;
@ -1346,8 +1303,7 @@ init_builtin(name)
/* Frozen modules */ /* Frozen modules */
static struct _frozen * static struct _frozen *
find_frozen(name) find_frozen(char *name)
char *name;
{ {
struct _frozen *p; struct _frozen *p;
@ -1361,8 +1317,7 @@ find_frozen(name)
} }
static PyObject * static PyObject *
get_frozen_object(name) get_frozen_object(char *name)
char *name;
{ {
struct _frozen *p = find_frozen(name); struct _frozen *p = find_frozen(name);
int size; int size;
@ -1385,8 +1340,7 @@ get_frozen_object(name)
This function is also used from frozenmain.c */ This function is also used from frozenmain.c */
int int
PyImport_ImportFrozenModule(name) PyImport_ImportFrozenModule(char *name)
char *name;
{ {
struct _frozen *p = find_frozen(name); struct _frozen *p = find_frozen(name);
PyObject *co; PyObject *co;
@ -1442,8 +1396,7 @@ PyImport_ImportFrozenModule(name)
its module object WITH INCREMENTED REFERENCE COUNT */ its module object WITH INCREMENTED REFERENCE COUNT */
PyObject * PyObject *
PyImport_ImportModule(name) PyImport_ImportModule(char *name)
char *name;
{ {
static PyObject *fromlist = NULL; static PyObject *fromlist = NULL;
if (fromlist == NULL && strchr(name, '.') != NULL) { if (fromlist == NULL && strchr(name, '.') != NULL) {
@ -1466,11 +1419,8 @@ static PyObject * import_submodule(PyObject *mod, char *name, char *fullname);
/* The Magnum Opus of dotted-name import :-) */ /* The Magnum Opus of dotted-name import :-) */
static PyObject * static PyObject *
import_module_ex(name, globals, locals, fromlist) import_module_ex(char *name, PyObject *globals, PyObject *locals,
char *name; PyObject *fromlist)
PyObject *globals;
PyObject *locals;
PyObject *fromlist;
{ {
char buf[MAXPATHLEN+1]; char buf[MAXPATHLEN+1];
int buflen = 0; int buflen = 0;
@ -1516,11 +1466,8 @@ import_module_ex(name, globals, locals, fromlist)
} }
PyObject * PyObject *
PyImport_ImportModuleEx(name, globals, locals, fromlist) PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals,
char *name; PyObject *fromlist)
PyObject *globals;
PyObject *locals;
PyObject *fromlist;
{ {
PyObject *result; PyObject *result;
lock_import(); lock_import();
@ -1530,10 +1477,7 @@ PyImport_ImportModuleEx(name, globals, locals, fromlist)
} }
static PyObject * static PyObject *
get_parent(globals, buf, p_buflen) get_parent(PyObject *globals, char *buf, int *p_buflen)
PyObject *globals;
char *buf;
int *p_buflen;
{ {
static PyObject *namestr = NULL; static PyObject *namestr = NULL;
static PyObject *pathstr = NULL; static PyObject *pathstr = NULL;
@ -1598,13 +1542,10 @@ get_parent(globals, buf, p_buflen)
If this is violated... Who cares? */ If this is violated... Who cares? */
} }
/* altmod is either None or same as mod */
static PyObject * static PyObject *
load_next(mod, altmod, p_name, buf, p_buflen) load_next(PyObject *mod, PyObject *altmod, char **p_name, char *buf,
PyObject *mod; int *p_buflen)
PyObject *altmod; /* Either None or same as mod */
char **p_name;
char *buf;
int *p_buflen;
{ {
char *name = *p_name; char *name = *p_name;
char *dot = strchr(name, '.'); char *dot = strchr(name, '.');
@ -1667,20 +1608,15 @@ load_next(mod, altmod, p_name, buf, p_buflen)
} }
static int static int
mark_miss(name) mark_miss(char *name)
char *name;
{ {
PyObject *modules = PyImport_GetModuleDict(); PyObject *modules = PyImport_GetModuleDict();
return PyDict_SetItemString(modules, name, Py_None); return PyDict_SetItemString(modules, name, Py_None);
} }
static int static int
ensure_fromlist(mod, fromlist, buf, buflen, recursive) ensure_fromlist(PyObject *mod, PyObject *fromlist, char *buf, int buflen,
PyObject *mod; int recursive)
PyObject *fromlist;
char *buf;
int buflen;
int recursive;
{ {
int i; int i;
@ -1747,10 +1683,7 @@ ensure_fromlist(mod, fromlist, buf, buflen, recursive)
} }
static PyObject * static PyObject *
import_submodule(mod, subname, fullname) import_submodule(PyObject *mod, char *subname, char *fullname)
PyObject *mod; /* May be None */
char *subname;
char *fullname;
{ {
PyObject *modules = PyImport_GetModuleDict(); PyObject *modules = PyImport_GetModuleDict();
PyObject *m; PyObject *m;
@ -1809,8 +1742,7 @@ import_submodule(mod, subname, fullname)
INCREMENTED REFERENCE COUNT */ INCREMENTED REFERENCE COUNT */
PyObject * PyObject *
PyImport_ReloadModule(m) PyImport_ReloadModule(PyObject *m)
PyObject *m;
{ {
PyObject *modules = PyImport_GetModuleDict(); PyObject *modules = PyImport_GetModuleDict();
PyObject *path = NULL; PyObject *path = NULL;
@ -1876,8 +1808,7 @@ PyImport_ReloadModule(m)
will return <module "gencache"> instead of <module "win32com">. */ will return <module "gencache"> instead of <module "win32com">. */
PyObject * PyObject *
PyImport_Import(module_name) PyImport_Import(PyObject *module_name)
PyObject *module_name;
{ {
static PyObject *silly_list = NULL; static PyObject *silly_list = NULL;
static PyObject *builtins_str = NULL; static PyObject *builtins_str = NULL;
@ -1953,9 +1884,7 @@ PyImport_Import(module_name)
*/ */
static PyObject * static PyObject *
imp_get_magic(self, args) imp_get_magic(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char buf[4]; char buf[4];
@ -1970,9 +1899,7 @@ imp_get_magic(self, args)
} }
static PyObject * static PyObject *
imp_get_suffixes(self, args) imp_get_suffixes(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *list; PyObject *list;
struct filedescr *fdp; struct filedescr *fdp;
@ -2000,9 +1927,7 @@ imp_get_suffixes(self, args)
} }
static PyObject * static PyObject *
call_find_module(name, path) call_find_module(char *name, PyObject *path)
char *name;
PyObject *path; /* list or None or NULL */
{ {
extern int fclose(FILE *); extern int fclose(FILE *);
PyObject *fob, *ret; PyObject *fob, *ret;
@ -2034,9 +1959,7 @@ call_find_module(name, path)
} }
static PyObject * static PyObject *
imp_find_module(self, args) imp_find_module(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
PyObject *path = NULL; PyObject *path = NULL;
@ -2046,9 +1969,7 @@ imp_find_module(self, args)
} }
static PyObject * static PyObject *
imp_init_builtin(self, args) imp_init_builtin(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
int ret; int ret;
@ -2068,9 +1989,7 @@ imp_init_builtin(self, args)
} }
static PyObject * static PyObject *
imp_init_frozen(self, args) imp_init_frozen(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
int ret; int ret;
@ -2090,9 +2009,7 @@ imp_init_frozen(self, args)
} }
static PyObject * static PyObject *
imp_get_frozen_object(self, args) imp_get_frozen_object(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
@ -2102,9 +2019,7 @@ imp_get_frozen_object(self, args)
} }
static PyObject * static PyObject *
imp_is_builtin(self, args) imp_is_builtin(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) if (!PyArg_ParseTuple(args, "s:is_builtin", &name))
@ -2113,9 +2028,7 @@ imp_is_builtin(self, args)
} }
static PyObject * static PyObject *
imp_is_frozen(self, args) imp_is_frozen(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
struct _frozen *p; struct _frozen *p;
@ -2126,10 +2039,7 @@ imp_is_frozen(self, args)
} }
static FILE * static FILE *
get_file(pathname, fob, mode) get_file(char *pathname, PyObject *fob, char *mode)
char *pathname;
PyObject *fob;
char *mode;
{ {
FILE *fp; FILE *fp;
if (fob == NULL) { if (fob == NULL) {
@ -2147,9 +2057,7 @@ get_file(pathname, fob, mode)
} }
static PyObject * static PyObject *
imp_load_compiled(self, args) imp_load_compiled(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
char *pathname; char *pathname;
@ -2171,9 +2079,7 @@ imp_load_compiled(self, args)
#ifdef HAVE_DYNAMIC_LOADING #ifdef HAVE_DYNAMIC_LOADING
static PyObject * static PyObject *
imp_load_dynamic(self, args) imp_load_dynamic(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
char *pathname; char *pathname;
@ -2195,9 +2101,7 @@ imp_load_dynamic(self, args)
#endif /* HAVE_DYNAMIC_LOADING */ #endif /* HAVE_DYNAMIC_LOADING */
static PyObject * static PyObject *
imp_load_source(self, args) imp_load_source(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
char *pathname; char *pathname;
@ -2218,9 +2122,7 @@ imp_load_source(self, args)
#ifdef macintosh #ifdef macintosh
static PyObject * static PyObject *
imp_load_resource(self, args) imp_load_resource(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
char *pathname; char *pathname;
@ -2234,9 +2136,7 @@ imp_load_resource(self, args)
#endif /* macintosh */ #endif /* macintosh */
static PyObject * static PyObject *
imp_load_module(self, args) imp_load_module(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
PyObject *fob; PyObject *fob;
@ -2271,9 +2171,7 @@ imp_load_module(self, args)
} }
static PyObject * static PyObject *
imp_load_package(self, args) imp_load_package(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
char *pathname; char *pathname;
@ -2283,9 +2181,7 @@ imp_load_package(self, args)
} }
static PyObject * static PyObject *
imp_new_module(self, args) imp_new_module(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *name; char *name;
if (!PyArg_ParseTuple(args, "s:new_module", &name)) if (!PyArg_ParseTuple(args, "s:new_module", &name))
@ -2356,10 +2252,7 @@ static PyMethodDef imp_methods[] = {
}; };
static int static int
setint(d, name, value) setint(PyObject *d, char *name, int value)
PyObject *d;
char *name;
int value;
{ {
PyObject *v; PyObject *v;
int err; int err;
@ -2371,7 +2264,7 @@ setint(d, name, value)
} }
void void
initimp() initimp(void)
{ {
PyObject *m, *d; PyObject *m, *d;
@ -2402,8 +2295,7 @@ initimp()
After a similar function by Just van Rossum. */ After a similar function by Just van Rossum. */
int int
PyImport_ExtendInittab(newtab) PyImport_ExtendInittab(struct _inittab *newtab)
struct _inittab *newtab;
{ {
static struct _inittab *our_copy = NULL; static struct _inittab *our_copy = NULL;
struct _inittab *p; struct _inittab *p;
@ -2435,9 +2327,7 @@ PyImport_ExtendInittab(newtab)
/* Shorthand to add a single entry given a name and a function */ /* Shorthand to add a single entry given a name and a function */
int int
PyImport_AppendInittab(name, initfunc) PyImport_AppendInittab(char *name, void (*initfunc)(void))
char *name;
void (*initfunc)();
{ {
struct _inittab newtab[2]; struct _inittab newtab[2];

View file

@ -28,10 +28,7 @@ extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name,
PyObject * PyObject *
_PyImport_LoadDynamicModule(name, pathname, fp) _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp)
char *name;
char *pathname;
FILE *fp;
{ {
PyObject *m, *d, *s; PyObject *m, *d, *s;
char *lastdot, *shortname, *packagecontext; char *lastdot, *shortname, *packagecontext;

View file

@ -55,9 +55,7 @@ typedef struct {
else w_more(c, p) else w_more(c, p)
static void static void
w_more(c, p) w_more(char c, WFILE *p)
char c;
WFILE *p;
{ {
int size, newsize; int size, newsize;
if (p->str == NULL) if (p->str == NULL)
@ -76,10 +74,7 @@ w_more(c, p)
} }
static void static void
w_string(s, n, p) w_string(char *s, int n, WFILE *p)
char *s;
int n;
WFILE *p;
{ {
if (p->fp != NULL) { if (p->fp != NULL) {
fwrite(s, 1, n, p->fp); fwrite(s, 1, n, p->fp);
@ -93,18 +88,14 @@ w_string(s, n, p)
} }
static void static void
w_short(x, p) w_short(int x, WFILE *p)
int x;
WFILE *p;
{ {
w_byte( x & 0xff, p); w_byte( x & 0xff, p);
w_byte((x>> 8) & 0xff, p); w_byte((x>> 8) & 0xff, p);
} }
static void static void
w_long(x, p) w_long(long x, WFILE *p)
long x;
WFILE *p;
{ {
w_byte((int)( x & 0xff), p); w_byte((int)( x & 0xff), p);
w_byte((int)((x>> 8) & 0xff), p); w_byte((int)((x>> 8) & 0xff), p);
@ -114,9 +105,7 @@ w_long(x, p)
#if SIZEOF_LONG > 4 #if SIZEOF_LONG > 4
static void static void
w_long64(x, p) w_long64(long x, WFILE *p)
long x;
WFILE *p;
{ {
w_long(x, p); w_long(x, p);
w_long(x>>32, p); w_long(x>>32, p);
@ -124,9 +113,7 @@ w_long64(x, p)
#endif #endif
static void static void
w_object(v, p) w_object(PyObject *v, WFILE *p)
PyObject *v;
WFILE *p;
{ {
int i, n; int i, n;
PyBufferProcs *pb; PyBufferProcs *pb;
@ -286,9 +273,7 @@ w_object(v, p)
} }
void void
PyMarshal_WriteLongToFile(x, fp) PyMarshal_WriteLongToFile(long x, FILE *fp)
long x;
FILE *fp;
{ {
WFILE wf; WFILE wf;
wf.fp = fp; wf.fp = fp;
@ -298,9 +283,7 @@ PyMarshal_WriteLongToFile(x, fp)
} }
void void
PyMarshal_WriteObjectToFile(x, fp) PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp)
PyObject *x;
FILE *fp;
{ {
WFILE wf; WFILE wf;
wf.fp = fp; wf.fp = fp;
@ -316,10 +299,7 @@ typedef WFILE RFILE; /* Same struct with different invariants */
#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) #define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p))
static int static int
r_string(s, n, p) r_string(char *s, int n, RFILE *p)
char *s;
int n;
RFILE *p;
{ {
if (p->fp != NULL) if (p->fp != NULL)
return fread(s, 1, n, p->fp); return fread(s, 1, n, p->fp);
@ -331,8 +311,7 @@ r_string(s, n, p)
} }
static int static int
r_short(p) r_short(RFILE *p)
RFILE *p;
{ {
register short x; register short x;
x = r_byte(p); x = r_byte(p);
@ -342,8 +321,7 @@ r_short(p)
} }
static long static long
r_long(p) r_long(RFILE *p)
RFILE *p;
{ {
register long x; register long x;
register FILE *fp = p->fp; register FILE *fp = p->fp;
@ -368,8 +346,7 @@ r_long(p)
} }
static long static long
r_long64(p) r_long64(RFILE *p)
RFILE *p;
{ {
register long x; register long x;
x = r_long(p); x = r_long(p);
@ -388,8 +365,7 @@ r_long64(p)
} }
static PyObject * static PyObject *
r_object(p) r_object(RFILE *p)
RFILE *p;
{ {
PyObject *v, *v2; PyObject *v, *v2;
long i, n; long i, n;
@ -634,8 +610,7 @@ r_object(p)
} }
long long
PyMarshal_ReadLongFromFile(fp) PyMarshal_ReadLongFromFile(FILE *fp)
FILE *fp;
{ {
RFILE rf; RFILE rf;
rf.fp = fp; rf.fp = fp;
@ -643,8 +618,7 @@ PyMarshal_ReadLongFromFile(fp)
} }
PyObject * PyObject *
PyMarshal_ReadObjectFromFile(fp) PyMarshal_ReadObjectFromFile(FILE *fp)
FILE *fp;
{ {
RFILE rf; RFILE rf;
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
@ -656,9 +630,7 @@ PyMarshal_ReadObjectFromFile(fp)
} }
PyObject * PyObject *
PyMarshal_ReadObjectFromString(str, len) PyMarshal_ReadObjectFromString(char *str, int len)
char *str;
int len;
{ {
RFILE rf; RFILE rf;
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
@ -673,8 +645,7 @@ PyMarshal_ReadObjectFromString(str, len)
} }
PyObject * PyObject *
PyMarshal_WriteObjectToString(x) /* wrs_object() */ PyMarshal_WriteObjectToString(PyObject *x) /* wrs_object() */
PyObject *x;
{ {
WFILE wf; WFILE wf;
wf.fp = NULL; wf.fp = NULL;
@ -703,9 +674,7 @@ PyMarshal_WriteObjectToString(x) /* wrs_object() */
/* And an interface for Python programs... */ /* And an interface for Python programs... */
static PyObject * static PyObject *
marshal_dump(self, args) marshal_dump(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
WFILE wf; WFILE wf;
PyObject *x; PyObject *x;
@ -734,9 +703,7 @@ marshal_dump(self, args)
} }
static PyObject * static PyObject *
marshal_load(self, args) marshal_load(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
RFILE rf; RFILE rf;
PyObject *f; PyObject *f;
@ -761,9 +728,7 @@ marshal_load(self, args)
} }
static PyObject * static PyObject *
marshal_dumps(self, args) marshal_dumps(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *x; PyObject *x;
if (!PyArg_ParseTuple(args, "O:dumps", &x)) if (!PyArg_ParseTuple(args, "O:dumps", &x))
@ -772,9 +737,7 @@ marshal_dumps(self, args)
} }
static PyObject * static PyObject *
marshal_loads(self, args) marshal_loads(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
RFILE rf; RFILE rf;
PyObject *v; PyObject *v;
@ -804,7 +767,7 @@ static PyMethodDef marshal_methods[] = {
}; };
void void
PyMarshal_Init() PyMarshal_Init(void)
{ {
(void) Py_InitModule("marshal", marshal_methods); (void) Py_InitModule("marshal", marshal_methods);
} }

View file

@ -10,13 +10,10 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* A perhaps slow but I hope correct implementation of memmove */ /* A perhaps slow but I hope correct implementation of memmove */
extern char *memcpy(); extern char *memcpy(char *, char *, int);
char * char *
memmove(dst, src, n) memmove(char *dst, char *src, int n)
char *dst;
char *src;
int n;
{ {
char *realdst = dst; char *realdst = dst;
if (n <= 0) if (n <= 0)

View file

@ -42,12 +42,8 @@ static char api_version_warning[] =
This Python has API version %d, module %s has version %d.\n"; This Python has API version %d, module %s has version %d.\n";
PyObject * PyObject *
Py_InitModule4(name, methods, doc, passthrough, module_api_version) Py_InitModule4(char *name, PyMethodDef *methods, char *doc,
char *name; PyObject *passthrough, int module_api_version)
PyMethodDef *methods;
char *doc;
PyObject *passthrough;
int module_api_version;
{ {
PyObject *m, *d, *v; PyObject *m, *d, *v;
PyMethodDef *ml; PyMethodDef *ml;
@ -84,10 +80,7 @@ Py_InitModule4(name, methods, doc, passthrough, module_api_version)
/* Helper for mkvalue() to scan the length of a format */ /* Helper for mkvalue() to scan the length of a format */
static int countformat(char *format, int endchar); static int countformat(char *format, int endchar)
static int countformat(format, endchar)
char *format;
int endchar;
{ {
int count = 0; int count = 0;
int level = 0; int level = 0;
@ -137,11 +130,7 @@ static PyObject *do_mkvalue(char**, va_list *);
static PyObject * static PyObject *
do_mkdict(p_format, p_va, endchar, n) do_mkdict(char **p_format, va_list *p_va, int endchar, int n)
char **p_format;
va_list *p_va;
int endchar;
int n;
{ {
PyObject *d; PyObject *d;
int i; int i;
@ -183,11 +172,7 @@ do_mkdict(p_format, p_va, endchar, n)
} }
static PyObject * static PyObject *
do_mklist(p_format, p_va, endchar, n) do_mklist(char **p_format, va_list *p_va, int endchar, int n)
char **p_format;
va_list *p_va;
int endchar;
int n;
{ {
PyObject *v; PyObject *v;
int i; int i;
@ -224,11 +209,7 @@ _ustrlen(Py_UNICODE *u)
} }
static PyObject * static PyObject *
do_mktuple(p_format, p_va, endchar, n) do_mktuple(char **p_format, va_list *p_va, int endchar, int n)
char **p_format;
va_list *p_va;
int endchar;
int n;
{ {
PyObject *v; PyObject *v;
int i; int i;
@ -256,9 +237,7 @@ do_mktuple(p_format, p_va, endchar, n)
} }
static PyObject * static PyObject *
do_mkvalue(p_format, p_va) do_mkvalue(char **p_format, va_list *p_va)
char **p_format;
va_list *p_va;
{ {
for (;;) { for (;;) {
switch (*(*p_format)++) { switch (*(*p_format)++) {
@ -401,32 +380,18 @@ do_mkvalue(p_format, p_va)
} }
#ifdef HAVE_STDARG_PROTOTYPES
/* VARARGS 2 */
PyObject *Py_BuildValue(char *format, ...) PyObject *Py_BuildValue(char *format, ...)
#else
/* VARARGS */
PyObject *Py_BuildValue(va_alist) va_dcl
#endif
{ {
va_list va; va_list va;
PyObject* retval; PyObject* retval;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format); va_start(va, format);
#else
char *format;
va_start(va);
format = va_arg(va, char *);
#endif
retval = Py_VaBuildValue(format, va); retval = Py_VaBuildValue(format, va);
va_end(va); va_end(va);
return retval; return retval;
} }
PyObject * PyObject *
Py_VaBuildValue(format, va) Py_VaBuildValue(char *format, va_list va)
char *format;
va_list va;
{ {
char *f = format; char *f = format;
int n = countformat(f, '\0'); int n = countformat(f, '\0');
@ -450,26 +415,14 @@ Py_VaBuildValue(format, va)
} }
#ifdef HAVE_STDARG_PROTOTYPES
PyObject * PyObject *
PyEval_CallFunction(PyObject *obj, char *format, ...) PyEval_CallFunction(PyObject *obj, char *format, ...)
#else
PyObject *
PyEval_CallFunction(obj, format, va_alist)
PyObject *obj;
char *format;
va_dcl
#endif
{ {
va_list vargs; va_list vargs;
PyObject *args; PyObject *args;
PyObject *res; PyObject *res;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format); va_start(vargs, format);
#else
va_start(vargs);
#endif
args = Py_VaBuildValue(format, vargs); args = Py_VaBuildValue(format, vargs);
va_end(vargs); va_end(vargs);
@ -484,17 +437,8 @@ PyEval_CallFunction(obj, format, va_alist)
} }
#ifdef HAVE_STDARG_PROTOTYPES
PyObject * PyObject *
PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...) PyEval_CallMethod(PyObject *obj, char *methodname, char *format, ...)
#else
PyObject *
PyEval_CallMethod(obj, methodname, format, va_alist)
PyObject *obj;
char *methodname;
char *format;
va_dcl
#endif
{ {
va_list vargs; va_list vargs;
PyObject *meth; PyObject *meth;
@ -505,11 +449,7 @@ PyEval_CallMethod(obj, methodname, format, va_alist)
if (meth == NULL) if (meth == NULL)
return NULL; return NULL;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, format); va_start(vargs, format);
#else
va_start(vargs);
#endif
args = Py_VaBuildValue(format, vargs); args = Py_VaBuildValue(format, vargs);
va_end(vargs); va_end(vargs);

View file

@ -44,10 +44,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#endif #endif
unsigned long unsigned long
PyOS_strtoul(str, ptr, base) PyOS_strtoul(register char *str, char **ptr, int base)
register char * str;
char ** ptr;
int base;
{ {
register unsigned long result; /* return value of the function */ register unsigned long result; /* return value of the function */
register int c; /* current input character */ register int c; /* current input character */
@ -137,10 +134,7 @@ int base;
} }
long long
PyOS_strtol(str, ptr, base) PyOS_strtol(char *str, char **ptr, int base)
char * str;
char ** ptr;
int base;
{ {
long result; long result;
char sign; char sign;

View file

@ -17,8 +17,7 @@ int PyFPE_counter = 0;
warning when compiling an empty file. */ warning when compiling an empty file. */
double double
PyFPE_dummy(dummy) PyFPE_dummy(void *dummy)
void *dummy;
{ {
return 1.0; return 1.0;
} }

View file

@ -37,7 +37,7 @@ PyThreadState *_PyThreadState_Current = NULL;
PyInterpreterState * PyInterpreterState *
PyInterpreterState_New() PyInterpreterState_New(void)
{ {
PyInterpreterState *interp = PyMem_NEW(PyInterpreterState, 1); PyInterpreterState *interp = PyMem_NEW(PyInterpreterState, 1);
@ -58,8 +58,7 @@ PyInterpreterState_New()
void void
PyInterpreterState_Clear(interp) PyInterpreterState_Clear(PyInterpreterState *interp)
PyInterpreterState *interp;
{ {
PyThreadState *p; PyThreadState *p;
HEAD_LOCK(); HEAD_LOCK();
@ -73,8 +72,7 @@ PyInterpreterState_Clear(interp)
static void static void
zapthreads(interp) zapthreads(PyInterpreterState *interp)
PyInterpreterState *interp;
{ {
PyThreadState *p; PyThreadState *p;
/* No need to lock the mutex here because this should only happen /* No need to lock the mutex here because this should only happen
@ -86,8 +84,7 @@ zapthreads(interp)
void void
PyInterpreterState_Delete(interp) PyInterpreterState_Delete(PyInterpreterState *interp)
PyInterpreterState *interp;
{ {
PyInterpreterState **p; PyInterpreterState **p;
zapthreads(interp); zapthreads(interp);
@ -106,8 +103,7 @@ PyInterpreterState_Delete(interp)
PyThreadState * PyThreadState *
PyThreadState_New(interp) PyThreadState_New(PyInterpreterState *interp)
PyInterpreterState *interp;
{ {
PyThreadState *tstate = PyMem_NEW(PyThreadState, 1); PyThreadState *tstate = PyMem_NEW(PyThreadState, 1);
@ -143,8 +139,7 @@ PyThreadState_New(interp)
void void
PyThreadState_Clear(tstate) PyThreadState_Clear(PyThreadState *tstate)
PyThreadState *tstate;
{ {
if (Py_VerboseFlag && tstate->frame != NULL) if (Py_VerboseFlag && tstate->frame != NULL)
fprintf(stderr, fprintf(stderr,
@ -168,8 +163,7 @@ PyThreadState_Clear(tstate)
void void
PyThreadState_Delete(tstate) PyThreadState_Delete(PyThreadState *tstate)
PyThreadState *tstate;
{ {
PyInterpreterState *interp; PyInterpreterState *interp;
PyThreadState **p; PyThreadState **p;
@ -195,7 +189,7 @@ PyThreadState_Delete(tstate)
PyThreadState * PyThreadState *
PyThreadState_Get() PyThreadState_Get(void)
{ {
if (_PyThreadState_Current == NULL) if (_PyThreadState_Current == NULL)
Py_FatalError("PyThreadState_Get: no current thread"); Py_FatalError("PyThreadState_Get: no current thread");
@ -205,8 +199,7 @@ PyThreadState_Get()
PyThreadState * PyThreadState *
PyThreadState_Swap(new) PyThreadState_Swap(PyThreadState *new)
PyThreadState *new;
{ {
PyThreadState *old = _PyThreadState_Current; PyThreadState *old = _PyThreadState_Current;
@ -222,7 +215,7 @@ PyThreadState_Swap(new)
likely MemoryError) and the caller should pass on the exception. */ likely MemoryError) and the caller should pass on the exception. */
PyObject * PyObject *
PyThreadState_GetDict() PyThreadState_GetDict(void)
{ {
if (_PyThreadState_Current == NULL) if (_PyThreadState_Current == NULL)
Py_FatalError("PyThreadState_GetDict: no current thread"); Py_FatalError("PyThreadState_GetDict: no current thread");

View file

@ -37,7 +37,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#ifdef macintosh #ifdef macintosh
#include "macglue.h" #include "macglue.h"
#endif #endif
extern char *Py_GetPath(); extern char *Py_GetPath(void);
extern grammar _PyParser_Grammar; /* From graminit.c */ extern grammar _PyParser_Grammar; /* From graminit.c */
@ -59,10 +59,10 @@ static void call_ll_exitfuncs(void);
int _Py_AskYesNo(char *prompt); int _Py_AskYesNo(char *prompt);
#endif #endif
extern void _PyUnicode_Init(); extern void _PyUnicode_Init(void);
extern void _PyUnicode_Fini(); extern void _PyUnicode_Fini(void);
extern void _PyCodecRegistry_Init(); extern void _PyCodecRegistry_Init(void);
extern void _PyCodecRegistry_Fini(); extern void _PyCodecRegistry_Fini(void);
int Py_DebugFlag; /* Needed by parser.c */ int Py_DebugFlag; /* Needed by parser.c */
@ -78,7 +78,7 @@ static int initialized = 0;
/* API to access the initialized flag -- useful for esoteric use */ /* API to access the initialized flag -- useful for esoteric use */
int int
Py_IsInitialized() Py_IsInitialized(void)
{ {
return initialized; return initialized;
} }
@ -96,7 +96,7 @@ Py_IsInitialized()
*/ */
void void
Py_Initialize() Py_Initialize(void)
{ {
PyInterpreterState *interp; PyInterpreterState *interp;
PyThreadState *tstate; PyThreadState *tstate;
@ -185,7 +185,7 @@ extern void dump_counts(void);
*/ */
void void
Py_Finalize() Py_Finalize(void)
{ {
PyInterpreterState *interp; PyInterpreterState *interp;
PyThreadState *tstate; PyThreadState *tstate;
@ -283,7 +283,7 @@ Py_Finalize()
*/ */
PyThreadState * PyThreadState *
Py_NewInterpreter() Py_NewInterpreter(void)
{ {
PyInterpreterState *interp; PyInterpreterState *interp;
PyThreadState *tstate, *save_tstate; PyThreadState *tstate, *save_tstate;
@ -352,8 +352,7 @@ Py_NewInterpreter()
*/ */
void void
Py_EndInterpreter(tstate) Py_EndInterpreter(PyThreadState *tstate)
PyThreadState *tstate;
{ {
PyInterpreterState *interp = tstate->interp; PyInterpreterState *interp = tstate->interp;
@ -373,15 +372,14 @@ Py_EndInterpreter(tstate)
static char *progname = "python"; static char *progname = "python";
void void
Py_SetProgramName(pn) Py_SetProgramName(char *pn)
char *pn;
{ {
if (pn && *pn) if (pn && *pn)
progname = pn; progname = pn;
} }
char * char *
Py_GetProgramName() Py_GetProgramName(void)
{ {
return progname; return progname;
} }
@ -389,14 +387,13 @@ Py_GetProgramName()
static char *default_home = NULL; static char *default_home = NULL;
void void
Py_SetPythonHome(home) Py_SetPythonHome(char *home)
char *home;
{ {
default_home = home; default_home = home;
} }
char * char *
Py_GetPythonHome() Py_GetPythonHome(void)
{ {
char *home = default_home; char *home = default_home;
if (home == NULL) if (home == NULL)
@ -407,7 +404,7 @@ Py_GetPythonHome()
/* Create __main__ module */ /* Create __main__ module */
static void static void
initmain() initmain(void)
{ {
PyObject *m, *d; PyObject *m, *d;
m = PyImport_AddModule("__main__"); m = PyImport_AddModule("__main__");
@ -426,7 +423,7 @@ initmain()
/* Import the site module (not into __main__ though) */ /* Import the site module (not into __main__ though) */
static void static void
initsite() initsite(void)
{ {
PyObject *m, *f; PyObject *m, *f;
m = PyImport_ImportModule("site"); m = PyImport_ImportModule("site");
@ -451,9 +448,7 @@ initsite()
/* Parse input from a file and execute it */ /* Parse input from a file and execute it */
int int
PyRun_AnyFile(fp, filename) PyRun_AnyFile(FILE *fp, char *filename)
FILE *fp;
char *filename;
{ {
if (filename == NULL) if (filename == NULL)
filename = "???"; filename = "???";
@ -464,9 +459,7 @@ PyRun_AnyFile(fp, filename)
} }
int int
PyRun_InteractiveLoop(fp, filename) PyRun_InteractiveLoop(FILE *fp, char *filename)
FILE *fp;
char *filename;
{ {
PyObject *v; PyObject *v;
int ret; int ret;
@ -495,9 +488,7 @@ PyRun_InteractiveLoop(fp, filename)
} }
int int
PyRun_InteractiveOne(fp, filename) PyRun_InteractiveOne(FILE *fp, char *filename)
FILE *fp;
char *filename;
{ {
PyObject *m, *d, *v, *w; PyObject *m, *d, *v, *w;
node *n; node *n;
@ -549,9 +540,7 @@ PyRun_InteractiveOne(fp, filename)
} }
int int
PyRun_SimpleFile(fp, filename) PyRun_SimpleFile(FILE *fp, char *filename)
FILE *fp;
char *filename;
{ {
PyObject *m, *d, *v; PyObject *m, *d, *v;
char *ext; char *ext;
@ -592,8 +581,7 @@ PyRun_SimpleFile(fp, filename)
} }
int int
PyRun_SimpleString(command) PyRun_SimpleString(char *command)
char *command;
{ {
PyObject *m, *d, *v; PyObject *m, *d, *v;
m = PyImport_AddModule("__main__"); m = PyImport_AddModule("__main__");
@ -612,13 +600,8 @@ PyRun_SimpleString(command)
} }
static int static int
parse_syntax_error(err, message, filename, lineno, offset, text) parse_syntax_error(PyObject *err, PyObject **message, char **filename,
PyObject* err; int *lineno, int *offset, char **text)
PyObject** message;
char** filename;
int* lineno;
int* offset;
char** text;
{ {
long hold; long hold;
PyObject *v; PyObject *v;
@ -675,14 +658,13 @@ finally:
} }
void void
PyErr_Print() PyErr_Print(void)
{ {
PyErr_PrintEx(1); PyErr_PrintEx(1);
} }
void void
PyErr_PrintEx(set_sys_last_vars) PyErr_PrintEx(int set_sys_last_vars)
int set_sys_last_vars;
{ {
int err = 0; int err = 0;
PyObject *exception, *v, *tb, *f; PyObject *exception, *v, *tb, *f;
@ -853,31 +835,22 @@ PyErr_PrintEx(set_sys_last_vars)
} }
PyObject * PyObject *
PyRun_String(str, start, globals, locals) PyRun_String(char *str, int start, PyObject *globals, PyObject *locals)
char *str;
int start;
PyObject *globals, *locals;
{ {
return run_err_node(PyParser_SimpleParseString(str, start), return run_err_node(PyParser_SimpleParseString(str, start),
"<string>", globals, locals); "<string>", globals, locals);
} }
PyObject * PyObject *
PyRun_File(fp, filename, start, globals, locals) PyRun_File(FILE *fp, char *filename, int start, PyObject *globals,
FILE *fp; PyObject *locals)
char *filename;
int start;
PyObject *globals, *locals;
{ {
return run_err_node(PyParser_SimpleParseFile(fp, filename, start), return run_err_node(PyParser_SimpleParseFile(fp, filename, start),
filename, globals, locals); filename, globals, locals);
} }
static PyObject * static PyObject *
run_err_node(n, filename, globals, locals) run_err_node(node *n, char *filename, PyObject *globals, PyObject *locals)
node *n;
char *filename;
PyObject *globals, *locals;
{ {
if (n == NULL) if (n == NULL)
return NULL; return NULL;
@ -885,10 +858,7 @@ run_err_node(n, filename, globals, locals)
} }
static PyObject * static PyObject *
run_node(n, filename, globals, locals) run_node(node *n, char *filename, PyObject *globals, PyObject *locals)
node *n;
char *filename;
PyObject *globals, *locals;
{ {
PyCodeObject *co; PyCodeObject *co;
PyObject *v; PyObject *v;
@ -902,10 +872,7 @@ run_node(n, filename, globals, locals)
} }
static PyObject * static PyObject *
run_pyc_file(fp, filename, globals, locals) run_pyc_file(FILE *fp, char *filename, PyObject *globals, PyObject *locals)
FILE *fp;
char *filename;
PyObject *globals, *locals;
{ {
PyCodeObject *co; PyCodeObject *co;
PyObject *v; PyObject *v;
@ -934,10 +901,7 @@ run_pyc_file(fp, filename, globals, locals)
} }
PyObject * PyObject *
Py_CompileString(str, filename, start) Py_CompileString(char *str, char *filename, int start)
char *str;
char *filename;
int start;
{ {
node *n; node *n;
PyCodeObject *co; PyCodeObject *co;
@ -952,10 +916,7 @@ Py_CompileString(str, filename, start)
/* Simplified interface to parsefile -- return node or set exception */ /* Simplified interface to parsefile -- return node or set exception */
node * node *
PyParser_SimpleParseFile(fp, filename, start) PyParser_SimpleParseFile(FILE *fp, char *filename, int start)
FILE *fp;
char *filename;
int start;
{ {
node *n; node *n;
perrdetail err; perrdetail err;
@ -969,9 +930,7 @@ PyParser_SimpleParseFile(fp, filename, start)
/* Simplified interface to parsestring -- return node or set exception */ /* Simplified interface to parsestring -- return node or set exception */
node * node *
PyParser_SimpleParseString(str, start) PyParser_SimpleParseString(char *str, int start)
char *str;
int start;
{ {
node *n; node *n;
perrdetail err; perrdetail err;
@ -984,8 +943,7 @@ PyParser_SimpleParseString(str, start)
/* Set the error appropriate to the given input error code (see errcode.h) */ /* Set the error appropriate to the given input error code (see errcode.h) */
static void static void
err_input(err) err_input(perrdetail *err)
perrdetail *err;
{ {
PyObject *v, *w, *errtype; PyObject *v, *w, *errtype;
char *msg = NULL; char *msg = NULL;
@ -1053,8 +1011,7 @@ err_input(err)
/* Print fatal error message and abort */ /* Print fatal error message and abort */
void void
Py_FatalError(msg) Py_FatalError(char *msg)
char *msg;
{ {
fprintf(stderr, "Fatal Python error: %s\n", msg); fprintf(stderr, "Fatal Python error: %s\n", msg);
#ifdef macintosh #ifdef macintosh
@ -1079,11 +1036,10 @@ int _PyThread_Started = 0; /* Set by threadmodule.c and maybe others */
#endif #endif
#define NEXITFUNCS 32 #define NEXITFUNCS 32
static void (*exitfuncs[NEXITFUNCS])(); static void (*exitfuncs[NEXITFUNCS])(void);
static int nexitfuncs = 0; static int nexitfuncs = 0;
int Py_AtExit(func) int Py_AtExit(void (*func)(void))
void (*func)(void);
{ {
if (nexitfuncs >= NEXITFUNCS) if (nexitfuncs >= NEXITFUNCS)
return -1; return -1;
@ -1092,7 +1048,7 @@ int Py_AtExit(func)
} }
static void static void
call_sys_exitfunc() call_sys_exitfunc(void)
{ {
PyObject *exitfunc = PySys_GetObject("exitfunc"); PyObject *exitfunc = PySys_GetObject("exitfunc");
@ -1115,7 +1071,7 @@ call_sys_exitfunc()
} }
static void static void
call_ll_exitfuncs() call_ll_exitfuncs(void)
{ {
while (nexitfuncs > 0) while (nexitfuncs > 0)
(*exitfuncs[--nexitfuncs])(); (*exitfuncs[--nexitfuncs])();
@ -1125,8 +1081,7 @@ call_ll_exitfuncs()
} }
void void
Py_Exit(sts) Py_Exit(int sts)
int sts;
{ {
Py_Finalize(); Py_Finalize();
@ -1138,7 +1093,7 @@ Py_Exit(sts)
} }
static void static void
initsigs() initsigs(void)
{ {
#ifdef HAVE_SIGNAL_H #ifdef HAVE_SIGNAL_H
#ifdef SIGPIPE #ifdef SIGPIPE
@ -1152,8 +1107,7 @@ initsigs()
/* Ask a yes/no question */ /* Ask a yes/no question */
int int
_Py_AskYesNo(prompt) _Py_AskYesNo(char *prompt)
char *prompt;
{ {
char buf[256]; char buf[256];
@ -1170,8 +1124,7 @@ _Py_AskYesNo(prompt)
Pretend that stdin is always interactive, other files never. */ Pretend that stdin is always interactive, other files never. */
int int
isatty(fd) isatty(int fd)
int fd;
{ {
return fd == fileno(stdin); return fd == fileno(stdin);
} }
@ -1185,9 +1138,7 @@ isatty(fd)
* the descriptor is NULL or "<stdin>" or "???". * the descriptor is NULL or "<stdin>" or "???".
*/ */
int int
Py_FdIsInteractive(fp, filename) Py_FdIsInteractive(FILE *fp, char *filename)
FILE *fp;
char *filename;
{ {
if (isatty((int)fileno(fp))) if (isatty((int)fileno(fp)))
return 1; return 1;

View file

@ -19,7 +19,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* ARGSUSED */ /* ARGSUSED */
int int
PyErr_CheckSignals() PyErr_CheckSignals(void)
{ {
if (!PyOS_InterruptOccurred()) if (!PyOS_InterruptOccurred())
return 0; return 0;

View file

@ -3,8 +3,7 @@
#include "pgenheaders.h" #include "pgenheaders.h"
char * char *
strdup(str) strdup(const char *str)
const char *str;
{ {
if (str != NULL) { if (str != NULL) {
register char *copy = malloc(strlen(str) + 1); register char *copy = malloc(strlen(str) + 1);

View file

@ -17,8 +17,7 @@ extern int sys_nerr;
extern char *sys_errlist[]; extern char *sys_errlist[];
char * char *
strerror(err) strerror(int err)
int err;
{ {
static char buf[20]; static char buf[20];
if (err >= 0 && err < sys_nerr) if (err >= 0 && err < sys_nerr)

View file

@ -52,17 +52,15 @@ static int MDMAXEXPT = { 309};
static char MDMAXFRAC[] = "17976931348623157"; static char MDMAXFRAC[] = "17976931348623157";
static double HUGE = 1.7976931348623157e308; static double HUGE = 1.7976931348623157e308;
extern double atof(); /* Only called when result known to be ok */ extern double atof(const char *); /* Only called when result known to be ok */
#ifndef DONT_HAVE_ERRNO_H #ifndef DONT_HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
extern int errno; extern int errno;
double strtod(str, ptr) double strtod(char *str, char **ptr)
char *str; {
char **ptr;
{
int sign, scale, dotseen; int sign, scale, dotseen;
int esign, expt; int esign, expt;
char *save; char *save;
@ -155,4 +153,4 @@ double strtod(str, ptr)
(void) sprintf(dp, "E%d", expt); (void) sprintf(dp, "E%d", expt);
errno = 0; errno = 0;
return atof(buffer)*sign; return atof(buffer)*sign;
} }

View file

@ -15,8 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "structmember.h" #include "structmember.h"
static PyObject * static PyObject *
listmembers(mlist) listmembers(struct memberlist *mlist)
struct memberlist *mlist;
{ {
int i, n; int i, n;
PyObject *v; PyObject *v;
@ -39,10 +38,7 @@ listmembers(mlist)
} }
PyObject * PyObject *
PyMember_Get(addr, mlist, name) PyMember_Get(char *addr, struct memberlist *mlist, char *name)
char *addr;
struct memberlist *mlist;
char *name;
{ {
struct memberlist *l; struct memberlist *l;
@ -139,11 +135,7 @@ PyMember_Get(addr, mlist, name)
} }
int int
PyMember_Set(addr, mlist, name, v) PyMember_Set(char *addr, struct memberlist *mlist, char *name, PyObject *v)
char *addr;
struct memberlist *mlist;
char *name;
PyObject *v;
{ {
struct memberlist *l; struct memberlist *l;
PyObject *oldv; PyObject *oldv;

View file

@ -38,8 +38,7 @@ extern const char *PyWin_DLLVersionString;
#endif #endif
PyObject * PyObject *
PySys_GetObject(name) PySys_GetObject(char *name)
char *name;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
PyObject *sd = tstate->interp->sysdict; PyObject *sd = tstate->interp->sysdict;
@ -49,9 +48,7 @@ PySys_GetObject(name)
} }
FILE * FILE *
PySys_GetFile(name, def) PySys_GetFile(char *name, FILE *def)
char *name;
FILE *def;
{ {
FILE *fp = NULL; FILE *fp = NULL;
PyObject *v = PySys_GetObject(name); PyObject *v = PySys_GetObject(name);
@ -63,9 +60,7 @@ PySys_GetFile(name, def)
} }
int int
PySys_SetObject(name, v) PySys_SetObject(char *name, PyObject *v)
char *name;
PyObject *v;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
PyObject *sd = tstate->interp->sysdict; PyObject *sd = tstate->interp->sysdict;
@ -80,9 +75,7 @@ PySys_SetObject(name, v)
} }
static PyObject * static PyObject *
sys_exc_info(self, args) sys_exc_info(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyThreadState *tstate; PyThreadState *tstate;
if (!PyArg_ParseTuple(args, ":exc_info")) if (!PyArg_ParseTuple(args, ":exc_info"))
@ -103,9 +96,7 @@ Return information about the exception that is currently being handled.\n\
This should be called from inside an except clause only."; This should be called from inside an except clause only.";
static PyObject * static PyObject *
sys_exit(self, args) sys_exit(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
/* Raise SystemExit so callers may catch it or clean up. */ /* Raise SystemExit so callers may catch it or clean up. */
PyErr_SetObject(PyExc_SystemExit, args); PyErr_SetObject(PyExc_SystemExit, args);
@ -122,9 +113,7 @@ If it is another kind of object, it will be printed and the system\n\
exit status will be one (i.e., failure)."; exit status will be one (i.e., failure).";
static PyObject * static PyObject *
sys_getdefaultencoding(self, args) sys_getdefaultencoding(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
if (!PyArg_ParseTuple(args, ":getdefaultencoding")) if (!PyArg_ParseTuple(args, ":getdefaultencoding"))
return NULL; return NULL;
@ -138,9 +127,7 @@ Return the current default string encoding used by the Unicode \n\
implementation."; implementation.";
static PyObject * static PyObject *
sys_setdefaultencoding(self, args) sys_setdefaultencoding(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
char *encoding; char *encoding;
if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding)) if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding))
@ -157,9 +144,7 @@ static char setdefaultencoding_doc[] =
Set the current default string encoding used by the Unicode implementation."; Set the current default string encoding used by the Unicode implementation.";
static PyObject * static PyObject *
sys_settrace(self, args) sys_settrace(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
if (args == Py_None) if (args == Py_None)
@ -179,9 +164,7 @@ Set the global debug tracing function. It will be called on each\n\
function call. See the debugger chapter in the library manual."; function call. See the debugger chapter in the library manual.";
static PyObject * static PyObject *
sys_setprofile(self, args) sys_setprofile(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
if (args == Py_None) if (args == Py_None)
@ -201,9 +184,7 @@ Set the profiling function. It will be called on each function call\n\
and return. See the profiler chapter in the library manual."; and return. See the profiler chapter in the library manual.";
static PyObject * static PyObject *
sys_setcheckinterval(self, args) sys_setcheckinterval(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyThreadState *tstate = PyThreadState_Get(); PyThreadState *tstate = PyThreadState_Get();
if (!PyArg_ParseTuple(args, "i:setcheckinterval", &tstate->interp->checkinterval)) if (!PyArg_ParseTuple(args, "i:setcheckinterval", &tstate->interp->checkinterval))
@ -223,9 +204,7 @@ n instructions. This also affects how often thread switches occur.";
#include <malloc.h> #include <malloc.h>
static PyObject * static PyObject *
sys_mdebug(self, args) sys_mdebug(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
int flag; int flag;
if (!PyArg_ParseTuple(args, "i:mdebug", &flag)) if (!PyArg_ParseTuple(args, "i:mdebug", &flag))
@ -237,9 +216,7 @@ sys_mdebug(self, args)
#endif /* USE_MALLOPT */ #endif /* USE_MALLOPT */
static PyObject * static PyObject *
sys_getrefcount(self, args) sys_getrefcount(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
PyObject *arg; PyObject *arg;
if (!PyArg_ParseTuple(args, "O:getrefcount", &arg)) if (!PyArg_ParseTuple(args, "O:getrefcount", &arg))
@ -267,8 +244,7 @@ temporary reference in the argument list, so it is at least 2.";
#ifdef COUNT_ALLOCS #ifdef COUNT_ALLOCS
static PyObject * static PyObject *
sys_getcounts(self, args) sys_getcounts(PyObject *self, PyObject *args)
PyObject *self, *args;
{ {
extern PyObject *get_counts(void); extern PyObject *get_counts(void);
@ -315,7 +291,7 @@ static PyMethodDef sys_methods[] = {
}; };
static PyObject * static PyObject *
list_builtin_module_names() list_builtin_module_names(void)
{ {
PyObject *list = PyList_New(0); PyObject *list = PyList_New(0);
int i; int i;
@ -407,7 +383,7 @@ settrace() -- set the global debug tracing function\n\
#endif #endif
PyObject * PyObject *
_PySys_Init() _PySys_Init(void)
{ {
extern int fclose(FILE *); extern int fclose(FILE *);
PyObject *m, *v, *sysdict; PyObject *m, *v, *sysdict;
@ -495,9 +471,7 @@ _PySys_Init()
} }
static PyObject * static PyObject *
makepathobject(path, delim) makepathobject(char *path, int delim)
char *path;
int delim;
{ {
int i, n; int i, n;
char *p; char *p;
@ -530,8 +504,7 @@ makepathobject(path, delim)
} }
void void
PySys_SetPath(path) PySys_SetPath(char *path)
char *path;
{ {
PyObject *v; PyObject *v;
if ((v = makepathobject(path, DELIM)) == NULL) if ((v = makepathobject(path, DELIM)) == NULL)
@ -542,9 +515,7 @@ PySys_SetPath(path)
} }
static PyObject * static PyObject *
makeargvobject(argc, argv) makeargvobject(int argc, char **argv)
int argc;
char **argv;
{ {
PyObject *av; PyObject *av;
if (argc <= 0 || argv == NULL) { if (argc <= 0 || argv == NULL) {
@ -570,9 +541,7 @@ makeargvobject(argc, argv)
} }
void void
PySys_SetArgv(argc, argv) PySys_SetArgv(int argc, char **argv)
int argc;
char **argv;
{ {
PyObject *av = makeargvobject(argc, argv); PyObject *av = makeargvobject(argc, argv);
PyObject *path = PySys_GetObject("path"); PyObject *path = PySys_GetObject("path");
@ -674,11 +643,7 @@ PySys_SetArgv(argc, argv)
*/ */
static void static void
mywrite(name, fp, format, va) mywrite(char *name, FILE *fp, const char *format, va_list va)
char *name;
FILE *fp;
const char *format;
va_list va;
{ {
PyObject *file; PyObject *file;
PyObject *error_type, *error_value, *error_traceback; PyObject *error_type, *error_value, *error_traceback;
@ -700,43 +665,21 @@ mywrite(name, fp, format, va)
} }
void void
#ifdef HAVE_STDARG_PROTOTYPES
PySys_WriteStdout(const char *format, ...) PySys_WriteStdout(const char *format, ...)
#else
PySys_WriteStdout(va_alist)
va_dcl
#endif
{ {
va_list va; va_list va;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format); va_start(va, format);
#else
char *format;
va_start(va);
format = va_arg(va, char *);
#endif
mywrite("stdout", stdout, format, va); mywrite("stdout", stdout, format, va);
va_end(va); va_end(va);
} }
void void
#ifdef HAVE_STDARG_PROTOTYPES
PySys_WriteStderr(const char *format, ...) PySys_WriteStderr(const char *format, ...)
#else
PySys_WriteStderr(va_alist)
va_dcl
#endif
{ {
va_list va; va_list va;
#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format); va_start(va, format);
#else
char *format;
va_start(va);
format = va_arg(va, char *);
#endif
mywrite("stderr", stderr, format, va); mywrite("stderr", stderr, format, va);
va_end(va); va_end(va);
} }

View file

@ -29,7 +29,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <stdlib.h> #include <stdlib.h>
#else #else
#ifdef Py_DEBUG #ifdef Py_DEBUG
extern char *getenv(); extern char *getenv(const char *);
#endif #endif
#endif #endif
@ -73,17 +73,6 @@ extern char *getenv();
#endif /* _POSIX_THREADS */ #endif /* _POSIX_THREADS */
#ifdef __STDC__
#define _P(args) args
#define _P0() (void)
#define _P1(v,t) (t)
#define _P2(v1,t1,v2,t2) (t1,t2)
#else
#define _P(args) ()
#define _P0() ()
#define _P1(v,t) (v) t;
#define _P2(v1,t1,v2,t2) (v1,v2) t1; t2;
#endif /* __STDC__ */
#ifdef Py_DEBUG #ifdef Py_DEBUG
static int thread_debug = 0; static int thread_debug = 0;
@ -98,7 +87,7 @@ static int initialized;
static void PyThread__init_thread(); /* Forward */ static void PyThread__init_thread(); /* Forward */
void PyThread_init_thread _P0() void PyThread_init_thread(void)
{ {
#ifdef Py_DEBUG #ifdef Py_DEBUG
char *p = getenv("THREADDEBUG"); char *p = getenv("THREADDEBUG");

View file

@ -14,7 +14,8 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* /*
* Initialization. * Initialization.
*/ */
static void PyThread__init_thread _P0() static void
PyThread__init_thread(void)
{ {
cthread_init(); cthread_init();
} }
@ -22,7 +23,8 @@ static void PyThread__init_thread _P0()
/* /*
* Thread support. * Thread support.
*/ */
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int
PyThread_start_new_thread(func, void (*func)(void *), void *arg)
{ {
int success = 0; /* init not needed when SOLARIS_THREADS and */ int success = 0; /* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */ /* C_THREADS implemented properly */
@ -37,14 +39,16 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return success < 0 ? 0 : 1; return success < 0 ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long
PyThread_get_thread_ident(void)
{ {
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
return (long) cthread_self(); return (long) cthread_self();
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static void
do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) if (!initialized)
@ -55,18 +59,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
cthread_exit(0); cthread_exit(0);
} }
void PyThread_exit_thread _P0() void
PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void
PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static
void do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -80,12 +87,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit(status); exit(status);
} }
void PyThread_exit_prog _P1(status, int status) void
PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void
PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -94,7 +103,8 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock
PyThread_allocate_lock(void)
{ {
mutex_t lock; mutex_t lock;
@ -112,13 +122,15 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void
PyThread_free_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%p) called\n", lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
mutex_free(lock); mutex_free(lock);
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int
PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success = FALSE; int success = FALSE;
@ -133,7 +145,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void
PyThread_release_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%p) called\n", lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
mutex_unlock((mutex_t )lock); mutex_unlock((mutex_t )lock);
@ -153,7 +166,8 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
* semaphore using a condition. * semaphore using a condition.
* *
*/ */
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema
PyThread_allocate_sema(int value)
{ {
char *sema = 0; char *sema = 0;
dprintf(("PyThread_allocate_sema called\n")); dprintf(("PyThread_allocate_sema called\n"));
@ -164,19 +178,22 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void
PyThread_free_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%p) called\n", sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int
PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
dprintf(("PyThread_down_sema(%p) return\n", sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void
PyThread_up_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%p)\n", sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
} }

View file

@ -11,14 +11,16 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* /*
* Initialization. * Initialization.
*/ */
static void PyThread__init_thread _P0() static void
PyThread__init_thread(void)
{ {
} }
/* /*
* Thread support. * Thread support.
*/ */
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int
PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
int success = 0; /* init not needed when SOLARIS_THREADS and */ int success = 0; /* init not needed when SOLARIS_THREADS and */
/* C_THREADS implemented properly */ /* C_THREADS implemented properly */
@ -29,13 +31,15 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return success < 0 ? 0 : 1; return success < 0 ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long
PyThread_get_thread_ident(void)
{ {
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static
void do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) if (!initialized)
@ -45,18 +49,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
exit(0); exit(0);
} }
void PyThread_exit_thread _P0() void
PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void
PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static
void do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -66,12 +73,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit(status); exit(status);
} }
void PyThread_exit_prog _P1(status, int status) void
PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void
PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -80,7 +89,8 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock
PyThread_allocate_lock(void)
{ {
dprintf(("PyThread_allocate_lock called\n")); dprintf(("PyThread_allocate_lock called\n"));
@ -91,12 +101,14 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void
PyThread_free_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%p) called\n", lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int
PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success; int success;
@ -105,7 +117,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void
PyThread_release_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%p) called\n", lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
} }
@ -113,7 +126,8 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/* /*
* Semaphore support. * Semaphore support.
*/ */
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema
PyThread_allocate_sema(int value)
{ {
dprintf(("PyThread_allocate_sema called\n")); dprintf(("PyThread_allocate_sema called\n"));
if (!initialized) if (!initialized)
@ -123,19 +137,22 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void
PyThread_free_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%p) called\n", sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int
PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
dprintf(("PyThread_down_sema(%p) return\n", sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void
PyThread_up_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%p)\n", sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
} }

View file

@ -25,7 +25,7 @@ struct lock {
/* /*
* Initialization. * Initialization.
*/ */
static void PyThread__init_thread _P0() static void PyThread__init_thread(void)
{ {
lwp_setstkcache(STACKSIZE, NSTACKS); lwp_setstkcache(STACKSIZE, NSTACKS);
} }
@ -35,7 +35,7 @@ static void PyThread__init_thread _P0()
*/ */
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
thread_t tid; thread_t tid;
int success; int success;
@ -46,7 +46,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return success < 0 ? 0 : 1; return success < 0 ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long PyThread_get_thread_ident(void)
{ {
thread_t tid; thread_t tid;
if (!initialized) if (!initialized)
@ -56,7 +56,7 @@ long PyThread_get_thread_ident _P0()
return tid.thread_id; return tid.thread_id;
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static void do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) if (!initialized)
@ -67,18 +67,18 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
lwp_destroy(SELF); lwp_destroy(SELF);
} }
void PyThread_exit_thread _P0() void PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static void do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -89,12 +89,12 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
pod_exit(status); pod_exit(status);
} }
void PyThread_exit_prog _P1(status, int status) void PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -103,7 +103,7 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock PyThread_allocate_lock(void)
{ {
struct lock *lock; struct lock *lock;
extern char *malloc(); extern char *malloc();
@ -120,14 +120,14 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%p) called\n", lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
mon_destroy(((struct lock *) lock)->lock_monitor); mon_destroy(((struct lock *) lock)->lock_monitor);
free((char *) lock); free((char *) lock);
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success; int success;
@ -148,7 +148,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%p) called\n", lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
(void) mon_enter(((struct lock *) lock)->lock_monitor); (void) mon_enter(((struct lock *) lock)->lock_monitor);
@ -160,7 +160,7 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/* /*
* Semaphore support. * Semaphore support.
*/ */
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema PyThread_allocate_sema(int value)
{ {
PyThread_type_sema sema = 0; PyThread_type_sema sema = 0;
dprintf(("PyThread_allocate_sema called\n")); dprintf(("PyThread_allocate_sema called\n"));
@ -171,19 +171,19 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%p) called\n", sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag)); dprintf(("PyThread_down_sema(%p, %d) called\n", sema, waitflag));
dprintf(("PyThread_down_sema(%p) return\n", sema)); dprintf(("PyThread_down_sema(%p) return\n", sema));
return -1; return -1;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%p)\n", sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
} }

View file

@ -122,7 +122,7 @@ BOOL LeaveNonRecursiveMutex(PNRMUTEX mutex)
SetEvent(mutex->hevent) ; /* Other threads are waiting, wake one on them up */ SetEvent(mutex->hevent) ; /* Other threads are waiting, wake one on them up */
} }
PNRMUTEX AllocNonRecursiveMutex() PNRMUTEX AllocNonRecursiveMutex(void)
{ {
PNRMUTEX mutex = (PNRMUTEX)malloc(sizeof(NRMUTEX)) ; PNRMUTEX mutex = (PNRMUTEX)malloc(sizeof(NRMUTEX)) ;
if (mutex && !InitializeNonRecursiveMutex(mutex)) if (mutex && !InitializeNonRecursiveMutex(mutex))
@ -231,7 +231,7 @@ void PyThread_exit_prog(int status)
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(int status) void PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }

View file

@ -29,14 +29,16 @@ long PyThread_get_thread_ident(void);
/* /*
* Initialization of the C package, should not be needed. * Initialization of the C package, should not be needed.
*/ */
static void PyThread__init_thread(void) static void
PyThread__init_thread(void)
{ {
} }
/* /*
* Thread support. * Thread support.
*/ */
int PyThread_start_new_thread(void (*func)(void *), void *arg) int
PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
int aThread; int aThread;
int success = 1; int success = 1;
@ -52,7 +54,8 @@ int PyThread_start_new_thread(void (*func)(void *), void *arg)
return success; return success;
} }
long PyThread_get_thread_ident(void) long
PyThread_get_thread_ident(void)
{ {
PPIB pib; PPIB pib;
PTIB tib; PTIB tib;
@ -64,7 +67,8 @@ long PyThread_get_thread_ident(void)
return tib->tib_ptib2->tib2_ultid; return tib->tib_ptib2->tib2_ultid;
} }
static void do_PyThread_exit_thread(int no_cleanup) static void
do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident())); dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident()));
if (!initialized) if (!initialized)
@ -75,18 +79,21 @@ static void do_PyThread_exit_thread(int no_cleanup)
_endthread(); _endthread();
} }
void PyThread_exit_thread(void) void
PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread(void) void
PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog(int status, int no_cleanup) static void
do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -96,12 +103,14 @@ static void do_PyThread_exit_prog(int status, int no_cleanup)
exit(status); exit(status);
} }
void PyThread_exit_prog(int status) void
PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(int status) void
PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -112,7 +121,8 @@ void PyThread__exit_prog _P1(int status)
* I [Dag] tried to implement it with mutex but I could find a way to * I [Dag] tried to implement it with mutex but I could find a way to
* tell whether a thread already own the lock or not. * tell whether a thread already own the lock or not.
*/ */
PyThread_type_lock PyThread_allocate_lock(void) PyThread_type_lock
PyThread_allocate_lock(void)
{ {
HMTX aLock; HMTX aLock;
APIRET rc; APIRET rc;
@ -131,7 +141,8 @@ PyThread_type_lock PyThread_allocate_lock(void)
return (PyThread_type_lock) aLock; return (PyThread_type_lock) aLock;
} }
void PyThread_free_lock(PyThread_type_lock aLock) void
PyThread_free_lock(PyThread_type_lock aLock)
{ {
dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); dprintf(("%ld: PyThread_free_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
@ -144,7 +155,8 @@ void PyThread_free_lock(PyThread_type_lock aLock)
* and 0 if the lock was not acquired. This means a 0 is returned * and 0 if the lock was not acquired. This means a 0 is returned
* if the lock has already been acquired by this thread! * if the lock has already been acquired by this thread!
*/ */
int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag) int
PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
{ {
int success = 1; int success = 1;
ULONG rc, count; ULONG rc, count;
@ -172,7 +184,8 @@ int PyThread_acquire_lock(PyThread_type_lock aLock, int waitflag)
return success; return success;
} }
void PyThread_release_lock(PyThread_type_lock aLock) void
PyThread_release_lock(PyThread_type_lock aLock)
{ {
dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock)); dprintf(("%ld: PyThread_release_lock(%p) called\n", PyThread_get_thread_ident(),aLock));
@ -185,22 +198,26 @@ void PyThread_release_lock(PyThread_type_lock aLock)
/* /*
* Semaphore support. * Semaphore support.
*/ */
PyThread_type_sema PyThread_allocate_sema(int value) PyThread_type_sema
PyThread_allocate_sema(int value)
{ {
return (PyThread_type_sema) 0; return (PyThread_type_sema) 0;
} }
void PyThread_free_sema(PyThread_type_sema aSemaphore) void
PyThread_free_sema(PyThread_type_sema aSemaphore)
{ {
} }
int PyThread_down_sema(PyThread_type_sema aSemaphore, int waitflag) int
PyThread_down_sema(PyThread_type_sema aSemaphore, int waitflag)
{ {
return -1; return -1;
} }
void PyThread_up_sema(PyThread_type_sema aSemaphore) void
PyThread_up_sema(PyThread_type_sema aSemaphore)
{ {
dprintf(("%ld: PyThread_up_sema(%p)\n", PyThread_get_thread_ident(), aSemaphore)); dprintf(("%ld: PyThread_up_sema(%p)\n", PyThread_get_thread_ident(), aSemaphore));
} }

View file

@ -43,7 +43,7 @@ typedef struct {
* Initialization. * Initialization.
*/ */
static void PyThread__init_thread _P0() static void PyThread__init_thread(void)
{ {
pth_init(); pth_init();
} }
@ -53,7 +53,7 @@ static void PyThread__init_thread _P0()
*/ */
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
pth_t th; pth_t th;
int success; int success;
@ -62,14 +62,14 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
PyThread_init_thread(); PyThread_init_thread();
th = pth_spawn(PTH_ATTR_DEFAULT, th = pth_spawn(PTH_ATTR_DEFAULT,
(void* (*)_P((void *)))func, (void* (*)(void *))func,
(void *)arg (void *)arg
); );
return th == NULL ? 0 : 1; return th == NULL ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long PyThread_get_thread_ident(void)
{ {
volatile pth_t threadid; volatile pth_t threadid;
if (!initialized) if (!initialized)
@ -79,7 +79,7 @@ long PyThread_get_thread_ident _P0()
return (long) *(long *) &threadid; return (long) *(long *) &threadid;
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static void do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) { if (!initialized) {
@ -90,18 +90,18 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
} }
} }
void PyThread_exit_thread _P0() void PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static void do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -111,12 +111,12 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit(status); exit(status);
} }
void PyThread_exit_prog _P1(status, int status) void PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -125,7 +125,7 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock PyThread_allocate_lock(void)
{ {
pth_lock *lock; pth_lock *lock;
int status, error = 0; int status, error = 0;
@ -151,7 +151,7 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock(PyThread_type_lock lock)
{ {
pth_lock *thelock = (pth_lock *)lock; pth_lock *thelock = (pth_lock *)lock;
int status, error = 0; int status, error = 0;
@ -161,7 +161,7 @@ void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
free((void *)thelock); free((void *)thelock);
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success; int success;
pth_lock *thelock = (pth_lock *)lock; pth_lock *thelock = (pth_lock *)lock;
@ -198,7 +198,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock(PyThread_type_lock lock)
{ {
pth_lock *thelock = (pth_lock *)lock; pth_lock *thelock = (pth_lock *)lock;
int status, error = 0; int status, error = 0;
@ -228,7 +228,7 @@ struct semaphore {
int value; int value;
}; };
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema PyThread_allocate_sema(int value)
{ {
struct semaphore *sema; struct semaphore *sema;
int status, error = 0; int status, error = 0;
@ -253,7 +253,7 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema(PyThread_type_sema sema)
{ {
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
@ -262,7 +262,7 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
free((void *) thesema); free((void *) thesema);
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
int status, error = 0, success; int status, error = 0, success;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
@ -291,7 +291,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return success; return success;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema(PyThread_type_sema sema)
{ {
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;

View file

@ -100,11 +100,13 @@ typedef struct {
*/ */
#ifdef _HAVE_BSDI #ifdef _HAVE_BSDI
static void _noop() static
void _noop(void)
{ {
} }
static void PyThread__init_thread _P0() static void
PyThread__init_thread(void)
{ {
/* DO AN INIT BY STARTING THE THREAD */ /* DO AN INIT BY STARTING THE THREAD */
static int dummy = 0; static int dummy = 0;
@ -115,7 +117,8 @@ static void PyThread__init_thread _P0()
#else /* !_HAVE_BSDI */ #else /* !_HAVE_BSDI */
static void PyThread__init_thread _P0() static void
PyThread__init_thread(void)
{ {
#if defined(_AIX) && defined(__GNUC__) #if defined(_AIX) && defined(__GNUC__)
pthread_init(); pthread_init();
@ -129,7 +132,8 @@ static void PyThread__init_thread _P0()
*/ */
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int
PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
pthread_t th; pthread_t th;
int success; int success;
@ -144,7 +148,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
(pthread_addr_t)arg (pthread_addr_t)arg
#elif defined(PY_PTHREAD_D6) #elif defined(PY_PTHREAD_D6)
pthread_attr_default, pthread_attr_default,
(void* (*)_P((void *)))func, (void* (*)(void *))func,
arg arg
#elif defined(PY_PTHREAD_D7) #elif defined(PY_PTHREAD_D7)
pthread_attr_default, pthread_attr_default,
@ -152,7 +156,7 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
arg arg
#elif defined(PY_PTHREAD_STD) #elif defined(PY_PTHREAD_STD)
(pthread_attr_t*)NULL, (pthread_attr_t*)NULL,
(void* (*)_P((void *)))func, (void* (*)(void *))func,
(void *)arg (void *)arg
#endif #endif
); );
@ -167,7 +171,8 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return success != 0 ? 0 : 1; return success != 0 ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long
PyThread_get_thread_ident(void)
{ {
volatile pthread_t threadid; volatile pthread_t threadid;
if (!initialized) if (!initialized)
@ -177,7 +182,8 @@ long PyThread_get_thread_ident _P0()
return (long) *(long *) &threadid; return (long) *(long *) &threadid;
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static void
do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) { if (!initialized) {
@ -188,18 +194,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
} }
} }
void PyThread_exit_thread _P0() void
PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void
PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static void
do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -209,12 +218,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit(status); exit(status);
} }
void PyThread_exit_prog _P1(status, int status) void
PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void
PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -223,7 +234,8 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock
PyThread_allocate_lock(void)
{ {
pthread_lock *lock; pthread_lock *lock;
int status, error = 0; int status, error = 0;
@ -255,7 +267,8 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void
PyThread_free_lock(PyThread_type_lock lock)
{ {
pthread_lock *thelock = (pthread_lock *)lock; pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0; int status, error = 0;
@ -271,7 +284,8 @@ void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
free((void *)thelock); free((void *)thelock);
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int
PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success; int success;
pthread_lock *thelock = (pthread_lock *)lock; pthread_lock *thelock = (pthread_lock *)lock;
@ -308,7 +322,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void
PyThread_release_lock(PyThread_type_lock lock)
{ {
pthread_lock *thelock = (pthread_lock *)lock; pthread_lock *thelock = (pthread_lock *)lock;
int status, error = 0; int status, error = 0;
@ -338,7 +353,8 @@ struct semaphore {
int value; int value;
}; };
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema
PyThread_allocate_sema(int value)
{ {
struct semaphore *sema; struct semaphore *sema;
int status, error = 0; int status, error = 0;
@ -365,7 +381,8 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void
PyThread_free_sema(PyThread_type_sema sema)
{ {
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
@ -378,7 +395,8 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
free((void *) thesema); free((void *) thesema);
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int
PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
int status, error = 0, success; int status, error = 0, success;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;
@ -407,7 +425,8 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return success; return success;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void
PyThread_up_sema(PyThread_type_sema sema)
{ {
int status, error = 0; int status, error = 0;
struct semaphore *thesema = (struct semaphore *) sema; struct semaphore *thesema = (struct semaphore *) sema;

View file

@ -47,7 +47,7 @@ static int maxpidindex; /* # of PIDs in pidlist */
* exits. When that happens, we must see whether we have to exit as * exits. When that happens, we must see whether we have to exit as
* well (because of an PyThread_exit_prog()) or whether we should continue on. * well (because of an PyThread_exit_prog()) or whether we should continue on.
*/ */
static void exit_sig _P0() static void exit_sig(void)
{ {
d2printf(("exit_sig called\n")); d2printf(("exit_sig called\n"));
if (exiting && getpid() == my_pid) { if (exiting && getpid() == my_pid) {
@ -68,7 +68,7 @@ static void exit_sig _P0()
* This routine is called when a process calls exit(). If that wasn't * This routine is called when a process calls exit(). If that wasn't
* done from the library, we do as if an PyThread_exit_prog() was intended. * done from the library, we do as if an PyThread_exit_prog() was intended.
*/ */
static void maybe_exit _P0() static void maybe_exit(void)
{ {
dprintf(("maybe_exit called\n")); dprintf(("maybe_exit called\n"));
if (exiting) { if (exiting) {
@ -82,7 +82,7 @@ static void maybe_exit _P0()
/* /*
* Initialization. * Initialization.
*/ */
static void PyThread__init_thread _P0() static void PyThread__init_thread(void)
{ {
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
struct sigaction s; struct sigaction s;
@ -143,7 +143,7 @@ static void PyThread__init_thread _P0()
* Thread support. * Thread support.
*/ */
static void clean_threads _P0() static void clean_threads(void)
{ {
int i, j; int i, j;
pid_t mypid, pid; pid_t mypid, pid;
@ -177,7 +177,7 @@ static void clean_threads _P0()
} }
} }
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
#ifdef USE_DL #ifdef USE_DL
long addr, size; long addr, size;
@ -235,12 +235,12 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return success < 0 ? 0 : 1; return success < 0 ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long PyThread_get_thread_ident(void)
{ {
return getpid(); return getpid();
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static void do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) if (!initialized)
@ -305,18 +305,18 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
_exit(0); _exit(0);
} }
void PyThread_exit_thread _P0() void PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static void do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -329,12 +329,12 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
do_PyThread_exit_thread(no_cleanup); do_PyThread_exit_thread(no_cleanup);
} }
void PyThread_exit_prog _P1(status, int status) void PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -343,7 +343,7 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock PyThread_allocate_lock(void)
{ {
ulock_t lock; ulock_t lock;
@ -358,13 +358,13 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void PyThread_free_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%p) called\n", lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
usfreelock((ulock_t) lock, shared_arena); usfreelock((ulock_t) lock, shared_arena);
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success; int success;
@ -380,7 +380,7 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void PyThread_release_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%p) called\n", lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
if (usunsetlock((ulock_t) lock) < 0) if (usunsetlock((ulock_t) lock) < 0)
@ -390,7 +390,7 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/* /*
* Semaphore support. * Semaphore support.
*/ */
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema PyThread_allocate_sema(int value)
{ {
usema_t *sema; usema_t *sema;
dprintf(("PyThread_allocate_sema called\n")); dprintf(("PyThread_allocate_sema called\n"));
@ -403,13 +403,13 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void PyThread_free_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%p) called\n", sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
usfreesema((usema_t *) sema, shared_arena); usfreesema((usema_t *) sema, shared_arena);
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
int success; int success;
@ -424,7 +424,7 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return success; return success;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void PyThread_up_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%p)\n", sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
if (usvsema((usema_t *) sema) < 0) if (usvsema((usema_t *) sema) < 0)
@ -446,7 +446,7 @@ static struct key *keyhead = NULL;
static int nkeys = 0; static int nkeys = 0;
static PyThread_type_lock keymutex = NULL; static PyThread_type_lock keymutex = NULL;
static struct key *find_key _P2(key, int key, value, void *value) static struct key *find_key(int key, void *value)
{ {
struct key *p; struct key *p;
long id = PyThread_get_thread_ident(); long id = PyThread_get_thread_ident();
@ -469,14 +469,14 @@ static struct key *find_key _P2(key, int key, value, void *value)
return p; return p;
} }
int PyThread_create_key _P0() int PyThread_create_key(void)
{ {
if (keymutex == NULL) if (keymutex == NULL)
keymutex = PyThread_allocate_lock(); keymutex = PyThread_allocate_lock();
return ++nkeys; return ++nkeys;
} }
void PyThread_delete_key _P1(key, int key) void PyThread_delete_key(int key)
{ {
struct key *p, **q; struct key *p, **q;
PyThread_acquire_lock(keymutex, 1); PyThread_acquire_lock(keymutex, 1);
@ -493,7 +493,7 @@ void PyThread_delete_key _P1(key, int key)
PyThread_release_lock(keymutex); PyThread_release_lock(keymutex);
} }
int PyThread_set_key_value _P2(key, int key, value, void *value) int PyThread_set_key_value(int key, void *value)
{ {
struct key *p = find_key(key, value); struct key *p = find_key(key, value);
if (p == NULL) if (p == NULL)
@ -502,7 +502,7 @@ int PyThread_set_key_value _P2(key, int key, value, void *value)
return 0; return 0;
} }
void *PyThread_get_key_value _P1(key, int key) void *PyThread_get_key_value(int key)
{ {
struct key *p = find_key(key, NULL); struct key *p = find_key(key, NULL);
if (p == NULL) if (p == NULL)

View file

@ -19,7 +19,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
/* /*
* Initialization. * Initialization.
*/ */
static void PyThread__init_thread _P0() static void PyThread__init_thread(void)
{ {
} }
@ -27,13 +27,14 @@ static void PyThread__init_thread _P0()
* Thread support. * Thread support.
*/ */
struct func_arg { struct func_arg {
void (*func) _P((void *)); void (*func)(void *);
void *arg; void *arg;
}; };
static void *new_func _P1(funcarg, void *funcarg) static void *
new_func(void *funcarg)
{ {
void (*func) _P((void *)); void (*func)(void *);
void *arg; void *arg;
func = ((struct func_arg *) funcarg)->func; func = ((struct func_arg *) funcarg)->func;
@ -44,7 +45,8 @@ static void *new_func _P1(funcarg, void *funcarg)
} }
int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg) int
PyThread_start_new_thread(void (*func)(void *), void *arg)
{ {
struct func_arg *funcarg; struct func_arg *funcarg;
int success = 0; /* init not needed when SOLARIS_THREADS and */ int success = 0; /* init not needed when SOLARIS_THREADS and */
@ -65,14 +67,16 @@ int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *ar
return success < 0 ? 0 : 1; return success < 0 ? 0 : 1;
} }
long PyThread_get_thread_ident _P0() long
PyThread_get_thread_ident(void)
{ {
if (!initialized) if (!initialized)
PyThread_init_thread(); PyThread_init_thread();
return thr_self(); return thr_self();
} }
static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup) static void
do_PyThread_exit_thread(int no_cleanup)
{ {
dprintf(("PyThread_exit_thread called\n")); dprintf(("PyThread_exit_thread called\n"));
if (!initialized) if (!initialized)
@ -83,18 +87,21 @@ static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
thr_exit(0); thr_exit(0);
} }
void PyThread_exit_thread _P0() void
PyThread_exit_thread(void)
{ {
do_PyThread_exit_thread(0); do_PyThread_exit_thread(0);
} }
void PyThread__exit_thread _P0() void
PyThread__exit_thread(void)
{ {
do_PyThread_exit_thread(1); do_PyThread_exit_thread(1);
} }
#ifndef NO_EXIT_PROG #ifndef NO_EXIT_PROG
static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup) static void
do_PyThread_exit_prog(int status, int no_cleanup)
{ {
dprintf(("PyThread_exit_prog(%d) called\n", status)); dprintf(("PyThread_exit_prog(%d) called\n", status));
if (!initialized) if (!initialized)
@ -108,12 +115,14 @@ static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cle
exit(status); exit(status);
} }
void PyThread_exit_prog _P1(status, int status) void
PyThread_exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(status, int status) void
PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }
@ -122,7 +131,8 @@ void PyThread__exit_prog _P1(status, int status)
/* /*
* Lock support. * Lock support.
*/ */
PyThread_type_lock PyThread_allocate_lock _P0() PyThread_type_lock
PyThread_allocate_lock(void)
{ {
mutex_t *lock; mutex_t *lock;
@ -140,14 +150,16 @@ PyThread_type_lock PyThread_allocate_lock _P0()
return (PyThread_type_lock) lock; return (PyThread_type_lock) lock;
} }
void PyThread_free_lock _P1(lock, PyThread_type_lock lock) void
PyThread_free_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_free_lock(%p) called\n", lock)); dprintf(("PyThread_free_lock(%p) called\n", lock));
mutex_destroy((mutex_t *) lock); mutex_destroy((mutex_t *) lock);
free((void *) lock); free((void *) lock);
} }
int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag) int
PyThread_acquire_lock(PyThread_type_lock lock, int waitflag)
{ {
int success; int success;
@ -164,7 +176,8 @@ int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitf
return success; return success;
} }
void PyThread_release_lock _P1(lock, PyThread_type_lock lock) void
PyThread_release_lock(PyThread_type_lock lock)
{ {
dprintf(("PyThread_release_lock(%p) called\n", lock)); dprintf(("PyThread_release_lock(%p) called\n", lock));
if (mutex_unlock((mutex_t *) lock)) if (mutex_unlock((mutex_t *) lock))
@ -174,7 +187,8 @@ void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
/* /*
* Semaphore support. * Semaphore support.
*/ */
PyThread_type_sema PyThread_allocate_sema _P1(value, int value) PyThread_type_sema
PyThread_allocate_sema(int value)
{ {
sema_t *sema; sema_t *sema;
dprintf(("PyThread_allocate_sema called\n")); dprintf(("PyThread_allocate_sema called\n"));
@ -191,7 +205,8 @@ PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
return (PyThread_type_sema) sema; return (PyThread_type_sema) sema;
} }
void PyThread_free_sema _P1(sema, PyThread_type_sema sema) void
PyThread_free_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_free_sema(%p) called\n", sema)); dprintf(("PyThread_free_sema(%p) called\n", sema));
if (sema_destroy((sema_t *) sema)) if (sema_destroy((sema_t *) sema))
@ -199,7 +214,8 @@ void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
free((void *) sema); free((void *) sema);
} }
int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag) int
PyThread_down_sema(PyThread_type_sema sema, int waitflag)
{ {
int success; int success;
@ -220,7 +236,8 @@ int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag
return success; return success;
} }
void PyThread_up_sema _P1(sema, PyThread_type_sema sema) void
PyThread_up_sema(PyThread_type_sema sema)
{ {
dprintf(("PyThread_up_sema(%p)\n", sema)); dprintf(("PyThread_up_sema(%p)\n", sema));
if (sema_post((sema_t *) sema)) if (sema_post((sema_t *) sema))

View file

@ -99,7 +99,7 @@ void PyThread_exit_prog(int status)
do_PyThread_exit_prog(status, 0); do_PyThread_exit_prog(status, 0);
} }
void PyThread__exit_prog _P1(int status) void PyThread__exit_prog(int status)
{ {
do_PyThread_exit_prog(status, 1); do_PyThread_exit_prog(status, 1);
} }

View file

@ -36,16 +36,13 @@ static struct memberlist tb_memberlist[] = {
}; };
static PyObject * static PyObject *
tb_getattr(tb, name) tb_getattr(tracebackobject *tb, char *name)
tracebackobject *tb;
char *name;
{ {
return PyMember_Get((char *)tb, tb_memberlist, name); return PyMember_Get((char *)tb, tb_memberlist, name);
} }
static void static void
tb_dealloc(tb) tb_dealloc(tracebackobject *tb)
tracebackobject *tb;
{ {
Py_TRASHCAN_SAFE_BEGIN(tb) Py_TRASHCAN_SAFE_BEGIN(tb)
Py_XDECREF(tb->tb_next); Py_XDECREF(tb->tb_next);
@ -75,10 +72,8 @@ PyTypeObject Tracebacktype = {
}; };
static tracebackobject * static tracebackobject *
newtracebackobject(next, frame, lasti, lineno) newtracebackobject(tracebackobject *next, PyFrameObject *frame, int lasti,
tracebackobject *next; int lineno)
PyFrameObject *frame;
int lasti, lineno;
{ {
tracebackobject *tb; tracebackobject *tb;
if ((next != NULL && !is_tracebackobject(next)) || if ((next != NULL && !is_tracebackobject(next)) ||
@ -99,8 +94,7 @@ newtracebackobject(next, frame, lasti, lineno)
} }
int int
PyTraceBack_Here(frame) PyTraceBack_Here(PyFrameObject *frame)
PyFrameObject *frame;
{ {
PyThreadState *tstate = frame->f_tstate; PyThreadState *tstate = frame->f_tstate;
tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback; tracebackobject *oldtb = (tracebackobject *) tstate->curexc_traceback;
@ -114,11 +108,7 @@ PyTraceBack_Here(frame)
} }
static int static int
tb_displayline(f, filename, lineno, name) tb_displayline(PyObject *f, char *filename, int lineno, char *name)
PyObject *f;
char *filename;
int lineno;
char *name;
{ {
int err = 0; int err = 0;
FILE *xfp; FILE *xfp;
@ -206,10 +196,7 @@ tb_displayline(f, filename, lineno, name)
} }
static int static int
tb_printinternal(tb, f, limit) tb_printinternal(tracebackobject *tb, PyObject *f, int limit)
tracebackobject *tb;
PyObject *f;
int limit;
{ {
int err = 0; int err = 0;
int depth = 0; int depth = 0;
@ -238,9 +225,7 @@ tb_printinternal(tb, f, limit)
} }
int int
PyTraceBack_Print(v, f) PyTraceBack_Print(PyObject *v, PyObject *f)
PyObject *v;
PyObject *f;
{ {
int err; int err;
PyObject *limitv; PyObject *limitv;