blob: 270620a9a117a8768f7c50807a2e584f0a7ea9a4 [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:
8\code{AE} (Apple Events),
9\code{Cm} (Component Manager),
10\code{Ctl} (Control Manager),
11\code{Dlg} (Dialog Manager),
12\code{Evt} (Event Manager),
13\code{Fm} (Font Manager),
14\code{List} (List Manager),
15\code{Menu} (Moenu Manager),
16\code{Qd} (QuickDraw),
17\code{Qt} (QuickTime),
18\code{Res} (Resource Manager and Handles),
19\code{Scrap} (Scrap Manager),
20\code{Snd} (Sound Manager),
21\code{TE} (TextEdit),
22\code{Waste} (non-Apple TextEdit replacement) and
23\code{Win} (Window Manager).
24
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}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000037
38\bimodindex{mac}
39This module provides a subset of the operating system dependent
40functionality provided by the optional built-in module \code{posix}.
41It is best accessed through the more portable standard module
42\code{os}.
43
44The following functions are available in this module:
45\code{chdir},
Guido van Rossum66774a91996-07-21 02:20:58 +000046\code{close},
47\code{dup},
48\code{fdopen},
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000049\code{getcwd},
Guido van Rossum66774a91996-07-21 02:20:58 +000050\code{lseek},
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000051\code{listdir},
52\code{mkdir},
Guido van Rossum66774a91996-07-21 02:20:58 +000053\code{open},
54\code{read},
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000055\code{rename},
56\code{rmdir},
57\code{stat},
58\code{sync},
59\code{unlink},
Guido van Rossum66774a91996-07-21 02:20:58 +000060\code{write},
Guido van Rossum7e42cab1996-10-15 14:37:31 +000061as well as the exception \code{error}. Note that the times returned by
62\code{stat} are floating-point values, like all time values in
63MacPython.
64
65One additional function is available: \code{xstat}. This function
66returns the same information as \code{stat}, but with three extra
67values appended: the size of the resource fork of the file and its
684-char creator and type.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000069
Guido van Rossum470be141995-03-17 16:07:09 +000070\section{Standard Module \sectcode{macpath}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000071
72\stmodindex{macpath}
73This module provides a subset of the pathname manipulation functions
74available from the optional standard module \code{posixpath}. It is
75best accessed through the more portable standard module \code{os}, as
76\code{os.path}.
77
78The following functions are available in this module:
79\code{normcase},
Guido van Rossum66774a91996-07-21 02:20:58 +000080\code{normpath},
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000081\code{isabs},
82\code{join},
83\code{split},
84\code{isdir},
85\code{isfile},
Guido van Rossum66774a91996-07-21 02:20:58 +000086\code{walk},
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000087\code{exists}.
Guido van Rossum66774a91996-07-21 02:20:58 +000088For other functions available in \code{posixpath} dummy counterparts
89are available.