mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
ANSIfication step 2: make sure all needed prototypes are available, and all needed
header files included.
This commit is contained in:
parent
5e80a75799
commit
9ae898b415
19 changed files with 83 additions and 41 deletions
|
@ -5,7 +5,7 @@
|
||||||
#include "macdefs.h"
|
#include "macdefs.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getbootvol()
|
getbootvol(void)
|
||||||
{
|
{
|
||||||
short vrefnum;
|
short vrefnum;
|
||||||
static unsigned char name[32];
|
static unsigned char name[32];
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
#define ROOTID 2 /* Root directory ID */
|
#define ROOTID 2 /* Root directory ID */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
getwd(cwd)
|
getwd(char *cwd)
|
||||||
char *cwd;
|
|
||||||
{
|
{
|
||||||
/* Universal parameter block. */
|
/* Universal parameter block. */
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -27,6 +27,7 @@ struct macstat {
|
||||||
#define S_IWRITE 0200
|
#define S_IWRITE 0200
|
||||||
#define S_IEXEC 0100
|
#define S_IEXEC 0100
|
||||||
|
|
||||||
|
extern int macstat(char *, struct macstat *);
|
||||||
/* To stop inclusion of MWerks header: */
|
/* To stop inclusion of MWerks header: */
|
||||||
#ifndef _STAT
|
#ifndef _STAT
|
||||||
#define _STAT
|
#define _STAT
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "macdefs.h"
|
#include "macdefs.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
sync()
|
sync(void)
|
||||||
{
|
{
|
||||||
if (FlushVol((StringPtr)0, 0) == noErr)
|
if (FlushVol((StringPtr)0, 0) == noErr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We may be able to use a std routine in think, don't know */
|
/* 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: */
|
/* Universal constants: */
|
||||||
#define MAXPATH 256
|
#define MAXPATH 256
|
||||||
|
|
|
@ -81,6 +81,7 @@ void PyMac_GetSchedParams(PyMacSchedParams *); /* Get schedulers params */
|
||||||
void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */
|
void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */
|
||||||
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
|
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
|
||||||
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
|
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_DoYield(int, int); /* Yield cpu. First arg is maxtime, second ok to call python */
|
||||||
int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */
|
int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */
|
||||||
void PyMac_HandleEventIntern(EventRecord *); /* Handle one event internal only */
|
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: */
|
/* From macfiletype.c: */
|
||||||
|
|
||||||
long getfiletype(char *); /* Get file type */
|
long PyMac_getfiletype(char *); /* Get file type */
|
||||||
int setfiletype(char *, long, long); /* Set file creator and 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,6 +34,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include "getapplbycreator.h"
|
#include "getapplbycreator.h"
|
||||||
|
|
||||||
|
/* Should this be in macglue.h? */
|
||||||
|
extern FSSpec *mfs_GetFSSpecFSSpec(PyObject *);
|
||||||
|
|
||||||
static PyObject *ErrorObject;
|
static PyObject *ErrorObject;
|
||||||
|
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
@ -174,9 +177,8 @@ mfsa_getattr(self, name)
|
||||||
return Py_FindMethod(mfsa_methods, (PyObject *)self, name);
|
return Py_FindMethod(mfsa_methods, (PyObject *)self, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
mfsaobject *
|
static mfsaobject *
|
||||||
newmfsaobject(alias)
|
newmfsaobject(AliasHandle alias)
|
||||||
AliasHandle alias;
|
|
||||||
{
|
{
|
||||||
mfsaobject *self;
|
mfsaobject *self;
|
||||||
|
|
||||||
|
@ -334,8 +336,7 @@ static PyTypeObject Mfsitype = {
|
||||||
** object is a python fsspec object, else NULL
|
** object is a python fsspec object, else NULL
|
||||||
*/
|
*/
|
||||||
FSSpec *
|
FSSpec *
|
||||||
mfs_GetFSSpecFSSpec(self)
|
mfs_GetFSSpecFSSpec(PyObject *self)
|
||||||
PyObject *self;
|
|
||||||
{
|
{
|
||||||
if ( is_mfssobject(self) )
|
if ( is_mfssobject(self) )
|
||||||
return &((mfssobject *)self)->fsspec;
|
return &((mfssobject *)self)->fsspec;
|
||||||
|
|
|
@ -24,6 +24,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
#include "macglue.h"
|
||||||
|
|
||||||
#include <Gestalt.h>
|
#include <Gestalt.h>
|
||||||
#include "Speech.h"
|
#include "Speech.h"
|
||||||
|
|
|
@ -31,11 +31,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#pragma lib_export on
|
#pragma lib_export on
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void PyMac_InitApplet();
|
extern void PyMac_InitApplication(void);
|
||||||
#ifdef USE_MAC_APPLET_SUPPORT
|
#ifdef USE_MAC_APPLET_SUPPORT
|
||||||
extern void PyMac_InitApplication();
|
extern void PyMac_InitApplet(void);
|
||||||
#endif /* USE_MAC_APPLET_SUPPORT */
|
#endif /* USE_MAC_APPLET_SUPPORT */
|
||||||
|
|
||||||
|
/* From the MSL runtime: */
|
||||||
|
extern void __initialize(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Alternative initialization entry point for some very special cases.
|
** Alternative initialization entry point for some very special cases.
|
||||||
|
|
|
@ -53,15 +53,16 @@ static int applocation_inited;
|
||||||
/* Duplicate a string to the heap. We also export this since it isn't standard
|
/* Duplicate a string to the heap. We also export this since it isn't standard
|
||||||
** and others use it
|
** and others use it
|
||||||
*/
|
*/
|
||||||
|
#ifndef HAVE_STRDUP
|
||||||
char *
|
char *
|
||||||
strdup(char *src)
|
strdup(const char *src)
|
||||||
{
|
{
|
||||||
char *dst = malloc(strlen(src) + 1);
|
char *dst = malloc(strlen(src) + 1);
|
||||||
if (dst)
|
if (dst)
|
||||||
strcpy(dst, src);
|
strcpy(dst, src);
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize FSSpec and full name of current application */
|
/* Initialize FSSpec and full name of current application */
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
/* Return a string representing the compiler name */
|
/* Return a string representing the compiler name */
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "Python.h"
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#ifdef USE_GUSI1
|
#ifdef USE_GUSI1
|
||||||
|
@ -75,8 +76,8 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
Py_GetCompiler()
|
Py_GetCompiler(void)
|
||||||
{
|
{
|
||||||
return COMPILER;
|
return COMPILER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,9 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "osdefs.h"
|
#include "osdefs.h"
|
||||||
#include "macglue.h"
|
#include "macglue.h"
|
||||||
#include "pythonresources.h"
|
#include "pythonresources.h"
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Return the initial python search path. This is called once from
|
/* Return the initial python search path. This is called once from
|
||||||
|
@ -58,6 +61,10 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <GUSI.h>
|
#include <GUSI.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_BUILTIN_PATH
|
||||||
|
staticforward char *PyMac_GetPythonPath();
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PYTHONPATH "\
|
#define PYTHONPATH "\
|
||||||
:\n\
|
:\n\
|
||||||
:Lib\n\
|
:Lib\n\
|
||||||
|
@ -143,9 +150,6 @@ Py_GetPath()
|
||||||
char *p, *endp;
|
char *p, *endp;
|
||||||
int newlen;
|
int newlen;
|
||||||
char *curwd;
|
char *curwd;
|
||||||
#ifndef USE_BUILTIN_PATH
|
|
||||||
staticforward char *PyMac_GetPythonPath();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( pythonpath ) return pythonpath;
|
if ( pythonpath ) return pythonpath;
|
||||||
#ifndef USE_BUILTIN_PATH
|
#ifndef USE_BUILTIN_PATH
|
||||||
|
@ -294,7 +298,7 @@ PyMac_GetPythonDir()
|
||||||
|
|
||||||
#ifndef USE_BUILTIN_PATH
|
#ifndef USE_BUILTIN_PATH
|
||||||
char *
|
char *
|
||||||
PyMac_GetPythonPath()
|
PyMac_GetPythonPath(void)
|
||||||
{
|
{
|
||||||
short oldrh, prefrh = -1;
|
short oldrh, prefrh = -1;
|
||||||
char *rv;
|
char *rv;
|
||||||
|
|
|
@ -29,8 +29,10 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
char *
|
#include "Python.h"
|
||||||
Py_GetPlatform()
|
|
||||||
|
const char *
|
||||||
|
Py_GetPlatform(void)
|
||||||
{
|
{
|
||||||
return "mac";
|
return "mac";
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <TextUtils.h>
|
#include <TextUtils.h>
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#include <SIOUX.h>
|
#include <SIOUX.h>
|
||||||
|
extern void SIOUXSetupMenus(void);
|
||||||
|
extern void SIOUXDoAboutBox(void);
|
||||||
#endif
|
#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
|
#ifdef USE_GUSI1
|
||||||
#include <TFileSpec.h> /* For Path2FSSpec */
|
#include <TFileSpec.h> /* For Path2FSSpec */
|
||||||
#include <GUSI.h>
|
#include <GUSI.h>
|
||||||
|
@ -103,7 +115,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define fnfErr -43
|
#define fnfErr -43
|
||||||
|
|
||||||
/* Declared in macfsmodule.c: */
|
/* Declared in macfsmodule.c: */
|
||||||
extern FSSpec *mfs_GetFSSpecFSSpec();
|
extern FSSpec *mfs_GetFSSpecFSSpec(PyObject *);
|
||||||
extern PyObject *newmfssobject(FSSpec *);
|
extern PyObject *newmfssobject(FSSpec *);
|
||||||
|
|
||||||
/* Interrupt code variables: */
|
/* Interrupt code variables: */
|
||||||
|
@ -246,15 +258,13 @@ PyMac_StopGUSISpin() {
|
||||||
** StdCLib. Moreover, that implementation is broken under cfm68k...
|
** StdCLib. Moreover, that implementation is broken under cfm68k...
|
||||||
*/
|
*/
|
||||||
pascal void
|
pascal void
|
||||||
PLstrcpy(to, fr)
|
PLstrcpy(unsigned char *to, unsigned char *fr)
|
||||||
unsigned char *to, *fr;
|
|
||||||
{
|
{
|
||||||
memcpy(to, fr, fr[0]+1);
|
memcpy(to, fr, fr[0]+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pascal int
|
pascal int
|
||||||
PLstrcmp(s1, s2)
|
PLstrcmp(unsigned char *s1, unsigned char *s2)
|
||||||
unsigned char *s1, *s2;
|
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
int l = s1[0] < s2[0] ? s1[0] : s2[0];
|
int l = s1[0] < s2[0] ? s1[0] : s2[0];
|
||||||
|
@ -272,9 +282,7 @@ PLstrcmp(s1, s2)
|
||||||
}
|
}
|
||||||
|
|
||||||
pascal unsigned char *
|
pascal unsigned char *
|
||||||
PLstrrchr(str, chr)
|
PLstrrchr(unsigned char *str, unsigned char chr)
|
||||||
unsigned char *str;
|
|
||||||
unsigned char chr;
|
|
||||||
{
|
{
|
||||||
unsigned char *ptr = 0;
|
unsigned char *ptr = 0;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
@ -457,8 +465,8 @@ PyOS_InterruptOccurred()
|
||||||
return interrupted;
|
return interrupted;
|
||||||
}
|
}
|
||||||
/* Check whether we are in the foreground */
|
/* Check whether we are in the foreground */
|
||||||
int
|
static int
|
||||||
PyMac_InForeground()
|
PyMac_InForeground(void)
|
||||||
{
|
{
|
||||||
static ProcessSerialNumber ours;
|
static ProcessSerialNumber ours;
|
||||||
static inited;
|
static inited;
|
||||||
|
|
|
@ -37,7 +37,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* Interface used by parsetok.c */
|
/* Interface used by parsetok.c */
|
||||||
|
#error
|
||||||
guesstabsize(path)
|
guesstabsize(path)
|
||||||
char *path;
|
char *path;
|
||||||
{
|
{
|
||||||
|
|
|
@ -413,7 +413,9 @@ PyMac_FindModuleExtension(char *buf, size_t *lenp, char *module)
|
||||||
unsigned char fnbuf[64];
|
unsigned char fnbuf[64];
|
||||||
int modnamelen = strlen(module);
|
int modnamelen = strlen(module);
|
||||||
FSSpec fss;
|
FSSpec fss;
|
||||||
|
#ifdef USE_GUSI1
|
||||||
FInfo finfo;
|
FInfo finfo;
|
||||||
|
#endif
|
||||||
short refnum;
|
short refnum;
|
||||||
long dirid;
|
long dirid;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#include <SIOUX.h>
|
#include <SIOUX.h>
|
||||||
#define USE_SIOUX
|
#define USE_SIOUX
|
||||||
|
extern int ccommand(char ***);
|
||||||
#if __profile__ == 1
|
#if __profile__ == 1
|
||||||
#include <profiler.h>
|
#include <profiler.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -549,9 +550,7 @@ Py_GetProgramFullPath()
|
||||||
This is rare, but it is needed by the secureware extension. */
|
This is rare, but it is needed by the secureware extension. */
|
||||||
|
|
||||||
void
|
void
|
||||||
Py_GetArgcArgv(argc,argv)
|
Py_GetArgcArgv(int *argc,char ***argv)
|
||||||
int *argc;
|
|
||||||
char ***argv;
|
|
||||||
{
|
{
|
||||||
*argc = orig_argc;
|
*argc = orig_argc;
|
||||||
*argv = orig_argv;
|
*argv = orig_argv;
|
||||||
|
|
|
@ -34,10 +34,12 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Python.h"
|
||||||
|
#include "macglue.h"
|
||||||
#include "macdefs.h"
|
#include "macdefs.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
setfiletype(name, creator, type)
|
PyMac_setfiletype(name, creator, type)
|
||||||
char *name;
|
char *name;
|
||||||
long creator, type;
|
long creator, type;
|
||||||
{
|
{
|
||||||
|
@ -56,7 +58,7 @@ long creator, type;
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
getfiletype(name)
|
PyMac_getfiletype(name)
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
FInfo info;
|
FInfo info;
|
||||||
|
|
|
@ -78,7 +78,9 @@ typedef u_long caddr_t;
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
static void morecore();
|
static void morecore();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue