From 289fb4c96ae31358540e6a60c549ae7dedd1851d Mon Sep 17 00:00:00 2001 From: Clifford Matthews Date: Wed, 1 Jul 2009 11:14:48 -0600 Subject: [PATCH] README.64 explains unfinished state of 64-bit port. --- README | 2 +- TODO | 4 ---- src/config/front-ends/sdl/sdlwin.c | 4 ++-- src/configure.ac | 8 ++++++++ src/ctlArrows.c | 6 +++--- src/include/CQuickDraw.h | 10 ++++++++-- src/include/MacTypes.h | 6 +++--- src/include/rsys/byteswap.h | 15 +++++++++++---- 8 files changed, 36 insertions(+), 19 deletions(-) diff --git a/README b/README index 5fa84cc..0e9d04b 100644 --- a/README +++ b/README @@ -68,7 +68,7 @@ At one time we had Executor running on the Alpha, a 64-bit environment. We actually modified gcc to support "pointer bit-fields" and were able to get Executor to run. Now that 64-bit machines are more popular, I've begun an experiment in supporting 64-bit machines -without modifying the compiler. +without modifying the compiler. See README.64 for more info. As I continue Executor's transition to a recent gnu build system I may inadvertantly push versions that don't build when using the above diff --git a/TODO b/TODO index 460254a..8b06ca7 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - Document work in progress on 64-bit port - Yank all the misleading RCS strings Update the copyright notices to make it that the code is under @@ -8,8 +6,6 @@ package up the System Folder and whatnot so that people w/o the old executor-aux can run Executor - do this before or after switching to GNU build system? - probably get rid of most of the customization stuff (don't yet wholesale kill it, since some might be useful as per-user, per-app or command line configuration) diff --git a/src/config/front-ends/sdl/sdlwin.c b/src/config/front-ends/sdl/sdlwin.c index 0886d2a..b2e7dab 100644 --- a/src/config/front-ends/sdl/sdlwin.c +++ b/src/config/front-ends/sdl/sdlwin.c @@ -131,7 +131,7 @@ vdriver_set_mode (int width, int height, int bpp, boolean_t grayscale_p) if (width == 0) { width = VDRIVER_DEFAULT_SCREEN_WIDTH; -#if true +#if 1 #warning "TODO: fixme so we can use fullscreen in Mac OS X" #else if (ROMlib_fullscreen_p) @@ -146,7 +146,7 @@ vdriver_set_mode (int width, int height, int bpp, boolean_t grayscale_p) if (height == 0) { height = VDRIVER_DEFAULT_SCREEN_HEIGHT; -#if true +#if 1 #warning "TODO: fixme so we can use fullscreen in Mac OS X" #else if (ROMlib_fullscreen_p) diff --git a/src/configure.ac b/src/configure.ac index c2678e5..72c7f47 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -98,6 +98,14 @@ AC_ARG_WITH(sound, AC_MSG_ERROR([Must use --with-sound=sdl or --with-sound=x]) fi]) +AC_DEFINE([FORCE_EXPERIMENTAL_PACKED_MACROS], [0], [Enable the macros that store Macintosh addresses in a union of a 32-bit unsigned int and an array of zero pointers; this currently doesn't work, but eventually it is how we'll support 64-bit architectures]) + +AC_ARG_WITH(incomplete-packed-macros, + [AS_HELP_STRING([--with-incomplete-packed-macros], + [use macros that will eventually allow 64-bit ports of Executor (but will not work yet)])], + [if test x"$withval" = xyes; then AC_DEFINE([FORCE_EXPERIMENTAL_PACKED_MACROS], [1]) +fi]) + if test x$host_os = xcygwin32; then # None of this is tested yet AC_CHECK_LIB(dxguid, GUID_Valid_Start_Time) diff --git a/src/ctlArrows.c b/src/ctlArrows.c index 3917bec..c17fbe6 100644 --- a/src/ctlArrows.c +++ b/src/ctlArrows.c @@ -154,7 +154,7 @@ validate_colors_for_control (ControlHandle ctl) ctl_ctab_colors[i] = default_ctl_colors[i].rgb; t_aux_c = MR (*lookup_aux_ctl (ctl)); - if (t_aux_c && HxX (t_aux_c, acCTable)) + if (t_aux_c && HxZ (t_aux_c, acCTable)) { CTabHandle c_ctab; ColorSpec *c_ctab_table; @@ -667,7 +667,7 @@ save_and_switch_to_color_port_if_needed (save_t *sp) sp->cp = * (CGrafPtr) thePort; wp = (CGrafPtr) MR (wmgr_port); sp->cp.portPixMap = (PixMapHandle) CopyMacHandle ((Handle) wp->portPixMap); - PIXMAP_BOUNDS (MR (sp->cp.portPixMap)) = thePort->portBits.bounds; + PIXMAP_BOUNDS (PPR (sp->cp.portPixMap)) = thePort->portBits.bounds; sp->cp.portVersion = wp->portVersion; sp->cp.grafVars = wp->grafVars; sp->cp.chExtra = wp->chExtra; @@ -689,7 +689,7 @@ PRIVATE void restore (const save_t *sp) { SetPort (sp->port); - DisposHandle ((Handle) MR (sp->cp.portPixMap)); + DisposHandle ((Handle) PPR (sp->cp.portPixMap)); } P4 (PUBLIC pascal, LONGINT, cdef16, /* IMI-328 */ diff --git a/src/include/CQuickDraw.h b/src/include/CQuickDraw.h index 4b80ea1..1cdee17 100644 --- a/src/include/CQuickDraw.h +++ b/src/include/CQuickDraw.h @@ -455,12 +455,18 @@ extern HIDDEN_GDHandle MainDevice_H; extern HIDDEN_GDHandle DeviceList_H; #endif +#if SIZEOF_CHAR_P == 4 && !FORCE_EXPERIMENTAL_PACKED_MACROS + # define TheGDevice (TheGDevice_H.p) # define MainDevice (MainDevice_H.p) # define DeviceList (DeviceList_H.p) -#if SIZEOF_CHAR_P == 8 -# warning "no type info in TheGDevice, MainDevice, DeviceList" +#else + +# define TheGDevice ((typeof (TheGDevice_H.type[0]))(TheGDevice_H.pp)) +# define MainDevice ((typeof MainDevice_H.type[0])(MainDevice_H.p)) +# define DeviceList ((typeof DeviceList_H.type[0])(DeviceList_H.p)) + #endif #endif /* _CQUICKDRAW_H_ */ diff --git a/src/include/MacTypes.h b/src/include/MacTypes.h index 9acc0be..d04d77b 100644 --- a/src/include/MacTypes.h +++ b/src/include/MacTypes.h @@ -15,7 +15,7 @@ typedef int8 SignedByte; typedef uint8 Byte; typedef int8 *Ptr; -#if (SIZEOF_CHAR_P == 4) || 1 /* always do this for now */ +#if (SIZEOF_CHAR_P == 4) && !FORCE_EXPERIMENTAL_PACKED_MACROS #define MAKE_HIDDEN(typ) typedef struct { typ p; } HIDDEN_ ## typ #else #define MAKE_HIDDEN(typ) \ @@ -66,11 +66,11 @@ typedef LONGINT BOOLEANRET; typedef LONGINT SignedByteRET; -#if (SIZEOF_CHAR_P == 4) || 1 +#if (SIZEOF_CHAR_P == 4) && !FORCE_EXPERIMENTAL_PACKED_MACROS # define PACKED_MEMBER(typ, name) typ name #else # define PACKED_MEMBER(typ, name) \ - union PACKED { uint32 pp; typ *type[0]; } name + union PACKED { uint32 pp; typ type[0]; } name #endif typedef struct PACKED { diff --git a/src/include/rsys/byteswap.h b/src/include/rsys/byteswap.h index c4fa255..ae97ba9 100644 --- a/src/include/rsys/byteswap.h +++ b/src/include/rsys/byteswap.h @@ -39,7 +39,7 @@ #define RM(n) ((typeof (n))(n ? ((swap32 ((unsigned long) (n)- ROMlib_offset)) ) : 0)) #else -#if (SIZEOF_CHAR_P == 4) || 1 /* always do this for now */ +#if (SIZEOF_CHAR_P == 4) && !FORCE_EXPERIMENTAL_PACKED_MACROS # define MR(n) ((typeof (n))({ typeof (n) _t = n; _t ? ((swap32 ((unsigned long) (_t))) + ROMlib_offset) : 0;})) @@ -55,7 +55,7 @@ #define RM(n) ((typeof (n))({ typeof (n) _t = n; _t ? ((swap32 ((unsigned long) (_t)- ROMlib_offset)) ) : 0;})) /* Packed Pointer to ROMlib */ -#if (SIZEOF_CHAR_P == 4) || 1 /* always do this for now */ +#if (SIZEOF_CHAR_P == 4) && !FORCE_EXPERIMENTAL_PACKED_MACROS # define PPR(n) MR(n) #else # define PPR(n) ((typeof (n.type[0]))({ typeof (n) _t = n; _t.pp ? (YY(_t.pp)) : 0;})) @@ -102,14 +102,21 @@ extern int bad_cx_splosion; #define CBC(rhs) (rhs) #define CBV(rhs) (rhs) -#if (SIZEOF_CHAR_P == 4) || 1 /* always do this for now */ +#if (SIZEOF_CHAR_P == 4) && !FORCE_EXPERIMENTAL_PACKED_MACROS # define STARH(h) MR ((h)->p) # define HxP(handle, field) MR (STARH(handle)->field) # define HxX(handle, field) (STARH(handle)->field) +# define HxZ(handle, field) HxX(handle, field) #else # define STARH(h) ((typeof ((h)->type[0])) (YY ((h)->pp))) -# define HxP(handle, field) MR ((STARH(handle)->field).p) +# define HxP(handle, field) MR ((STARH(handle)->field).pp) # define HxX(handle, field) ((STARH(handle))->field) + +// HxZ is a handle dereference where the member selected is itself some form +// of packed pointer, but we're only checking to see if it's zero or non-zero +// (e.g. if (HxZ(hand)) ) + +# define HxZ(handle, field) ((STARH(handle))->field.pp) #endif #define Hx(handle, field) Cx (STARH(handle)->field)