1995-03-28 13:35:14 +00:00
|
|
|
\chapter{Macintosh Specific Services}
|
1994-01-02 01:22:07 +00:00
|
|
|
|
1995-02-28 17:14:32 +00:00
|
|
|
The modules in this chapter are available on the Apple Macintosh only.
|
1994-01-02 01:22:07 +00:00
|
|
|
|
1996-07-21 02:20:58 +00:00
|
|
|
Aside from the modules described here there are also interfaces to
|
|
|
|
various MacOS toolboxes, which are currently not extensively
|
|
|
|
described. The toolboxes for which modules exist are:
|
|
|
|
\code{AE} (Apple Events),
|
|
|
|
\code{Cm} (Component Manager),
|
|
|
|
\code{Ctl} (Control Manager),
|
|
|
|
\code{Dlg} (Dialog Manager),
|
|
|
|
\code{Evt} (Event Manager),
|
|
|
|
\code{Fm} (Font Manager),
|
|
|
|
\code{List} (List Manager),
|
|
|
|
\code{Menu} (Moenu Manager),
|
|
|
|
\code{Qd} (QuickDraw),
|
|
|
|
\code{Qt} (QuickTime),
|
|
|
|
\code{Res} (Resource Manager and Handles),
|
|
|
|
\code{Scrap} (Scrap Manager),
|
|
|
|
\code{Snd} (Sound Manager),
|
|
|
|
\code{TE} (TextEdit),
|
|
|
|
\code{Waste} (non-Apple TextEdit replacement) and
|
|
|
|
\code{Win} (Window Manager).
|
|
|
|
|
|
|
|
If applicable the module will define a number of Python objects for
|
|
|
|
the various structures declared by the toolbox, and operations will be
|
|
|
|
implemented as methods of the object. Other operations will be
|
|
|
|
implemented as functions in the module. Not all operations possible in
|
|
|
|
C will also be possible in Python (callbacks are often a problem), and
|
|
|
|
parameters will occasionally be different in Python (input and output
|
|
|
|
buffers, especially). All methods and functions have a \code{__doc__}
|
|
|
|
string describing their arguments and return values, and for
|
|
|
|
additional description you are referred to Inside Mac or similar
|
|
|
|
works.
|
|
|
|
|
1995-03-17 16:07:09 +00:00
|
|
|
\section{Built-in Module \sectcode{mac}}
|
1994-01-02 01:22:07 +00:00
|
|
|
|
|
|
|
\bimodindex{mac}
|
|
|
|
This module provides a subset of the operating system dependent
|
|
|
|
functionality provided by the optional built-in module \code{posix}.
|
|
|
|
It is best accessed through the more portable standard module
|
|
|
|
\code{os}.
|
|
|
|
|
|
|
|
The following functions are available in this module:
|
|
|
|
\code{chdir},
|
1996-07-21 02:20:58 +00:00
|
|
|
\code{close},
|
|
|
|
\code{dup},
|
|
|
|
\code{fdopen},
|
1994-01-02 01:22:07 +00:00
|
|
|
\code{getcwd},
|
1996-07-21 02:20:58 +00:00
|
|
|
\code{lseek},
|
1994-01-02 01:22:07 +00:00
|
|
|
\code{listdir},
|
|
|
|
\code{mkdir},
|
1996-07-21 02:20:58 +00:00
|
|
|
\code{open},
|
|
|
|
\code{read},
|
1994-01-02 01:22:07 +00:00
|
|
|
\code{rename},
|
|
|
|
\code{rmdir},
|
|
|
|
\code{stat},
|
|
|
|
\code{sync},
|
|
|
|
\code{unlink},
|
1996-07-21 02:20:58 +00:00
|
|
|
\code{write},
|
1996-10-15 14:37:31 +00:00
|
|
|
as well as the exception \code{error}. Note that the times returned by
|
|
|
|
\code{stat} are floating-point values, like all time values in
|
|
|
|
MacPython.
|
|
|
|
|
|
|
|
One additional function is available: \code{xstat}. This function
|
|
|
|
returns the same information as \code{stat}, but with three extra
|
|
|
|
values appended: the size of the resource fork of the file and its
|
|
|
|
4-char creator and type.
|
1994-01-02 01:22:07 +00:00
|
|
|
|
1995-03-17 16:07:09 +00:00
|
|
|
\section{Standard Module \sectcode{macpath}}
|
1994-01-02 01:22:07 +00:00
|
|
|
|
|
|
|
\stmodindex{macpath}
|
|
|
|
This module provides a subset of the pathname manipulation functions
|
|
|
|
available from the optional standard module \code{posixpath}. It is
|
|
|
|
best accessed through the more portable standard module \code{os}, as
|
|
|
|
\code{os.path}.
|
|
|
|
|
|
|
|
The following functions are available in this module:
|
|
|
|
\code{normcase},
|
1996-07-21 02:20:58 +00:00
|
|
|
\code{normpath},
|
1994-01-02 01:22:07 +00:00
|
|
|
\code{isabs},
|
|
|
|
\code{join},
|
|
|
|
\code{split},
|
|
|
|
\code{isdir},
|
|
|
|
\code{isfile},
|
1996-07-21 02:20:58 +00:00
|
|
|
\code{walk},
|
1994-01-02 01:22:07 +00:00
|
|
|
\code{exists}.
|
1996-07-21 02:20:58 +00:00
|
|
|
For other functions available in \code{posixpath} dummy counterparts
|
|
|
|
are available.
|