Getting rid of pre-Carbon (MacOS8) support. All code depending on

TARGET_API_MAC_OS8 (or !TARGET_API_MAC_CARBON) is gone. Also some
TARGET_API_MAC_OSX conditional code is gone, because it is no longer
used on OSX-only Python (only in MacPython-OS9).
This commit is contained in:
Jack Jansen 2002-12-12 10:31:54 +00:00
parent 6bf45c6752
commit 6c7e326eaa
54 changed files with 100 additions and 5242 deletions

View file

@ -51,11 +51,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <Carbon/Carbon.h>
#endif
#if !TARGET_API_MAC_OS8
/* Unfortunately this call is probably slower... */
#define LMGetTicks() TickCount()
#endif
#ifdef __MWERKS__
#include <SIOUX.h>
extern void SIOUXSetupMenus(void);
@ -85,7 +80,6 @@ extern pascal char *PLstrrchr(const unsigned char *, short);
#define MINIMUM_STACK_SIZE 8192
#endif
#if TARGET_API_MAC_CARBON
/*
** On MacOSX StackSpace() lies: it gives the distance from heap end to stack pointer,
** but the stack cannot grow that far due to rlimit values. We cannot get at this value
@ -93,7 +87,6 @@ extern pascal char *PLstrrchr(const unsigned char *, short);
** stack limit of 512K.
*/
#define MAXIMUM_STACK_SIZE (256*1024)
#endif
/*
** We have to be careful, since we can't handle
@ -147,23 +140,6 @@ int PyMac_ConsoleIsDead;
*/
static MenuBarHandle sioux_mbar;
/*
** Some stuff for our GetDirectory and PromptGetFile routines
*/
struct hook_args {
int selectcur_hit; /* Set to true when "select current" selected */
char *prompt; /* The prompt */
};
#if !TARGET_API_MAC_OS8
/* The StandardFile hooks don't exist in Carbon. This breaks GetDirectory,
** but the macfsn code will replace it by a NavServices version anyway.
*/
#define myhook_upp NULL
#else
static DlgHookYDUPP myhook_upp;
static int upp_inited = 0;
#endif
/*
** The python-code event handler
*/
@ -256,48 +232,6 @@ PyMac_StopGUSISpin() {
PyMac_ConsoleIsDead = 1;
}
#if TARGET_API_MAC_OS8
/*
** Replacement routines for the PLstr... functions so we don't need
** StdCLib.
*/
pascal void
PLstrcpy(unsigned char *to, unsigned char *fr)
{
memcpy(to, fr, fr[0]+1);
}
pascal int
PLstrcmp(unsigned char *s1, unsigned char *s2)
{
int res;
int l = s1[0] < s2[0] ? s1[0] : s2[0];
res = memcmp(s1+1, s2+1, l);
if ( res != 0 )
return res;
if ( s1[0] < s2[0] )
return -1;
else if ( s1[0] > s2[0] )
return 1;
else
return 0;
}
pascal unsigned char *
PLstrrchr(unsigned char *str, unsigned char chr)
{
unsigned char *ptr = 0;
unsigned char *p;
for(p=str+1; p<str+str[0]; p++)
if ( *p == chr )
ptr = p;
return ptr;
}
#endif /* TARGET_API_MAC_OS8 */
#endif /* USE_GUSI */
@ -316,29 +250,6 @@ Pstring(char *str)
return buf;
}
#if TARGET_API_MAC_OS8
Point
LMGetMouse(void)
{
return LMGetMouseLocation();
}
long LMGetExpandMem(void)
{
return 0;
}
void
c2pstrcpy(unsigned char *dst, const char *src)
{
int len;
len = strlen(src);
if ( len > 255 ) len = 255;
strncpy((char *)dst+1, src, len);
dst[0] = len;
}
#endif /* TARGET_API_MAC_OS8 */
#ifdef USE_STACKCHECK
/* Check for stack overflow */
@ -420,35 +331,17 @@ static void
scan_event_queue(force)
int force;
{
#if !TARGET_API_MAC_OS8
if ( interrupted || (!schedparams.check_interrupt && !force) )
return;
if ( CheckEventQueueForUserCancel() )
interrupted = 1;
#else
register EvQElPtr q;
if ( interrupted || (!schedparams.check_interrupt && !force) || !PyMac_InForeground() )
return;
q = (EvQElPtr) LMGetEventQueue()->qHead;
for (; q; q = (EvQElPtr)q->qLink) {
if (q->evtQWhat == keyDown &&
(char)q->evtQMessage == '.' &&
(q->evtQModifiers & cmdKey) != 0) {
FlushEvents(keyDownMask, 0);
interrupted = 1;
break;
}
}
#endif
}
int
PyErr_CheckSignals()
{
if (schedparams.enabled) {
if ( interrupted || (unsigned long)LMGetTicks() > schedparams.next_check ) {
if ( interrupted || (unsigned long)TickCount() > schedparams.next_check ) {
scan_event_queue(0);
if (interrupted) {
interrupted = 0;
@ -457,7 +350,7 @@ PyErr_CheckSignals()
}
if ( PyMac_Yield() < 0)
return -1;
schedparams.next_check = (unsigned long)LMGetTicks()
schedparams.next_check = (unsigned long)TickCount()
+ schedparams.check_interval;
}
}
@ -498,16 +391,6 @@ void
PyMac_HandleEventIntern(evp)
EventRecord *evp;
{
#if TARGET_API_MAC_OS8
if ( evp->what == mouseDown ) {
WindowPtr wp;
if ( FindWindow(evp->where, &wp) == inSysWindow ) {
SystemClick(evp, wp);
return;
}
}
#endif
#ifdef __MWERKS__
{
int siouxdidit;
@ -568,14 +451,10 @@ PyMac_DoYield(int maxsleep, int maycallpython)
if( in_here > 1 || !schedparams.process_events ||
(python_event_handler && !maycallpython) ) {
if ( maxsleep >= 0 ) {
#if TARGET_API_MAC_OS8
SystemTask();
#else
int xxx = 0;
#endif
/* XXXX Need to do something here */
}
} else {
latest_time_ready = LMGetTicks() + maxsleep;
latest_time_ready = TickCount() + maxsleep;
do {
/* XXXX Hack by Jack.
** In time.sleep() you can click to another application
@ -590,7 +469,7 @@ PyMac_DoYield(int maxsleep, int maycallpython)
in_here--;
return -1;
}
maxsleep = latest_time_ready - LMGetTicks();
maxsleep = latest_time_ready - TickCount();
} while ( maxsleep > 0 );
}
in_here--;
@ -730,82 +609,3 @@ SIOUXDoAboutBox(void)
}
#endif /* !TARGET_API_MAC_OSX */
#if TARGET_API_MAC_OS8
/*
** Helper routine for GetDirectory
*/
static pascal short
myhook_proc(short item, DialogPtr theDialog, struct hook_args *dataptr)
{
if ( item == sfHookFirstCall && dataptr->prompt) {
Handle prompth;
short type;
Rect rect;
GetDialogItem(theDialog, PROMPT_ITEM, &type, &prompth, &rect);
if ( prompth )
SetDialogItemText(prompth, (unsigned char *)dataptr->prompt);
} else
if ( item == SELECTCUR_ITEM ) {
item = sfItemCancelButton;
dataptr->selectcur_hit = 1;
}
return item;
}
/*
** Ask the user for a directory. I still can't understand
** why Apple doesn't provide a standard solution for this...
*/
int
PyMac_GetDirectory(dirfss, prompt)
FSSpec *dirfss;
char *prompt;
{
static SFTypeList list = {'fldr', 0, 0, 0};
static Point where = {-1, -1};
StandardFileReply reply;
struct hook_args hook_args;
if ( !upp_inited ) {
myhook_upp = NewDlgHookYDProc(myhook_proc);
upp_inited = 1;
}
if ( prompt && *prompt )
hook_args.prompt = (char *)Pstring(prompt);
else
hook_args.prompt = NULL;
hook_args.selectcur_hit = 0;
CustomGetFile((FileFilterYDUPP)0, 1, list, &reply, GETDIR_ID, where, myhook_upp,
NULL, NULL, NULL, (void *)&hook_args);
reply.sfFile.name[0] = 0;
if( FSMakeFSSpec(reply.sfFile.vRefNum, reply.sfFile.parID, reply.sfFile.name, dirfss) )
return 0;
return hook_args.selectcur_hit;
}
/*
** Slightly extended StandardGetFile: accepts a prompt */
void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList,
StandardFileReply *reply, char *prompt)
{
static Point where = {-1, -1};
struct hook_args hook_args;
if ( !upp_inited ) {
myhook_upp = NewDlgHookYDProc(myhook_proc);
upp_inited = 1;
}
if ( prompt && *prompt )
hook_args.prompt = (char *)Pstring(prompt);
else
hook_args.prompt = NULL;
hook_args.selectcur_hit = 0;
CustomGetFile((FileFilterYDUPP)0, numTypes, typeList, reply, GETFILEPROMPT_ID, where,
myhook_upp, NULL, NULL, NULL, (void *)&hook_args);
}
#endif /* TARGET_API_MAC_OS8 */