Relocating file to Doc/mac.
This commit is contained in:
parent
2880beb3d9
commit
64958d593c
151
Doc/libctb.tex
151
Doc/libctb.tex
|
@ -1,151 +0,0 @@
|
|||
\section{Built-in Module \module{ctb}}
|
||||
\label{module-ctb}
|
||||
\bimodindex{ctb}
|
||||
|
||||
This module provides a partial interface to the Macintosh
|
||||
Communications Toolbox. Currently, only Connection Manager tools are
|
||||
supported. It may not be available in all Mac Python versions.
|
||||
\index{Communications Toolbox, Macintosh}
|
||||
\index{Macintosh Communications Toolbox}
|
||||
\index{Connection Manager}
|
||||
|
||||
\begin{datadesc}{error}
|
||||
The exception raised on errors.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{cmData}
|
||||
\dataline{cmCntl}
|
||||
\dataline{cmAttn}
|
||||
Flags for the \var{channel} argument of the \method{Read()} and
|
||||
\method{Write()} methods.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{cmFlagsEOM}
|
||||
End-of-message flag for \method{Read()} and \method{Write()}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{choose*}
|
||||
Values returned by \method{Choose()}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{cmStatus*}
|
||||
Bits in the status as returned by \method{Status()}.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{funcdesc}{available}{}
|
||||
Return \code{1} if the Communication Toolbox is available, zero otherwise.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{CMNew}{name, sizes}
|
||||
Create a connection object using the connection tool named
|
||||
\var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in,
|
||||
data out, control in, control out, attention in and attention out.
|
||||
Alternatively, passing \code{None} for \var{sizes} will result in
|
||||
default buffer sizes.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{connection object}
|
||||
\label{connection-object}
|
||||
|
||||
For all connection methods that take a \var{timeout} argument, a value
|
||||
of \code{-1} is indefinite, meaning that the command runs to completion.
|
||||
|
||||
\begin{memberdesc}[connection]{callback}
|
||||
If this member is set to a value other than \code{None} it should point
|
||||
to a function accepting a single argument (the connection
|
||||
object). This will make all connection object methods work
|
||||
asynchronously, with the callback routine being called upon
|
||||
completion.
|
||||
|
||||
\emph{Note:} for reasons beyond my understanding the callback routine
|
||||
is currently never called. You are advised against using asynchronous
|
||||
calls for the time being.
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
\begin{methoddesc}[connection]{Open}{timeout}
|
||||
Open an outgoing connection, waiting at most \var{timeout} seconds for
|
||||
the connection to be established.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Listen}{timeout}
|
||||
Wait for an incoming connection. Stop waiting after \var{timeout}
|
||||
seconds. This call is only meaningful to some tools.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{accept}{yesno}
|
||||
Accept (when \var{yesno} is non-zero) or reject an incoming call after
|
||||
\method{Listen()} returned.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Close}{timeout, now}
|
||||
Close a connection. When \var{now} is zero, the close is orderly
|
||||
(i.e.\ outstanding output is flushed, etc.)\ with a timeout of
|
||||
\var{timeout} seconds. When \var{now} is non-zero the close is
|
||||
immediate, discarding output.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Read}{len, chan, timeout}
|
||||
Read \var{len} bytes, or until \var{timeout} seconds have passed, from
|
||||
the channel \var{chan} (which is one of \constant{cmData},
|
||||
\constant{cmCntl} or \constant{cmAttn}). Return a 2-tuple:\ the data
|
||||
read and the end-of-message flag, \constant{cmFlagsEOM}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Write}{buf, chan, timeout, eom}
|
||||
Write \var{buf} to channel \var{chan}, aborting after \var{timeout}
|
||||
seconds. When \var{eom} has the value \constant{cmFlagsEOM}, an
|
||||
end-of-message indicator will be written after the data (if this
|
||||
concept has a meaning for this communication tool). The method returns
|
||||
the number of bytes written.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Status}{}
|
||||
Return connection status as the 2-tuple \code{(\var{sizes},
|
||||
\var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used
|
||||
(see \function{CMNew()}), \var{flags} is a set of bits describing the state
|
||||
of the connection.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{GetConfig}{}
|
||||
Return the configuration string of the communication tool. These
|
||||
configuration strings are tool-dependent, but usually easily parsed
|
||||
and modified.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{SetConfig}{str}
|
||||
Set the configuration string for the tool. The strings are parsed
|
||||
left-to-right, with later values taking precedence. This means
|
||||
individual configuration parameters can be modified by simply appending
|
||||
something like \code{'baud 4800'} to the end of the string returned by
|
||||
\method{GetConfig()} and passing that to this method. The method returns
|
||||
the number of characters actually parsed by the tool before it
|
||||
encountered an error (or completed successfully).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Choose}{}
|
||||
Present the user with a dialog to choose a communication tool and
|
||||
configure it. If there is an outstanding connection some choices (like
|
||||
selecting a different tool) may cause the connection to be
|
||||
aborted. The return value (one of the \constant{choose*} constants) will
|
||||
indicate this.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Idle}{}
|
||||
Give the tool a chance to use the processor. You should call this
|
||||
method regularly.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Abort}{}
|
||||
Abort an outstanding asynchronous \method{Open()} or \method{Listen()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Reset}{}
|
||||
Reset a connection. Exact meaning depends on the tool.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[connection]{Break}{length}
|
||||
Send a break. Whether this means anything, what it means and
|
||||
interpretation of the \var{length} parameter depends on the tool in
|
||||
use.
|
||||
\end{methoddesc}
|
151
Doc/libmac.tex
151
Doc/libmac.tex
|
@ -1,151 +0,0 @@
|
|||
\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.
|
|
@ -1,111 +0,0 @@
|
|||
\section{Built-in Module \module{macconsole}}
|
||||
\label{module-macconsole}
|
||||
\bimodindex{macconsole}
|
||||
|
||||
|
||||
This module is available on the Macintosh, provided Python has been
|
||||
built using the Think \C{} compiler. It provides an interface to the
|
||||
Think console package, with which basic text windows can be created.
|
||||
|
||||
\begin{datadesc}{options}
|
||||
An object allowing you to set various options when creating windows,
|
||||
see below.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{C_ECHO}
|
||||
\dataline{C_NOECHO}
|
||||
\dataline{C_CBREAK}
|
||||
\dataline{C_RAW}
|
||||
Options for the \code{setmode} method. \constant{C_ECHO} and
|
||||
\constant{C_CBREAK} enable character echo, the other two disable it,
|
||||
\constant{C_ECHO} and \constant{C_NOECHO} enable line-oriented input
|
||||
(erase/kill processing, etc).
|
||||
\end{datadesc}
|
||||
|
||||
\begin{funcdesc}{copen}{}
|
||||
Open a new console window. Return a console window object.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{fopen}{fp}
|
||||
Return the console window object corresponding with the given file
|
||||
object. \var{fp} should be one of \code{sys.stdin}, \code{sys.stdout} or
|
||||
\code{sys.stderr}.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{macconsole options object}
|
||||
These options are examined when a window is created:
|
||||
|
||||
\setindexsubitem{(macconsole option)}
|
||||
\begin{datadesc}{top}
|
||||
\dataline{left}
|
||||
The origin of the window.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{nrows}
|
||||
\dataline{ncols}
|
||||
The size of the window.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{txFont}
|
||||
\dataline{txSize}
|
||||
\dataline{txStyle}
|
||||
The font, fontsize and fontstyle to be used in the window.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{title}
|
||||
The title of the window.
|
||||
\end{datadesc}
|
||||
|
||||
\begin{datadesc}{pause_atexit}
|
||||
If set non-zero, the window will wait for user action before closing.
|
||||
\end{datadesc}
|
||||
|
||||
\subsection{console window object}
|
||||
|
||||
\setindexsubitem{(console window attribute)}
|
||||
|
||||
\begin{datadesc}{file}
|
||||
The file object corresponding to this console window. If the file is
|
||||
buffered, you should call \code{\var{file}.flush()} between
|
||||
\code{write()} and \code{read()} calls.
|
||||
\end{datadesc}
|
||||
|
||||
\setindexsubitem{(console window method)}
|
||||
|
||||
\begin{funcdesc}{setmode}{mode}
|
||||
Set the input mode of the console to \constant{C_ECHO}, etc.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{settabs}{n}
|
||||
Set the tabsize to \var{n} spaces.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{cleos}{}
|
||||
Clear to end-of-screen.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{cleol}{}
|
||||
Clear to end-of-line.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{inverse}{onoff}
|
||||
Enable inverse-video mode:\ characters with the high bit set are
|
||||
displayed in inverse video (this disables the upper half of a
|
||||
non-\ASCII{} character set).
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{gotoxy}{x, y}
|
||||
Set the cursor to position \code{(\var{x}, \var{y})}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{hide}{}
|
||||
Hide the window, remembering the contents.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{show}{}
|
||||
Show the window again.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{echo2printer}{}
|
||||
Copy everything written to the window to the printer as well.
|
||||
\end{funcdesc}
|
|
@ -1,120 +0,0 @@
|
|||
\section{Built-in Module \module{macdnr}}
|
||||
\label{module-macdnr}
|
||||
\bimodindex{macdnr}
|
||||
|
||||
This module provides an interface to the Macintosh Domain Name
|
||||
Resolver. It is usually used in conjunction with the \module{mactcp}
|
||||
module, to map hostnames to IP addresses. It may not be available in
|
||||
all Mac Python versions.
|
||||
\index{Macintosh Domain Name Resolver}
|
||||
\index{Domain Name Resolver, Macintosh}
|
||||
|
||||
The \module{macdnr} module defines the following functions:
|
||||
|
||||
|
||||
\begin{funcdesc}{Open}{\optional{filename}}
|
||||
Open the domain name resolver extension. If \var{filename} is given it
|
||||
should be the pathname of the extension, otherwise a default is
|
||||
used. Normally, this call is not needed since the other calls will
|
||||
open the extension automatically.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Close}{}
|
||||
Close the resolver extension. Again, not needed for normal use.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{StrToAddr}{hostname}
|
||||
Look up the IP address for \var{hostname}. This call returns a dnr
|
||||
result object of the ``address'' variation.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AddrToName}{addr}
|
||||
Do a reverse lookup on the 32-bit integer IP-address
|
||||
\var{addr}. Returns a dnr result object of the ``address'' variation.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AddrToStr}{addr}
|
||||
Convert the 32-bit integer IP-address \var{addr} to a dotted-decimal
|
||||
string. Returns the string.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{HInfo}{hostname}
|
||||
Query the nameservers for a \code{HInfo} record for host
|
||||
\var{hostname}. These records contain hardware and software
|
||||
information about the machine in question (if they are available in
|
||||
the first place). Returns a dnr result object of the ``hinfo''
|
||||
variety.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{MXInfo}{domain}
|
||||
Query the nameservers for a mail exchanger for \var{domain}. This is
|
||||
the hostname of a host willing to accept SMTP\index{SMTP} mail for the
|
||||
given domain. Returns a dnr result object of the ``mx'' variety.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{dnr result object}
|
||||
\label{dnr-result-object}
|
||||
|
||||
Since the DNR calls all execute asynchronously you do not get the
|
||||
results back immediately. Instead, you get a dnr result object. You
|
||||
can check this object to see whether the query is complete, and access
|
||||
its attributes to obtain the information when it is.
|
||||
|
||||
Alternatively, you can also reference the result attributes directly,
|
||||
this will result in an implicit wait for the query to complete.
|
||||
|
||||
The \member{rtnCode} and \member{cname} attributes are always
|
||||
available, the others depend on the type of query (address, hinfo or
|
||||
mx).
|
||||
|
||||
|
||||
% Add args, as in {arg1, arg2 \optional{, arg3}}
|
||||
\begin{methoddesc}[dnr result]{wait}{}
|
||||
Wait for the query to complete.
|
||||
\end{methoddesc}
|
||||
|
||||
% Add args, as in {arg1, arg2 \optional{, arg3}}
|
||||
\begin{methoddesc}[dnr result]{isdone}{}
|
||||
Return \code{1} if the query is complete.
|
||||
\end{methoddesc}
|
||||
|
||||
|
||||
\begin{memberdesc}[dnr result]{rtnCode}
|
||||
The error code returned by the query.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[dnr result]{cname}
|
||||
The canonical name of the host that was queried.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[dnr result]{ip0}
|
||||
\memberline[dnr result]{ip1}
|
||||
\memberline[dnr result]{ip2}
|
||||
\memberline[dnr result]{ip3}
|
||||
At most four integer IP addresses for this host. Unused entries are
|
||||
zero. Valid only for address queries.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[dnr result]{cpuType}
|
||||
\memberline[dnr result]{osType}
|
||||
Textual strings giving the machine type an OS name. Valid for ``hinfo''
|
||||
queries.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[dnr result]{exchange}
|
||||
The name of a mail-exchanger host. Valid for ``mx'' queries.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[dnr result]{preference}
|
||||
The preference of this mx record. Not too useful, since the Macintosh
|
||||
will only return a single mx record. Valid for ``mx'' queries only.
|
||||
\end{memberdesc}
|
||||
|
||||
The simplest way to use the module to convert names to dotted-decimal
|
||||
strings, without worrying about idle time, etc:
|
||||
\begin{verbatim}
|
||||
>>> def gethostname(name):
|
||||
... import macdnr
|
||||
... dnrr = macdnr.StrToAddr(name)
|
||||
... return macdnr.AddrToStr(dnrr.ip0)
|
||||
\end{verbatim}
|
225
Doc/libmacfs.tex
225
Doc/libmacfs.tex
|
@ -1,225 +0,0 @@
|
|||
\section{Built-in Module \module{macfs}}
|
||||
\label{module-macfs}
|
||||
\bimodindex{macfs}
|
||||
|
||||
|
||||
This module provides access to Macintosh FSSpec handling, the Alias
|
||||
Manager, \program{finder} aliases and the Standard File package.
|
||||
\index{Macintosh Alias Manager}
|
||||
\index{Alias Manager, Macintosh}
|
||||
\index{Standard File}
|
||||
|
||||
Whenever a function or method expects a \var{file} argument, this
|
||||
argument can be one of three things:\ (1) a full or partial Macintosh
|
||||
pathname, (2) an \pytype{FSSpec} object or (3) a 3-tuple \code{(\var{wdRefNum},
|
||||
\var{parID}, \var{name})} as described in \emph{Inside
|
||||
Macintosh:\ Files}\@. A description of aliases and the Standard File
|
||||
package can also be found there.
|
||||
|
||||
\begin{funcdesc}{FSSpec}{file}
|
||||
Create an \pytype{FSSpec} object for the specified file.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{RawFSSpec}{data}
|
||||
Create an \pytype{FSSpec} object given the raw data for the \C{}
|
||||
structure for the \pytype{FSSpec} as a string. This is mainly useful
|
||||
if you have obtained an \pytype{FSSpec} structure over a network.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{RawAlias}{data}
|
||||
Create an \pytype{Alias} object given the raw data for the \C{}
|
||||
structure for the alias as a string. This is mainly useful if you
|
||||
have obtained an \pytype{FSSpec} structure over a network.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{FInfo}{}
|
||||
Create a zero-filled \pytype{FInfo} object.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{ResolveAliasFile}{file}
|
||||
Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec},
|
||||
\var{isfolder}, \var{aliased})} where \var{fsspec} is the resulting
|
||||
\pytype{FSSpec} object, \var{isfolder} is true if \var{fsspec} points
|
||||
to a folder and \var{aliased} is true if the file was an alias in the
|
||||
first place (otherwise the \pytype{FSSpec} object for the file itself
|
||||
is returned).
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{StandardGetFile}{\optional{type, ...}}
|
||||
Present the user with a standard ``open input file''
|
||||
dialog. Optionally, you can pass up to four 4-character file types to limit
|
||||
the files the user can choose from. The function returns an \pytype{FSSpec}
|
||||
object and a flag indicating that the user completed the dialog
|
||||
without cancelling.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{PromptGetFile}{prompt\optional{, type, ...}}
|
||||
Similar to \function{StandardGetFile()} but allows you to specify a
|
||||
prompt.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{StandardPutFile}{prompt, \optional{default}}
|
||||
Present the user with a standard ``open output file''
|
||||
dialog. \var{prompt} is the prompt string, and the optional
|
||||
\var{default} argument initializes the output file name. The function
|
||||
returns an \pytype{FSSpec} object and a flag indicating that the user
|
||||
completed the dialog without cancelling.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetDirectory}{\optional{prompt}}
|
||||
Present the user with a non-standard ``select a directory''
|
||||
dialog. \var{prompt} is the prompt string, and the optional.
|
||||
Return an \pytype{FSSpec} object and a success-indicator.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SetFolder}{\optional{fsspec}}
|
||||
Set the folder that is initially presented to the user when one of
|
||||
the file selection dialogs is presented. \var{fsspec} should point to
|
||||
a file in the folder, not the folder itself (the file need not exist,
|
||||
though). If no argument is passed the folder will be set to the
|
||||
current directory, i.e. what \function{os.getcwd()} returns.
|
||||
|
||||
Note that starting with system 7.5 the user can change Standard File
|
||||
behaviour with the ``general controls'' controlpanel, thereby making
|
||||
this call inoperative.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{FindFolder}{where, which, create}
|
||||
Locates one of the ``special'' folders that MacOS knows about, such as
|
||||
the trash or the Preferences folder. \var{where} is the disk to
|
||||
search, \var{which} is the 4-character string specifying which folder to
|
||||
locate. Setting \var{create} causes the folder to be created if it
|
||||
does not exist. Returns a \code{(\var{vrefnum}, \var{dirid})} tuple.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{NewAliasMinimalFromFullPath}{pathname}
|
||||
Return a minimal \pytype{alias} object that points to the given file, which
|
||||
must be specified as a full pathname. This is the only way to create an
|
||||
\pytype{Alias} pointing to a non-existing file.
|
||||
|
||||
The constants for \var{where} and \var{which} can be obtained from the
|
||||
standard module \var{MACFS}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{FindApplication}{creator}
|
||||
Locate the application with 4-char creator code \var{creator}. The
|
||||
function returns an \pytype{FSSpec} object pointing to the application.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{FSSpec objects}
|
||||
\label{fsspec-objects}
|
||||
|
||||
\begin{memberdesc}[FSSpec]{data}
|
||||
The raw data from the FSSpec object, suitable for passing
|
||||
to other applications, for instance.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{as_pathname}{}
|
||||
Return the full pathname of the file described by the \pytype{FSSpec}
|
||||
object.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{as_tuple}{}
|
||||
Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of
|
||||
the file described by the \pytype{FSSpec} object.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{NewAlias}{\optional{file}}
|
||||
Create an Alias object pointing to the file described by this
|
||||
FSSpec. If the optional \var{file} parameter is present the alias
|
||||
will be relative to that file, otherwise it will be absolute.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{NewAliasMinimal}{}
|
||||
Create a minimal alias pointing to this file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{GetCreatorType}{}
|
||||
Return the 4-character creator and type of the file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{SetCreatorType}{creator, type}
|
||||
Set the 4-character creator and type of the file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{GetFInfo}{}
|
||||
Return a \pytype{FInfo} object describing the finder info for the file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{SetFInfo}{finfo}
|
||||
Set the finder info for the file to the values given as \var{finfo}
|
||||
(an \pytype{FInfo} object).
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{GetDates}{}
|
||||
Return a tuple with three floating point values representing the
|
||||
creation date, modification date and backup date of the file.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[FSSpec]{SetDates}{crdate, moddate, backupdate}
|
||||
Set the creation, modification and backup date of the file. The values
|
||||
are in the standard floating point format used for times throughout
|
||||
Python.
|
||||
\end{methoddesc}
|
||||
|
||||
|
||||
\subsection{Alias Objects}
|
||||
\label{alias-objects}
|
||||
|
||||
\begin{memberdesc}[Alias]{data}
|
||||
The raw data for the Alias record, suitable for storing in a resource
|
||||
or transmitting to other programs.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{methoddesc}[Alias]{Resolve}{\optional{file}}
|
||||
Resolve the alias. If the alias was created as a relative alias you
|
||||
should pass the file relative to which it is. Return the FSSpec for
|
||||
the file pointed to and a flag indicating whether the \pytype{Alias} object
|
||||
itself was modified during the search process. If the file does
|
||||
not exist but the path leading up to it does exist a valid fsspec
|
||||
is returned.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Alias]{GetInfo}{num}
|
||||
An interface to the \C{} routine \cfunction{GetAliasInfo()}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Alias]{Update}{file, \optional{file2}}
|
||||
Update the alias to point to the \var{file} given. If \var{file2} is
|
||||
present a relative alias will be created.
|
||||
\end{methoddesc}
|
||||
|
||||
Note that it is currently not possible to directly manipulate a
|
||||
resource as an \pytype{Alias} object. Hence, after calling
|
||||
\method{Update()} or after \method{Resolve()} indicates that the alias
|
||||
has changed the Python program is responsible for getting the
|
||||
\member{data} value from the \pytype{Alias} object and modifying the
|
||||
resource.
|
||||
|
||||
|
||||
\subsection{FInfo Objects}
|
||||
\label{finfo-objects}
|
||||
|
||||
See \emph{Inside Macintosh: Files} for a complete description of what
|
||||
the various fields mean.
|
||||
|
||||
\begin{memberdesc}[FInfo]{Creator}
|
||||
The 4-character creator code of the file.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[FInfo]{Type}
|
||||
The 4-character type code of the file.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[FInfo]{Flags}
|
||||
The finder flags for the file as 16-bit integer. The bit values in
|
||||
\var{Flags} are defined in standard module \module{MACFS}.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[FInfo]{Location}
|
||||
A Point giving the position of the file's icon in its folder.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[FInfo]{Fldr}
|
||||
The folder the file is in (as an integer).
|
||||
\end{memberdesc}
|
124
Doc/libmacic.tex
124
Doc/libmacic.tex
|
@ -1,124 +0,0 @@
|
|||
\section{Standard Module \module{ic}}
|
||||
\label{module-ic}
|
||||
\bimodindex{ic}
|
||||
|
||||
|
||||
This module provides access to Macintosh Internet Config package,
|
||||
which stores preferences for Internet programs such as mail address,
|
||||
default homepage, etc. Also, Internet Config contains an elaborate set
|
||||
of mappings from Macintosh creator/type codes to foreign filename
|
||||
extensions plus information on how to transfer files (binary, ascii,
|
||||
etc).
|
||||
|
||||
There is a low-level companion module
|
||||
\module{icglue}\refbimodindex{icglue} which provides the basic
|
||||
Internet Config access functionality. This low-level module is not
|
||||
documented, but the docstrings of the routines document the parameters
|
||||
and the routine names are the same as for the Pascal or \C{} API to
|
||||
Internet Config, so the standard IC programmers' documentation can be
|
||||
used if this module is needed.
|
||||
|
||||
The \module{ic} module defines the \exception{error} exception and
|
||||
symbolic names for all error codes Internet Config can produce; see
|
||||
the source for details.
|
||||
|
||||
\begin{excdesc}{error}
|
||||
Exception raised on errors in the \module{ic} module.
|
||||
\end{excdesc}
|
||||
|
||||
|
||||
The \module{ic} module defines the following class and function:
|
||||
|
||||
\begin{classdesc}{IC}{\optional{signature\optional{, ic}}}
|
||||
Create an internet config object. The signature is a 4-character creator
|
||||
code of the current application (default \code{'Pyth'}) which may
|
||||
influence some of ICs settings. The optional \var{ic} argument is a
|
||||
low-level \code{icglue.icinstance} created beforehand, this may be
|
||||
useful if you want to get preferences from a different config file,
|
||||
etc.
|
||||
\end{classdesc}
|
||||
|
||||
\begin{funcdesc}{launchurl}{url\optional{, hint}}
|
||||
\funcline{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
|
||||
\funcline{mapfile}{file}
|
||||
\funcline{maptypecreator}{type, creator\optional{, filename}}
|
||||
\funcline{settypecreator}{file}
|
||||
These functions are ``shortcuts'' to the methods of the same name,
|
||||
described below.
|
||||
\end{funcdesc}
|
||||
|
||||
|
||||
\subsection{IC Objects}
|
||||
|
||||
\class{IC} objects have a mapping interface, hence to obtain the mail
|
||||
address you simply get \code{\var{ic}['MailAddress']}. Assignment also
|
||||
works, and changes the option in the configuration file.
|
||||
|
||||
The module knows about various datatypes, and converts the internal IC
|
||||
representation to a ``logical'' Python data structure. Running the
|
||||
\module{ic} module standalone will run a test program that lists all
|
||||
keys and values in your IC database, this will have to server as
|
||||
documentation.
|
||||
|
||||
If the module does not know how to represent the data it returns an
|
||||
instance of the \code{ICOpaqueData} type, with the raw data in its
|
||||
\member{data} attribute. Objects of this type are also acceptable values
|
||||
for assignment.
|
||||
|
||||
Besides the dictionary interface, \class{IC} objects have the
|
||||
following methods:
|
||||
|
||||
|
||||
\begin{methoddesc}{launchurl}{url\optional{, hint}}
|
||||
Parse the given URL, lauch the correct application and pass it the
|
||||
URL. The optional \var{hint} can be a scheme name such as
|
||||
\code{'mailto:'}, in which case incomplete URLs are completed with this
|
||||
scheme. If \var{hint} is not provided, incomplete URLs are invalid.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{parseurl}{data\optional{, start\optional{, end\optional{, hint}}}}
|
||||
Find an URL somewhere in \var{data} and return start position, end
|
||||
position and the URL. The optional \var{start} and \var{end} can be
|
||||
used to limit the search, so for instance if a user clicks in a long
|
||||
textfield you can pass the whole textfield and the click-position in
|
||||
\var{start} and this routine will return the whole URL in which the
|
||||
user clicked. As above, \var{hint} is an optional scheme used to
|
||||
complete incomplete URLs.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{mapfile}{file}
|
||||
Return the mapping entry for the given \var{file}, which can be passed
|
||||
as either a filename or an \function{macfs.FSSpec()} result, and which
|
||||
need not exist.
|
||||
|
||||
The mapping entry is returned as a tuple \code{(}\var{version},
|
||||
\var{type}, \var{creator}, \var{postcreator}, \var{flags},
|
||||
\var{extension}, \var{appname}, \var{postappname}, \var{mimetype},
|
||||
\var{entryname}\code{)}, where \var{version} is the entry version
|
||||
number, \var{type} is the 4-character filetype, \var{creator} is the
|
||||
4-character creator type, \var{postcreator} is the 4-character creator
|
||||
code of an
|
||||
optional application to post-process the file after downloading,
|
||||
\var{flags} are various bits specifying whether to transfer in binary
|
||||
or ascii and such, \var{extension} is the filename extension for this
|
||||
file type, \var{appname} is the printable name of the application to
|
||||
which this file belongs, \var{postappname} is the name of the
|
||||
postprocessing application, \var{mimetype} is the MIME type of this
|
||||
file and \var{entryname} is the name of this entry.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{maptypecreator}{type, creator\optional{, filename}}
|
||||
Return the mapping entry for files with given 4-character \var{type} and
|
||||
\var{creator} codes. The optional \var{filename} may be specified to
|
||||
further help finding the correct entry (if the creator code is
|
||||
\code{'????'}, for instance).
|
||||
|
||||
The mapping entry is returned in the same format as for \var{mapfile}.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}{settypecreator}{file}
|
||||
Given an existing \var{file}, specified either as a filename or as an
|
||||
\function{macfs.FSSpec()} result, set its creator and type correctly based
|
||||
on its extension. The finder is told about the change, so the finder
|
||||
icon will be updated quickly.
|
||||
\end{methoddesc}
|
|
@ -1,95 +0,0 @@
|
|||
\section{Built-in Module \module{MacOS}}
|
||||
\label{module-MacOS}
|
||||
\bimodindex{MacOS}
|
||||
|
||||
|
||||
This module provides access to MacOS specific functionality in the
|
||||
Python interpreter, such as how the interpreter eventloop functions
|
||||
and the like. Use with care.
|
||||
|
||||
Note the capitalisation of the module name, this is a historical
|
||||
artifact.
|
||||
|
||||
\begin{excdesc}{Error}
|
||||
This exception is raised on MacOS generated errors, either from
|
||||
functions in this module or from other mac-specific modules like the
|
||||
toolbox interfaces. The arguments are the integer error code (the
|
||||
\cdata{OSErr} value) and a textual description of the error code.
|
||||
Symbolic names for all known error codes are defined in the standard
|
||||
module \module{macerrors}\refstmodindex{macerrors}.
|
||||
\end{excdesc}
|
||||
|
||||
\begin{funcdesc}{SetEventHandler}{handler}
|
||||
In the inner interpreter loop Python will occasionally check for events,
|
||||
unless disabled with \function{ScheduleParams()}. With this function you
|
||||
can pass a Python event-handler function that will be called if an event
|
||||
is available. The event is passed as parameter and the function should return
|
||||
non-zero if the event has been fully processed, otherwise event processing
|
||||
continues (by passing the event to the console window package, for instance).
|
||||
|
||||
Call \function{SetEventHandler()} without a parameter to clear the
|
||||
event handler. Setting an event handler while one is already set is an
|
||||
error.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SchedParams}{\optional{doint\optional{, evtmask\optional{,
|
||||
besocial\optional{, interval\optional{,
|
||||
bgyield}}}}}}
|
||||
Influence the interpreter inner loop event handling. \var{Interval}
|
||||
specifies how often (in seconds, floating point) the interpreter
|
||||
should enter the event processing code. When true, \var{doint} causes
|
||||
interrupt (command-dot) checking to be done. \var{evtmask} tells the
|
||||
interpreter to do event processing for events in the mask (redraws,
|
||||
mouseclicks to switch to other applications, etc). The \var{besocial}
|
||||
flag gives other processes a chance to run. They are granted minimal
|
||||
runtime when Python is in the foreground and \var{bgyield} seconds per
|
||||
\var{interval} when Python runs in the background.
|
||||
|
||||
All parameters are optional, and default to the current value. The return
|
||||
value of this function is a tuple with the old values of these options.
|
||||
Initial defaults are that all processing is enabled, checking is done every
|
||||
quarter second and the CPU is given up for a quarter second when in the
|
||||
background.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{HandleEvent}{ev}
|
||||
Pass the event record \var{ev} back to the Python event loop, or
|
||||
possibly to the handler for the \code{sys.stdout} window (based on the
|
||||
compiler used to build Python). This allows Python programs that do
|
||||
their own event handling to still have some command-period and
|
||||
window-switching capability.
|
||||
|
||||
If you attempt to call this function from an event handler set through
|
||||
\function{SetEventHandler()} you will get an exception.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetErrorString}{errno}
|
||||
Return the textual description of MacOS error code \var{errno}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{splash}{resid}
|
||||
This function will put a splash window
|
||||
on-screen, with the contents of the DLOG resource specified by
|
||||
\var{resid}. Calling with a zero argument will remove the splash
|
||||
screen. This function is useful if you want an applet to post a splash screen
|
||||
early in initialization without first having to load numerous
|
||||
extension modules.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{DebugStr}{message \optional{, object}}
|
||||
Drop to the low-level debugger with message \var{message}. The
|
||||
optional \var{object} argument is not used, but can easily be
|
||||
inspected from the debugger.
|
||||
|
||||
Note that you should use this function with extreme care: if no
|
||||
low-level debugger like MacsBug is installed this call will crash your
|
||||
system. It is intended mainly for developers of Python extension
|
||||
modules.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{openrf}{name \optional{, mode}}
|
||||
Open the resource fork of a file. Arguments are the same as for the
|
||||
built-in function \function{open()}. The object returned has file-like
|
||||
semantics, but it is not a Python file object, so there may be subtle
|
||||
differences.
|
||||
\end{funcdesc}
|
|
@ -1,99 +0,0 @@
|
|||
\section{Standard Module \module{macostools}}
|
||||
\label{module-macostools}
|
||||
\stmodindex{macostools}
|
||||
|
||||
This module contains some convenience routines for file-manipulation
|
||||
on the Macintosh.
|
||||
|
||||
The \module{macostools} module defines the following functions:
|
||||
|
||||
|
||||
\begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
|
||||
Copy file \var{src} to \var{dst}. The files can be specified as
|
||||
pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
|
||||
\var{dst} must be a pathname and the folders leading to the
|
||||
destination are created if necessary. The method copies data and
|
||||
resource fork and some finder information (creator, type, flags) and
|
||||
optionally the creation, modification and backup times (default is to
|
||||
copy them). Custom icons, comments and icon position are not copied.
|
||||
|
||||
If the source is an alias the original to which the alias points is
|
||||
copied, not the aliasfile.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{copytree}{src, dst}
|
||||
Recursively copy a file tree from \var{src} to \var{dst}, creating
|
||||
folders as needed. \var{src} and \var{dst} should be specified as
|
||||
pathnames.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{mkalias}{src, dst}
|
||||
Create a finder alias \var{dst} pointing to \var{src}. Both may be
|
||||
specified as pathnames or \pytype{FSSpec} objects.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{touched}{dst}
|
||||
Tell the finder that some bits of finder-information such as creator
|
||||
or type for file \var{dst} has changed. The file can be specified by
|
||||
pathname or fsspec. This call should prod the finder into redrawing the
|
||||
files icon.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{datadesc}{BUFSIZ}
|
||||
The buffer size for \code{copy}, default 1 megabyte.
|
||||
\end{datadesc}
|
||||
|
||||
Note that the process of creating finder aliases is not specified in
|
||||
the Apple documentation. Hence, aliases created with \function{mkalias()}
|
||||
could conceivably have incompatible behaviour in some cases.
|
||||
|
||||
\section{Standard Module \module{findertools}}
|
||||
\label{module-findertools}
|
||||
\stmodindex{findertools}
|
||||
|
||||
This module contains routines that give Python programs access to some
|
||||
functionality provided by the finder. They are implemented as wrappers
|
||||
around the AppleEvent\index{AppleEvents} interface to the finder.
|
||||
|
||||
All file and folder parameters can be specified either as full
|
||||
pathnames or as \pytype{FSSpec} objects.
|
||||
|
||||
The \module{findertools} module defines the following functions:
|
||||
|
||||
|
||||
\begin{funcdesc}{launch}{file}
|
||||
Tell the finder to launch \var{file}. What launching means depends on the file:
|
||||
applications are started, folders are opened and documents are opened
|
||||
in the correct application.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Print}{file}
|
||||
Tell the finder to print a file (again specified by full pathname or
|
||||
\pytype{FSSpec}). The behaviour is identical to selecting the file and using
|
||||
the print command in the finder.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{copy}{file, destdir}
|
||||
Tell the finder to copy a file or folder \var{file} to folder
|
||||
\var{destdir}. The function returns an \pytype{Alias} object pointing to
|
||||
the new file.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{move}{file, destdir}
|
||||
Tell the finder to move a file or folder \var{file} to folder
|
||||
\var{destdir}. The function returns an \pytype{Alias} object pointing to
|
||||
the new file.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{sleep}{}
|
||||
Tell the finder to put the Macintosh to sleep, if your machine
|
||||
supports it.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{restart}{}
|
||||
Tell the finder to perform an orderly restart of the machine.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{shutdown}{}
|
||||
Tell the finder to perform an orderly shutdown of the machine.
|
||||
\end{funcdesc}
|
|
@ -1,93 +0,0 @@
|
|||
\section{Built-in Module \module{macspeech}}
|
||||
\label{module-macspeech}
|
||||
\bimodindex{macspeech}
|
||||
|
||||
|
||||
This module provides an interface to the Macintosh Speech Manager,
|
||||
\index{Macintosh Speech Manager}
|
||||
\index{Speech Manager, Macintosh}
|
||||
allowing you to let the Macintosh utter phrases. You need a version of
|
||||
the Speech Manager extension (version 1 and 2 have been tested) in
|
||||
your \file{Extensions} folder for this to work. The module does not
|
||||
provide full access to all features of the Speech Manager yet. It may
|
||||
not be available in all Mac Python versions.
|
||||
|
||||
\begin{funcdesc}{Available}{}
|
||||
Test availability of the Speech Manager extension (and, on the
|
||||
PowerPC, the Speech Manager shared library). Return \code{0} or
|
||||
\code{1}.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Version}{}
|
||||
Return the (integer) version number of the Speech Manager.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{SpeakString}{str}
|
||||
Utter the string \var{str} using the default voice,
|
||||
asynchronously. This aborts any speech that may still be active from
|
||||
prior \function{SpeakString()} invocations.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{Busy}{}
|
||||
Return the number of speech channels busy, system-wide.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{CountVoices}{}
|
||||
Return the number of different voices available.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{GetIndVoice}{num}
|
||||
Return a \pytype{Voice} object for voice number \var{num}.
|
||||
\end{funcdesc}
|
||||
|
||||
\subsection{Voice Objects}
|
||||
\label{voice-objects}
|
||||
|
||||
Voice objects contain the description of a voice. It is currently not
|
||||
yet possible to access the parameters of a voice.
|
||||
|
||||
\setindexsubitem{(voice object method)}
|
||||
|
||||
\begin{methoddesc}[Voice]{GetGender}{}
|
||||
Return the gender of the voice: \code{0} for male, \code{1} for female
|
||||
and \code{-1} for neuter.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Voice]{NewChannel}{}
|
||||
Return a new Speech Channel object using this voice.
|
||||
\end{methoddesc}
|
||||
|
||||
\subsection{Speech Channel Objects}
|
||||
\label{speech-channel-objects}
|
||||
|
||||
A Speech Channel object allows you to speak strings with slightly more
|
||||
control than \function{SpeakString()}, and allows you to use multiple
|
||||
speakers at the same time. Please note that channel pitch and rate are
|
||||
interrelated in some way, so that to make your Macintosh sing you will
|
||||
have to adjust both.
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{SpeakText}{str}
|
||||
Start uttering the given string.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{Stop}{}
|
||||
Stop babbling.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{GetPitch}{}
|
||||
Return the current pitch of the channel, as a floating-point number.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{SetPitch}{pitch}
|
||||
Set the pitch of the channel.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{GetRate}{}
|
||||
Get the speech rate (utterances per minute) of the channel as a
|
||||
floating point number.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[Speech Channel]{SetRate}{rate}
|
||||
Set the speech rate of the channel.
|
||||
\end{methoddesc}
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
\section{Built-in Module \module{mactcp}}
|
||||
\label{module-mactcp}
|
||||
\bimodindex{mactcp}
|
||||
|
||||
|
||||
This module provides an interface to the Macintosh TCP/IP driver%
|
||||
\index{MacTCP} MacTCP\@. There is an accompanying module,
|
||||
\module{macdnr}\refbimodindex{macdnr}, which provides an interface to
|
||||
the name-server (allowing you to translate hostnames to IP addresses),
|
||||
a module \module{MACTCPconst}\refstmodindex{MACTCPconst} which has
|
||||
symbolic names for constants constants used by MacTCP. Since the
|
||||
built-in module \module{socket} is also available on the Macintosh it
|
||||
is usually easier to use sockets instead of the Macintosh-specific
|
||||
MacTCP API.
|
||||
|
||||
A complete description of the MacTCP interface can be found in the
|
||||
Apple MacTCP API documentation.
|
||||
|
||||
\begin{funcdesc}{MTU}{}
|
||||
Return the Maximum Transmit Unit (the packet size) of the network
|
||||
interface.\index{Maximum Transmit Unit}
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{IPAddr}{}
|
||||
Return the 32-bit integer IP address of the network interface.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{NetMask}{}
|
||||
Return the 32-bit integer network mask of the interface.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{TCPCreate}{size}
|
||||
Create a TCP Stream object. \var{size} is the size of the receive
|
||||
buffer, \code{4096} is suggested by various sources.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{UDPCreate}{size, port}
|
||||
Create a UDP Stream object. \var{size} is the size of the receive
|
||||
buffer (and, hence, the size of the biggest datagram you can receive
|
||||
on this port). \var{port} is the UDP port number you want to receive
|
||||
datagrams on, a value of zero will make MacTCP select a free port.
|
||||
\end{funcdesc}
|
||||
|
||||
|
||||
\subsection{TCP Stream Objects}
|
||||
|
||||
\begin{memberdesc}[TCP Stream]{asr}
|
||||
\index{asynchronous service routine}
|
||||
\index{service routine, asynchronous}
|
||||
When set to a value different than \code{None} this should refer to a
|
||||
function with two integer parameters:\ an event code and a detail. This
|
||||
function will be called upon network-generated events such as urgent
|
||||
data arrival. Macintosh documentation calls this the
|
||||
\dfn{asynchronous service routine}. In addition, it is called with
|
||||
eventcode \code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen}
|
||||
completes. This is a Python addition to the MacTCP semantics.
|
||||
It is safe to do further calls from \var{asr}.
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{PassiveOpen}{port}
|
||||
Wait for an incoming connection on TCP port \var{port} (zero makes the
|
||||
system pick a free port). The call returns immediately, and you should
|
||||
use \method{wait()} to wait for completion. You should not issue any method
|
||||
calls other than \method{wait()}, \method{isdone()} or
|
||||
\method{GetSockName()} before the call completes.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{wait}{}
|
||||
Wait for \code{PassiveOpen} to complete.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{isdone}{}
|
||||
Return \code{1} if a \code{PassiveOpen} has completed.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{GetSockName}{}
|
||||
Return the TCP address of this side of a connection as a 2-tuple
|
||||
\code{(\var{host}, \var{port})}, both integers.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{ActiveOpen}{lport, host, rport}
|
||||
Open an outgoing connection to TCP address \code{(\var{host},
|
||||
\var{rport})}. Use
|
||||
local port \var{lport} (zero makes the system pick a free port). This
|
||||
call blocks until the connection has been established.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{Send}{buf, push, urgent}
|
||||
Send data \var{buf} over the connection. \var{push} and \var{urgent}
|
||||
are flags as specified by the TCP standard.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{Rcv}{timeout}
|
||||
Receive data. The call returns when \var{timeout} seconds have passed
|
||||
or when (according to the MacTCP documentation) ``a reasonable amount
|
||||
of data has been received''. The return value is a 3-tuple
|
||||
\code{(\var{data}, \var{urgent}, \var{mark})}. If urgent data is
|
||||
outstanding \code{Rcv} will always return that before looking at any
|
||||
normal data. The first call returning urgent data will have the
|
||||
\var{urgent} flag set, the last will have the \var{mark} flag set.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{Close}{}
|
||||
Tell MacTCP that no more data will be transmitted on this
|
||||
connection. The call returns when all data has been acknowledged by
|
||||
the receiving side.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{Abort}{}
|
||||
Forcibly close both sides of a connection, ignoring outstanding data.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[TCP Stream]{Status}{}
|
||||
Return a TCP status object for this stream giving the current status
|
||||
(see below).
|
||||
\end{methoddesc}
|
||||
|
||||
|
||||
\subsection{TCP Status Objects}
|
||||
|
||||
This object has no methods, only some members holding information on
|
||||
the connection. A complete description of all fields in this objects
|
||||
can be found in the Apple documentation. The most interesting ones are:
|
||||
|
||||
\begin{memberdesc}[TCP Status]{localHost}
|
||||
\memberline{localPort}
|
||||
\memberline{remoteHost}
|
||||
\memberline{remotePort}
|
||||
The integer IP-addresses and port numbers of both endpoints of the
|
||||
connection.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[TCP Status]{sendWindow}
|
||||
The current window size.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[TCP Status]{amtUnackedData}
|
||||
The number of bytes sent but not yet acknowledged. \code{sendWindow -
|
||||
amtUnackedData} is what you can pass to \method{Send()} without
|
||||
blocking.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[TCP Status]{amtUnreadData}
|
||||
The number of bytes received but not yet read (what you can
|
||||
\method{Recv()} without blocking).
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
|
||||
\subsection{UDP Stream Objects}
|
||||
|
||||
Note that, unlike the name suggests, there is nothing stream-like
|
||||
about UDP.
|
||||
|
||||
|
||||
\begin{memberdesc}[UDP Stream]{asr}
|
||||
\index{asynchronous service routine}
|
||||
\index{service routine, asynchronous}
|
||||
The asynchronous service routine to be called on events such as
|
||||
datagram arrival without outstanding \code{Read} call. The \var{asr}
|
||||
has a single argument, the event code.
|
||||
\end{memberdesc}
|
||||
|
||||
\begin{memberdesc}[UDP Stream]{port}
|
||||
A read-only member giving the port number of this UDP Stream.
|
||||
\end{memberdesc}
|
||||
|
||||
|
||||
\begin{methoddesc}[UDP Stream]{Read}{timeout}
|
||||
Read a datagram, waiting at most \var{timeout} seconds (-1 is
|
||||
infinite). Return the data.
|
||||
\end{methoddesc}
|
||||
|
||||
\begin{methoddesc}[UDP Stream]{Write}{host, port, buf}
|
||||
Send \var{buf} as a datagram to IP-address \var{host}, port
|
||||
\var{port}.
|
||||
\end{methoddesc}
|
|
@ -1,54 +0,0 @@
|
|||
\section{Standard Module \module{EasyDialogs}}
|
||||
\label{module-EasyDialogs}
|
||||
\stmodindex{EasyDialogs}
|
||||
|
||||
The \module{EasyDialogs} module contains some simple dialogs for
|
||||
the Macintosh, modelled after the \module{stdwin} dialogs with similar
|
||||
names. All routines have an optional parameter \var{id} with which you
|
||||
can override the DLOG resource used for the dialog, as long as the
|
||||
item numbers correspond. See the source for details.
|
||||
|
||||
The \module{EasyDialogs} module defines the following functions:
|
||||
|
||||
|
||||
\begin{funcdesc}{Message}{str}
|
||||
A modal dialog with the message text \var{str}, which should be at
|
||||
most 255 characters long, is displayed. Control is returned when the
|
||||
user clicks ``OK''.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AskString}{prompt\optional{, default}}
|
||||
Ask the user to input a string value, in a modal dialog. \var{prompt}
|
||||
is the promt message, the optional \var{default} arg is the initial
|
||||
value for the string. All strings can be at most 255 bytes
|
||||
long. \function{AskString()} returns the string entered or \code{None}
|
||||
in case the user cancelled.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{AskYesNoCancel}{question\optional{, default}}
|
||||
Present a dialog with text \var{question} and three buttons labelled
|
||||
``yes'', ``no'' and ``cancel''. Return \code{1} for yes, \code{0} for
|
||||
no and \code{-1} for cancel. The default return value chosen by
|
||||
hitting return is \code{0}. This can be changed with the optional
|
||||
\var{default} argument.
|
||||
\end{funcdesc}
|
||||
|
||||
\begin{funcdesc}{ProgressBar}{\optional{label\optional{, maxval}}}
|
||||
Display a modeless progress dialog with a thermometer bar. \var{label}
|
||||
is the text string displayed (default ``Working...''), \var{maxval} is
|
||||
the value at which progress is complete (default \code{100}). The
|
||||
returned object has one method, \code{set(\var{value})}, which sets
|
||||
the value of the progress bar. The bar remains visible until the
|
||||
object returned is discarded.
|
||||
|
||||
The progress bar has a ``cancel'' button, but it is currently
|
||||
non-functional.
|
||||
\end{funcdesc}
|
||||
|
||||
Note that \module{EasyDialogs} does not currently use the notification
|
||||
manager. This means that displaying dialogs while the program is in
|
||||
the background will lead to unexpected results and possibly
|
||||
crashes. Also, all dialogs are modeless and hence expect to be at the
|
||||
top of the stacking order. This is true when the dialogs are created,
|
||||
but windows that pop-up later (like a console window) may also result
|
||||
in crashes.
|
67
Doc/mac.tex
67
Doc/mac.tex
|
@ -1,67 +0,0 @@
|
|||
\documentclass{howto}
|
||||
|
||||
\title{Macintosh Library Modules}
|
||||
|
||||
\input{boilerplate}
|
||||
|
||||
\makeindex % tell \index to actually write the
|
||||
% .idx file
|
||||
\makemodindex % ... and the module index as well.
|
||||
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
|
||||
\input{copyright}
|
||||
|
||||
\begin{abstract}
|
||||
|
||||
\noindent
|
||||
This library reference manual documents Python's extensions for the
|
||||
Macintosh. It should be used in conjunction with the \emph{Python
|
||||
Library Reference}, which documents the standard library and built-in
|
||||
types.
|
||||
|
||||
This manual assumes basic knowledge about the Python language. For an
|
||||
informal introduction to Python, see the \emph{Python Tutorial}; the
|
||||
\emph{Python Reference Manual} remains the highest authority on
|
||||
syntactic and semantic questions. Finally, the manual entitled
|
||||
\emph{Extending and Embedding the Python Interpreter} describes how to
|
||||
add new extensions to Python and how to embed it in other applications.
|
||||
|
||||
\end{abstract}
|
||||
|
||||
\tableofcontents
|
||||
|
||||
\input{libmac} % MACINTOSH ONLY
|
||||
\input{libctb}
|
||||
\input{libmacconsole}
|
||||
\input{libmacdnr}
|
||||
\input{libmacfs}
|
||||
\input{libmacic}
|
||||
\input{libmacos}
|
||||
\input{libmacostools}
|
||||
\input{libmactcp}
|
||||
\input{libmacspeech}
|
||||
\input{libmacui}
|
||||
\input{libframework}
|
||||
\input{libminiae}
|
||||
|
||||
%
|
||||
% The ugly "%begin{latexonly}" pseudo-environments are really just to
|
||||
% keep LaTeX2HTML quiet during the \renewcommand{} macros; they're
|
||||
% not really valuable.
|
||||
%
|
||||
|
||||
%begin{latexonly}
|
||||
\renewcommand{\indexname}{Module Index}
|
||||
%end{latexonly}
|
||||
\input{modmac.ind} % Module Index
|
||||
|
||||
%begin{latexonly}
|
||||
\renewcommand{\indexname}{Index}
|
||||
%end{latexonly}
|
||||
\input{mac.ind} % Index
|
||||
|
||||
\end{document}
|
Loading…
Reference in New Issue