From 9ae898b415ad0758dbe1e1cb43f48f60bf8dfab0 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Tue, 11 Jul 2000 21:16:03 +0000 Subject: ANSIfication step 2: make sure all needed prototypes are available, and all needed header files included. --- Mac/Compat/getbootvol.c | 2 +- Mac/Compat/getwd.c | 3 +-- Mac/Compat/macstat.h | 1 + Mac/Compat/sync.c | 2 +- Mac/Include/macdefs.h | 6 ++++-- Mac/Include/macglue.h | 19 +++++++++++++++++-- Mac/Modules/macfsmodule.c | 11 ++++++----- Mac/Modules/macspeechmodule.c | 1 + Mac/Python/macapplication.c | 6 ++++-- Mac/Python/macgetargv.c | 5 +++-- Mac/Python/macgetcompiler.c | 5 +++-- Mac/Python/macgetpath.c | 12 ++++++++---- Mac/Python/macgetplatform.c | 6 ++++-- Mac/Python/macglue.c | 28 ++++++++++++++++++---------- Mac/Python/macguesstabsize.c | 2 +- Mac/Python/macimport.c | 2 ++ Mac/Python/macmain.c | 5 ++--- Mac/Python/macsetfiletype.c | 6 ++++-- Mac/mwerks/malloc/malloc.c | 2 ++ 19 files changed, 83 insertions(+), 41 deletions(-) diff --git a/Mac/Compat/getbootvol.c b/Mac/Compat/getbootvol.c index 8f5d28c..df450c6 100644 --- a/Mac/Compat/getbootvol.c +++ b/Mac/Compat/getbootvol.c @@ -5,7 +5,7 @@ #include "macdefs.h" char * -getbootvol() +getbootvol(void) { short vrefnum; static unsigned char name[32]; diff --git a/Mac/Compat/getwd.c b/Mac/Compat/getwd.c index 27f68a2..1487fb0 100644 --- a/Mac/Compat/getwd.c +++ b/Mac/Compat/getwd.c @@ -32,8 +32,7 @@ #define ROOTID 2 /* Root directory ID */ char * -getwd(cwd) - char *cwd; +getwd(char *cwd) { /* Universal parameter block. */ union { diff --git a/Mac/Compat/macstat.h b/Mac/Compat/macstat.h index 64ace4e..d6cad85 100644 --- a/Mac/Compat/macstat.h +++ b/Mac/Compat/macstat.h @@ -27,6 +27,7 @@ struct macstat { #define S_IWRITE 0200 #define S_IEXEC 0100 +extern int macstat(char *, struct macstat *); /* To stop inclusion of MWerks header: */ #ifndef _STAT #define _STAT diff --git a/Mac/Compat/sync.c b/Mac/Compat/sync.c index a6487e1..944ba23 100644 --- a/Mac/Compat/sync.c +++ b/Mac/Compat/sync.c @@ -6,7 +6,7 @@ #include "macdefs.h" int -sync() +sync(void) { if (FlushVol((StringPtr)0, 0) == noErr) return 0; diff --git a/Mac/Include/macdefs.h b/Mac/Include/macdefs.h index 9cc3ae1..8898b49 100644 --- a/Mac/Include/macdefs.h +++ b/Mac/Include/macdefs.h @@ -15,8 +15,10 @@ #endif /* We may be able to use a std routine in think, don't know */ -unsigned char *Pstring(char *); - +extern unsigned char *Pstring(char *); +extern char *getbootvol(void); +extern char *getwd(char *); +extern int sync(void); /* Universal constants: */ #define MAXPATH 256 diff --git a/Mac/Include/macglue.h b/Mac/Include/macglue.h index f96b96f..5767368 100644 --- a/Mac/Include/macglue.h +++ b/Mac/Include/macglue.h @@ -81,6 +81,7 @@ void PyMac_GetSchedParams(PyMacSchedParams *); /* Get schedulers params */ void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */ PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ +int PyOS_CheckStack(void); /* Check that we aren't overflowing our stack */ int PyMac_DoYield(int, int); /* Yield cpu. First arg is maxtime, second ok to call python */ int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */ void PyMac_HandleEventIntern(EventRecord *); /* Handle one event internal only */ @@ -133,8 +134,22 @@ short PyMac_OpenPrefFile(void); /* From macgetpath.c, open and return preferen /* From macfiletype.c: */ -long getfiletype(char *); /* Get file type */ -int setfiletype(char *, long, long); /* Set file creator and type */ +long PyMac_getfiletype(char *); /* Get file type */ +int PyMac_setfiletype(char *, long, long); /* Set file creator and type */ + +/* from macmain.c: */ +void PyMac_Exit(int); +void PyMac_InitApplication(void); +#ifdef USE_MAC_APPLET_SUPPORT +void PyMac_InitApplet(void); +#endif + +/* from macgetargv: */ +OSErr PyMac_init_process_location(void); +#ifndef HAVE_STRDUP +char * strdup(const char *str); +#endif + #ifdef __cplusplus } #endif diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index bdc1263..048b243 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -34,6 +34,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "getapplbycreator.h" +/* Should this be in macglue.h? */ +extern FSSpec *mfs_GetFSSpecFSSpec(PyObject *); + static PyObject *ErrorObject; /* ----------------------------------------------------- */ @@ -174,9 +177,8 @@ mfsa_getattr(self, name) return Py_FindMethod(mfsa_methods, (PyObject *)self, name); } -mfsaobject * -newmfsaobject(alias) - AliasHandle alias; +static mfsaobject * +newmfsaobject(AliasHandle alias) { mfsaobject *self; @@ -334,8 +336,7 @@ static PyTypeObject Mfsitype = { ** object is a python fsspec object, else NULL */ FSSpec * -mfs_GetFSSpecFSSpec(self) - PyObject *self; +mfs_GetFSSpecFSSpec(PyObject *self) { if ( is_mfssobject(self) ) return &((mfssobject *)self)->fsspec; diff --git a/Mac/Modules/macspeechmodule.c b/Mac/Modules/macspeechmodule.c index accb7b2..a6fbddd 100644 --- a/Mac/Modules/macspeechmodule.c +++ b/Mac/Modules/macspeechmodule.c @@ -24,6 +24,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "Python.h" +#include "macglue.h" #include #include "Speech.h" diff --git a/Mac/Python/macapplication.c b/Mac/Python/macapplication.c index 0fe1c70..3923af2 100644 --- a/Mac/Python/macapplication.c +++ b/Mac/Python/macapplication.c @@ -31,11 +31,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #pragma lib_export on #endif -extern void PyMac_InitApplet(); +extern void PyMac_InitApplication(void); #ifdef USE_MAC_APPLET_SUPPORT -extern void PyMac_InitApplication(); +extern void PyMac_InitApplet(void); #endif /* USE_MAC_APPLET_SUPPORT */ +/* From the MSL runtime: */ +extern void __initialize(void); /* ** Alternative initialization entry point for some very special cases. diff --git a/Mac/Python/macgetargv.c b/Mac/Python/macgetargv.c index 1eb4a54..b4a3ec6 100644 --- a/Mac/Python/macgetargv.c +++ b/Mac/Python/macgetargv.c @@ -53,15 +53,16 @@ static int applocation_inited; /* Duplicate a string to the heap. We also export this since it isn't standard ** and others use it */ - +#ifndef HAVE_STRDUP char * -strdup(char *src) +strdup(const char *src) { char *dst = malloc(strlen(src) + 1); if (dst) strcpy(dst, src); return dst; } +#endif /* Initialize FSSpec and full name of current application */ diff --git a/Mac/Python/macgetcompiler.c b/Mac/Python/macgetcompiler.c index 226fa29..39f3a2b 100644 --- a/Mac/Python/macgetcompiler.c +++ b/Mac/Python/macgetcompiler.c @@ -32,6 +32,7 @@ PERFORMANCE OF THIS SOFTWARE. /* Return a string representing the compiler name */ #include "config.h" +#include "Python.h" #ifdef __MWERKS__ #ifdef USE_GUSI1 @@ -75,8 +76,8 @@ PERFORMANCE OF THIS SOFTWARE. #endif #endif -char * -Py_GetCompiler() +const char * +Py_GetCompiler(void) { return COMPILER; } diff --git a/Mac/Python/macgetpath.c b/Mac/Python/macgetpath.c index bc957cc..c180d1f 100644 --- a/Mac/Python/macgetpath.c +++ b/Mac/Python/macgetpath.c @@ -33,6 +33,9 @@ PERFORMANCE OF THIS SOFTWARE. #include "osdefs.h" #include "macglue.h" #include "pythonresources.h" +#ifdef HAVE_UNISTD_H +#include +#endif /* Return the initial python search path. This is called once from @@ -58,6 +61,10 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif +#ifndef USE_BUILTIN_PATH +staticforward char *PyMac_GetPythonPath(); +#endif + #define PYTHONPATH "\ :\n\ :Lib\n\ @@ -143,9 +150,6 @@ Py_GetPath() char *p, *endp; int newlen; char *curwd; -#ifndef USE_BUILTIN_PATH - staticforward char *PyMac_GetPythonPath(); -#endif if ( pythonpath ) return pythonpath; #ifndef USE_BUILTIN_PATH @@ -294,7 +298,7 @@ PyMac_GetPythonDir() #ifndef USE_BUILTIN_PATH char * -PyMac_GetPythonPath() +PyMac_GetPythonPath(void) { short oldrh, prefrh = -1; char *rv; diff --git a/Mac/Python/macgetplatform.c b/Mac/Python/macgetplatform.c index cbfc890..3640d76 100644 --- a/Mac/Python/macgetplatform.c +++ b/Mac/Python/macgetplatform.c @@ -29,8 +29,10 @@ PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -char * -Py_GetPlatform() +#include "Python.h" + +const char * +Py_GetPlatform(void) { return "mac"; } diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c index 1266b59..607f4bb 100644 --- a/Mac/Python/macglue.c +++ b/Mac/Python/macglue.c @@ -63,7 +63,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #ifdef __MWERKS__ #include +extern void SIOUXSetupMenus(void); +extern void SIOUXDoAboutBox(void); #endif +#ifdef USE_GUSI +/* Functions we redefine because they're in obscure libraries */ +extern void SpinCursor(short x); +extern void RotateCursor(short x); +extern pascal void PLstrcpy(unsigned char *, unsigned char *); +extern pascal int PLstrcmp(unsigned char *, unsigned char *); +extern pascal unsigned char *PLstrrchr(unsigned char *, unsigned char); + +#endif + #ifdef USE_GUSI1 #include /* For Path2FSSpec */ #include @@ -103,7 +115,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define fnfErr -43 /* Declared in macfsmodule.c: */ -extern FSSpec *mfs_GetFSSpecFSSpec(); +extern FSSpec *mfs_GetFSSpecFSSpec(PyObject *); extern PyObject *newmfssobject(FSSpec *); /* Interrupt code variables: */ @@ -246,15 +258,13 @@ PyMac_StopGUSISpin() { ** StdCLib. Moreover, that implementation is broken under cfm68k... */ pascal void -PLstrcpy(to, fr) - unsigned char *to, *fr; +PLstrcpy(unsigned char *to, unsigned char *fr) { memcpy(to, fr, fr[0]+1); } pascal int -PLstrcmp(s1, s2) - unsigned char *s1, *s2; +PLstrcmp(unsigned char *s1, unsigned char *s2) { int res; int l = s1[0] < s2[0] ? s1[0] : s2[0]; @@ -272,9 +282,7 @@ PLstrcmp(s1, s2) } pascal unsigned char * -PLstrrchr(str, chr) - unsigned char *str; - unsigned char chr; +PLstrrchr(unsigned char *str, unsigned char chr) { unsigned char *ptr = 0; unsigned char *p; @@ -457,8 +465,8 @@ PyOS_InterruptOccurred() return interrupted; } /* Check whether we are in the foreground */ -int -PyMac_InForeground() +static int +PyMac_InForeground(void) { static ProcessSerialNumber ours; static inited; diff --git a/Mac/Python/macguesstabsize.c b/Mac/Python/macguesstabsize.c index 64a6ad7..482f43d 100644 --- a/Mac/Python/macguesstabsize.c +++ b/Mac/Python/macguesstabsize.c @@ -37,7 +37,7 @@ PERFORMANCE OF THIS SOFTWARE. #include /* Interface used by parsetok.c */ - +#error guesstabsize(path) char *path; { diff --git a/Mac/Python/macimport.c b/Mac/Python/macimport.c index 1b3b994..0806536 100644 --- a/Mac/Python/macimport.c +++ b/Mac/Python/macimport.c @@ -413,7 +413,9 @@ PyMac_FindModuleExtension(char *buf, size_t *lenp, char *module) unsigned char fnbuf[64]; int modnamelen = strlen(module); FSSpec fss; +#ifdef USE_GUSI1 FInfo finfo; +#endif short refnum; long dirid; diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index 8b2a1fd..e3e9615 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -44,6 +44,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef __MWERKS__ #include #define USE_SIOUX +extern int ccommand(char ***); #if __profile__ == 1 #include #endif @@ -549,9 +550,7 @@ Py_GetProgramFullPath() This is rare, but it is needed by the secureware extension. */ void -Py_GetArgcArgv(argc,argv) - int *argc; - char ***argv; +Py_GetArgcArgv(int *argc,char ***argv) { *argc = orig_argc; *argv = orig_argv; diff --git a/Mac/Python/macsetfiletype.c b/Mac/Python/macsetfiletype.c index c4b114f..b2d9531 100644 --- a/Mac/Python/macsetfiletype.c +++ b/Mac/Python/macsetfiletype.c @@ -34,10 +34,12 @@ PERFORMANCE OF THIS SOFTWARE. * */ +#include "Python.h" +#include "macglue.h" #include "macdefs.h" int -setfiletype(name, creator, type) +PyMac_setfiletype(name, creator, type) char *name; long creator, type; { @@ -56,7 +58,7 @@ long creator, type; } long -getfiletype(name) +PyMac_getfiletype(name) char *name; { FInfo info; diff --git a/Mac/mwerks/malloc/malloc.c b/Mac/mwerks/malloc/malloc.c index 7d0fb6c..38bd32a 100644 --- a/Mac/mwerks/malloc/malloc.c +++ b/Mac/mwerks/malloc/malloc.c @@ -78,7 +78,9 @@ typedef u_long caddr_t; #include #include +#ifndef NULL #define NULL 0 +#endif static void morecore(); -- cgit v0.12