blob: 75803622bd64f594f33979e14f6ce0f4fc6782a8 [file] [log] [blame]
Guido van Rossumecde7811995-03-28 13:35:14 +00001\chapter{Macintosh Specific Services}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00002
Guido van Rossum86751151995-02-28 17:14:32 +00003The modules in this chapter are available on the Apple Macintosh only.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00004
Guido van Rossum66774a91996-07-21 02:20:58 +00005Aside from the modules described here there are also interfaces to
6various MacOS toolboxes, which are currently not extensively
7described. The toolboxes for which modules exist are:
Fred Drake55fca541998-02-18 15:21:26 +00008\module{AE} (Apple Events),
9\module{Cm} (Component Manager),
10\module{Ctl} (Control Manager),
11\module{Dlg} (Dialog Manager),
12\module{Evt} (Event Manager),
13\module{Fm} (Font Manager),
14\module{List} (List Manager),
15\module{Menu} (Moenu Manager),
16\module{Qd} (QuickDraw),
17\module{Qt} (QuickTime),
18\module{Res} (Resource Manager and Handles),
19\module{Scrap} (Scrap Manager),
20\module{Snd} (Sound Manager),
21\module{TE} (TextEdit),
22\module{Waste} (non-Apple \program{TextEdit} replacement) and
23\module{Win} (Window Manager).
Guido van Rossum66774a91996-07-21 02:20:58 +000024
25If applicable the module will define a number of Python objects for
26the various structures declared by the toolbox, and operations will be
27implemented as methods of the object. Other operations will be
28implemented as functions in the module. Not all operations possible in
29C will also be possible in Python (callbacks are often a problem), and
30parameters will occasionally be different in Python (input and output
31buffers, especially). All methods and functions have a \code{__doc__}
32string describing their arguments and return values, and for
33additional description you are referred to Inside Mac or similar
34works.
35
Guido van Rossum470be141995-03-17 16:07:09 +000036\section{Built-in Module \sectcode{mac}}
Fred Drake55fca541998-02-18 15:21:26 +000037\label{module-mac}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000038\bimodindex{mac}
Fred Drake55fca541998-02-18 15:21:26 +000039
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000040This module provides a subset of the operating system dependent
Fred Drake55fca541998-02-18 15:21:26 +000041functionality provided by the optional built-in module \module{posix}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000042It is best accessed through the more portable standard module
Fred Drake55fca541998-02-18 15:21:26 +000043\module{os}.
Fred Drake8a528bd1997-12-15 21:40:15 +000044\refbimodindex{posix}
45\refstmodindex{os}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000046
47The following functions are available in this module:
Fred Drake55fca541998-02-18 15:21:26 +000048\function{chdir()},
49\function{close()},
50\function{dup()},
51\function{fdopen()},
52\function{getcwd()},
53\function{lseek()},
54\function{listdir()},
55\function{mkdir()},
56\function{open()},
57\function{read()},
58\function{rename()},
59\function{rmdir()},
60\function{stat()},
61\function{sync()},
62\function{unlink()},
63\function{write()},
64as well as the exception \exception{error}. Note that the times
65returned by \function{stat()} are floating-point values, like all time
66values in MacPython.
Guido van Rossum7e42cab1996-10-15 14:37:31 +000067
Fred Drake55fca541998-02-18 15:21:26 +000068One additional function is available: \function{xstat()}. This function
69returns the same information as \function{stat()}, but with three extra
Guido van Rossum7e42cab1996-10-15 14:37:31 +000070values appended: the size of the resource fork of the file and its
714-char creator and type.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000072
Guido van Rossum470be141995-03-17 16:07:09 +000073\section{Standard Module \sectcode{macpath}}
Fred Drake55fca541998-02-18 15:21:26 +000074\label{module-macpath}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000075\stmodindex{macpath}
Fred Drake55fca541998-02-18 15:21:26 +000076
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000077This module provides a subset of the pathname manipulation functions
Fred Drake55fca541998-02-18 15:21:26 +000078available from the optional standard module \module{posixpath}. It is
79best accessed through the more portable standard module \module{os}, as
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000080\code{os.path}.
Fred Drake8a528bd1997-12-15 21:40:15 +000081\refstmodindex{posixpath}
82\refstmodindex{os}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000083
84The following functions are available in this module:
Fred Drake55fca541998-02-18 15:21:26 +000085\function{normcase()},
86\function{normpath()},
87\function{isabs()},
88\function{join()},
89\function{split()},
90\function{isdir()},
91\function{isfile()},
92\function{walk()},
93\function{exists()}.
94For other functions available in \module{posixpath} dummy counterparts
Guido van Rossum66774a91996-07-21 02:20:58 +000095are available.