blob: 987f290e2210985049ade1f317ee48611c6bc640 [file] [log] [blame]
Guido van Rossumecde7811995-03-28 13:35:14 +00001\chapter{Macintosh Specific Services}
Fred Drakeaf9b6e61998-02-19 19:45:19 +00002\label{macintosh}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00003
Guido van Rossum86751151995-02-28 17:14:32 +00004The modules in this chapter are available on the Apple Macintosh only.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00005
Guido van Rossum66774a91996-07-21 02:20:58 +00006Aside from the modules described here there are also interfaces to
7various MacOS toolboxes, which are currently not extensively
8described. The toolboxes for which modules exist are:
Fred Drake55fca541998-02-18 15:21:26 +00009\module{AE} (Apple Events),
10\module{Cm} (Component Manager),
11\module{Ctl} (Control Manager),
12\module{Dlg} (Dialog Manager),
13\module{Evt} (Event Manager),
14\module{Fm} (Font Manager),
15\module{List} (List Manager),
16\module{Menu} (Moenu Manager),
17\module{Qd} (QuickDraw),
18\module{Qt} (QuickTime),
19\module{Res} (Resource Manager and Handles),
20\module{Scrap} (Scrap Manager),
21\module{Snd} (Sound Manager),
22\module{TE} (TextEdit),
23\module{Waste} (non-Apple \program{TextEdit} replacement) and
24\module{Win} (Window Manager).
Guido van Rossum66774a91996-07-21 02:20:58 +000025
26If applicable the module will define a number of Python objects for
27the various structures declared by the toolbox, and operations will be
28implemented as methods of the object. Other operations will be
29implemented as functions in the module. Not all operations possible in
Fred Drakeaf9b6e61998-02-19 19:45:19 +000030\C{} will also be possible in Python (callbacks are often a problem), and
Guido van Rossum66774a91996-07-21 02:20:58 +000031parameters will occasionally be different in Python (input and output
32buffers, especially). All methods and functions have a \code{__doc__}
33string describing their arguments and return values, and for
Fred Drakeaf9b6e61998-02-19 19:45:19 +000034additional description you are referred to \emph{Inside Macintosh} or
35similar works.
36
37The following modules are documented here:
38
Fred Drake1ee492e1998-02-21 06:30:17 +000039\begin{description}
Fred Drakeaf9b6e61998-02-19 19:45:19 +000040
41\item[mac]
42--- Similar interfaces to the \module{posix} module.
43
44\item[macpath]
45--- Path manipulation functions; use via \code{os.path}.
46
47\item[ctb]
48--- Interfaces to the Communications Tool Box. Only the Connection
49Manager is currently supported.
50
51\item[macconsole]
52--- Think C's console package is available using this module.
53
54\item[macdnr]
55--- Interfaces to the Macintosh Domain Name Resolver.
56
57\item[macfs]
58--- Support for FSSpec, the Alias Manager, \program{finder} aliases,
59and the Standard File package.
60
61\item[macic]
62--- Internet Config.
63
64\item[MacOS]
65--- Access to MacOS specific interpreter features.
66
67\item[macostools]
68--- Convenience routines for file manipulation.
69
70\item[findertools]
71--- Wrappers around the \program{finder}'s Apple Events interface.
72
73\item[mactcp]
74--- The MacTCP interfaces.
75
76\item[macspeech]
77--- Interface to the Macintosh Speech Manager.
78
79\item[EasyDialogs]
80--- Basic Macintosh dialogs.
81
82\item[FrameWork]
83--- Interactive application framework.
84
85\item[MiniAEFrame]
86--- Support to act as an Open Scripting Architecture (OSA) server
87(``Apple Events'').
88
Fred Drake1ee492e1998-02-21 06:30:17 +000089\end{description}
Fred Drakeaf9b6e61998-02-19 19:45:19 +000090
Guido van Rossum66774a91996-07-21 02:20:58 +000091
Guido van Rossum470be141995-03-17 16:07:09 +000092\section{Built-in Module \sectcode{mac}}
Fred Drake55fca541998-02-18 15:21:26 +000093\label{module-mac}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000094\bimodindex{mac}
Fred Drake55fca541998-02-18 15:21:26 +000095
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000096This module provides a subset of the operating system dependent
Fred Drake55fca541998-02-18 15:21:26 +000097functionality provided by the optional built-in module \module{posix}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000098It is best accessed through the more portable standard module
Fred Drake55fca541998-02-18 15:21:26 +000099\module{os}.
Fred Drake8a528bd1997-12-15 21:40:15 +0000100\refbimodindex{posix}
101\refstmodindex{os}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000102
103The following functions are available in this module:
Fred Drake55fca541998-02-18 15:21:26 +0000104\function{chdir()},
105\function{close()},
106\function{dup()},
107\function{fdopen()},
108\function{getcwd()},
109\function{lseek()},
110\function{listdir()},
111\function{mkdir()},
112\function{open()},
113\function{read()},
114\function{rename()},
115\function{rmdir()},
116\function{stat()},
117\function{sync()},
118\function{unlink()},
119\function{write()},
120as well as the exception \exception{error}. Note that the times
121returned by \function{stat()} are floating-point values, like all time
122values in MacPython.
Guido van Rossum7e42cab1996-10-15 14:37:31 +0000123
Fred Drake55fca541998-02-18 15:21:26 +0000124One additional function is available: \function{xstat()}. This function
125returns the same information as \function{stat()}, but with three extra
Guido van Rossum7e42cab1996-10-15 14:37:31 +0000126values appended: the size of the resource fork of the file and its
1274-char creator and type.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000128
Guido van Rossum470be141995-03-17 16:07:09 +0000129\section{Standard Module \sectcode{macpath}}
Fred Drake55fca541998-02-18 15:21:26 +0000130\label{module-macpath}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000131\stmodindex{macpath}
Fred Drake55fca541998-02-18 15:21:26 +0000132
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000133This module provides a subset of the pathname manipulation functions
Fred Drake55fca541998-02-18 15:21:26 +0000134available from the optional standard module \module{posixpath}. It is
135best accessed through the more portable standard module \module{os}, as
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000136\code{os.path}.
Fred Drake8a528bd1997-12-15 21:40:15 +0000137\refstmodindex{posixpath}
138\refstmodindex{os}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000139
140The following functions are available in this module:
Fred Drake55fca541998-02-18 15:21:26 +0000141\function{normcase()},
142\function{normpath()},
143\function{isabs()},
144\function{join()},
145\function{split()},
146\function{isdir()},
147\function{isfile()},
148\function{walk()},
149\function{exists()}.
150For other functions available in \module{posixpath} dummy counterparts
Guido van Rossum66774a91996-07-21 02:20:58 +0000151are available.