Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6143d53

Browse files
committed
Include Carbon/Carbon.h in stead of universal headers, if appropriate.
Test for TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON where appropriate.
1 parent 9f66b4a commit 6143d53

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

Mac/Modules/icgluemodule.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,29 @@ PERFORMANCE OF THIS SOFTWARE.
3434

3535
extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */
3636

37-
#if TARGET_API_MAC_CARBON
37+
#ifdef WITHOUT_FRAMEWORKS
38+
#if !TARGET_API_MAC_OS8
3839
/* The Carbon headers define PRAGMA_ALIGN_SUPPORT to something illegal,
3940
** because you shouldn't use it for Carbon. All good and well, but portable
4041
** code still needs it. So, we undefine it here.
4142
*/
4243
#undef PRAGMA_ALIGN_SUPPORTED
4344
#define PRAGMA_ALIGN_SUPPORTED 0
44-
#endif /* TARGET_API_MAC_CARBON */
45+
#endif /* !TARGET_API_MAC_OS8 */
4546

4647
#include "ICAPI.h"
48+
#else
49+
#include <Carbon/Carbon.h>
50+
typedef OSStatus ICError;
51+
/* Some fields in ICMapEntry have changed names. */
52+
#define file_type fileType
53+
#define file_creator fileCreator
54+
#define post_creator postCreator
55+
#define creator_app_name creatorAppName
56+
#define post_app_name postAppName
57+
#define MIME_type MIMEType
58+
#define entry_name entryName
59+
#endif
4760

4861
static PyObject *ErrorObject;
4962

@@ -69,7 +82,7 @@ staticforward PyTypeObject Icitype;
6982

7083
/* ---------------------------------------------------------------- */
7184

72-
#if !TARGET_API_MAC_CARBON
85+
#if TARGET_API_MAC_OS8
7386
static char ici_ICFindConfigFile__doc__[] =
7487
"()->None; Find config file in standard places"
7588
;
@@ -129,8 +142,6 @@ ici_ICChooseConfig(self, args)
129142
Py_INCREF(Py_None);
130143
return Py_None;
131144
}
132-
#endif /* !TARGET_API_MAC_CARBON */
133-
134145

135146
static char ici_ICChooseNewConfig__doc__[] =
136147
"()->None; Let the user choose a new config file"
@@ -150,6 +161,7 @@ ici_ICChooseNewConfig(self, args)
150161
Py_INCREF(Py_None);
151162
return Py_None;
152163
}
164+
#endif /* TARGET_API_MAC_OS8 */
153165

154166

155167
static char ici_ICGetSeed__doc__[] =
@@ -460,12 +472,12 @@ ici_ICMapTypeCreator(self, args)
460472

461473

462474
static struct PyMethodDef ici_methods[] = {
463-
#if !TARGET_API_MAC_CARBON
475+
#if TARGET_API_MAC_OS8
464476
{"ICFindConfigFile", (PyCFunction)ici_ICFindConfigFile, METH_VARARGS, ici_ICFindConfigFile__doc__},
465477
{"ICFindUserConfigFile", (PyCFunction)ici_ICFindUserConfigFile, METH_VARARGS, ici_ICFindUserConfigFile__doc__},
466478
{"ICChooseConfig", (PyCFunction)ici_ICChooseConfig, METH_VARARGS, ici_ICChooseConfig__doc__},
467479
{"ICChooseNewConfig", (PyCFunction)ici_ICChooseNewConfig, METH_VARARGS, ici_ICChooseNewConfig__doc__},
468-
#endif /* !TARGET_API_MAC_CARBON */
480+
#endif /* TARGET_API_MAC_OS8 */
469481
{"ICGetSeed", (PyCFunction)ici_ICGetSeed, METH_VARARGS, ici_ICGetSeed__doc__},
470482
{"ICBegin", (PyCFunction)ici_ICBegin, METH_VARARGS, ici_ICBegin__doc__},
471483
{"ICFindPrefHandle", (PyCFunction)ici_ICFindPrefHandle, METH_VARARGS, ici_ICFindPrefHandle__doc__},

Mac/Modules/macfsmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2525
#include "Python.h"
2626
#include "macglue.h"
2727

28+
#ifdef WITHOUT_FRAMEWORKS
2829
#include <Memory.h>
2930
#include <Files.h>
3031
#include <Folders.h>
3132
#include <StandardFile.h>
3233
#include <Aliases.h>
3334
#include <LowMem.h>
35+
#else
36+
#include <Carbon/Carbon.h>
37+
#endif
3438

3539
#include "getapplbycreator.h"
3640

Mac/Modules/macosmodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2828
#include "macglue.h"
2929
#include "pythonresources.h"
3030

31+
#ifdef WITHOUT_FRAMEWORKS
3132
#include <Windows.h>
3233
#include <Files.h>
3334
#include <LowMem.h>
3435
#include <Sound.h>
3536
#include <Events.h>
37+
#else
38+
#include <Carbon/Carbon.h>
39+
#endif
3640

3741
static PyObject *MacOS_Error; /* Exception MacOS.Error */
3842

@@ -354,13 +358,13 @@ MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
354358
return Py_None;
355359
}
356360

361+
#if TARGET_API_MAC_OS8
357362
/*----------------------------------------------------------------------*/
358363
/* STDWIN High Level Event interface */
359364

360365
#include <EPPC.h>
361366
#include <Events.h>
362367

363-
#if TARGET_API_MAC_OS8
364368
static char accepthle_doc[] = "Get arguments of pending high-level event";
365369

366370
static PyObject *

0 commit comments

Comments
 (0)