summaryrefslogtreecommitdiffstats
path: root/Doc/mac/libmac.tex
blob: 284c09c36095e0fe73ec4d00c4aa2b08b541909c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
\section{Introduction}
\label{intro}

The modules in this manual are available on the Apple Macintosh only.

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:
\module{AE} (Apple Events),
\module{Cm} (Component Manager),
\module{Ctl} (Control Manager),
\module{Dlg} (Dialog Manager),
\module{Evt} (Event Manager),
\module{Fm} (Font Manager),
\module{List} (List Manager),
\module{Menu} (Moenu Manager),
\module{Qd} (QuickDraw),
\module{Qt} (QuickTime),
\module{Res} (Resource Manager and Handles),
\module{Scrap} (Scrap Manager),
\module{Snd} (Sound Manager),
\module{TE} (TextEdit),
\module{Waste} (non-Apple \program{TextEdit} replacement) and
\module{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 \emph{Inside Macintosh} or
similar works.

The following modules are documented here:

\begin{description}

\item[mac]
--- Similar interfaces to the \module{posix} module.

\item[macpath]
--- Path manipulation functions; use via \code{os.path}.

\item[ctb]
--- Interfaces to the Communications Tool Box.  Only the Connection
Manager is currently supported.

\item[macconsole]
--- Think C's console package is available using this module.

\item[macdnr]
--- Interfaces to the Macintosh Domain Name Resolver.

\item[macfs]
--- Support for FSSpec, the Alias Manager, \program{finder} aliases,
and the Standard File package.

\item[macic]
--- Internet Config.

\item[MacOS]
--- Access to MacOS specific interpreter features.

\item[macostools]
--- Convenience routines for file manipulation.

\item[findertools]
--- Wrappers around the \program{finder}'s Apple Events interface.

\item[mactcp]
--- The MacTCP interfaces.

\item[macspeech]
--- Interface to the Macintosh Speech Manager.

\item[EasyDialogs]
--- Basic Macintosh dialogs.

\item[FrameWork]
--- Interactive application framework.

\item[MiniAEFrame]
--- Support to act as an Open Scripting Architecture (OSA) server
(``Apple Events'').

\end{description}


\section{Built-in Module \module{mac}}
\label{module-mac}
\bimodindex{mac}

This module provides a subset of the operating system dependent
functionality provided by the optional built-in module \module{posix}.
It is best accessed through the more portable standard module
\module{os}.
\refbimodindex{posix}
\refstmodindex{os}

The following functions are available in this module:
\function{chdir()},
\function{close()},
\function{dup()},
\function{fdopen()},
\function{getcwd()},
\function{lseek()},
\function{listdir()},
\function{mkdir()},
\function{open()},
\function{read()},
\function{rename()},
\function{rmdir()},
\function{stat()},
\function{sync()},
\function{unlink()},
\function{write()},
as well as the exception \exception{error}. Note that the times
returned by \function{stat()} are floating-point values, like all time
values in MacPython.

One additional function is available: \function{xstat()}. This function
returns the same information as \function{stat()}, but with three extra
values appended: the size of the resource fork of the file and its
4-character creator and type.

\section{Standard Module \module{macpath}}
\label{module-macpath}
\stmodindex{macpath}

This module provides a subset of the pathname manipulation functions
available from the optional standard module \module{posixpath}.  It is
best accessed through the more portable standard module \module{os}, as
\code{os.path}.
\refstmodindex{posixpath}
\refstmodindex{os}

The following functions are available in this module:
\function{normcase()},
\function{normpath()},
\function{isabs()},
\function{join()},
\function{split()},
\function{isdir()},
\function{isfile()},
\function{walk()},
\function{exists()}.
For other functions available in \module{posixpath} dummy counterparts
are available.