mirror of
https://github.com/python/cpython.git
synced 2025-08-01 23:53:15 +00:00
Be more sensible about when to use TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON. This should greatly facilitate porting stuff to OSX in its MachO/BSD incarnation.
This commit is contained in:
parent
1bd0a712ad
commit
6e68a7e74f
4 changed files with 26 additions and 23 deletions
|
@ -84,11 +84,11 @@ int PyMac_FindCodeResourceModule(PyStringObject *, char *, char *); /* Test for
|
||||||
PyObject * PyMac_LoadCodeResourceModule(char *, char *); /* Load 'PYD ' resource from file */
|
PyObject * PyMac_LoadCodeResourceModule(char *, char *); /* Load 'PYD ' resource from file */
|
||||||
struct filedescr *PyMac_FindModuleExtension(char *, size_t *, char *); /* Look for module in single folder */
|
struct filedescr *PyMac_FindModuleExtension(char *, size_t *, char *); /* Look for module in single folder */
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
int PyMac_GetDirectory(FSSpec *dirfss, char *prompt); /* Ask user for a directory */
|
int PyMac_GetDirectory(FSSpec *dirfss, char *prompt); /* Ask user for a directory */
|
||||||
void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList,
|
void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList,
|
||||||
StandardFileReply *reply, char *prompt); /* Ask user for file, with prompt */
|
StandardFileReply *reply, char *prompt); /* Ask user for file, with prompt */
|
||||||
#endif /* TARGET_API_MAC_CARBON */
|
#endif /* TARGET_API_MAC_OS8 */
|
||||||
|
|
||||||
int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */
|
int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */
|
||||||
PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */
|
PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */
|
||||||
|
|
|
@ -31,7 +31,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
/* Skip for Carbon */
|
/* Skip for Carbon */
|
||||||
#include "macstat.h"
|
#include "macstat.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,7 +51,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#else /* USE_GUSI */
|
#else /* USE_GUSI */
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
#define stat macstat
|
#define stat macstat
|
||||||
#endif
|
#endif
|
||||||
#endif /* USE_GUSI */
|
#endif /* USE_GUSI */
|
||||||
|
@ -259,7 +259,7 @@ mac_fdopen(self, args)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
static PyObject *
|
static PyObject *
|
||||||
mac_getbootvol(self, args)
|
mac_getbootvol(self, args)
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
|
@ -499,7 +499,7 @@ mac_fstat(self, args)
|
||||||
}
|
}
|
||||||
#endif /* WEHAVE_FSTAT */
|
#endif /* WEHAVE_FSTAT */
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
static PyObject *
|
static PyObject *
|
||||||
mac_xstat(self, args)
|
mac_xstat(self, args)
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
|
@ -611,7 +611,7 @@ static struct PyMethodDef mac_methods[] = {
|
||||||
#ifdef WEHAVE_FSTAT
|
#ifdef WEHAVE_FSTAT
|
||||||
{"fstat", mac_fstat},
|
{"fstat", mac_fstat},
|
||||||
#endif
|
#endif
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
{"getbootvol", mac_getbootvol}, /* non-standard */
|
{"getbootvol", mac_getbootvol}, /* non-standard */
|
||||||
#endif
|
#endif
|
||||||
{"getcwd", mac_getcwd},
|
{"getcwd", mac_getcwd},
|
||||||
|
@ -623,7 +623,7 @@ static struct PyMethodDef mac_methods[] = {
|
||||||
{"rename", mac_rename},
|
{"rename", mac_rename},
|
||||||
{"rmdir", mac_rmdir},
|
{"rmdir", mac_rmdir},
|
||||||
{"stat", mac_stat},
|
{"stat", mac_stat},
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
{"xstat", mac_xstat},
|
{"xstat", mac_xstat},
|
||||||
#endif
|
#endif
|
||||||
{"sync", mac_sync},
|
{"sync", mac_sync},
|
||||||
|
|
|
@ -360,7 +360,7 @@ MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
|
||||||
#include <EPPC.h>
|
#include <EPPC.h>
|
||||||
#include <Events.h>
|
#include <Events.h>
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
static char accepthle_doc[] = "Get arguments of pending high-level event";
|
static char accepthle_doc[] = "Get arguments of pending high-level event";
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -704,7 +704,7 @@ MacOS_OutputSeen(PyObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyMethodDef MacOS_Methods[] = {
|
static PyMethodDef MacOS_Methods[] = {
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
{"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc},
|
{"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc},
|
||||||
#endif
|
#endif
|
||||||
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
|
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
|
||||||
|
@ -760,10 +760,13 @@ initMacOS()
|
||||||
Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0)
|
Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0)
|
||||||
return;
|
return;
|
||||||
#if TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_CARBON
|
||||||
/* Will need a different name for MachO-carbon later (macho?) */
|
|
||||||
#define PY_RUNTIMEMODEL "carbon"
|
#define PY_RUNTIMEMODEL "carbon"
|
||||||
#else
|
#elif TARGET_API_MAC_OS8
|
||||||
#define PY_RUNTIMEMODEL "ppc"
|
#define PY_RUNTIMEMODEL "ppc"
|
||||||
|
#elif TARGET_API_MAC_OSX
|
||||||
|
#define PY_RUNTIMEMODEL "macho"
|
||||||
|
#else
|
||||||
|
#error "None of the TARGET_API_MAC_XXX I know about is set"
|
||||||
#endif
|
#endif
|
||||||
if (PyDict_SetItemString(d, "runtimemodel",
|
if (PyDict_SetItemString(d, "runtimemodel",
|
||||||
Py_BuildValue("s", PY_RUNTIMEMODEL)) != 0)
|
Py_BuildValue("s", PY_RUNTIMEMODEL)) != 0)
|
||||||
|
|
|
@ -32,7 +32,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include <Events.h>
|
#include <Events.h>
|
||||||
|
|
||||||
#if TARGET_API_MAC_CARBON
|
#if !TARGET_API_MAC_OS8
|
||||||
/* Unfortunately this call is probably slower... */
|
/* Unfortunately this call is probably slower... */
|
||||||
#define LMGetTicks() TickCount()
|
#define LMGetTicks() TickCount()
|
||||||
#endif
|
#endif
|
||||||
|
@ -171,7 +171,7 @@ struct hook_args {
|
||||||
int selectcur_hit; /* Set to true when "select current" selected */
|
int selectcur_hit; /* Set to true when "select current" selected */
|
||||||
char *prompt; /* The prompt */
|
char *prompt; /* The prompt */
|
||||||
};
|
};
|
||||||
#if TARGET_API_MAC_CARBON
|
#if !TARGET_API_MAC_OS8
|
||||||
/* The StandardFile hooks don't exist in Carbon. This breaks GetDirectory,
|
/* The StandardFile hooks don't exist in Carbon. This breaks GetDirectory,
|
||||||
** but the macfsn code will replace it by a NavServices version anyway.
|
** but the macfsn code will replace it by a NavServices version anyway.
|
||||||
*/
|
*/
|
||||||
|
@ -297,7 +297,7 @@ PyMac_StopGUSISpin() {
|
||||||
PyMac_ConsoleIsDead = 1;
|
PyMac_ConsoleIsDead = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
/*
|
/*
|
||||||
** Replacement routines for the PLstr... functions so we don't need
|
** Replacement routines for the PLstr... functions so we don't need
|
||||||
** StdCLib.
|
** StdCLib.
|
||||||
|
@ -338,7 +338,7 @@ PLstrrchr(unsigned char *str, unsigned char chr)
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !TARGET_API_MAC_CARBON */
|
#endif /* TARGET_API_MAC_OS8 */
|
||||||
#endif /* USE_GUSI */
|
#endif /* USE_GUSI */
|
||||||
|
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ Pstring(char *str)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
void
|
void
|
||||||
c2pstrcpy(unsigned char *dst, const char *src)
|
c2pstrcpy(unsigned char *dst, const char *src)
|
||||||
{
|
{
|
||||||
|
@ -368,7 +368,7 @@ c2pstrcpy(unsigned char *dst, const char *src)
|
||||||
strncpy((char *)dst+1, src, len);
|
strncpy((char *)dst+1, src, len);
|
||||||
dst[0] = len;
|
dst[0] = len;
|
||||||
}
|
}
|
||||||
#endif /* !TARGET_API_MAC_CARBON */
|
#endif /* TARGET_API_MAC_OS8 */
|
||||||
|
|
||||||
/* Like strerror() but for Mac OS error numbers */
|
/* Like strerror() but for Mac OS error numbers */
|
||||||
char *PyMac_StrError(int err)
|
char *PyMac_StrError(int err)
|
||||||
|
@ -498,7 +498,7 @@ static void
|
||||||
scan_event_queue(flush)
|
scan_event_queue(flush)
|
||||||
int flush;
|
int flush;
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_CARBON
|
#if !TARGET_API_MAC_OS8
|
||||||
if ( CheckEventQueueForUserCancel() )
|
if ( CheckEventQueueForUserCancel() )
|
||||||
interrupted = 1;
|
interrupted = 1;
|
||||||
#else
|
#else
|
||||||
|
@ -608,7 +608,7 @@ void
|
||||||
PyMac_HandleEventIntern(evp)
|
PyMac_HandleEventIntern(evp)
|
||||||
EventRecord *evp;
|
EventRecord *evp;
|
||||||
{
|
{
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
if ( evp->what == mouseDown ) {
|
if ( evp->what == mouseDown ) {
|
||||||
WindowPtr wp;
|
WindowPtr wp;
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ PyMac_DoYield(int maxsleep, int maycallpython)
|
||||||
if( in_here > 1 || !schedparams.process_events ||
|
if( in_here > 1 || !schedparams.process_events ||
|
||||||
(python_event_handler && !maycallpython) ) {
|
(python_event_handler && !maycallpython) ) {
|
||||||
if ( maxsleep >= 0 ) {
|
if ( maxsleep >= 0 ) {
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
SystemTask();
|
SystemTask();
|
||||||
#else
|
#else
|
||||||
int xxx = 0;
|
int xxx = 0;
|
||||||
|
@ -878,7 +878,7 @@ myhook_proc(short item, DialogPtr theDialog, struct hook_args *dataptr)
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
#if !TARGET_API_MAC_CARBON
|
#if TARGET_API_MAC_OS8
|
||||||
/*
|
/*
|
||||||
** Ask the user for a directory. I still can't understand
|
** Ask the user for a directory. I still can't understand
|
||||||
** why Apple doesn't provide a standard solution for this...
|
** why Apple doesn't provide a standard solution for this...
|
||||||
|
@ -931,7 +931,7 @@ void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList,
|
||||||
CustomGetFile((FileFilterYDUPP)0, numTypes, typeList, reply, GETFILEPROMPT_ID, where,
|
CustomGetFile((FileFilterYDUPP)0, numTypes, typeList, reply, GETFILEPROMPT_ID, where,
|
||||||
myhook_upp, NULL, NULL, NULL, (void *)&hook_args);
|
myhook_upp, NULL, NULL, NULL, (void *)&hook_args);
|
||||||
}
|
}
|
||||||
#endif /* TARGET_API_MAC_CARBON */
|
#endif /* TARGET_API_MAC_OS8 */
|
||||||
|
|
||||||
/* Convert a 4-char string object argument to an OSType value */
|
/* Convert a 4-char string object argument to an OSType value */
|
||||||
int
|
int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue