Commit 61885924 authored by Fred Drake's avatar Fred Drake

Lots of markup consistency nits.

Logical markup.
parent 6251c169
...@@ -123,7 +123,7 @@ window, for instance). This is needed so that update events and such ...@@ -123,7 +123,7 @@ window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window. can be passed on to other windows like the Sioux console window.
Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch} Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch}
or its callees, since this may result in an infinite loop if the or its callees, since this may result in an infinite loop if the
code is called through the python inner-loop event handler. code is called through the Python inner-loop event handler.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{asyncevents}{onoff} \begin{funcdesc}{asyncevents}{onoff}
......
...@@ -123,7 +123,7 @@ window, for instance). This is needed so that update events and such ...@@ -123,7 +123,7 @@ window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window. can be passed on to other windows like the Sioux console window.
Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch} Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch}
or its callees, since this may result in an infinite loop if the or its callees, since this may result in an infinite loop if the
code is called through the python inner-loop event handler. code is called through the Python inner-loop event handler.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{asyncevents}{onoff} \begin{funcdesc}{asyncevents}{onoff}
......
...@@ -55,7 +55,7 @@ you simply get \code{\var{ic}['MailAddress']}. Assignment also works, ...@@ -55,7 +55,7 @@ you simply get \code{\var{ic}['MailAddress']}. Assignment also works,
and changes the option in the configuration file. and changes the option in the configuration file.
The module knows about various datatypes, and converts the internal IC The module knows about various datatypes, and converts the internal IC
representation to a ``logical'' python datastructure. Running the representation to a ``logical'' Python datastructure. Running the
\module{ic} module standalone will run a test program that lists all \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 keys and values in your IC database, this will have to server as
documentation. documentation.
......
...@@ -5,38 +5,41 @@ ...@@ -5,38 +5,41 @@
\setindexsubitem{(in module MacOS)} \setindexsubitem{(in module MacOS)}
This module provides access to MacOS specific functionality in the This module provides access to MacOS specific functionality in the
python interpreter, such as how the interpreter eventloop functions Python interpreter, such as how the interpreter eventloop functions
and the like. Use with care. and the like. Use with care.
Note the capitalisation of the module name, this is a historical Note the capitalisation of the module name, this is a historical
artefact. artifact.
\begin{excdesc}{Error} \begin{excdesc}{Error}
This exception is raised on MacOS generated errors, either from This exception is raised on MacOS generated errors, either from
functions in this module or from other mac-specific modules like the functions in this module or from other mac-specific modules like the
toolbox interfaces. The arguments are the integer error code (the toolbox interfaces. The arguments are the integer error code (the
\var{OSErr} value) and a textual description of the error code. \cdata{OSErr} value) and a textual description of the error code.
Symbolic names for all known error codes are defined in the standard Symbolic names for all known error codes are defined in the standard
module \var{macerrors}. module \module{macerrors}\refstmodindex{macerrors}.
\end{excdesc} \end{excdesc}
\begin{funcdesc}{SetEventHandler}{handler} \begin{funcdesc}{SetEventHandler}{handler}
In the inner interpreter loop Python will occasionally check for events, In the inner interpreter loop Python will occasionally check for events,
unless disabled with \var{ScheduleParams}. With this function you unless disabled with \function{ScheduleParams()}. With this function you
can pass a Python event-handler function that will be called if an event 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 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 non-zero if the event has been fully processed, otherwise event processing
continues (by passing the event to the console window package, for instance). continues (by passing the event to the console window package, for instance).
Call SetEventHandler without parameter to clear the event handler. Setting Call \function{SetEventHandler()} without a parameter to clear the
an eventhandler while one is already set is an error. event handler. Setting an event handler while one is already set is an
error.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{SchedParams}{\optional{doint, evtmask, besocial, interval, bgyield}} \begin{funcdesc}{SchedParams}{\optional{doint\optional{, evtmask\optional{,
besocial\optional{, interval\optional{,
bgyield}}}}}}
Influence the interpreter inner loop event handling. \var{Interval} Influence the interpreter inner loop event handling. \var{Interval}
specifies how often (in seconds, floating point) the interpreter specifies how often (in seconds, floating point) the interpreter
should enter the event processing code. When true, \var{doint} causes should enter the event processing code. When true, \var{doint} causes
interrupt (command-dot) checking to be done. \var{Evtmask} tells the interrupt (command-dot) checking to be done. \var{evtmask} tells the
interpreter to do event processing for events in the mask (redraws, interpreter to do event processing for events in the mask (redraws,
mouseclicks to switch to other applications, etc). The \var{besocial} mouseclicks to switch to other applications, etc). The \var{besocial}
flag gives other processes a chance to run. They are granted minimal flag gives other processes a chance to run. They are granted minimal
...@@ -51,14 +54,14 @@ background. ...@@ -51,14 +54,14 @@ background.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{HandleEvent}{ev} \begin{funcdesc}{HandleEvent}{ev}
Pass the event record \code{ev} back to the python event loop, or 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 possibly to the handler for the \code{sys.stdout} window (based on the
compiler used to build python). This allows python programs that do compiler used to build Python). This allows Python programs that do
their own event handling to still have some command-period and their own event handling to still have some command-period and
window-switching capability. window-switching capability.
If you attempt to call this function from an event handler set through If you attempt to call this function from an event handler set through
\code{SetEventHandler} you will get an exception. \function{SetEventHandler()} you will get an exception.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetErrorString}{errno} \begin{funcdesc}{GetErrorString}{errno}
...@@ -68,7 +71,7 @@ Return the textual description of MacOS error code \var{errno}. ...@@ -68,7 +71,7 @@ Return the textual description of MacOS error code \var{errno}.
\begin{funcdesc}{splash}{resid} \begin{funcdesc}{splash}{resid}
This function will put a splash window This function will put a splash window
on-screen, with the contents of the DLOG resource specified by on-screen, with the contents of the DLOG resource specified by
\code{resid}. Calling with a zero argument will remove the splash \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 screen. This function is useful if you want an applet to post a splash screen
early in initialization without first having to load numerous early in initialization without first having to load numerous
extension modules. extension modules.
...@@ -87,7 +90,7 @@ modules. ...@@ -87,7 +90,7 @@ modules.
\begin{funcdesc}{openrf}{name \optional{, mode}} \begin{funcdesc}{openrf}{name \optional{, mode}}
Open the resource fork of a file. Arguments are the same as for the Open the resource fork of a file. Arguments are the same as for the
builtin function \code{open}. The object returned has file-like 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 semantics, but it is not a Python file object, so there may be subtle
differences. differences.
\end{funcdesc} \end{funcdesc}
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
This module contains some convenience routines for file-manipulation This module contains some convenience routines for file-manipulation
on the Macintosh. on the Macintosh.
The \code{macostools} module defines the following functions: The \module{macostools} module defines the following functions:
\setindexsubitem{(in module macostools)}
\begin{funcdesc}{copy}{src, dst\optional{, createpath, copytimes}} \begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Copy file \var{src} to \var{dst}. The files can be specified as Copy file \var{src} to \var{dst}. The files can be specified as
pathnames or \code{FSSpec} objects. If \var{createpath} is non-zero pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
\var{dst} must be a pathname and the folders leading to the \var{dst} must be a pathname and the folders leading to the
destination are created if necessary. The method copies data and destination are created if necessary. The method copies data and
resource fork and some finder information (creator, type, flags) and resource fork and some finder information (creator, type, flags) and
...@@ -24,13 +23,13 @@ copied, not the aliasfile. ...@@ -24,13 +23,13 @@ copied, not the aliasfile.
\begin{funcdesc}{copytree}{src, dst} \begin{funcdesc}{copytree}{src, dst}
Recursively copy a file tree from \var{src} to \var{dst}, creating Recursively copy a file tree from \var{src} to \var{dst}, creating
folders as needed. \var{Src} and \var{dst} should be specified as folders as needed. \var{src} and \var{dst} should be specified as
pathnames. pathnames.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mkalias}{src, dst} \begin{funcdesc}{mkalias}{src, dst}
Create a finder alias \var{dst} pointing to \var{src}. Both may be Create a finder alias \var{dst} pointing to \var{src}. Both may be
specified as pathnames or \var{FSSpec} objects. specified as pathnames or \pytype{FSSpec} objects.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{touched}{dst} \begin{funcdesc}{touched}{dst}
...@@ -45,7 +44,7 @@ The buffer size for \code{copy}, default 1 megabyte. ...@@ -45,7 +44,7 @@ The buffer size for \code{copy}, default 1 megabyte.
\end{datadesc} \end{datadesc}
Note that the process of creating finder aliases is not specified in Note that the process of creating finder aliases is not specified in
the Apple documentation. Hence, aliases created with \code{mkalias} the Apple documentation. Hence, aliases created with \function{mkalias()}
could conceivably have incompatible behaviour in some cases. could conceivably have incompatible behaviour in some cases.
\section{Standard Module \sectcode{findertools}} \section{Standard Module \sectcode{findertools}}
...@@ -54,14 +53,13 @@ could conceivably have incompatible behaviour in some cases. ...@@ -54,14 +53,13 @@ could conceivably have incompatible behaviour in some cases.
This module contains routines that give Python programs access to some This module contains routines that give Python programs access to some
functionality provided by the finder. They are implemented as wrappers functionality provided by the finder. They are implemented as wrappers
around the AppleEvent interface to the finder. around the AppleEvent\index{AppleEvents} interface to the finder.
All file and folder parameters can be specified either as full All file and folder parameters can be specified either as full
pathnames or as \code{FSSpec} objects. pathnames or as \pytype{FSSpec} objects.
The \code{findertools} module defines the following functions: The \module{findertools} module defines the following functions:
\setindexsubitem{(in module macostools)}
\begin{funcdesc}{launch}{file} \begin{funcdesc}{launch}{file}
Tell the finder to launch \var{file}. What launching means depends on the file: Tell the finder to launch \var{file}. What launching means depends on the file:
...@@ -71,24 +69,25 @@ in the correct application. ...@@ -71,24 +69,25 @@ in the correct application.
\begin{funcdesc}{Print}{file} \begin{funcdesc}{Print}{file}
Tell the finder to print a file (again specified by full pathname or Tell the finder to print a file (again specified by full pathname or
FSSpec). The behaviour is identical to selecting the file and using \pytype{FSSpec}). The behaviour is identical to selecting the file and using
the print command in the finder. the print command in the finder.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{copy}{file, destdir} \begin{funcdesc}{copy}{file, destdir}
Tell the finder to copy a file or folder \var{file} to folder Tell the finder to copy a file or folder \var{file} to folder
\var{destdir}. The function returns an \code{Alias} object pointing to \var{destdir}. The function returns an \pytype{Alias} object pointing to
the new file. the new file.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{move}{file, destdir} \begin{funcdesc}{move}{file, destdir}
Tell the finder to move a file or folder \var{file} to folder Tell the finder to move a file or folder \var{file} to folder
\var{destdir}. The function returns an \code{Alias} object pointing to \var{destdir}. The function returns an \pytype{Alias} object pointing to
the new file. the new file.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sleep}{} \begin{funcdesc}{sleep}{}
Tell the finder to put the mac to sleep, if your machine supports it. Tell the finder to put the Macintosh to sleep, if your machine
supports it.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{restart}{} \begin{funcdesc}{restart}{}
......
...@@ -2,22 +2,23 @@ ...@@ -2,22 +2,23 @@
\label{module-mactcp} \label{module-mactcp}
\bimodindex{mactcp} \bimodindex{mactcp}
\setindexsubitem{(in module mactcp)}
This module provides an interface to the Macintosh TCP/IP driver This module provides an interface to the Macintosh TCP/IP driver%
MacTCP\@. There is an accompanying module \code{macdnr} which provides an \index{MacTCP} MacTCP\@. There is an accompanying module,
interface to the name-server (allowing you to translate hostnames to \module{macdnr}\refbimodindex{macdnr}, which provides an interface to
ip-addresses), a module \code{MACTCPconst} which has symbolic names for the name-server (allowing you to translate hostnames to IP addresses),
constants constants used by MacTCP. Since the builtin module a module \module{MACTCPconst}\refstmodindex{MACTCPconst} which has
\code{socket} is also available on the mac it is usually easier to use symbolic names for constants constants used by MacTCP. Since the
sockets in stead of the mac-specific MacTCP API. 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 A complete description of the MacTCP interface can be found in the
Apple MacTCP API documentation. Apple MacTCP API documentation.
\begin{funcdesc}{MTU}{} \begin{funcdesc}{MTU}{}
Return the Maximum Transmit Unit (the packet size) of the network Return the Maximum Transmit Unit (the packet size) of the network
interface. interface.\index{Maximum Transmit Unit}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{IPAddr}{} \begin{funcdesc}{IPAddr}{}
...@@ -34,141 +35,144 @@ buffer, \code{4096} is suggested by various sources. ...@@ -34,141 +35,144 @@ buffer, \code{4096} is suggested by various sources.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{UDPCreate}{size, port} \begin{funcdesc}{UDPCreate}{size, port}
Create a UDP stream object. \var{size} is the size of the receive 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 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 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. datagrams on, a value of zero will make MacTCP select a free port.
\end{funcdesc} \end{funcdesc}
\subsection{TCP Stream Objects}
\setindexsubitem{(TCP stream attribute)} \subsection{TCP Stream Objects}
\begin{datadesc}{asr} \begin{memberdesc}[TCP Stream]{asr}
When set to a value different than \code{None} this should point to a \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 with two integer parameters:\ an event code and a detail. This
function will be called upon network-generated events such as urgent function will be called upon network-generated events such as urgent
data arrival. In addition, it is called with eventcode data arrival. Macintosh documentation calls this the
\code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen} completes. This \dfn{asynchronous service routine}. In addition, it is called with
is a Python addition to the MacTCP semantics. eventcode \code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen}
It is safe to do further calls from the \code{asr}. completes. This is a Python addition to the MacTCP semantics.
\end{datadesc} It is safe to do further calls from \var{asr}.
\end{memberdesc}
\setindexsubitem{(TCP stream method)}
\begin{funcdesc}{PassiveOpen}{port} \begin{methoddesc}[TCP Stream]{PassiveOpen}{port}
Wait for an incoming connection on TCP port \var{port} (zero makes the 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 system pick a free port). The call returns immediately, and you should
use \var{wait} to wait for completion. You should not issue any method use \method{wait()} to wait for completion. You should not issue any method
calls other than calls other than \method{wait()}, \method{isdone()} or
\code{wait}, \code{isdone} or \code{GetSockName} before the call \method{GetSockName()} before the call completes.
completes. \end{methoddesc}
\end{funcdesc}
\begin{funcdesc}{wait}{} \begin{methoddesc}[TCP Stream]{wait}{}
Wait for \code{PassiveOpen} to complete. Wait for \code{PassiveOpen} to complete.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{isdone}{} \begin{methoddesc}[TCP Stream]{isdone}{}
Return 1 if a \code{PassiveOpen} has completed. Return \code{1} if a \code{PassiveOpen} has completed.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetSockName}{} \begin{methoddesc}[TCP Stream]{GetSockName}{}
Return the TCP address of this side of a connection as a 2-tuple Return the TCP address of this side of a connection as a 2-tuple
\code{(host, port)}, both integers. \code{(\var{host}, \var{port})}, both integers.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{ActiveOpen}{lport, host, rport} \begin{methoddesc}[TCP Stream]{ActiveOpen}{lport, host, rport}
Open an outgoing connection to TCP address \code{(\var{host}, \var{rport})}. Use 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 local port \var{lport} (zero makes the system pick a free port). This
call blocks until the connection has been established. call blocks until the connection has been established.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Send}{buf, push, urgent} \begin{methoddesc}[TCP Stream]{Send}{buf, push, urgent}
Send data \var{buf} over the connection. \var{Push} and \var{urgent} Send data \var{buf} over the connection. \var{push} and \var{urgent}
are flags as specified by the TCP standard. are flags as specified by the TCP standard.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Rcv}{timeout} \begin{methoddesc}[TCP Stream]{Rcv}{timeout}
Receive data. The call returns when \var{timeout} seconds have passed Receive data. The call returns when \var{timeout} seconds have passed
or when (according to the MacTCP documentation) ``a reasonable amount or when (according to the MacTCP documentation) ``a reasonable amount
of data has been received''. The return value is a 3-tuple 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} \code{(\var{data}, \var{urgent}, \var{mark})}. If urgent data is
will always return that before looking at any normal data. The first outstanding \code{Rcv} will always return that before looking at any
call returning urgent data will have the \var{urgent} flag set, the normal data. The first call returning urgent data will have the
last will have the \var{mark} flag set. \var{urgent} flag set, the last will have the \var{mark} flag set.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Close}{} \begin{methoddesc}[TCP Stream]{Close}{}
Tell MacTCP that no more data will be transmitted on this Tell MacTCP that no more data will be transmitted on this
connection. The call returns when all data has been acknowledged by connection. The call returns when all data has been acknowledged by
the receiving side. the receiving side.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Abort}{} \begin{methoddesc}[TCP Stream]{Abort}{}
Forcibly close both sides of a connection, ignoring outstanding data. Forcibly close both sides of a connection, ignoring outstanding data.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Status}{} \begin{methoddesc}[TCP Stream]{Status}{}
Return a TCP status object for this stream giving the current status Return a TCP status object for this stream giving the current status
(see below). (see below).
\end{funcdesc} \end{methoddesc}
\subsection{TCP Status Objects} \subsection{TCP Status Objects}
This object has no methods, only some members holding information on This object has no methods, only some members holding information on
the connection. A complete description of all fields in this objects the connection. A complete description of all fields in this objects
can be found in the Apple documentation. The most interesting ones are: can be found in the Apple documentation. The most interesting ones are:
\setindexsubitem{(TCP status attribute)} \begin{memberdesc}[TCP Status]{localHost}
\memberline{localPort}
\begin{datadesc}{localHost} \memberline{remoteHost}
\dataline{localPort} \memberline{remotePort}
\dataline{remoteHost}
\dataline{remotePort}
The integer IP-addresses and port numbers of both endpoints of the The integer IP-addresses and port numbers of both endpoints of the
connection. connection.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{sendWindow} \begin{memberdesc}[TCP Status]{sendWindow}
The current window size. The current window size.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{amtUnackedData} \begin{memberdesc}[TCP Status]{amtUnackedData}
The number of bytes sent but not yet acknowledged. \code{sendWindow - The number of bytes sent but not yet acknowledged. \code{sendWindow -
amtUnackedData} is what you can pass to \code{Send} without blocking. amtUnackedData} is what you can pass to \method{Send()} without
\end{datadesc} blocking.
\end{memberdesc}
\begin{datadesc}{amtUnreadData} \begin{memberdesc}[TCP Status]{amtUnreadData}
The number of bytes received but not yet read (what you can \code{Recv} The number of bytes received but not yet read (what you can
without blocking). \method{Recv()} without blocking).
\end{datadesc} \end{memberdesc}
\subsection{UDP Stream Objects} \subsection{UDP Stream Objects}
Note that, unlike the name suggests, there is nothing stream-like Note that, unlike the name suggests, there is nothing stream-like
about UDP. about UDP.
\setindexsubitem{(UDP stream attribute)}
\begin{datadesc}{asr} \begin{memberdesc}[UDP Stream]{asr}
\index{asynchronous service routine}
\index{service routine, asynchronous}
The asynchronous service routine to be called on events such as The asynchronous service routine to be called on events such as
datagram arrival without outstanding \code{Read} call. The \code{asr} has a datagram arrival without outstanding \code{Read} call. The \var{asr}
single argument, the event code. has a single argument, the event code.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{port} \begin{memberdesc}[UDP Stream]{port}
A read-only member giving the port number of this UDP stream. A read-only member giving the port number of this UDP Stream.
\end{datadesc} \end{memberdesc}
\setindexsubitem{(UDP stream method)}
\begin{funcdesc}{Read}{timeout} \begin{methoddesc}[UDP Stream]{Read}{timeout}
Read a datagram, waiting at most \var{timeout} seconds (-1 is Read a datagram, waiting at most \var{timeout} seconds (-1 is
infinite). Return the data. infinite). Return the data.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Write}{host, port, buf} \begin{methoddesc}[UDP Stream]{Write}{host, port, buf}
Send \var{buf} as a datagram to IP-address \var{host}, port Send \var{buf} as a datagram to IP-address \var{host}, port
\var{port}. \var{port}.
\end{funcdesc} \end{methoddesc}
...@@ -123,7 +123,7 @@ window, for instance). This is needed so that update events and such ...@@ -123,7 +123,7 @@ window, for instance). This is needed so that update events and such
can be passed on to other windows like the Sioux console window. can be passed on to other windows like the Sioux console window.
Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch} Calling \code{MacOS.HandleEvent} is not allowed within \var{our_dispatch}
or its callees, since this may result in an infinite loop if the or its callees, since this may result in an infinite loop if the
code is called through the python inner-loop event handler. code is called through the Python inner-loop event handler.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{asyncevents}{onoff} \begin{funcdesc}{asyncevents}{onoff}
......
...@@ -55,7 +55,7 @@ you simply get \code{\var{ic}['MailAddress']}. Assignment also works, ...@@ -55,7 +55,7 @@ you simply get \code{\var{ic}['MailAddress']}. Assignment also works,
and changes the option in the configuration file. and changes the option in the configuration file.
The module knows about various datatypes, and converts the internal IC The module knows about various datatypes, and converts the internal IC
representation to a ``logical'' python datastructure. Running the representation to a ``logical'' Python datastructure. Running the
\module{ic} module standalone will run a test program that lists all \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 keys and values in your IC database, this will have to server as
documentation. documentation.
......
...@@ -5,38 +5,41 @@ ...@@ -5,38 +5,41 @@
\setindexsubitem{(in module MacOS)} \setindexsubitem{(in module MacOS)}
This module provides access to MacOS specific functionality in the This module provides access to MacOS specific functionality in the
python interpreter, such as how the interpreter eventloop functions Python interpreter, such as how the interpreter eventloop functions
and the like. Use with care. and the like. Use with care.
Note the capitalisation of the module name, this is a historical Note the capitalisation of the module name, this is a historical
artefact. artifact.
\begin{excdesc}{Error} \begin{excdesc}{Error}
This exception is raised on MacOS generated errors, either from This exception is raised on MacOS generated errors, either from
functions in this module or from other mac-specific modules like the functions in this module or from other mac-specific modules like the
toolbox interfaces. The arguments are the integer error code (the toolbox interfaces. The arguments are the integer error code (the
\var{OSErr} value) and a textual description of the error code. \cdata{OSErr} value) and a textual description of the error code.
Symbolic names for all known error codes are defined in the standard Symbolic names for all known error codes are defined in the standard
module \var{macerrors}. module \module{macerrors}\refstmodindex{macerrors}.
\end{excdesc} \end{excdesc}
\begin{funcdesc}{SetEventHandler}{handler} \begin{funcdesc}{SetEventHandler}{handler}
In the inner interpreter loop Python will occasionally check for events, In the inner interpreter loop Python will occasionally check for events,
unless disabled with \var{ScheduleParams}. With this function you unless disabled with \function{ScheduleParams()}. With this function you
can pass a Python event-handler function that will be called if an event 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 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 non-zero if the event has been fully processed, otherwise event processing
continues (by passing the event to the console window package, for instance). continues (by passing the event to the console window package, for instance).
Call SetEventHandler without parameter to clear the event handler. Setting Call \function{SetEventHandler()} without a parameter to clear the
an eventhandler while one is already set is an error. event handler. Setting an event handler while one is already set is an
error.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{SchedParams}{\optional{doint, evtmask, besocial, interval, bgyield}} \begin{funcdesc}{SchedParams}{\optional{doint\optional{, evtmask\optional{,
besocial\optional{, interval\optional{,
bgyield}}}}}}
Influence the interpreter inner loop event handling. \var{Interval} Influence the interpreter inner loop event handling. \var{Interval}
specifies how often (in seconds, floating point) the interpreter specifies how often (in seconds, floating point) the interpreter
should enter the event processing code. When true, \var{doint} causes should enter the event processing code. When true, \var{doint} causes
interrupt (command-dot) checking to be done. \var{Evtmask} tells the interrupt (command-dot) checking to be done. \var{evtmask} tells the
interpreter to do event processing for events in the mask (redraws, interpreter to do event processing for events in the mask (redraws,
mouseclicks to switch to other applications, etc). The \var{besocial} mouseclicks to switch to other applications, etc). The \var{besocial}
flag gives other processes a chance to run. They are granted minimal flag gives other processes a chance to run. They are granted minimal
...@@ -51,14 +54,14 @@ background. ...@@ -51,14 +54,14 @@ background.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{HandleEvent}{ev} \begin{funcdesc}{HandleEvent}{ev}
Pass the event record \code{ev} back to the python event loop, or 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 possibly to the handler for the \code{sys.stdout} window (based on the
compiler used to build python). This allows python programs that do compiler used to build Python). This allows Python programs that do
their own event handling to still have some command-period and their own event handling to still have some command-period and
window-switching capability. window-switching capability.
If you attempt to call this function from an event handler set through If you attempt to call this function from an event handler set through
\code{SetEventHandler} you will get an exception. \function{SetEventHandler()} you will get an exception.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetErrorString}{errno} \begin{funcdesc}{GetErrorString}{errno}
...@@ -68,7 +71,7 @@ Return the textual description of MacOS error code \var{errno}. ...@@ -68,7 +71,7 @@ Return the textual description of MacOS error code \var{errno}.
\begin{funcdesc}{splash}{resid} \begin{funcdesc}{splash}{resid}
This function will put a splash window This function will put a splash window
on-screen, with the contents of the DLOG resource specified by on-screen, with the contents of the DLOG resource specified by
\code{resid}. Calling with a zero argument will remove the splash \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 screen. This function is useful if you want an applet to post a splash screen
early in initialization without first having to load numerous early in initialization without first having to load numerous
extension modules. extension modules.
...@@ -87,7 +90,7 @@ modules. ...@@ -87,7 +90,7 @@ modules.
\begin{funcdesc}{openrf}{name \optional{, mode}} \begin{funcdesc}{openrf}{name \optional{, mode}}
Open the resource fork of a file. Arguments are the same as for the Open the resource fork of a file. Arguments are the same as for the
builtin function \code{open}. The object returned has file-like 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 semantics, but it is not a Python file object, so there may be subtle
differences. differences.
\end{funcdesc} \end{funcdesc}
...@@ -5,13 +5,12 @@ ...@@ -5,13 +5,12 @@
This module contains some convenience routines for file-manipulation This module contains some convenience routines for file-manipulation
on the Macintosh. on the Macintosh.
The \code{macostools} module defines the following functions: The \module{macostools} module defines the following functions:
\setindexsubitem{(in module macostools)}
\begin{funcdesc}{copy}{src, dst\optional{, createpath, copytimes}} \begin{funcdesc}{copy}{src, dst\optional{, createpath\optional{, copytimes}}}
Copy file \var{src} to \var{dst}. The files can be specified as Copy file \var{src} to \var{dst}. The files can be specified as
pathnames or \code{FSSpec} objects. If \var{createpath} is non-zero pathnames or \pytype{FSSpec} objects. If \var{createpath} is non-zero
\var{dst} must be a pathname and the folders leading to the \var{dst} must be a pathname and the folders leading to the
destination are created if necessary. The method copies data and destination are created if necessary. The method copies data and
resource fork and some finder information (creator, type, flags) and resource fork and some finder information (creator, type, flags) and
...@@ -24,13 +23,13 @@ copied, not the aliasfile. ...@@ -24,13 +23,13 @@ copied, not the aliasfile.
\begin{funcdesc}{copytree}{src, dst} \begin{funcdesc}{copytree}{src, dst}
Recursively copy a file tree from \var{src} to \var{dst}, creating Recursively copy a file tree from \var{src} to \var{dst}, creating
folders as needed. \var{Src} and \var{dst} should be specified as folders as needed. \var{src} and \var{dst} should be specified as
pathnames. pathnames.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mkalias}{src, dst} \begin{funcdesc}{mkalias}{src, dst}
Create a finder alias \var{dst} pointing to \var{src}. Both may be Create a finder alias \var{dst} pointing to \var{src}. Both may be
specified as pathnames or \var{FSSpec} objects. specified as pathnames or \pytype{FSSpec} objects.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{touched}{dst} \begin{funcdesc}{touched}{dst}
...@@ -45,7 +44,7 @@ The buffer size for \code{copy}, default 1 megabyte. ...@@ -45,7 +44,7 @@ The buffer size for \code{copy}, default 1 megabyte.
\end{datadesc} \end{datadesc}
Note that the process of creating finder aliases is not specified in Note that the process of creating finder aliases is not specified in
the Apple documentation. Hence, aliases created with \code{mkalias} the Apple documentation. Hence, aliases created with \function{mkalias()}
could conceivably have incompatible behaviour in some cases. could conceivably have incompatible behaviour in some cases.
\section{Standard Module \sectcode{findertools}} \section{Standard Module \sectcode{findertools}}
...@@ -54,14 +53,13 @@ could conceivably have incompatible behaviour in some cases. ...@@ -54,14 +53,13 @@ could conceivably have incompatible behaviour in some cases.
This module contains routines that give Python programs access to some This module contains routines that give Python programs access to some
functionality provided by the finder. They are implemented as wrappers functionality provided by the finder. They are implemented as wrappers
around the AppleEvent interface to the finder. around the AppleEvent\index{AppleEvents} interface to the finder.
All file and folder parameters can be specified either as full All file and folder parameters can be specified either as full
pathnames or as \code{FSSpec} objects. pathnames or as \pytype{FSSpec} objects.
The \code{findertools} module defines the following functions: The \module{findertools} module defines the following functions:
\setindexsubitem{(in module macostools)}
\begin{funcdesc}{launch}{file} \begin{funcdesc}{launch}{file}
Tell the finder to launch \var{file}. What launching means depends on the file: Tell the finder to launch \var{file}. What launching means depends on the file:
...@@ -71,24 +69,25 @@ in the correct application. ...@@ -71,24 +69,25 @@ in the correct application.
\begin{funcdesc}{Print}{file} \begin{funcdesc}{Print}{file}
Tell the finder to print a file (again specified by full pathname or Tell the finder to print a file (again specified by full pathname or
FSSpec). The behaviour is identical to selecting the file and using \pytype{FSSpec}). The behaviour is identical to selecting the file and using
the print command in the finder. the print command in the finder.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{copy}{file, destdir} \begin{funcdesc}{copy}{file, destdir}
Tell the finder to copy a file or folder \var{file} to folder Tell the finder to copy a file or folder \var{file} to folder
\var{destdir}. The function returns an \code{Alias} object pointing to \var{destdir}. The function returns an \pytype{Alias} object pointing to
the new file. the new file.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{move}{file, destdir} \begin{funcdesc}{move}{file, destdir}
Tell the finder to move a file or folder \var{file} to folder Tell the finder to move a file or folder \var{file} to folder
\var{destdir}. The function returns an \code{Alias} object pointing to \var{destdir}. The function returns an \pytype{Alias} object pointing to
the new file. the new file.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{sleep}{} \begin{funcdesc}{sleep}{}
Tell the finder to put the mac to sleep, if your machine supports it. Tell the finder to put the Macintosh to sleep, if your machine
supports it.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{restart}{} \begin{funcdesc}{restart}{}
......
...@@ -2,22 +2,23 @@ ...@@ -2,22 +2,23 @@
\label{module-mactcp} \label{module-mactcp}
\bimodindex{mactcp} \bimodindex{mactcp}
\setindexsubitem{(in module mactcp)}
This module provides an interface to the Macintosh TCP/IP driver This module provides an interface to the Macintosh TCP/IP driver%
MacTCP\@. There is an accompanying module \code{macdnr} which provides an \index{MacTCP} MacTCP\@. There is an accompanying module,
interface to the name-server (allowing you to translate hostnames to \module{macdnr}\refbimodindex{macdnr}, which provides an interface to
ip-addresses), a module \code{MACTCPconst} which has symbolic names for the name-server (allowing you to translate hostnames to IP addresses),
constants constants used by MacTCP. Since the builtin module a module \module{MACTCPconst}\refstmodindex{MACTCPconst} which has
\code{socket} is also available on the mac it is usually easier to use symbolic names for constants constants used by MacTCP. Since the
sockets in stead of the mac-specific MacTCP API. 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 A complete description of the MacTCP interface can be found in the
Apple MacTCP API documentation. Apple MacTCP API documentation.
\begin{funcdesc}{MTU}{} \begin{funcdesc}{MTU}{}
Return the Maximum Transmit Unit (the packet size) of the network Return the Maximum Transmit Unit (the packet size) of the network
interface. interface.\index{Maximum Transmit Unit}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{IPAddr}{} \begin{funcdesc}{IPAddr}{}
...@@ -34,141 +35,144 @@ buffer, \code{4096} is suggested by various sources. ...@@ -34,141 +35,144 @@ buffer, \code{4096} is suggested by various sources.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{UDPCreate}{size, port} \begin{funcdesc}{UDPCreate}{size, port}
Create a UDP stream object. \var{size} is the size of the receive 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 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 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. datagrams on, a value of zero will make MacTCP select a free port.
\end{funcdesc} \end{funcdesc}
\subsection{TCP Stream Objects}
\setindexsubitem{(TCP stream attribute)} \subsection{TCP Stream Objects}
\begin{datadesc}{asr} \begin{memberdesc}[TCP Stream]{asr}
When set to a value different than \code{None} this should point to a \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 with two integer parameters:\ an event code and a detail. This
function will be called upon network-generated events such as urgent function will be called upon network-generated events such as urgent
data arrival. In addition, it is called with eventcode data arrival. Macintosh documentation calls this the
\code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen} completes. This \dfn{asynchronous service routine}. In addition, it is called with
is a Python addition to the MacTCP semantics. eventcode \code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen}
It is safe to do further calls from the \code{asr}. completes. This is a Python addition to the MacTCP semantics.
\end{datadesc} It is safe to do further calls from \var{asr}.
\end{memberdesc}
\setindexsubitem{(TCP stream method)}
\begin{funcdesc}{PassiveOpen}{port} \begin{methoddesc}[TCP Stream]{PassiveOpen}{port}
Wait for an incoming connection on TCP port \var{port} (zero makes the 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 system pick a free port). The call returns immediately, and you should
use \var{wait} to wait for completion. You should not issue any method use \method{wait()} to wait for completion. You should not issue any method
calls other than calls other than \method{wait()}, \method{isdone()} or
\code{wait}, \code{isdone} or \code{GetSockName} before the call \method{GetSockName()} before the call completes.
completes. \end{methoddesc}
\end{funcdesc}
\begin{funcdesc}{wait}{} \begin{methoddesc}[TCP Stream]{wait}{}
Wait for \code{PassiveOpen} to complete. Wait for \code{PassiveOpen} to complete.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{isdone}{} \begin{methoddesc}[TCP Stream]{isdone}{}
Return 1 if a \code{PassiveOpen} has completed. Return \code{1} if a \code{PassiveOpen} has completed.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{GetSockName}{} \begin{methoddesc}[TCP Stream]{GetSockName}{}
Return the TCP address of this side of a connection as a 2-tuple Return the TCP address of this side of a connection as a 2-tuple
\code{(host, port)}, both integers. \code{(\var{host}, \var{port})}, both integers.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{ActiveOpen}{lport, host, rport} \begin{methoddesc}[TCP Stream]{ActiveOpen}{lport, host, rport}
Open an outgoing connection to TCP address \code{(\var{host}, \var{rport})}. Use 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 local port \var{lport} (zero makes the system pick a free port). This
call blocks until the connection has been established. call blocks until the connection has been established.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Send}{buf, push, urgent} \begin{methoddesc}[TCP Stream]{Send}{buf, push, urgent}
Send data \var{buf} over the connection. \var{Push} and \var{urgent} Send data \var{buf} over the connection. \var{push} and \var{urgent}
are flags as specified by the TCP standard. are flags as specified by the TCP standard.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Rcv}{timeout} \begin{methoddesc}[TCP Stream]{Rcv}{timeout}
Receive data. The call returns when \var{timeout} seconds have passed Receive data. The call returns when \var{timeout} seconds have passed
or when (according to the MacTCP documentation) ``a reasonable amount or when (according to the MacTCP documentation) ``a reasonable amount
of data has been received''. The return value is a 3-tuple 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} \code{(\var{data}, \var{urgent}, \var{mark})}. If urgent data is
will always return that before looking at any normal data. The first outstanding \code{Rcv} will always return that before looking at any
call returning urgent data will have the \var{urgent} flag set, the normal data. The first call returning urgent data will have the
last will have the \var{mark} flag set. \var{urgent} flag set, the last will have the \var{mark} flag set.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Close}{} \begin{methoddesc}[TCP Stream]{Close}{}
Tell MacTCP that no more data will be transmitted on this Tell MacTCP that no more data will be transmitted on this
connection. The call returns when all data has been acknowledged by connection. The call returns when all data has been acknowledged by
the receiving side. the receiving side.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Abort}{} \begin{methoddesc}[TCP Stream]{Abort}{}
Forcibly close both sides of a connection, ignoring outstanding data. Forcibly close both sides of a connection, ignoring outstanding data.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Status}{} \begin{methoddesc}[TCP Stream]{Status}{}
Return a TCP status object for this stream giving the current status Return a TCP status object for this stream giving the current status
(see below). (see below).
\end{funcdesc} \end{methoddesc}
\subsection{TCP Status Objects} \subsection{TCP Status Objects}
This object has no methods, only some members holding information on This object has no methods, only some members holding information on
the connection. A complete description of all fields in this objects the connection. A complete description of all fields in this objects
can be found in the Apple documentation. The most interesting ones are: can be found in the Apple documentation. The most interesting ones are:
\setindexsubitem{(TCP status attribute)} \begin{memberdesc}[TCP Status]{localHost}
\memberline{localPort}
\begin{datadesc}{localHost} \memberline{remoteHost}
\dataline{localPort} \memberline{remotePort}
\dataline{remoteHost}
\dataline{remotePort}
The integer IP-addresses and port numbers of both endpoints of the The integer IP-addresses and port numbers of both endpoints of the
connection. connection.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{sendWindow} \begin{memberdesc}[TCP Status]{sendWindow}
The current window size. The current window size.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{amtUnackedData} \begin{memberdesc}[TCP Status]{amtUnackedData}
The number of bytes sent but not yet acknowledged. \code{sendWindow - The number of bytes sent but not yet acknowledged. \code{sendWindow -
amtUnackedData} is what you can pass to \code{Send} without blocking. amtUnackedData} is what you can pass to \method{Send()} without
\end{datadesc} blocking.
\end{memberdesc}
\begin{datadesc}{amtUnreadData} \begin{memberdesc}[TCP Status]{amtUnreadData}
The number of bytes received but not yet read (what you can \code{Recv} The number of bytes received but not yet read (what you can
without blocking). \method{Recv()} without blocking).
\end{datadesc} \end{memberdesc}
\subsection{UDP Stream Objects} \subsection{UDP Stream Objects}
Note that, unlike the name suggests, there is nothing stream-like Note that, unlike the name suggests, there is nothing stream-like
about UDP. about UDP.
\setindexsubitem{(UDP stream attribute)}
\begin{datadesc}{asr} \begin{memberdesc}[UDP Stream]{asr}
\index{asynchronous service routine}
\index{service routine, asynchronous}
The asynchronous service routine to be called on events such as The asynchronous service routine to be called on events such as
datagram arrival without outstanding \code{Read} call. The \code{asr} has a datagram arrival without outstanding \code{Read} call. The \var{asr}
single argument, the event code. has a single argument, the event code.
\end{datadesc} \end{memberdesc}
\begin{datadesc}{port} \begin{memberdesc}[UDP Stream]{port}
A read-only member giving the port number of this UDP stream. A read-only member giving the port number of this UDP Stream.
\end{datadesc} \end{memberdesc}
\setindexsubitem{(UDP stream method)}
\begin{funcdesc}{Read}{timeout} \begin{methoddesc}[UDP Stream]{Read}{timeout}
Read a datagram, waiting at most \var{timeout} seconds (-1 is Read a datagram, waiting at most \var{timeout} seconds (-1 is
infinite). Return the data. infinite). Return the data.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{Write}{host, port, buf} \begin{methoddesc}[UDP Stream]{Write}{host, port, buf}
Send \var{buf} as a datagram to IP-address \var{host}, port Send \var{buf} as a datagram to IP-address \var{host}, port
\var{port}. \var{port}.
\end{funcdesc} \end{methoddesc}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment