annotate Mac/Include/macglue.h @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents 87d658a128f9
children 98ec423ca6fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
1 /***********************************************************
5079
d6b292a33cfe Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents: 4962
diff changeset
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam,
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
3 The Netherlands.
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
4
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
5 All Rights Reserved
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
6
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
7 Permission to use, copy, modify, and distribute this software and its
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
8 documentation for any purpose and without fee is hereby granted,
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
9 provided that the above copyright notice appear in all copies and that
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
10 both that copyright notice and this permission notice appear in
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
11 supporting documentation, and that the names of Stichting Mathematisch
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
12 Centrum or CWI not be used in advertising or publicity pertaining to
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
13 distribution of the software without specific, written prior permission.
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
14
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
22
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
23 ******************************************************************/
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
24
2337
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
25 #ifndef SystemSevenOrLater
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
26 #define SystemSevenOrLater 1
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
27 #endif
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
28
2176
1e9e74944bb5 - Moved some useful routines from macosmodule.c here
Jack Jansen <jack.jansen@cwi.nl>
parents: 2136
diff changeset
29 #include <Types.h>
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
30 #include <Files.h>
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
31 #include <Events.h>
2989
04bada8d65de Added PyMac_PromptGetFile, removed stuff gone to other sources.
Jack Jansen <jack.jansen@cwi.nl>
parents: 2794
diff changeset
32 #include <StandardFile.h>
2176
1e9e74944bb5 - Moved some useful routines from macosmodule.c here
Jack Jansen <jack.jansen@cwi.nl>
parents: 2136
diff changeset
33
5710
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
34 /* Scheduler parameters */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
35 typedef struct {
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
36 int check_interrupt; /* if true check for command-dot */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
37 int process_events; /* if nonzero enable evt processing, this mask */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
38 int besocial; /* Be social, give up CPU now and again */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
39 double check_interval; /* how often to check */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
40 double bg_yield; /* yield at most so long when in background */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
41 } PyMacSchedParams;
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
42
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
43
5616
bae2c0189f85 Added PyMac_StopGUSISpin
Jack Jansen <jack.jansen@cwi.nl>
parents: 5079
diff changeset
44 #ifdef GENERATINGCFM /* Defined to 0 or 1 in Universal headers */
2337
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
45 #define HAVE_UNIVERSAL_HEADERS
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
46 #endif
71e60871c681 ported to Think C
Guido van Rossum <guido@python.org>
parents: 2312
diff changeset
47
2794
823f3a8ecfe4 Initial port to CodeWarrior CFM68K support (mainly by disabling
Jack Jansen <jack.jansen@cwi.nl>
parents: 2403
diff changeset
48 #ifdef SYMANTEC__CFM68K__
2381
ff3fc30ed760 macstrerror -> MacOS-StrError; added applet and cfm-68k support
Guido van Rossum <guido@python.org>
parents: 2350
diff changeset
49 #pragma lib_export on
ff3fc30ed760 macstrerror -> MacOS-StrError; added applet and cfm-68k support
Guido van Rossum <guido@python.org>
parents: 2350
diff changeset
50 #endif
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
51
3433
578ca302a598 Replaced previous gusi-chdir() fix by a call to PyMac_FixGUSIcd()
Jack Jansen <jack.jansen@cwi.nl>
parents: 3278
diff changeset
52 #ifdef USE_GUSI
5616
bae2c0189f85 Added PyMac_StopGUSISpin
Jack Jansen <jack.jansen@cwi.nl>
parents: 5079
diff changeset
53 void PyMac_FixGUSIcd Py_PROTO((void)); /* Workaround for GUSI chdir() call */
3433
578ca302a598 Replaced previous gusi-chdir() fix by a call to PyMac_FixGUSIcd()
Jack Jansen <jack.jansen@cwi.nl>
parents: 3278
diff changeset
54 #endif
578ca302a598 Replaced previous gusi-chdir() fix by a call to PyMac_FixGUSIcd()
Jack Jansen <jack.jansen@cwi.nl>
parents: 3278
diff changeset
55
2381
ff3fc30ed760 macstrerror -> MacOS-StrError; added applet and cfm-68k support
Guido van Rossum <guido@python.org>
parents: 2350
diff changeset
56 char *PyMac_StrError(int); /* strerror with mac errors */
ff3fc30ed760 macstrerror -> MacOS-StrError; added applet and cfm-68k support
Guido van Rossum <guido@python.org>
parents: 2350
diff changeset
57
4197
b70baba1c789 - Fixed PyMac_DoYield:
Jack Jansen <jack.jansen@cwi.nl>
parents: 3927
diff changeset
58 #ifdef USE_GUSI
b70baba1c789 - Fixed PyMac_DoYield:
Jack Jansen <jack.jansen@cwi.nl>
parents: 3927
diff changeset
59 extern int PyMac_ConsoleIsDead; /* True when exiting */
5616
bae2c0189f85 Added PyMac_StopGUSISpin
Jack Jansen <jack.jansen@cwi.nl>
parents: 5079
diff changeset
60 extern void PyMac_SetGUSISpin(void); /* Install our private GUSI spin routine */
bae2c0189f85 Added PyMac_StopGUSISpin
Jack Jansen <jack.jansen@cwi.nl>
parents: 5079
diff changeset
61 extern void PyMac_StopGUSISpin(void); /* Stop eventprocessing during exit() */
4197
b70baba1c789 - Fixed PyMac_DoYield:
Jack Jansen <jack.jansen@cwi.nl>
parents: 3927
diff changeset
62 #endif
2262
03bd79432f06 - Moved interrupt code to macglue.c
Jack Jansen <jack.jansen@cwi.nl>
parents: 2252
diff changeset
63
4227
573ed5e3879b macglue: added PyMac_AppRefNum
Jack Jansen <jack.jansen@cwi.nl>
parents: 4215
diff changeset
64 extern short PyMac_AppRefNum; /* RefNum of application rsrcfork (from macmain.c) */
5616
bae2c0189f85 Added PyMac_StopGUSISpin
Jack Jansen <jack.jansen@cwi.nl>
parents: 5079
diff changeset
65 extern FSSpec PyMac_ApplicationFSSpec; /* Application location (from macargv.c) */
bae2c0189f85 Added PyMac_StopGUSISpin
Jack Jansen <jack.jansen@cwi.nl>
parents: 5079
diff changeset
66 extern char PyMac_ApplicationPath[]; /* Application location (from macargv.c) */
4525
ffef2c30dc48 Added PyMac_GetFullPath(), PyMac_ApplicationPath and PyMac_ApplicationFSSpec
Jack Jansen <jack.jansen@cwi.nl>
parents: 4227
diff changeset
67 extern OSErr PyMac_init_application_location Py_PROTO((void)); /* Init the above */
ffef2c30dc48 Added PyMac_GetFullPath(), PyMac_ApplicationPath and PyMac_ApplicationFSSpec
Jack Jansen <jack.jansen@cwi.nl>
parents: 4227
diff changeset
68 extern OSErr PyMac_GetFullPath Py_PROTO((FSSpec *, char *)); /* convert fsspec->path (macargv.c) */
ffef2c30dc48 Added PyMac_GetFullPath(), PyMac_ApplicationPath and PyMac_ApplicationFSSpec
Jack Jansen <jack.jansen@cwi.nl>
parents: 4227
diff changeset
69 extern int PyMac_GetArgv Py_PROTO((char ***, int)); /* Get argc, argv (from macargv.c) */
4227
573ed5e3879b macglue: added PyMac_AppRefNum
Jack Jansen <jack.jansen@cwi.nl>
parents: 4215
diff changeset
70
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
71 extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
72 PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
73
5710
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
74 void PyMac_GetSchedParams Py_PROTO((PyMacSchedParams *)); /* Get schedulers params */
f1da294772cf Removed SetScheduleTimes and PyMac_DoYieldEnabled
Jack Jansen <jack.jansen@cwi.nl>
parents: 5616
diff changeset
75 void PyMac_SetSchedParams Py_PROTO((PyMacSchedParams *)); /* Set schedulers params */
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
76 PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
2276
66d6d13df4f8 Added HandleEvent method to macos, so python programs can hand back
Jack Jansen <jack.jansen@cwi.nl>
parents: 2262
diff changeset
77 PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
5751
87d658a128f9 Mods for user mainloop event handling
Jack Jansen <jack.jansen@cwi.nl>
parents: 5737
diff changeset
78 int PyMac_HandleEvent Py_PROTO((EventRecord *)); /* Handle one event, possibly in Python */
87d658a128f9 Mods for user mainloop event handling
Jack Jansen <jack.jansen@cwi.nl>
parents: 5737
diff changeset
79 void PyMac_HandleEventIntern Py_PROTO((EventRecord *)); /* Handle one event internal only */
87d658a128f9 Mods for user mainloop event handling
Jack Jansen <jack.jansen@cwi.nl>
parents: 5737
diff changeset
80 int PyMac_SetEventHandler Py_PROTO((PyObject *)); /* set python-coded event handler */
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
81
4215
0410ed3808ee Python about box implemented. Slightly convoluted, since (a) we have
Jack Jansen <jack.jansen@cwi.nl>
parents: 4197
diff changeset
82 void PyMac_InitMenuBar(void); /* Setup menu bar as we want it */
5736
4dca5329e8fc Added prototype for PyMac_RestoreMenuBar
Jack Jansen <jack.jansen@cwi.nl>
parents: 5710
diff changeset
83 void PyMac_RestoreMenuBar(void); /* Restore menu bar for ease of exiting */
4215
0410ed3808ee Python about box implemented. Slightly convoluted, since (a) we have
Jack Jansen <jack.jansen@cwi.nl>
parents: 4197
diff changeset
84
5737
d0c6b49d7101 Make imports faster on the Mac, by
Jack Jansen <jack.jansen@cwi.nl>
parents: 5736
diff changeset
85 int PyMac_FindResourceModule(PyStringObject *, char *, char *); /* Test for 'PYC ' resource in a file */
2350
a2054933775b Added support for loading pyc code from a resource.
Jack Jansen <jack.jansen@cwi.nl>
parents: 2337
diff changeset
86 PyObject * PyMac_LoadResourceModule(char *, char *); /* Load 'PYC ' resource from file */
5737
d0c6b49d7101 Make imports faster on the Mac, by
Jack Jansen <jack.jansen@cwi.nl>
parents: 5736
diff changeset
87 struct filedescr *PyMac_FindModuleExtension(char *, int *, char *); /* Look for module in single folder */
2350
a2054933775b Added support for loading pyc code from a resource.
Jack Jansen <jack.jansen@cwi.nl>
parents: 2337
diff changeset
88
2989
04bada8d65de Added PyMac_PromptGetFile, removed stuff gone to other sources.
Jack Jansen <jack.jansen@cwi.nl>
parents: 2794
diff changeset
89 int PyMac_GetDirectory(FSSpec *dirfss, char *prompt); /* Ask user for a directory */
04bada8d65de Added PyMac_PromptGetFile, removed stuff gone to other sources.
Jack Jansen <jack.jansen@cwi.nl>
parents: 2794
diff changeset
90 void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList,
04bada8d65de Added PyMac_PromptGetFile, removed stuff gone to other sources.
Jack Jansen <jack.jansen@cwi.nl>
parents: 2794
diff changeset
91 StandardFileReply *reply, char *prompt); /* Ask user for file, with prompt */
2403
72c715c004c8 - Added PyMac_GetDirectory call which asks the user to select a
Jack Jansen <jack.jansen@cwi.nl>
parents: 2381
diff changeset
92
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
93 int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
94 PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
95
3927
53e757bb67d5 PyMac_BuildNumVersion added
Jack Jansen <jack.jansen@cwi.nl>
parents: 3433
diff changeset
96 PyObject *PyMac_BuildNumVersion(NumVersion); /* Convert NumVersion to PyObject */
53e757bb67d5 PyMac_BuildNumVersion added
Jack Jansen <jack.jansen@cwi.nl>
parents: 3433
diff changeset
97
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
98 int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
99 PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
100
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
101 int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
102 PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
103
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
104 int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
105 PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */
2224
32435d33f34a cosmetics: copyright, comments
Guido van Rossum <guido@python.org>
parents: 2209
diff changeset
106
2231
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
107 int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
108 PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
109
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
110 int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for EventRecord */
1e8b347a056c Some layout changes; added EventRecord Get/Build functions (as a tuple).
Guido van Rossum <guido@python.org>
parents: 2224
diff changeset
111 PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to PyObject */
2381
ff3fc30ed760 macstrerror -> MacOS-StrError; added applet and cfm-68k support
Guido van Rossum <guido@python.org>
parents: 2350
diff changeset
112
3278
43c5e7a3fc1f Added converters for Fixed
Jack Jansen <jack.jansen@cwi.nl>
parents: 2989
diff changeset
113 int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */
43c5e7a3fc1f Added converters for Fixed
Jack Jansen <jack.jansen@cwi.nl>
parents: 2989
diff changeset
114 PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */
2381
ff3fc30ed760 macstrerror -> MacOS-StrError; added applet and cfm-68k support
Guido van Rossum <guido@python.org>
parents: 2350
diff changeset
115 void PyMac_InitApplet(void); /* Initialize and run an Applet */
4962
765d962f4449 Added PyMac_Initialize() routine, to be used by embedding programs (in
Jack Jansen <jack.jansen@cwi.nl>
parents: 4525
diff changeset
116 void PyMac_Initialize(void); /* Initialize function for embedding Python */