+#undef DEBUG
+#undef free
+#undef malloc
+#undef realloc
+/* Macros max and min defined in lisp.h conflict with those in
+ precompiled header Carbon.h. */
+#undef max
+#undef min
+#undef init_process
+#include <Carbon/Carbon.h>
+#if ! HAVE_MKTIME || BROKEN_MKTIME
+#undef mktime
+#define mktime emacs_mktime
+#endif
+#undef free
+#define free unexec_free
+#undef malloc
+#define malloc unexec_malloc
+#undef realloc
+#define realloc unexec_realloc
+#undef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#undef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#undef init_process
+#define init_process emacs_init_process
+#undef INFINITY
+#else /* not MAC_OSX */
+#undef SIGHUP
+#define OLDP2C 1
+#include <Carbon.h>
+#endif /* not MAC_OSX */
+#undef Z
+#define Z (current_buffer->text->z)
+#else /* not HAVE_CARBON */
+#include <QuickDraw.h> /* for WindowPtr */
+#include <QDOffscreen.h> /* for GWorldPtr */
+#include <Appearance.h> /* for ThemeCursor */
+#include <Windows.h>
+#include <Controls.h>
+#include <Gestalt.h>
+#endif /* not HAVE_CARBON */
+
+typedef WindowPtr Window;
+typedef GWorldPtr Pixmap;
+
+#define Cursor ThemeCursor
+#define No_Cursor (-1)