Macintosh port update
Several long-awaited updates for the Macintosh port, by Dean Luick and myself. This set affects Mac-only files. * Update the support for MPW compilers. * Use new system call names provided for in the latest Apple Universal Headers. * Tune up some of the includes for CodeWarrior. * Define YY_NEVER_INTERACTIVE for the dungeon and level compilers. * Remove pointless debugging code. * Clean up some unterminated comments.
This commit is contained in:
@@ -8,32 +8,15 @@
|
||||
#include "mactty.h"
|
||||
#include "wintty.h"
|
||||
|
||||
#if defined(applec)
|
||||
#include <sysequ.h>
|
||||
#else
|
||||
#include <LowMem.h>
|
||||
#endif
|
||||
#include <AppleEvents.h>
|
||||
#include <Gestalt.h>
|
||||
#include <TextUtils.h>
|
||||
#include <DiskInit.h>
|
||||
#include <ControlDefinitions.h>
|
||||
|
||||
NhWindow *theWindows = (NhWindow *) 0;
|
||||
|
||||
#ifndef USESROUTINEDESCRIPTORS /* not using universal headers */
|
||||
/* Cast everything in terms of the new Low Memory function calls. */
|
||||
# if defined(applec)
|
||||
# define LMGetCurStackBase() (*(long *) CurStackBase)
|
||||
# define LMGetDefltStack() (*(long *) DefltStack)
|
||||
# elif defined(THINK_C)
|
||||
# define LMGetCurStackBase() CurStackBase
|
||||
# define LMGetDefltStack() (*(long *) DefltStack)
|
||||
# elif defined(__MWERKS__)
|
||||
# else
|
||||
# error /* need to define LM functions for this compiler */
|
||||
# endif
|
||||
#endif /* !USEROUTINEDESCRIPTORS (universal headers) */
|
||||
|
||||
/* Borrowed from the Mac tty port */
|
||||
extern WindowPtr _mt_window;
|
||||
|
||||
@@ -355,13 +338,13 @@ InitMac(void) {
|
||||
/* set up base fonts for all window types */
|
||||
GetFNum ("\pHackFont", &i);
|
||||
if (i == 0)
|
||||
i = monaco;
|
||||
i = kFontIDMonaco;
|
||||
win_fonts [NHW_BASE] = win_fonts [NHW_MAP] = win_fonts [NHW_STATUS] = i;
|
||||
GetFNum ("\pPSHackFont", &i);
|
||||
if (i == 0)
|
||||
i = geneva;
|
||||
i = kFontIDGeneva;
|
||||
win_fonts [NHW_MESSAGE] = i;
|
||||
win_fonts [NHW_TEXT] = geneva;
|
||||
win_fonts [NHW_TEXT] = kFontIDGeneva;
|
||||
|
||||
macFlags.hasAE = 0;
|
||||
if(!Gestalt(gestaltAppleEventsAttr, &l) && (l & (1L << gestaltAppleEventsPresent))){
|
||||
@@ -685,7 +668,8 @@ mac_init_nhwindows (int *argcp, char **argv) {
|
||||
InitMenuRes ();
|
||||
|
||||
theWindows = (NhWindow *) NewPtrClear (NUM_MACWINDOWS * sizeof (NhWindow));
|
||||
mustwork(MemError());
|
||||
if (MemError())
|
||||
error("mac_init_nhwindows: Couldn't allocate memory for windows.");
|
||||
|
||||
DimMenuBar ();
|
||||
|
||||
@@ -808,7 +792,7 @@ topl_resp_rect(int resp_idx, Rect *r) {
|
||||
void
|
||||
enter_topl_mode(char *query) {
|
||||
if (in_topl_mode())
|
||||
Debugger();
|
||||
return;
|
||||
|
||||
putstr(WIN_MESSAGE, ATR_BOLD, query);
|
||||
|
||||
@@ -832,7 +816,7 @@ leave_topl_mode(char *answer) {
|
||||
NhWindow *aWin = theWindows + WIN_MESSAGE;
|
||||
|
||||
if (!in_topl_mode())
|
||||
Debugger();
|
||||
return;
|
||||
|
||||
/* remove unprintables from the answer */
|
||||
for (ap = *(*top_line)->hText + topl_query_len, bp = answer; ans_len > 0; ans_len--, ap++) {
|
||||
@@ -1147,7 +1131,7 @@ mac_destroy_nhwindow (winid win) {
|
||||
if (iflags.window_inited) {
|
||||
if (flags.tombstone && killer) {
|
||||
/* Prepare for the coming of the tombstone window. */
|
||||
win_fonts [NHW_TEXT] = monaco;
|
||||
win_fonts [NHW_TEXT] = kFontIDMonaco;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1160,7 +1144,7 @@ mac_destroy_nhwindow (winid win) {
|
||||
if ((!((WindowPeek) theWindow)->visible || (kind != NHW_MENU && kind != NHW_TEXT))) {
|
||||
DisposeWindow (theWindow);
|
||||
if (aWin->windowText) {
|
||||
DisposHandle (aWin->windowText);
|
||||
DisposeHandle (aWin->windowText);
|
||||
}
|
||||
aWin->its_window = (WindowPtr) 0;
|
||||
aWin->windowText = (Handle) 0;
|
||||
@@ -1477,7 +1461,7 @@ macClickTerm (EventRecord *theEvent, WindowPtr theWindow) {
|
||||
where.v = where.v / nhw->row_height;
|
||||
clicked_mod = (theEvent->modifiers & shiftKey) ? CLICK_2 : CLICK_1;
|
||||
|
||||
if (strchr(topl_resp, click_to_cmd(where.h, where.v, clicked_mod)))
|
||||
if (strchr(topl_resp, *click_to_cmd(where.h, where.v, clicked_mod)))
|
||||
nhbell();
|
||||
else {
|
||||
if (cursor_locked)
|
||||
@@ -1595,8 +1579,6 @@ mac_doprev_message(void) {
|
||||
|
||||
static short
|
||||
macDoNull (EventRecord *theEvent, WindowPtr theWindow) {
|
||||
if (!theEvent || !theWindow)
|
||||
Debugger ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1626,9 +1608,8 @@ macUpdateMessage (EventRecord *theEvent, WindowPtr theWindow) {
|
||||
NhWindow *aWin = GetNhWin (theWindow);
|
||||
int l;
|
||||
|
||||
if (!theEvent) {
|
||||
Debugger ();
|
||||
}
|
||||
if (!theEvent)
|
||||
return 0;
|
||||
|
||||
GetClip(org_clip);
|
||||
|
||||
@@ -1666,7 +1647,7 @@ macUpdateMessage (EventRecord *theEvent, WindowPtr theWindow) {
|
||||
name = tmp;
|
||||
break;
|
||||
}
|
||||
TextFont(geneva);
|
||||
TextFont(kFontIDGeneva);
|
||||
TextSize(9);
|
||||
GetFontInfo(&font);
|
||||
MoveTo ((frame.left + frame.right - StringWidth(name)) / 2,
|
||||
@@ -1770,9 +1751,8 @@ GeneralUpdate (EventRecord *theEvent, WindowPtr theWindow) {
|
||||
RgnHandle h;
|
||||
Boolean vis;
|
||||
|
||||
if (!theEvent) {
|
||||
Debugger ();
|
||||
}
|
||||
if (!theEvent)
|
||||
return 0;
|
||||
|
||||
r2.left = r2.right - SBARWIDTH;
|
||||
r2.right += 1;
|
||||
@@ -1829,7 +1809,7 @@ macCursorTerm (EventRecord *theEvent, WindowPtr theWindow, RgnHandle mouseRgn) {
|
||||
|
||||
GlobalToLocal (&where);
|
||||
dir_bas = iflags.num_pad ? (char *) ndir : (char *) sdir;
|
||||
dir = strchr (dir_bas, click_to_cmd (where.h / nhw->char_width + 1 ,
|
||||
dir = strchr (dir_bas, *click_to_cmd (where.h / nhw->char_width + 1 ,
|
||||
where.v / nhw->row_height, CLICK_1));
|
||||
}
|
||||
ch = GetCursor (dir ? dir - dir_bas + 513 : 512);
|
||||
|
||||
Reference in New Issue
Block a user