Commit 6bb1adc7 authored by Guido van Rossum's avatar Guido van Rossum

small changes by Soren Larsen

parent a8a8d4aa
...@@ -11,14 +11,14 @@ The sampling rate or frame rate is the number of times per second the ...@@ -11,14 +11,14 @@ The sampling rate or frame rate is the number of times per second the
sound is sampled. The number of channels indicate if the audio is sound is sampled. The number of channels indicate if the audio is
mono, stereo, or quadro. Each frame consists of one sample per mono, stereo, or quadro. Each frame consists of one sample per
channel. The sample size is the size in bytes of each sample. Thus a channel. The sample size is the size in bytes of each sample. Thus a
frame consists of nchannels*framesize bytes, and a second's worth of frame consists of \var{nchannels}*\var{framesize} bytes, and a second's worth of
audio consists of nchannels*framesize*framerate bytes. audio consists of \var{nchannels}*\var{framesize}*\var{framerate} bytes.
Module \code{aifc} defines the following function: Module \code{aifc} defines the following function:
\renewcommand{\indexsubitem}{(in module aifc)} \renewcommand{\indexsubitem}{(in module aifc)}
\begin{funcdesc}{open}{file\, mode} \begin{funcdesc}{open}{file\, mode}
Opens an AIFF or AIFF-C file and returns an object instance with Open an AIFF or AIFF-C file and return an object instance with
methods that are described below. The argument file is either a methods that are described below. The argument file is either a
string naming a file or a file object. The mode is either the string string naming a file or a file object. The mode is either the string
'r' when the file must be opened for reading, or 'w' when the file 'r' when the file must be opened for reading, or 'w' when the file
...@@ -75,7 +75,7 @@ the given id. ...@@ -75,7 +75,7 @@ the given id.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{readframes}{nframes} \begin{funcdesc}{readframes}{nframes}
Read and return the next nframes frames from the audio file. The Read and return the next \var{nframes} frames from the audio file. The
returned data is a string containing for each frame the uncompressed returned data is a string containing for each frame the uncompressed
samples of all channels. samples of all channels.
\end{funcdesc} \end{funcdesc}
...@@ -175,6 +175,6 @@ not updated. ...@@ -175,6 +175,6 @@ not updated.
\begin{funcdesc}{close}{} \begin{funcdesc}{close}{}
Close the AIFF file. The header of the file is updated to reflect the Close the AIFF file. The header of the file is updated to reflect the
actual size of the audio data After calling this method, the object actual size of the audio data. After calling this method, the object
can no longer be used. can no longer be used.
\end{funcdesc} \end{funcdesc}
\section{Built-in module \sectcode{audioop}} \section{Built-in module \sectcode{audioop}}
\bimodindex{audioop} \bimodindex{audioop}
The audioop module contains some useful operations on sound fragments. The \code{audioop} module contains some useful operations on sound fragments.
It operates on sound fragments consisting of signed integer samples of It operates on sound fragments consisting of signed integer samples
8, 16 or 32 bits wide, stored in Python strings. This is the same 8, 16 or 32 bits wide, stored in Python strings. This is the same
format as used by the \code{al} and \code{sunaudiodev} modules. All format as used by the \code{al} and \code{sunaudiodev} modules. All
scalar items are integers, unless specified otherwise. scalar items are integers, unless specified otherwise.
...@@ -19,7 +19,7 @@ per sample, etc. ...@@ -19,7 +19,7 @@ per sample, etc.
\end{excdesc} \end{excdesc}
\begin{funcdesc}{add}{fragment1\, fragment2\, width} \begin{funcdesc}{add}{fragment1\, fragment2\, width}
This function returns a fragment that is the addition of the two samples This function returns a fragment which is the addition of the two samples
passed as parameters. \var{width} is the sample width in bytes, either passed as parameters. \var{width} is the sample width in bytes, either
\code{1}, \code{2} or \code{4}. Both fragments should have the same length. \code{1}, \code{2} or \code{4}. Both fragments should have the same length.
\end{funcdesc} \end{funcdesc}
...@@ -60,8 +60,8 @@ passed as an argument. ...@@ -60,8 +60,8 @@ passed as an argument.
\begin{funcdesc}{findfactor}{fragment\, reference} \begin{funcdesc}{findfactor}{fragment\, reference}
This routine (which only accepts 2-byte sample fragments) calculates a This routine (which only accepts 2-byte sample fragments) calculates a
factor \var{F} such that \code{rms(add(fragment, mul(reference, -F)))} factor \var{F} such that \code{rms(add(fragment, mul(reference, -F)))}
is minimal, i.e. it calculates the factor with which you should is minimal, i.e.\ it calculates the factor with which you should
multiply \var{reference} to make it match as good as possible to multiply \var{reference} to make it match as well as possible to
\var{fragment}. The fragments should be the same size. \var{fragment}. The fragments should be the same size.
The time taken by this routine is proportional to \code{len(fragment)}. The time taken by this routine is proportional to \code{len(fragment)}.
...@@ -69,7 +69,7 @@ The time taken by this routine is proportional to \code{len(fragment)}. ...@@ -69,7 +69,7 @@ The time taken by this routine is proportional to \code{len(fragment)}.
\begin{funcdesc}{findfit}{fragment\, reference} \begin{funcdesc}{findfit}{fragment\, reference}
This routine (which only accepts 2-byte sample fragments) tries to This routine (which only accepts 2-byte sample fragments) tries to
match \var{reference} as good as possible to a portion of match \var{reference} as well as possible to a portion of
\var{fragment} (which should be the longer fragment). It \var{fragment} (which should be the longer fragment). It
(conceptually) does this by taking slices out of \var{fragment}, using (conceptually) does this by taking slices out of \var{fragment}, using
\code{findfactor} to compute the best match, and minimizing the \code{findfactor} to compute the best match, and minimizing the
...@@ -81,8 +81,8 @@ and \var{factor} the floating-point factor as per \code{findfactor}. ...@@ -81,8 +81,8 @@ and \var{factor} the floating-point factor as per \code{findfactor}.
\begin{funcdesc}{findmax}{fragment\, length} \begin{funcdesc}{findmax}{fragment\, length}
This routine (which only accepts 2-byte sample fragments) searches This routine (which only accepts 2-byte sample fragments) searches
\var{fragment} for a slice of length \var{length} samples (not bytes!) \var{fragment} for a slice of length \var{length} samples (not bytes!)\
with maximum energy, i.e. it returns \var{i} for which with maximum energy, i.e.\ it returns \var{i} for which
\code{rms(fragment[i*2:(i+length)*2])} is maximal. \code{rms(fragment[i*2:(i+length)*2])} is maximal.
The routine takes time proportional to \code{len(fragment)}. The routine takes time proportional to \code{len(fragment)}.
...@@ -140,7 +140,7 @@ This function returns the maximum peak-peak value in the sound fragment. ...@@ -140,7 +140,7 @@ This function returns the maximum peak-peak value in the sound fragment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mul}{fragment\, width\, factor} \begin{funcdesc}{mul}{fragment\, width\, factor}
Mul returns a fragment that has all samples in the original framgent Return a fragment that has all samples in the original framgent
multiplied by the floating-point value \var{factor}. Overflow is multiplied by the floating-point value \var{factor}. Overflow is
silently ignored. silently ignored.
\end{funcdesc} \end{funcdesc}
...@@ -150,25 +150,6 @@ This function reverses the samples in a fragment and returns the ...@@ -150,25 +150,6 @@ This function reverses the samples in a fragment and returns the
modified fragment. modified fragment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tomono}{fragment\, width\, lfactor\, rfactor}
This function converts a stereo fragment to a mono fragment. The left
channel is multiplied by \var{lfactor} and the right channel by
\var{rfactor} before adding the two channels to give a mono signal.
\end{funcdesc}
\begin{funcdesc}{tostereo}{fragment\, width\, lfactor\, rfactor}
This function generates a stereo fragment from a mono fragment. Each
pair of samples in the stereo fragment are computed from the mono
sample, whereby left channel samples are multiplied by \var{lfactor}
and right channel samples by \var{rfactor}.
\end{funcdesc}
\begin{funcdesc}{mul}{fragment\, width\, factor}
Mul returns a fragment that has all samples in the original framgent
multiplied by the floating-point value \var{factor}. Overflow is
silently ignored.
\end{funcdesc}
\begin{funcdesc}{rms}{fragment\, width\, factor} \begin{funcdesc}{rms}{fragment\, width\, factor}
Returns the root-mean-square of the fragment, i.e. Returns the root-mean-square of the fragment, i.e.
\iftexi \iftexi
...@@ -184,6 +165,19 @@ divided by the sumber of samples. ...@@ -184,6 +165,19 @@ divided by the sumber of samples.
This is a measure of the power in an audio signal. This is a measure of the power in an audio signal.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tomono}{fragment\, width\, lfactor\, rfactor}
This function converts a stereo fragment to a mono fragment. The left
channel is multiplied by \var{lfactor} and the right channel by
\var{rfactor} before adding the two channels to give a mono signal.
\end{funcdesc}
\begin{funcdesc}{tostereo}{fragment\, width\, lfactor\, rfactor}
This function generates a stereo fragment from a mono fragment. Each
pair of samples in the stereo fragment are computed from the mono
sample, whereby left channel samples are multiplied by \var{lfactor}
and right channel samples by \var{rfactor}.
\end{funcdesc}
\begin{funcdesc}{ulaw2lin}{fragment\, width} \begin{funcdesc}{ulaw2lin}{fragment\, width}
This function converts sound fragments in ULAW encoding to linearly This function converts sound fragments in ULAW encoding to linearly
encoded sound fragments. ULAW encoding always uses 8 bits samples, so encoded sound fragments. ULAW encoding always uses 8 bits samples, so
...@@ -191,7 +185,7 @@ encoded sound fragments. ULAW encoding always uses 8 bits samples, so ...@@ -191,7 +185,7 @@ encoded sound fragments. ULAW encoding always uses 8 bits samples, so
\end{funcdesc} \end{funcdesc}
Note that operations such as \code{mul} or \code{max} make no Note that operations such as \code{mul} or \code{max} make no
distinction between mono and stereo fragments, i.e. all samples are distinction between mono and stereo fragments, i.e.\ all samples are
treated equal. If this is a problem the stereo fragment should be split treated equal. If this is a problem the stereo fragment should be split
into two mono fragments first and recombined later. Here is an example into two mono fragments first and recombined later. Here is an example
of how to do that: of how to do that:
...@@ -207,10 +201,10 @@ def mul_stereo(sample, width, lfactor, rfactor): ...@@ -207,10 +201,10 @@ def mul_stereo(sample, width, lfactor, rfactor):
\end{verbatim}\ecode \end{verbatim}\ecode
If you use the ADPCM coder to build network packets and you want your If you use the ADPCM coder to build network packets and you want your
protocol to be stateless (i.e. to be able to tolerate packet loss) protocol to be stateless (i.e.\ to be able to tolerate packet loss)
you should not only transmit the data but also the state. Note that you should not only transmit the data but also the state. Note that
you should send the \var{initial} state (the one you passed to you should send the \var{initial} state (the one you passed to
lin2adpcm) along to the decoder, not the final state (as returned by \code{lin2adpcm}) along to the decoder, not the final state (as returned by
the coder). If you want to use \code{struct} to store the state in the coder). If you want to use \code{struct} to store the state in
binary you can code the first element (the predicted value) in 16 bits binary you can code the first element (the predicted value) in 16 bits
and the second (the delta index) in 8. and the second (the delta index) in 8.
......
...@@ -10,8 +10,8 @@ Interface summary: ...@@ -10,8 +10,8 @@ Interface summary:
\begin{verbatim} \begin{verbatim}
import copy import copy
x = copy.copy(y) # make a shallow copy of y x = copy.copy(y) # make a shallow copy of y
x = copy.deepcopy(y) # make a deep copy of y x = copy.deepcopy(y) # make a deep copy of y
\end{verbatim} \end{verbatim}
For module specific errors, \code{copy.Error} is raised. For module specific errors, \code{copy.Error} is raised.
...@@ -44,7 +44,7 @@ Recursive objects (compound objects that, directly or indirectly, ...@@ -44,7 +44,7 @@ Recursive objects (compound objects that, directly or indirectly,
contain a reference to themselves) may cause a recursive loop. contain a reference to themselves) may cause a recursive loop.
\item \item
Because deep copy copies {\em everything} it may copy too much, e.g. Because deep copy copies {\em everything} it may copy too much, e.g.\
administrative data structures that should be shared even between administrative data structures that should be shared even between
copies. copies.
......
...@@ -19,6 +19,6 @@ raised for general mapping errors like specifying an incorrect key. ...@@ -19,6 +19,6 @@ raised for general mapping errors like specifying an incorrect key.
Open a dbm database and return a mapping object. \var{filename} is Open a dbm database and return a mapping object. \var{filename} is
the name of the database file (without the \file{.dir} or \file{.pag} the name of the database file (without the \file{.dir} or \file{.pag}
extensions), \var{rwmode} is \code{'r'}, \code{'w'} or \code{'rw'} as for extensions), \var{rwmode} is \code{'r'}, \code{'w'} or \code{'rw'} as for
\code{open}, and \var{filemode} is the unix mode of the file, used only \code{open}, and \var{filemode} is the \UNIX{} mode of the file, used only
when the database has to be created. when the database has to be created.
\end{funcdesc} \end{funcdesc}
% Manual text by Jaap Vermeulen % Manual text by Jaap Vermeulen
\section{Built-in module \sectcode{fcntl}} \section{Built-in module \sectcode{fcntl}}
\bimodindex{fcntl} \bimodindex{fcntl}
\indexii{UNIX}{file control} \indexii{\UNIX{}}{file control}
\indexii{UNIX}{IO control} \indexii{\UNIX{}}{I/O control}
This module performs file control and IO control on file descriptors. This module performs file control and I/O control on file descriptors.
It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX routines. It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX{} routines.
File descriptors can be obtained with the \dfn{fileno()} method of a File descriptors can be obtained with the \dfn{fileno()} method of a
file or socket object. file or socket object.
...@@ -23,10 +23,10 @@ The module defines the following functions: ...@@ -23,10 +23,10 @@ The module defines the following functions:
the argument missing or an integer value, the return value of this the argument missing or an integer value, the return value of this
function is the integer return value of the real \code{fcntl()} function is the integer return value of the real \code{fcntl()}
call. When the argument is a string it represents a binary call. When the argument is a string it represents a binary
structure, e.g. created by \code{struct.pack()}. The binary data is structure, e.g.\ created by \code{struct.pack()}. The binary data is
copied to a buffer whose address is passed to the real \code{fcntl()} copied to a buffer whose address is passed to the real \code{fcntl()}
call. The return value after a successful call is the contents of call. The return value after a successful call is the contents of
the buffer, converted to a string object. In the case the the buffer, converted to a string object. In case the
\code{fcntl()} fails, an \code{IOError} will be raised. \code{fcntl()} fails, an \code{IOError} will be raised.
\end{funcdesc} \end{funcdesc}
......
...@@ -405,7 +405,7 @@ returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns ...@@ -405,7 +405,7 @@ returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns
\end{verbatim}\ecode \end{verbatim}\ecode
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{vars}{} \begin{funcdesc}{vars}{\optional{object}}
Without arguments, return a dictionary corresponding to the current Without arguments, return a dictionary corresponding to the current
local symbol table. With a module, class or class instance object as local symbol table. With a module, class or class instance object as
argument (or anything else that has a \code{__dict__} attribute), argument (or anything else that has a \code{__dict__} attribute),
......
...@@ -21,10 +21,10 @@ raised for general mapping errors like specifying an incorrect key. ...@@ -21,10 +21,10 @@ raised for general mapping errors like specifying an incorrect key.
Open a gdbm database and return a mapping object. \var{filename} is Open a gdbm database and return a mapping object. \var{filename} is
the name of the database file, \var{rwmode} is \code{'r'}, \code{'w'}, the name of the database file, \var{rwmode} is \code{'r'}, \code{'w'},
\code{'c'}, or \code{'n'} for reader, writer (this also gives read \code{'c'}, or \code{'n'} for reader, writer (this also gives read
access), create (writer, but create the database if it doesnt already access), create (writer, but create the database if it doesn't already
exist) and newdb (which will always create a new database). Only one exist) and newdb (which will always create a new database). Only one
writer may open a gdbm file and many readers may open the file. Readers writer may open a gdbm file and many readers may open the file. Readers
and writers can not open the gdbm file at the same time. Note that the and writers cannot open the gdbm file at the same time. Note that the
\code{GDBM_FAST} mode of opening the database is not supported. \var{filemode} \code{GDBM_FAST} mode of opening the database is not supported. \var{filemode}
is the unix mode of the file, used only when a database is created. is the \UNIX\ mode of the file, used only when a database is created.
\end{funcdesc} \end{funcdesc}
...@@ -28,5 +28,5 @@ Return the group database entry for the given group name. ...@@ -28,5 +28,5 @@ Return the group database entry for the given group name.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getgrall}{} \begin{funcdesc}{getgrall}{}
Return a list of all available group entries entries, in arbitrary order. Return a list of all available group entries, in arbitrary order.
\end{funcdesc} \end{funcdesc}
\section{Built-in module \sectcode{imageop}} \section{Built-in module \sectcode{imageop}}
\bimodindex{imageop} \bimodindex{imageop}
The imageop module contains some useful operations on images. The \code{imageop} module contains some useful operations on images.
It operates on images consisting of 8 or 32 bit pixels It operates on images consisting of 8 or 32 bit pixels
stored in python strings. This is the same format as used stored in Python strings. This is the same format as used
by \code{gl.lrectwrite} and the \code{imgfile} module. by \code{gl.lrectwrite} and the \code{imgfile} module.
The module defines the following variables and functions: The module defines the following variables and functions:
...@@ -17,20 +17,20 @@ per pixel, etc. ...@@ -17,20 +17,20 @@ per pixel, etc.
\begin{funcdesc}{crop}{image\, psize\, width\, height\, x0\, y0\, x1\, y1} \begin{funcdesc}{crop}{image\, psize\, width\, height\, x0\, y0\, x1\, y1}
This function takes the image in \code{image}, which should by This function takes the image in \var{image}, which should by
\code{width} by \code{height} in size and consist of pixels of \var{width} by \var{height} in size and consist of pixels of
\code{psize} bytes, and returns the selected part of that image. \code{x0}, \var{psize} bytes, and returns the selected part of that image. \var{x0},
\code{y0}, \code{x1} and \code{y1} are like the \code{lrectread} \var{y0}, \var{x1} and \var{y1} are like the \code{lrectread}
parameters, i.e. the boundary is included in the new image. parameters, i.e. the boundary is included in the new image.
The new boundaries need not be inside the picture. Pixels that fall The new boundaries need not be inside the picture. Pixels that fall
outside the old image will have their value set to zero. outside the old image will have their value set to zero.
If \code{x0} is bigger than \code{x1} the new image is mirrored. The If \var{x0} is bigger than \var{x1} the new image is mirrored. The
same holds for the y coordinates. same holds for the y coordinates.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scale}{image\, psize\, width\, height\, newwidth\, newheight} \begin{funcdesc}{scale}{image\, psize\, width\, height\, newwidth\, newheight}
This function returns a \code{image} scaled to size \code{newwidth} by This function returns an \var{image} scaled to size \var{newwidth} by
\code{newheight}. No interpolation is done, scaling is done by \var{newheight}. No interpolation is done, scaling is done by
simple-minded pixel duplication or removal. Therefore, computer-generated simple-minded pixel duplication or removal. Therefore, computer-generated
images or dithered images will not look nice after scaling. images or dithered images will not look nice after scaling.
\end{funcdesc} \end{funcdesc}
...@@ -57,7 +57,7 @@ monochrome image but it uses a (simple-minded) dithering algorithm. ...@@ -57,7 +57,7 @@ monochrome image but it uses a (simple-minded) dithering algorithm.
\begin{funcdesc}{mono2grey}{image\, width\, height\, p0\, p1} \begin{funcdesc}{mono2grey}{image\, width\, height\, p0\, p1}
This function converts a 1-bit monochrome image to an 8 bit greyscale This function converts a 1-bit monochrome image to an 8 bit greyscale
or color image. All pixels that are zero-valued on input get value or color image. All pixels that are zero-valued on input get value
\code{p0} on output and all one-value input pixels get value \code{p1} \var{p0} on output and all one-value input pixels get value \var{p1}
on output. To convert a monochrome black-and-white image to greyscale on output. To convert a monochrome black-and-white image to greyscale
pass the values \code{0} and \code{255} respectively. pass the values \code{0} and \code{255} respectively.
\end{funcdesc} \end{funcdesc}
......
...@@ -39,7 +39,8 @@ returned by \code{get_suffixes} describing the kind of file found. ...@@ -39,7 +39,8 @@ returned by \code{get_suffixes} describing the kind of file found.
Initialize the built-in module called \var{name} and return its module Initialize the built-in module called \var{name} and return its module
object. If the module was already initialized, it will be initialized object. If the module was already initialized, it will be initialized
{\em again}. A few modules cannot be initialized twice --- attempting {\em again}. A few modules cannot be initialized twice --- attempting
to initialize these again will raise an exception. If there is no to initialize these again will raise an \code{ImportError} exception.
If there is no
built-in module called \var{name}, \code{None} is returned. built-in module called \var{name}, \code{None} is returned.
\end{funcdesc} \end{funcdesc}
......
\section{Built-in Module \sectcode{jpeg}} \section{Built-in Module \sectcode{jpeg}}
\bimodindex{jpeg} \bimodindex{jpeg}
The module jpeg provides access to the jpeg compressor and The module \code{jpeg} provides access to the jpeg compressor and
decompressor written by the Independent JPEG Group. JPEG is a (draft?) decompressor written by the Independent JPEG Group. JPEG is a (draft?)\
standard for compressing pictures. For details on jpeg or the standard for compressing pictures. For details on jpeg or the
Independent JPEG Group software refer to the JPEG standard or the Independent JPEG Group software refer to the JPEG standard or the
documentation provided with the software. documentation provided with the software.
The jpeg module defines these functions: The \code{jpeg} module defines these functions:
\renewcommand{\indexsubitem}{(in module jpeg)} \renewcommand{\indexsubitem}{(in module jpeg)}
\begin{funcdesc}{compress}{data\, w\, h\, b} \begin{funcdesc}{compress}{data\, w\, h\, b}
Treat data as a pixmap of width w and height h, with b bytes per Treat data as a pixmap of width \var{w} and height \var{h}, with \var{b} bytes per
pixel. The data is in SGI GL order, so the first pixel is in the pixel. The data is in SGI GL order, so the first pixel is in the
lower-left corner. This means that lrectread return data can lower-left corner. This means that \code{lrectread} return data can
immedeately be passed to compress. Currently only 1 byte and 4 byte immedeately be passed to compress. Currently only 1 byte and 4 byte
pixels are allowed, the former being treated as greyscale and the pixels are allowed, the former being treated as greyscale and the
latter as RGB color. Compress returns a string that contains the latter as RGB color. Compress returns a string that contains the
...@@ -24,28 +24,28 @@ compressed picture, in JFIF format. ...@@ -24,28 +24,28 @@ compressed picture, in JFIF format.
Data is a string containing a picture in JFIF format. It returns a Data is a string containing a picture in JFIF format. It returns a
tuple tuple
\code{(\var{data}, \var{width}, \var{height}, \var{bytesperpixel})}. \code{(\var{data}, \var{width}, \var{height}, \var{bytesperpixel})}.
Again, the data is suitable to pass to lrectwrite. Again, the data is suitable to pass to \code{lrectwrite}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setoption}{name\, value} \begin{funcdesc}{setoption}{name\, value}
Set various options. Subsequent compress and decompress calls Set various options. Subsequent compress and decompress calls
will use these options. The following options are available: will use these options. The following options are available:
\begin{description} \begin{description}
\item[\code{'forcegray'}] \item[\code{'forcegray' }]
Force output to be grayscale, even if input is RGB. Force output to be grayscale, even if input is RGB.
\item[\code{'quality'}] \item[\code{'quality' }]
Set the quality of the compressed image to a Set the quality of the compressed image to a
value between \code{0} and \code{100} (default is \code{75}). Compress only. value between \code{0} and \code{100} (default is \code{75}). Compress only.
\item[\code{'optimize'}] \item[\code{'optimize' }]
Perform Huffman table optimization. Takes longer, but results in Perform Huffman table optimization. Takes longer, but results in
smaller compressed image. Compress only. smaller compressed image. Compress only.
\item[\code{'smooth'}] \item[\code{'smooth' }]
Perform inter-block smoothing on uncompressed image. Only useful for Perform inter-block smoothing on uncompressed image. Only useful for
low-quality images. Decompress only. low-quality images. Decompress only.
\end{description} \end{description}
\end{funcdesc} \end{funcdesc}
Compress and uncompress raise the error jpeg.error in case of errors. Compress and uncompress raise the error \code{jpeg.error} in case of errors.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
This module implements the interface to RSA's MD5 message digest This module implements the interface to RSA's MD5 message digest
algorithm (see also the file \file{md5.doc}). Its use is quite algorithm (see also the file \file{md5.doc}). Its use is quite
straightforward: use the function \code{md5} to create an straightforward:\ use the function \code{new} to create an
\dfn{md5}-object. You can now ``feed'' this object with arbitrary \dfn{md5}-object. You can now ``feed'' this object with arbitrary
strings. strings.
......
...@@ -8,15 +8,15 @@ arithmetic routines. Only the interfaces to the \emph{integer} ...@@ -8,15 +8,15 @@ arithmetic routines. Only the interfaces to the \emph{integer}
otherwise, the description in the GNU MP documentation can be applied. otherwise, the description in the GNU MP documentation can be applied.
In general, \dfn{mpz}-numbers can be used just like other standard In general, \dfn{mpz}-numbers can be used just like other standard
Python numbers, e.g. you can use the built-in operators like \code{+}, Python numbers, e.g.\ you can use the built-in operators like \code{+},
\code{*}, etc., as well as the standard built-in functions like \code{*}, etc., as well as the standard built-in functions like
\code{abs}, \code{int}, \ldots, \code{divmod}, \code{pow}. \code{abs}, \code{int}, \ldots, \code{divmod}, \code{pow}.
\strong{Please note:} the {\it bitwise-xor} operation has been implemented as \strong{Please note:} the {\it bitwise-xor} operation has been implemented as
a bunch of {\it and}s, {\it invert}s and {\it or}s, because the library a bunch of {\it and}s, {\it invert}s and {\it or}s, because the library
lacks an \code{mpz_xor} function, and I didn't need one. lacks an \code{mpz_xor} function, and I didn't need one.
You create an mpz-number, by calling the function called \code{mpz} (see You create an mpz-number by calling the function called \code{mpz} (see
below for an excact description). An mpz-number is printed like this: below for an exact description). An mpz-number is printed like this:
\code{mpz(\var{value})}. \code{mpz(\var{value})}.
\renewcommand{\indexsubitem}{(in module mpz)} \renewcommand{\indexsubitem}{(in module mpz)}
...@@ -59,7 +59,7 @@ return mpz-numbers. ...@@ -59,7 +59,7 @@ return mpz-numbers.
\begin{funcdesc}{divm}{numerator\, denominator\, modulus} \begin{funcdesc}{divm}{numerator\, denominator\, modulus}
Returns a number \var{q}. such that Returns a number \var{q}. such that
\code{\var{q} * \var{denominator} \%{} \var{modulus} == \var{numerator}}. \code{\var{q} * \var{denominator} \%{} \var{modulus} == \var{numerator}}.
One could also implement this function in python, using \code{gcdext}. One could also implement this function in Python, using \code{gcdext}.
\end{funcdesc} \end{funcdesc}
An mpz-number has one method: An mpz-number has one method:
...@@ -69,6 +69,6 @@ An mpz-number has one method: ...@@ -69,6 +69,6 @@ An mpz-number has one method:
Convert this mpz-number to a binary string, where the number has been Convert this mpz-number to a binary string, where the number has been
stored as an array of radix-256 digits, least significant digit first. stored as an array of radix-256 digits, least significant digit first.
The mpz-number must have a value greater than- or equal to zero, The mpz-number must have a value greater than or equal to zero,
otherwise a \code{ValueError}-exception will be raised. otherwise a \code{ValueError}-exception will be raised.
\end{funcdesc} \end{funcdesc}
...@@ -9,7 +9,7 @@ When the optional built-in module \code{posix} is available, this ...@@ -9,7 +9,7 @@ When the optional built-in module \code{posix} is available, this
module exports the same functions and data as \code{posix}; otherwise, module exports the same functions and data as \code{posix}; otherwise,
it searches for an OS dependent built-in module like \code{mac} and it searches for an OS dependent built-in module like \code{mac} and
exports the same functions and data as found there. The design of all exports the same functions and data as found there. The design of all
Python's built-in OS dependen modules is such that as long as the same Python's built-in OS dependent modules is such that as long as the same
functionality is available, it uses the same interface; e.g., the functionality is available, it uses the same interface; e.g., the
function \code{os.stat(\var{file})} returns stat info about a \var{file} in a function \code{os.stat(\var{file})} returns stat info about a \var{file} in a
format compatible with the POSIX interface. format compatible with the POSIX interface.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
\indexii{pickling}{objects} \indexii{pickling}{objects}
The \code{pickle} module implements a basic but powerful algorithm for The \code{pickle} module implements a basic but powerful algorithm for
``pickling'' (a.k.a. serializing, marshalling or flattening) nearly ``pickling'' (a.k.a.\ serializing, marshalling or flattening) nearly
arbitrary Python objects. This is a more primitive notion than arbitrary Python objects. This is a more primitive notion than
persistency --- although \code{pickle} reads and writes file objects, persistency --- although \code{pickle} reads and writes file objects,
it does not handle the issue of naming persistent objects, nor the it does not handle the issue of naming persistent objects, nor the
...@@ -32,7 +32,7 @@ following correctly: ...@@ -32,7 +32,7 @@ following correctly:
\item pointer sharing \item pointer sharing
\item instances uf user-defined classes \item instances of user-defined classes
\end{itemize} \end{itemize}
...@@ -105,11 +105,11 @@ module. ...@@ -105,11 +105,11 @@ module.
\ttindex{__dict__} \ttindex{__dict__}
Note that when class instances are pickled, their class's code and Note that when class instances are pickled, their class's code and
data is not pickled along with them. Only the instance data is data are not pickled along with them. Only the instance data are
pickled. This is done on purpose, so you can fix bugs in a class or pickled. This is done on purpose, so you can fix bugs in a class or
add methods and still load objects that were created with an earlier add methods and still load objects that were created with an earlier
version of the class. If you plan to have long-lived objects that version of the class. If you plan to have long-lived objects that
will see many versions of a class, it may be worth to put a version will see many versions of a class, it may be worthwhile to put a version
number in the objects so that suitable conversions can be made by the number in the objects so that suitable conversions can be made by the
class's \code{__setstate__()} method. class's \code{__setstate__()} method.
...@@ -157,7 +157,7 @@ the file argument. ...@@ -157,7 +157,7 @@ the file argument.
It is possible to make multiple calls to \code{Pickler.dump()} or to It is possible to make multiple calls to \code{Pickler.dump()} or to
\code{Unpickler.load()}, as long as there is a one-to-one \code{Unpickler.load()}, as long as there is a one-to-one
correspondence between pickler and \code{Unpickler} objects and correspondence between \code{Pickler} and \code{Unpickler} objects and
between \code{dump} and \code{load} calls for any pair of between \code{dump} and \code{load} calls for any pair of
corresponding \code{Pickler} and \code{Unpicklers}. {\em Warning}: corresponding \code{Pickler} and \code{Unpicklers}. {\em Warning}:
this is intended for pickling multiple objects without intervening this is intended for pickling multiple objects without intervening
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\bimodindex{posix} \bimodindex{posix}
This module provides access to operating system functionality that is This module provides access to operating system functionality that is
standardized by the C Standard and the POSIX standard (a thinly diguised standardized by the C Standard and the POSIX standard (a thinly disguised
\UNIX{} interface). \UNIX{} interface).
It is available in all Python versions except on the Macintosh; It is available in all Python versions except on the Macintosh;
the MS-DOS version does not support certain functions. the MS-DOS version does not support certain functions.
...@@ -31,7 +31,7 @@ in C. ...@@ -31,7 +31,7 @@ in C.
\renewcommand{\indexsubitem}{(exception in module posix)} \renewcommand{\indexsubitem}{(exception in module posix)}
\begin{excdesc}{error} \begin{excdesc}{error}
This exception is raised when an POSIX function returns a This exception is raised when a POSIX function returns a
POSIX-related error (e.g., not for illegal argument types). Its POSIX-related error (e.g., not for illegal argument types). Its
string value is \code{'posix.error'}. The accompanying value is a string value is \code{'posix.error'}. The accompanying value is a
pair containing the numeric error code from \code{errno} and the pair containing the numeric error code from \code{errno} and the
...@@ -279,7 +279,7 @@ systems without symbolic links, this always raises ...@@ -279,7 +279,7 @@ systems without symbolic links, this always raises
\begin{funcdesc}{system}{command} \begin{funcdesc}{system}{command}
Execute the command (a string) in a subshell. This is implemented by Execute the command (a string) in a subshell. This is implemented by
calling the Standard C function \code{system()}, and has the same calling the Standard C function \code{system()}, and has the same
limitations. Changes to \code{posix.environ}, \code{sys.stdin} etc. are limitations. Changes to \code{posix.environ}, \code{sys.stdin} etc.\ are
not reflected in the environment of the executed command. The return not reflected in the environment of the executed command. The return
value is the exit status of the process as returned by Standard C value is the exit status of the process as returned by Standard C
\code{system()}. \code{system()}.
...@@ -302,7 +302,7 @@ Return a 5-tuple containing information identifying the current ...@@ -302,7 +302,7 @@ Return a 5-tuple containing information identifying the current
operating system. The tuple contains 5 strings: operating system. The tuple contains 5 strings:
\code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}. \code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}.
Some systems truncate the nodename to 8 Some systems truncate the nodename to 8
characters or to the leading component; an better way to get the characters or to the leading component; a better way to get the
hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older
\UNIX{} systems.) \UNIX{} systems.)
\end{funcdesc} \end{funcdesc}
......
...@@ -48,13 +48,13 @@ Return true if \var{p} is an absolute pathname (begins with a slash). ...@@ -48,13 +48,13 @@ Return true if \var{p} is an absolute pathname (begins with a slash).
\begin{funcdesc}{isfile}{p} \begin{funcdesc}{isfile}{p}
Return true if \var{p} is an existing regular file. This follows Return true if \var{p} is an existing regular file. This follows
symbolic links, so both islink() and isfile() can be true for the same symbolic links, so both \code{islink()} and \code{isfile()} can be true for the same
path. path.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{isdir}{p} \begin{funcdesc}{isdir}{p}
Return true if \var{p} is an existing directory. This follows Return true if \var{p} is an existing directory. This follows
symbolic links, so both islink() and isdir() can be true for the same symbolic links, so both \code{islink()} and \code{isdir()} can be true for the same
path. path.
\end{funcdesc} \end{funcdesc}
...@@ -109,7 +109,7 @@ everything leading up to that. If \var{p} ends in a slash (except if ...@@ -109,7 +109,7 @@ everything leading up to that. If \var{p} ends in a slash (except if
it is the root), the trailing slash is removed and the operation it is the root), the trailing slash is removed and the operation
applied to the result; otherwise, \code{join(\var{head}, \var{tail})} equals applied to the result; otherwise, \code{join(\var{head}, \var{tail})} equals
\var{p}. The \var{tail} part never contains a slash. Some boundary \var{p}. The \var{tail} part never contains a slash. Some boundary
cases: if \var{p} is the root, \var{head} equals \var{p} and cases:\ if \var{p} is the root, \var{head} equals \var{p} and
\var{tail} is empty; if \var{p} is empty, both \var{head} and \var{tail} is empty; if \var{p} is empty, both \var{head} and
\var{tail} are empty; if \var{p} contains no slash, \var{head} is \var{tail} are empty; if \var{p} contains no slash, \var{head} is
empty and \var{tail} equals \var{p}. empty and \var{tail} equals \var{p}.
......
\section{Standard Module \sectcode{rand}} \section{Standard Module \sectcode{rand}}
\stmodindex{rand} This module implements a pseudo-random number \stmodindex{rand} This module implements a pseudo-random number
generator with an interface similar to \code{rand()} in C. It defines generator with an interface similar to \code{rand()} in C\@. It defines
the following functions: the following functions:
\renewcommand{\indexsubitem}{(in module rand)} \renewcommand{\indexsubitem}{(in module rand)}
......
...@@ -22,7 +22,7 @@ are currently supported. ...@@ -22,7 +22,7 @@ are currently supported.
\begin{funcdesc}{longimagedata}{file} \begin{funcdesc}{longimagedata}{file}
This function reads and decodes the image on the specified file, and This function reads and decodes the image on the specified file, and
returns it as a python string. The string has 4 byte RGBA pixels. returns it as a Python string. The string has 4 byte RGBA pixels.
The bottom left pixel is the first in The bottom left pixel is the first in
the string. This format is suitable to pass to \code{gl.lrectwrite}, the string. This format is suitable to pass to \code{gl.lrectwrite},
for instance. for instance.
...@@ -41,5 +41,5 @@ These are the formats returned by \code{gl.lrectread}. ...@@ -41,5 +41,5 @@ These are the formats returned by \code{gl.lrectread}.
This function sets a global flag which defines whether the scan lines This function sets a global flag which defines whether the scan lines
of the image are read or written from bottom to top (flag is zero, of the image are read or written from bottom to top (flag is zero,
compatible with SGI GL) or from top to bottom(flag is one, compatible with SGI GL) or from top to bottom(flag is one,
compatible with X). The default is zero. compatible with X)\@. The default is zero.
\end{funcdesc} \end{funcdesc}
...@@ -25,7 +25,7 @@ The available functions in this module are: ...@@ -25,7 +25,7 @@ The available functions in this module are:
\renewcommand{\indexsubitem}{(in module rotor)} \renewcommand{\indexsubitem}{(in module rotor)}
\begin{funcdesc}{newrotor}{key\optional{\, numrotors}} \begin{funcdesc}{newrotor}{key\optional{\, numrotors}}
Returns a rotor object. \var{key} is a string containing the encryption key Return a rotor object. \var{key} is a string containing the encryption key
for the object; it can contain arbitrary binary data. The key will be used for the object; it can contain arbitrary binary data. The key will be used
to randomly generate the rotor permutations and their initial positions. to randomly generate the rotor permutations and their initial positions.
\var{numrotors} is the number of rotor permutations in the returned object; \var{numrotors} is the number of rotor permutations in the returned object;
...@@ -36,28 +36,28 @@ Rotor objects have the following methods: ...@@ -36,28 +36,28 @@ Rotor objects have the following methods:
\renewcommand{\indexsubitem}{(rotor method)} \renewcommand{\indexsubitem}{(rotor method)}
\begin{funcdesc}{setkey}{} \begin{funcdesc}{setkey}{}
Resets the rotor to its initial state. Reset the rotor to its initial state.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{encrypt}{plaintext} \begin{funcdesc}{encrypt}{plaintext}
Resets the rotor object to its initial state and encrypts \var{plaintext}, Reset the rotor object to its initial state and encrypt \var{plaintext},
returning a string containing the ciphertext. The ciphertext is always the returning a string containing the ciphertext. The ciphertext is always the
same length as the original plaintext. same length as the original plaintext.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{encryptmore}{plaintext} \begin{funcdesc}{encryptmore}{plaintext}
Encrypts \var{plaintext} without resetting the rotor object, and returns a Encrypt \var{plaintext} without resetting the rotor object, and return a
string containing the ciphertext. string containing the ciphertext.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{decrypt}{ciphertext} \begin{funcdesc}{decrypt}{ciphertext}
Resets the rotor object to its initial state and decrypts \var{ciphertext}, Reset the rotor object to its initial state and decrypt \var{ciphertext},
returning a string containing the ciphertext. The plaintext string will returning a string containing the ciphertext. The plaintext string will
always be the same length as the ciphertext. always be the same length as the ciphertext.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{decryptmore}{ciphertext} \begin{funcdesc}{decryptmore}{ciphertext}
Decrypts \var{ciphertext} without resetting the rotor object, and returns a Decrypt \var{ciphertext} without resetting the rotor object, and return a
string containing the ciphertext. string containing the ciphertext.
\end{funcdesc} \end{funcdesc}
......
...@@ -12,20 +12,20 @@ it is explicitly reset (i.e. Python uses the BSD style interface). ...@@ -12,20 +12,20 @@ it is explicitly reset (i.e. Python uses the BSD style interface).
\item \item
There is no way to ``block'' signals temporarily from critical There is no way to ``block'' signals temporarily from critical
sections (since this is not supported by all Unix flavors). sections (since this is not supported by all \UNIX{} flavors).
\item \item
Although Python signal handlers are called asynchronously as far as Although Python signal handlers are called asynchronously as far as
the Python user is concerned, they can only occur between the the Python user is concerned, they can only occur between the
``atomic'' instructions of the Python interpreter. This means that ``atomic'' instructions of the Python interpreter. This means that
signals arriving during long calculations implemented purely in C signals arriving during long calculations implemented purely in C
(e.g. regular expression matches on large bodies of text) may be (e.g.\ regular expression matches on large bodies of text) may be
delayed for an arbitrary time. delayed for an arbitrary time.
\item \item
When a signal arrives during an I/O operation, it is possible that the When a signal arrives during an I/O operation, it is possible that the
I/O operation raises an exception after the signal handler returns. I/O operation raises an exception after the signal handler returns.
This is dependent on the underlying Unix system's semantics regarding This is dependent on the underlying \UNIX{} system's semantics regarding
interrupted system calls. interrupted system calls.
\item \item
...@@ -44,8 +44,8 @@ overridden. ...@@ -44,8 +44,8 @@ overridden.
\item \item
Some care must be taken if both signals and threads are used in the Some care must be taken if both signals and threads are used in the
same program. The fundamental thing to remember in using signals and same program. The fundamental thing to remember in using signals and
threads simultaneously is: always perform \code{signal()} operations threads simultaneously is:\ always perform \code{signal()} operations
in the main thread of execution. Any thread can perform a in the main thread of execution. Any thread can perform an
\code{alarm()}, \code{getsignal()}, or \code{pause()}; only the main \code{alarm()}, \code{getsignal()}, or \code{pause()}; only the main
thread can set a new signal handler, and the main thread will be the thread can set a new signal handler, and the main thread will be the
only one to receive signals. This means that signals can't be used as only one to receive signals. This means that signals can't be used as
...@@ -73,7 +73,7 @@ The variables defined in the signal module are: ...@@ -73,7 +73,7 @@ The variables defined in the signal module are:
hangup signal is defined as \code{signal.SIGHUP}; the variable names hangup signal is defined as \code{signal.SIGHUP}; the variable names
are identical to the names used in C programs, as found in are identical to the names used in C programs, as found in
\file{signal.h}. \file{signal.h}.
The UNIX man page for \file{signal} lists the existing signals (on The \UNIX{} man page for \file{signal} lists the existing signals (on
some systems this is \file{signal(2)}, on others the list is in some systems this is \file{signal(2)}, on others the list is in
\file{signal(7)}). \file{signal(7)}).
Note that not all systems define the same set of signal names; only Note that not all systems define the same set of signal names; only
...@@ -89,18 +89,18 @@ The signal module defines the following functions: ...@@ -89,18 +89,18 @@ The signal module defines the following functions:
\begin{funcdesc}{alarm}{time} \begin{funcdesc}{alarm}{time}
If \var{time} is non-zero, this function requests that a If \var{time} is non-zero, this function requests that a
\code{SIGALRM} signal be sent to the process in \var{time} seconds. \code{SIGALRM} signal be sent to the process in \var{time} seconds.
Any previously scheduled alarm is canceled (i.e. only one alarm can Any previously scheduled alarm is canceled (i.e.\ only one alarm can
be scheduled at any time). The returned value is then the number of be scheduled at any time). The returned value is then the number of
seconds before any previously set alarm was to have been delivered. seconds before any previously set alarm was to have been delivered.
If \var{time} is zero, no alarm id scheduled, and any scheduled If \var{time} is zero, no alarm id scheduled, and any scheduled
alarm is canceled. The return value is the number of seconds alarm is canceled. The return value is the number of seconds
remaining before a previously scheduled alarm. If the return value remaining before a previously scheduled alarm. If the return value
is zero, no alarm is currently scheduled. (See the UNIX man page is zero, no alarm is currently scheduled. (See the \UNIX{} man page
\code{alarm(2)}.) \code{alarm(2)}.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getsignal}{signalnum} \begin{funcdesc}{getsignal}{signalnum}
Returns the current signal handler for the signal \var{signalnum}. Return the current signal handler for the signal \var{signalnum}.
The returned value may be a callable Python object, or one of the The returned value may be a callable Python object, or one of the
special values \code{signal.SIG_IGN}, \code{signal.SIG_DFL} or special values \code{signal.SIG_IGN}, \code{signal.SIG_DFL} or
\code{None}. Here, \code{signal.SIG_IGN} means that the signal was \code{None}. Here, \code{signal.SIG_IGN} means that the signal was
...@@ -110,20 +110,20 @@ The signal module defines the following functions: ...@@ -110,20 +110,20 @@ The signal module defines the following functions:
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pause}{} \begin{funcdesc}{pause}{}
Causes the process to sleep until a signal is received; the Cause the process to sleep until a signal is received; the
appropriate handler will then be called. Returns nothing. (See the appropriate handler will then be called. Returns nothing. (See the
UNIX man page \code{signal(2)}.) \UNIX{} man page \code{signal(2)}.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{signal}{signalnum\, handler} \begin{funcdesc}{signal}{signalnum\, handler}
Sets the handler for signal \var{signalnum} to the function Set the handler for signal \var{signalnum} to the function
\var{handler}. \var{handler} can be any callable Python object, or \var{handler}. \var{handler} can be any callable Python object, or
one of the special values \code{signal.SIG_IGN} or one of the special values \code{signal.SIG_IGN} or
\code{signal.SIG_DFL}. The previous signal handler will be returned \code{signal.SIG_DFL}. The previous signal handler will be returned
(see the description of \code{getsignal()} above). (See the UNIX (see the description of \code{getsignal()} above). (See the \UNIX{}
man page \code{signal(2)}.) man page \code{signal(2)}.)
When threads are enabled, this function can only be called from the When threads are enabled, this function can only be called from the
main thread; attempting to call it from other threads will cause a main thread; attempting to call it from other threads will cause a
\code{ValueError} exception will be raised. \code{ValueError} exception to be raised.
\end{funcdesc} \end{funcdesc}
...@@ -10,7 +10,7 @@ Tutorial}, by Stuart Sechrest and \emph{An Advanced 4.3BSD Interprocess ...@@ -10,7 +10,7 @@ Tutorial}, by Stuart Sechrest and \emph{An Advanced 4.3BSD Interprocess
Communication Tutorial}, by Samuel J. Leffler et al, both in the Communication Tutorial}, by Samuel J. Leffler et al, both in the
\UNIX{} Programmer's Manual, Supplementary Documents 1 (sections PS1:7 \UNIX{} Programmer's Manual, Supplementary Documents 1 (sections PS1:7
and PS1:8). The \UNIX{} manual pages for the various socket-related and PS1:8). The \UNIX{} manual pages for the various socket-related
system calls also a valuable source of information on the details of system calls are also a valuable source of information on the details of
socket semantics. socket semantics.
The Python interface is a straightforward transliteration of the The Python interface is a straightforward transliteration of the
...@@ -77,11 +77,11 @@ used for the second argument to \code{socket()}. ...@@ -77,11 +77,11 @@ used for the second argument to \code{socket()}.
\dataline{IPPORT_*} \dataline{IPPORT_*}
\dataline{INADDR_*} \dataline{INADDR_*}
\dataline{IP_*} \dataline{IP_*}
Many constants of these forms, documented in the Unix documentation on Many constants of these forms, documented in the \UNIX{} documentation on
sockets and/or the IP protocol, are also defined in the socket module. sockets and/or the IP protocol, are also defined in the socket module.
They are generally used in arguments to the \code{setsockopt} and They are generally used in arguments to the \code{setsockopt} and
\code{getsockopt} methods of socket objects. In most cases, only \code{getsockopt} methods of socket objects. In most cases, only
those symbols that are defined in the Unix header files are defined; those symbols that are defined in the \UNIX{} header files are defined;
for a few symbols, default values are provided. for a few symbols, default values are provided.
\end{datadesc} \end{datadesc}
...@@ -113,7 +113,7 @@ for that service. The protocol name should be \code{'tcp'} or ...@@ -113,7 +113,7 @@ for that service. The protocol name should be \code{'tcp'} or
\code{'udp'}. \code{'udp'}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{socket}{family\, type\, proto} \begin{funcdesc}{socket}{family\, type\optional{\, proto}}
Create a new socket using the given address family, socket type and Create a new socket using the given address family, socket type and
protocol number. The address family should be \code{AF_INET} or protocol number. The address family should be \code{AF_INET} or
\code{AF_UNIX}. The socket type should be \code{SOCK_STREAM}, \code{AF_UNIX}. The socket type should be \code{SOCK_STREAM},
...@@ -121,7 +121,7 @@ protocol number. The address family should be \code{AF_INET} or ...@@ -121,7 +121,7 @@ protocol number. The address family should be \code{AF_INET} or
The protocol number is usually zero and may be omitted in that case. The protocol number is usually zero and may be omitted in that case.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fromfd}{fd\, family\, type\, proto} \begin{funcdesc}{fromfd}{fd\, family\, type\optional{\, proto}}
Build a socket object from an existing file descriptor (an integer as Build a socket object from an existing file descriptor (an integer as
returned by a file object's \code{fileno} method). Address family, returned by a file object's \code{fileno} method). Address family,
socket type and protocol number are as for the \code{socket} function socket type and protocol number are as for the \code{socket} function
...@@ -129,7 +129,7 @@ above. The file descriptor should refer to a socket, but this is not ...@@ -129,7 +129,7 @@ above. The file descriptor should refer to a socket, but this is not
checked --- subsequent operations on the object may fail if the file checked --- subsequent operations on the object may fail if the file
descriptor is invalid. This function is rarely needed, but can be descriptor is invalid. This function is rarely needed, but can be
used to get or set socket options on a socket passed to a program as used to get or set socket options on a socket passed to a program as
standard input or output (e.g. a server started by the \UNIX{} inet standard input or output (e.g.\ a server started by the \UNIX{} inet
daemon). daemon).
\end{funcdesc} \end{funcdesc}
...@@ -185,7 +185,7 @@ number of an IP socket, for instance. ...@@ -185,7 +185,7 @@ number of an IP socket, for instance.
see above.) see above.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getsockopt}{level\, optname\, buflen} \begin{funcdesc}{getsockopt}{level\, optname\optional{\, buflen}}
Return the value of the given socket option (see the \UNIX{} man page Return the value of the given socket option (see the \UNIX{} man page
{\it getsockopt}(2)). The needed symbolic constants are defined in {\it getsockopt}(2)). The needed symbolic constants are defined in
the \code{socket} module (\code{SO_*} etc.). If the optional third the \code{socket} module (\code{SO_*} etc.). If the optional third
...@@ -211,7 +211,7 @@ descriptor, so the file object and socket object may be closed or ...@@ -211,7 +211,7 @@ descriptor, so the file object and socket object may be closed or
garbage-collected independently. garbage-collected independently.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{recv}{bufsize\, flags} \begin{funcdesc}{recv}{bufsize\optional{\, flags}}
Receive data from the socket. The return value is a string representing Receive data from the socket. The return value is a string representing
the data received. The maximum amount of data to be received the data received. The maximum amount of data to be received
at once is specified by \var{bufsize}. See the \UNIX{} manual page at once is specified by \var{bufsize}. See the \UNIX{} manual page
...@@ -271,7 +271,7 @@ Note that there are no methods \code{read()} or \code{write()}; use ...@@ -271,7 +271,7 @@ Note that there are no methods \code{read()} or \code{write()}; use
\subsection{Example} \subsection{Example}
\nodename{Socket Example} \nodename{Socket Example}
Here are two minimal example programs using the TCP/IP protocol: a Here are two minimal example programs using the TCP/IP protocol:\ a
server that echoes all data that it receives back (servicing only one server that echoes all data that it receives back (servicing only one
client), and a client using it. Note that a server must perform the client), and a client using it. Note that a server must perform the
sequence \code{socket}, \code{bind}, \code{listen}, \code{accept} sequence \code{socket}, \code{bind}, \code{listen}, \code{accept}
......
...@@ -72,7 +72,7 @@ or more digits, optionally preceded by a sign (\samp{+} or \samp{-}). ...@@ -72,7 +72,7 @@ or more digits, optionally preceded by a sign (\samp{+} or \samp{-}).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{expandtabs}{s\, tabsize} \begin{funcdesc}{expandtabs}{s\, tabsize}
Expand tabs in a string, i.e. replace them by one or more spaces, Expand tabs in a string, i.e.\ replace them by one or more spaces,
depending on the current column and the given tab size. The column depending on the current column and the given tab size. The column
number is reset to zero after each newline occurring in the string. number is reset to zero after each newline occurring in the string.
This doesn't understand other non-printing characters or escape This doesn't understand other non-printing characters or escape
...@@ -88,7 +88,7 @@ negative, \code{len(\var{s})} is added. ...@@ -88,7 +88,7 @@ negative, \code{len(\var{s})} is added.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{rfind}{s\, sub\optional{\, start}} \begin{funcdesc}{rfind}{s\, sub\optional{\, start}}
Like \code{find} but finds the highest index. Like \code{find} but find the highest index.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{index}{s\, sub\optional{\, start}} \begin{funcdesc}{index}{s\, sub\optional{\, start}}
...@@ -101,7 +101,7 @@ Like \code{rfind} but raise \code{ValueError} when the substring is ...@@ -101,7 +101,7 @@ Like \code{rfind} but raise \code{ValueError} when the substring is
not found. not found.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{count}{s\, sub\, i} \begin{funcdesc}{count}{s\, sub\optional{\, i}}
Return the number of (non-overlapping) occurrences of substring Return the number of (non-overlapping) occurrences of substring
\var{sub} in string \var{s} with index at least \var{i}. \var{sub} in string \var{s} with index at least \var{i}.
If \var{i} is omitted, it defaults to \code{0}. If \var{i} is omitted, it defaults to \code{0}.
...@@ -112,12 +112,12 @@ Convert letters to lower case. ...@@ -112,12 +112,12 @@ Convert letters to lower case.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{s} \begin{funcdesc}{split}{s}
Returns a list of the whitespace-delimited words of the string Return a list of the whitespace-delimited words of the string
\var{s}. \var{s}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{splitfields}{s\, sep} \begin{funcdesc}{splitfields}{s\, sep}
Returns a list containing the fields of the string \var{s}, using Return a list containing the fields of the string \var{s}, using
the string \var{sep} as a separator. The list will have one more the string \var{sep} as a separator. The list will have one more
items than the number of non-overlapping occurrences of the items than the number of non-overlapping occurrences of the
separator in the string. Thus, \code{string.splitfields(\var{s}, ' separator in the string. Thus, \code{string.splitfields(\var{s}, '
...@@ -139,12 +139,12 @@ equals \var{t}. ...@@ -139,12 +139,12 @@ equals \var{t}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{strip}{s} \begin{funcdesc}{strip}{s}
Removes leading and trailing whitespace from the string Remove leading and trailing whitespace from the string
\var{s}. \var{s}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{swapcase}{s} \begin{funcdesc}{swapcase}{s}
Converts lower case letters to upper case and vice versa. Convert lower case letters to upper case and vice versa.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{upper}{s} \begin{funcdesc}{upper}{s}
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
\renewcommand{\indexsubitem}{(in module tempfile)} \renewcommand{\indexsubitem}{(in module tempfile)}
This module generates temporary file names. It is not UNIX specific, This module generates temporary file names. It is not \UNIX{} specific,
but it may require some help on non-UNIX systems. but it may require some help on non-\UNIX{} systems.
Note: the modules does not create temporary files, nor does it Note: the modules does not create temporary files, nor does it
automatically remove them when the current process exits or dies. automatically remove them when the current process exits or dies.
...@@ -27,7 +27,7 @@ are initialized at the first call to \code{mktemp()}. ...@@ -27,7 +27,7 @@ are initialized at the first call to \code{mktemp()}.
When set to a value other than \code{None}, this variable defines the When set to a value other than \code{None}, this variable defines the
directory in which filenames returned by \code{mktemp()} reside. The directory in which filenames returned by \code{mktemp()} reside. The
default is taken from the environment variable \code{TMPDIR}; if this default is taken from the environment variable \code{TMPDIR}; if this
is not set, either \code{/usr/tmp} is used (on UNIX), or the current is not set, either \code{/usr/tmp} is used (on \UNIX{}), or the current
working directory (all other systems). No check is made to see working directory (all other systems). No check is made to see
whether its value is valid. whether its value is valid.
\end{datadesc} \end{datadesc}
...@@ -38,11 +38,11 @@ When set to a value other than \code{None}, this variable defines the ...@@ -38,11 +38,11 @@ When set to a value other than \code{None}, this variable defines the
prefix of the final component of the filenames returned by prefix of the final component of the filenames returned by
\code{mktemp()}. A string of decimal digits is added to generate \code{mktemp()}. A string of decimal digits is added to generate
unique filenames. The default is either ``\code{@\var{pid}.}'' where unique filenames. The default is either ``\code{@\var{pid}.}'' where
\var{pid} is the current process ID (on UNIX), or ``\code{tmp}'' (all \var{pid} is the current process ID (on \UNIX{}), or ``\code{tmp}'' (all
other systems). other systems).
\end{datadesc} \end{datadesc}
Warning: if a UNIX process uses \code{mktemp()}, then calls Warning: if a \UNIX{} process uses \code{mktemp()}, then calls
\code{fork()} and both parent and child continue to use \code{fork()} and both parent and child continue to use
\code{mktemp()}, the processes will generate conflicting temporary \code{mktemp()}, the processes will generate conflicting temporary
names. To resolve this, the child process should assign \code{None} names. To resolve this, the child process should assign \code{None}
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
\bimodindex{thread} \bimodindex{thread}
This module provides low-level primitives for working with multiple This module provides low-level primitives for working with multiple
threads (a.k.a. \dfn{light-weight processes} or \dfn{tasks}) --- multiple threads (a.k.a.\ \dfn{light-weight processes} or \dfn{tasks}) --- multiple
threads of control sharing their global data space. For threads of control sharing their global data space. For
synchronization, simple locks (a.k.a. \dfn{mutexes} or \dfn{binary synchronization, simple locks (a.k.a.\ \dfn{mutexes} or \dfn{binary
semaphores}) are provided. semaphores}) are provided.
The module is optional and supported on SGI IRIX 4.x and 5.x and Sun The module is optional and supported on SGI IRIX 4.x and 5.x and Sun
Solaris 2.x systems, as well as on systems that have a PTHREAD Solaris 2.x systems, as well as on systems that have a PTHREAD
implementation (e.g. KSR). implementation (e.g.\ KSR).
It defines the following constant and functions: It defines the following constant and functions:
...@@ -21,7 +21,7 @@ Raised on thread-specific errors. ...@@ -21,7 +21,7 @@ Raised on thread-specific errors.
\begin{funcdesc}{start_new_thread}{func\, arg} \begin{funcdesc}{start_new_thread}{func\, arg}
Start a new thread. The thread executes the function \var{func} Start a new thread. The thread executes the function \var{func}
with the argument list \var{arg} (which must be a tuple). When the with the argument list \var{arg} (which must be a tuple). When the
function returns, the thread silently exits. When the function raises function returns, the thread silently exits. When the function
terminates with an unhandled exception, a stack trace is printed and terminates with an unhandled exception, a stack trace is printed and
then the thread exits (but other threads continue to run). then the thread exits (but other threads continue to run).
\end{funcdesc} \end{funcdesc}
...@@ -59,7 +59,7 @@ Without the optional argument, this method acquires the lock ...@@ -59,7 +59,7 @@ Without the optional argument, this method acquires the lock
unconditionally, if necessary waiting until it is released by another unconditionally, if necessary waiting until it is released by another
thread (only one thread at a time can acquire a lock --- that's their thread (only one thread at a time can acquire a lock --- that's their
reason for existence), and returns \code{None}. If the integer reason for existence), and returns \code{None}. If the integer
\var{waitflag} argument is present, the action depends on its value: \var{waitflag} argument is present, the action depends on its value:\
if it is zero, the lock is only acquired if it can be acquired if it is zero, the lock is only acquired if it can be acquired
immediately without waiting, while if it is nonzero, the lock is immediately without waiting, while if it is nonzero, the lock is
acquired unconditionally as before. If an argument is present, the acquired unconditionally as before. If an argument is present, the
...@@ -72,7 +72,7 @@ necessarily by the same thread. ...@@ -72,7 +72,7 @@ necessarily by the same thread.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{locked}{} \begin{funcdesc}{locked}{}
Return the status of the lock: 1 if it has been acquired by some Return the status of the lock:\ 1 if it has been acquired by some
thread, 0 if not. thread, 0 if not.
\end{funcdesc} \end{funcdesc}
......
\chapter{UNIX ONLY} \chapter{UNIX ONLY}
The modules described in this chapter provide interfaces to features The modules described in this chapter provide interfaces to features
that are unique to the UNIX operating system, or in some cases to that are unique to the \UNIX{} operating system, or in some cases to
some or many variants of it. some or many variants of it.
...@@ -11,14 +11,14 @@ The sampling rate or frame rate is the number of times per second the ...@@ -11,14 +11,14 @@ The sampling rate or frame rate is the number of times per second the
sound is sampled. The number of channels indicate if the audio is sound is sampled. The number of channels indicate if the audio is
mono, stereo, or quadro. Each frame consists of one sample per mono, stereo, or quadro. Each frame consists of one sample per
channel. The sample size is the size in bytes of each sample. Thus a channel. The sample size is the size in bytes of each sample. Thus a
frame consists of nchannels*framesize bytes, and a second's worth of frame consists of \var{nchannels}*\var{framesize} bytes, and a second's worth of
audio consists of nchannels*framesize*framerate bytes. audio consists of \var{nchannels}*\var{framesize}*\var{framerate} bytes.
Module \code{aifc} defines the following function: Module \code{aifc} defines the following function:
\renewcommand{\indexsubitem}{(in module aifc)} \renewcommand{\indexsubitem}{(in module aifc)}
\begin{funcdesc}{open}{file\, mode} \begin{funcdesc}{open}{file\, mode}
Opens an AIFF or AIFF-C file and returns an object instance with Open an AIFF or AIFF-C file and return an object instance with
methods that are described below. The argument file is either a methods that are described below. The argument file is either a
string naming a file or a file object. The mode is either the string string naming a file or a file object. The mode is either the string
'r' when the file must be opened for reading, or 'w' when the file 'r' when the file must be opened for reading, or 'w' when the file
...@@ -75,7 +75,7 @@ the given id. ...@@ -75,7 +75,7 @@ the given id.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{readframes}{nframes} \begin{funcdesc}{readframes}{nframes}
Read and return the next nframes frames from the audio file. The Read and return the next \var{nframes} frames from the audio file. The
returned data is a string containing for each frame the uncompressed returned data is a string containing for each frame the uncompressed
samples of all channels. samples of all channels.
\end{funcdesc} \end{funcdesc}
...@@ -175,6 +175,6 @@ not updated. ...@@ -175,6 +175,6 @@ not updated.
\begin{funcdesc}{close}{} \begin{funcdesc}{close}{}
Close the AIFF file. The header of the file is updated to reflect the Close the AIFF file. The header of the file is updated to reflect the
actual size of the audio data After calling this method, the object actual size of the audio data. After calling this method, the object
can no longer be used. can no longer be used.
\end{funcdesc} \end{funcdesc}
\section{Built-in module \sectcode{audioop}} \section{Built-in module \sectcode{audioop}}
\bimodindex{audioop} \bimodindex{audioop}
The audioop module contains some useful operations on sound fragments. The \code{audioop} module contains some useful operations on sound fragments.
It operates on sound fragments consisting of signed integer samples of It operates on sound fragments consisting of signed integer samples
8, 16 or 32 bits wide, stored in Python strings. This is the same 8, 16 or 32 bits wide, stored in Python strings. This is the same
format as used by the \code{al} and \code{sunaudiodev} modules. All format as used by the \code{al} and \code{sunaudiodev} modules. All
scalar items are integers, unless specified otherwise. scalar items are integers, unless specified otherwise.
...@@ -19,7 +19,7 @@ per sample, etc. ...@@ -19,7 +19,7 @@ per sample, etc.
\end{excdesc} \end{excdesc}
\begin{funcdesc}{add}{fragment1\, fragment2\, width} \begin{funcdesc}{add}{fragment1\, fragment2\, width}
This function returns a fragment that is the addition of the two samples This function returns a fragment which is the addition of the two samples
passed as parameters. \var{width} is the sample width in bytes, either passed as parameters. \var{width} is the sample width in bytes, either
\code{1}, \code{2} or \code{4}. Both fragments should have the same length. \code{1}, \code{2} or \code{4}. Both fragments should have the same length.
\end{funcdesc} \end{funcdesc}
...@@ -60,8 +60,8 @@ passed as an argument. ...@@ -60,8 +60,8 @@ passed as an argument.
\begin{funcdesc}{findfactor}{fragment\, reference} \begin{funcdesc}{findfactor}{fragment\, reference}
This routine (which only accepts 2-byte sample fragments) calculates a This routine (which only accepts 2-byte sample fragments) calculates a
factor \var{F} such that \code{rms(add(fragment, mul(reference, -F)))} factor \var{F} such that \code{rms(add(fragment, mul(reference, -F)))}
is minimal, i.e. it calculates the factor with which you should is minimal, i.e.\ it calculates the factor with which you should
multiply \var{reference} to make it match as good as possible to multiply \var{reference} to make it match as well as possible to
\var{fragment}. The fragments should be the same size. \var{fragment}. The fragments should be the same size.
The time taken by this routine is proportional to \code{len(fragment)}. The time taken by this routine is proportional to \code{len(fragment)}.
...@@ -69,7 +69,7 @@ The time taken by this routine is proportional to \code{len(fragment)}. ...@@ -69,7 +69,7 @@ The time taken by this routine is proportional to \code{len(fragment)}.
\begin{funcdesc}{findfit}{fragment\, reference} \begin{funcdesc}{findfit}{fragment\, reference}
This routine (which only accepts 2-byte sample fragments) tries to This routine (which only accepts 2-byte sample fragments) tries to
match \var{reference} as good as possible to a portion of match \var{reference} as well as possible to a portion of
\var{fragment} (which should be the longer fragment). It \var{fragment} (which should be the longer fragment). It
(conceptually) does this by taking slices out of \var{fragment}, using (conceptually) does this by taking slices out of \var{fragment}, using
\code{findfactor} to compute the best match, and minimizing the \code{findfactor} to compute the best match, and minimizing the
...@@ -81,8 +81,8 @@ and \var{factor} the floating-point factor as per \code{findfactor}. ...@@ -81,8 +81,8 @@ and \var{factor} the floating-point factor as per \code{findfactor}.
\begin{funcdesc}{findmax}{fragment\, length} \begin{funcdesc}{findmax}{fragment\, length}
This routine (which only accepts 2-byte sample fragments) searches This routine (which only accepts 2-byte sample fragments) searches
\var{fragment} for a slice of length \var{length} samples (not bytes!) \var{fragment} for a slice of length \var{length} samples (not bytes!)\
with maximum energy, i.e. it returns \var{i} for which with maximum energy, i.e.\ it returns \var{i} for which
\code{rms(fragment[i*2:(i+length)*2])} is maximal. \code{rms(fragment[i*2:(i+length)*2])} is maximal.
The routine takes time proportional to \code{len(fragment)}. The routine takes time proportional to \code{len(fragment)}.
...@@ -140,7 +140,7 @@ This function returns the maximum peak-peak value in the sound fragment. ...@@ -140,7 +140,7 @@ This function returns the maximum peak-peak value in the sound fragment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{mul}{fragment\, width\, factor} \begin{funcdesc}{mul}{fragment\, width\, factor}
Mul returns a fragment that has all samples in the original framgent Return a fragment that has all samples in the original framgent
multiplied by the floating-point value \var{factor}. Overflow is multiplied by the floating-point value \var{factor}. Overflow is
silently ignored. silently ignored.
\end{funcdesc} \end{funcdesc}
...@@ -150,25 +150,6 @@ This function reverses the samples in a fragment and returns the ...@@ -150,25 +150,6 @@ This function reverses the samples in a fragment and returns the
modified fragment. modified fragment.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tomono}{fragment\, width\, lfactor\, rfactor}
This function converts a stereo fragment to a mono fragment. The left
channel is multiplied by \var{lfactor} and the right channel by
\var{rfactor} before adding the two channels to give a mono signal.
\end{funcdesc}
\begin{funcdesc}{tostereo}{fragment\, width\, lfactor\, rfactor}
This function generates a stereo fragment from a mono fragment. Each
pair of samples in the stereo fragment are computed from the mono
sample, whereby left channel samples are multiplied by \var{lfactor}
and right channel samples by \var{rfactor}.
\end{funcdesc}
\begin{funcdesc}{mul}{fragment\, width\, factor}
Mul returns a fragment that has all samples in the original framgent
multiplied by the floating-point value \var{factor}. Overflow is
silently ignored.
\end{funcdesc}
\begin{funcdesc}{rms}{fragment\, width\, factor} \begin{funcdesc}{rms}{fragment\, width\, factor}
Returns the root-mean-square of the fragment, i.e. Returns the root-mean-square of the fragment, i.e.
\iftexi \iftexi
...@@ -184,6 +165,19 @@ divided by the sumber of samples. ...@@ -184,6 +165,19 @@ divided by the sumber of samples.
This is a measure of the power in an audio signal. This is a measure of the power in an audio signal.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{tomono}{fragment\, width\, lfactor\, rfactor}
This function converts a stereo fragment to a mono fragment. The left
channel is multiplied by \var{lfactor} and the right channel by
\var{rfactor} before adding the two channels to give a mono signal.
\end{funcdesc}
\begin{funcdesc}{tostereo}{fragment\, width\, lfactor\, rfactor}
This function generates a stereo fragment from a mono fragment. Each
pair of samples in the stereo fragment are computed from the mono
sample, whereby left channel samples are multiplied by \var{lfactor}
and right channel samples by \var{rfactor}.
\end{funcdesc}
\begin{funcdesc}{ulaw2lin}{fragment\, width} \begin{funcdesc}{ulaw2lin}{fragment\, width}
This function converts sound fragments in ULAW encoding to linearly This function converts sound fragments in ULAW encoding to linearly
encoded sound fragments. ULAW encoding always uses 8 bits samples, so encoded sound fragments. ULAW encoding always uses 8 bits samples, so
...@@ -191,7 +185,7 @@ encoded sound fragments. ULAW encoding always uses 8 bits samples, so ...@@ -191,7 +185,7 @@ encoded sound fragments. ULAW encoding always uses 8 bits samples, so
\end{funcdesc} \end{funcdesc}
Note that operations such as \code{mul} or \code{max} make no Note that operations such as \code{mul} or \code{max} make no
distinction between mono and stereo fragments, i.e. all samples are distinction between mono and stereo fragments, i.e.\ all samples are
treated equal. If this is a problem the stereo fragment should be split treated equal. If this is a problem the stereo fragment should be split
into two mono fragments first and recombined later. Here is an example into two mono fragments first and recombined later. Here is an example
of how to do that: of how to do that:
...@@ -207,10 +201,10 @@ def mul_stereo(sample, width, lfactor, rfactor): ...@@ -207,10 +201,10 @@ def mul_stereo(sample, width, lfactor, rfactor):
\end{verbatim}\ecode \end{verbatim}\ecode
If you use the ADPCM coder to build network packets and you want your If you use the ADPCM coder to build network packets and you want your
protocol to be stateless (i.e. to be able to tolerate packet loss) protocol to be stateless (i.e.\ to be able to tolerate packet loss)
you should not only transmit the data but also the state. Note that you should not only transmit the data but also the state. Note that
you should send the \var{initial} state (the one you passed to you should send the \var{initial} state (the one you passed to
lin2adpcm) along to the decoder, not the final state (as returned by \code{lin2adpcm}) along to the decoder, not the final state (as returned by
the coder). If you want to use \code{struct} to store the state in the coder). If you want to use \code{struct} to store the state in
binary you can code the first element (the predicted value) in 16 bits binary you can code the first element (the predicted value) in 16 bits
and the second (the delta index) in 8. and the second (the delta index) in 8.
......
...@@ -10,8 +10,8 @@ Interface summary: ...@@ -10,8 +10,8 @@ Interface summary:
\begin{verbatim} \begin{verbatim}
import copy import copy
x = copy.copy(y) # make a shallow copy of y x = copy.copy(y) # make a shallow copy of y
x = copy.deepcopy(y) # make a deep copy of y x = copy.deepcopy(y) # make a deep copy of y
\end{verbatim} \end{verbatim}
For module specific errors, \code{copy.Error} is raised. For module specific errors, \code{copy.Error} is raised.
...@@ -44,7 +44,7 @@ Recursive objects (compound objects that, directly or indirectly, ...@@ -44,7 +44,7 @@ Recursive objects (compound objects that, directly or indirectly,
contain a reference to themselves) may cause a recursive loop. contain a reference to themselves) may cause a recursive loop.
\item \item
Because deep copy copies {\em everything} it may copy too much, e.g. Because deep copy copies {\em everything} it may copy too much, e.g.\
administrative data structures that should be shared even between administrative data structures that should be shared even between
copies. copies.
......
...@@ -30,14 +30,14 @@ Bits in the status as returned by \var{Status}. ...@@ -30,14 +30,14 @@ Bits in the status as returned by \var{Status}.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{available}{} \begin{funcdesc}{available}{}
Returns 1 if the communication toolbox is available, zero otherwise. Return 1 if the communication toolbox is available, zero otherwise.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{CMNew}{name\, sizes} \begin{funcdesc}{CMNew}{name\, sizes}
Create a connection object using the connection tool named Create a connection object using the connection tool named
\var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in, \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. data out, control in, control out, attention in and attention out.
Alternatively, passing \var{None} will result in default buffer sizes. Alternatively, passing \code{None} will result in default buffer sizes.
\end{funcdesc} \end{funcdesc}
\subsection{connection object} \subsection{connection object}
...@@ -47,14 +47,14 @@ of \code{-1} is indefinite, meaning that the command runs to completion. ...@@ -47,14 +47,14 @@ of \code{-1} is indefinite, meaning that the command runs to completion.
\renewcommand{\indexsubitem}{(connection object method)} \renewcommand{\indexsubitem}{(connection object method)}
\begin{datadesc}{callback} \begin{datadesc}{callback}
If this member is set to a value other than \var{None} it should point If this member is set to a value other than \code{None} it should point
to a function accepting a single argument (the connection to a function accepting a single argument (the connection
object). This will make all connection object methods work object). This will make all connection object methods work
asynchronously, with the callback routine being called upon asynchronously, with the callback routine being called upon
completion. completion.
{\em Note:} for reasons beyond my understanding the callback routine {\em Note:} for reasons beyond my understanding the callback routine
is never called currently. You are advised against using asynchronous is currently never called. You are advised against using asynchronous
calls for the time being. calls for the time being.
\end{datadesc} \end{datadesc}
...@@ -76,15 +76,15 @@ Accept (when \var{yesno} is non-zero) or reject an incoming call after ...@@ -76,15 +76,15 @@ Accept (when \var{yesno} is non-zero) or reject an incoming call after
\begin{funcdesc}{Close}{timeout\, now} \begin{funcdesc}{Close}{timeout\, now}
Close a connection. When \var{now} is zero, the close is orderly Close a connection. When \var{now} is zero, the close is orderly
(i.e. outstanding output is flushed, etc) with a timeout of (i.e.\ outstanding output is flushed, etc.)\ with a timeout of
\var{timeout} seconds. When \var{now} is non-zero the close is \var{timeout} seconds. When \var{now} is non-zero the close is
immedeate, discarding output. immediate, discarding output.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Read}{len\, chan\, timeout} \begin{funcdesc}{Read}{len\, chan\, timeout}
Read \var{len} bytes or until \var{timeout} seconds have passed from Read \var{len} bytes, or until \var{timeout} seconds have passed, from
the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or
\var{cmAttn}). Returns a 2-tuple: the data read and the end-of-message \var{cmAttn}). Return a 2-tuple:\ the data read and the end-of-message
flag. flag.
\end{funcdesc} \end{funcdesc}
...@@ -97,8 +97,8 @@ the number of bytes written. ...@@ -97,8 +97,8 @@ the number of bytes written.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Status}{} \begin{funcdesc}{Status}{}
Return connection status as the 2-tuple \code{(sizes, Return connection status as the 2-tuple \code{(\var{sizes},
flags)}. \var{Sizes} is a 6-tuple giving the actual buffer sizes used \var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used
(see \var{CMNew}), \var{flags} is a set of bits describing the state (see \var{CMNew}), \var{flags} is a set of bits describing the state
of the connection. of the connection.
\end{funcdesc} \end{funcdesc}
......
...@@ -19,6 +19,6 @@ raised for general mapping errors like specifying an incorrect key. ...@@ -19,6 +19,6 @@ raised for general mapping errors like specifying an incorrect key.
Open a dbm database and return a mapping object. \var{filename} is Open a dbm database and return a mapping object. \var{filename} is
the name of the database file (without the \file{.dir} or \file{.pag} the name of the database file (without the \file{.dir} or \file{.pag}
extensions), \var{rwmode} is \code{'r'}, \code{'w'} or \code{'rw'} as for extensions), \var{rwmode} is \code{'r'}, \code{'w'} or \code{'rw'} as for
\code{open}, and \var{filemode} is the unix mode of the file, used only \code{open}, and \var{filemode} is the \UNIX{} mode of the file, used only
when the database has to be created. when the database has to be created.
\end{funcdesc} \end{funcdesc}
% Manual text by Jaap Vermeulen % Manual text by Jaap Vermeulen
\section{Built-in module \sectcode{fcntl}} \section{Built-in module \sectcode{fcntl}}
\bimodindex{fcntl} \bimodindex{fcntl}
\indexii{UNIX}{file control} \indexii{\UNIX{}}{file control}
\indexii{UNIX}{IO control} \indexii{\UNIX{}}{I/O control}
This module performs file control and IO control on file descriptors. This module performs file control and I/O control on file descriptors.
It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX routines. It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX{} routines.
File descriptors can be obtained with the \dfn{fileno()} method of a File descriptors can be obtained with the \dfn{fileno()} method of a
file or socket object. file or socket object.
...@@ -23,10 +23,10 @@ The module defines the following functions: ...@@ -23,10 +23,10 @@ The module defines the following functions:
the argument missing or an integer value, the return value of this the argument missing or an integer value, the return value of this
function is the integer return value of the real \code{fcntl()} function is the integer return value of the real \code{fcntl()}
call. When the argument is a string it represents a binary call. When the argument is a string it represents a binary
structure, e.g. created by \code{struct.pack()}. The binary data is structure, e.g.\ created by \code{struct.pack()}. The binary data is
copied to a buffer whose address is passed to the real \code{fcntl()} copied to a buffer whose address is passed to the real \code{fcntl()}
call. The return value after a successful call is the contents of call. The return value after a successful call is the contents of
the buffer, converted to a string object. In the case the the buffer, converted to a string object. In case the
\code{fcntl()} fails, an \code{IOError} will be raised. \code{fcntl()} fails, an \code{IOError} will be raised.
\end{funcdesc} \end{funcdesc}
......
...@@ -405,7 +405,7 @@ returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns ...@@ -405,7 +405,7 @@ returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns
\end{verbatim}\ecode \end{verbatim}\ecode
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{vars}{} \begin{funcdesc}{vars}{\optional{object}}
Without arguments, return a dictionary corresponding to the current Without arguments, return a dictionary corresponding to the current
local symbol table. With a module, class or class instance object as local symbol table. With a module, class or class instance object as
argument (or anything else that has a \code{__dict__} attribute), argument (or anything else that has a \code{__dict__} attribute),
......
...@@ -21,10 +21,10 @@ raised for general mapping errors like specifying an incorrect key. ...@@ -21,10 +21,10 @@ raised for general mapping errors like specifying an incorrect key.
Open a gdbm database and return a mapping object. \var{filename} is Open a gdbm database and return a mapping object. \var{filename} is
the name of the database file, \var{rwmode} is \code{'r'}, \code{'w'}, the name of the database file, \var{rwmode} is \code{'r'}, \code{'w'},
\code{'c'}, or \code{'n'} for reader, writer (this also gives read \code{'c'}, or \code{'n'} for reader, writer (this also gives read
access), create (writer, but create the database if it doesnt already access), create (writer, but create the database if it doesn't already
exist) and newdb (which will always create a new database). Only one exist) and newdb (which will always create a new database). Only one
writer may open a gdbm file and many readers may open the file. Readers writer may open a gdbm file and many readers may open the file. Readers
and writers can not open the gdbm file at the same time. Note that the and writers cannot open the gdbm file at the same time. Note that the
\code{GDBM_FAST} mode of opening the database is not supported. \var{filemode} \code{GDBM_FAST} mode of opening the database is not supported. \var{filemode}
is the unix mode of the file, used only when a database is created. is the \UNIX\ mode of the file, used only when a database is created.
\end{funcdesc} \end{funcdesc}
...@@ -28,5 +28,5 @@ Return the group database entry for the given group name. ...@@ -28,5 +28,5 @@ Return the group database entry for the given group name.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getgrall}{} \begin{funcdesc}{getgrall}{}
Return a list of all available group entries entries, in arbitrary order. Return a list of all available group entries, in arbitrary order.
\end{funcdesc} \end{funcdesc}
\section{Built-in module \sectcode{imageop}} \section{Built-in module \sectcode{imageop}}
\bimodindex{imageop} \bimodindex{imageop}
The imageop module contains some useful operations on images. The \code{imageop} module contains some useful operations on images.
It operates on images consisting of 8 or 32 bit pixels It operates on images consisting of 8 or 32 bit pixels
stored in python strings. This is the same format as used stored in Python strings. This is the same format as used
by \code{gl.lrectwrite} and the \code{imgfile} module. by \code{gl.lrectwrite} and the \code{imgfile} module.
The module defines the following variables and functions: The module defines the following variables and functions:
...@@ -17,20 +17,20 @@ per pixel, etc. ...@@ -17,20 +17,20 @@ per pixel, etc.
\begin{funcdesc}{crop}{image\, psize\, width\, height\, x0\, y0\, x1\, y1} \begin{funcdesc}{crop}{image\, psize\, width\, height\, x0\, y0\, x1\, y1}
This function takes the image in \code{image}, which should by This function takes the image in \var{image}, which should by
\code{width} by \code{height} in size and consist of pixels of \var{width} by \var{height} in size and consist of pixels of
\code{psize} bytes, and returns the selected part of that image. \code{x0}, \var{psize} bytes, and returns the selected part of that image. \var{x0},
\code{y0}, \code{x1} and \code{y1} are like the \code{lrectread} \var{y0}, \var{x1} and \var{y1} are like the \code{lrectread}
parameters, i.e. the boundary is included in the new image. parameters, i.e. the boundary is included in the new image.
The new boundaries need not be inside the picture. Pixels that fall The new boundaries need not be inside the picture. Pixels that fall
outside the old image will have their value set to zero. outside the old image will have their value set to zero.
If \code{x0} is bigger than \code{x1} the new image is mirrored. The If \var{x0} is bigger than \var{x1} the new image is mirrored. The
same holds for the y coordinates. same holds for the y coordinates.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{scale}{image\, psize\, width\, height\, newwidth\, newheight} \begin{funcdesc}{scale}{image\, psize\, width\, height\, newwidth\, newheight}
This function returns a \code{image} scaled to size \code{newwidth} by This function returns an \var{image} scaled to size \var{newwidth} by
\code{newheight}. No interpolation is done, scaling is done by \var{newheight}. No interpolation is done, scaling is done by
simple-minded pixel duplication or removal. Therefore, computer-generated simple-minded pixel duplication or removal. Therefore, computer-generated
images or dithered images will not look nice after scaling. images or dithered images will not look nice after scaling.
\end{funcdesc} \end{funcdesc}
...@@ -57,7 +57,7 @@ monochrome image but it uses a (simple-minded) dithering algorithm. ...@@ -57,7 +57,7 @@ monochrome image but it uses a (simple-minded) dithering algorithm.
\begin{funcdesc}{mono2grey}{image\, width\, height\, p0\, p1} \begin{funcdesc}{mono2grey}{image\, width\, height\, p0\, p1}
This function converts a 1-bit monochrome image to an 8 bit greyscale This function converts a 1-bit monochrome image to an 8 bit greyscale
or color image. All pixels that are zero-valued on input get value or color image. All pixels that are zero-valued on input get value
\code{p0} on output and all one-value input pixels get value \code{p1} \var{p0} on output and all one-value input pixels get value \var{p1}
on output. To convert a monochrome black-and-white image to greyscale on output. To convert a monochrome black-and-white image to greyscale
pass the values \code{0} and \code{255} respectively. pass the values \code{0} and \code{255} respectively.
\end{funcdesc} \end{funcdesc}
......
...@@ -39,7 +39,8 @@ returned by \code{get_suffixes} describing the kind of file found. ...@@ -39,7 +39,8 @@ returned by \code{get_suffixes} describing the kind of file found.
Initialize the built-in module called \var{name} and return its module Initialize the built-in module called \var{name} and return its module
object. If the module was already initialized, it will be initialized object. If the module was already initialized, it will be initialized
{\em again}. A few modules cannot be initialized twice --- attempting {\em again}. A few modules cannot be initialized twice --- attempting
to initialize these again will raise an exception. If there is no to initialize these again will raise an \code{ImportError} exception.
If there is no
built-in module called \var{name}, \code{None} is returned. built-in module called \var{name}, \code{None} is returned.
\end{funcdesc} \end{funcdesc}
......
\section{Built-in Module \sectcode{jpeg}} \section{Built-in Module \sectcode{jpeg}}
\bimodindex{jpeg} \bimodindex{jpeg}
The module jpeg provides access to the jpeg compressor and The module \code{jpeg} provides access to the jpeg compressor and
decompressor written by the Independent JPEG Group. JPEG is a (draft?) decompressor written by the Independent JPEG Group. JPEG is a (draft?)\
standard for compressing pictures. For details on jpeg or the standard for compressing pictures. For details on jpeg or the
Independent JPEG Group software refer to the JPEG standard or the Independent JPEG Group software refer to the JPEG standard or the
documentation provided with the software. documentation provided with the software.
The jpeg module defines these functions: The \code{jpeg} module defines these functions:
\renewcommand{\indexsubitem}{(in module jpeg)} \renewcommand{\indexsubitem}{(in module jpeg)}
\begin{funcdesc}{compress}{data\, w\, h\, b} \begin{funcdesc}{compress}{data\, w\, h\, b}
Treat data as a pixmap of width w and height h, with b bytes per Treat data as a pixmap of width \var{w} and height \var{h}, with \var{b} bytes per
pixel. The data is in SGI GL order, so the first pixel is in the pixel. The data is in SGI GL order, so the first pixel is in the
lower-left corner. This means that lrectread return data can lower-left corner. This means that \code{lrectread} return data can
immedeately be passed to compress. Currently only 1 byte and 4 byte immedeately be passed to compress. Currently only 1 byte and 4 byte
pixels are allowed, the former being treated as greyscale and the pixels are allowed, the former being treated as greyscale and the
latter as RGB color. Compress returns a string that contains the latter as RGB color. Compress returns a string that contains the
...@@ -24,28 +24,28 @@ compressed picture, in JFIF format. ...@@ -24,28 +24,28 @@ compressed picture, in JFIF format.
Data is a string containing a picture in JFIF format. It returns a Data is a string containing a picture in JFIF format. It returns a
tuple tuple
\code{(\var{data}, \var{width}, \var{height}, \var{bytesperpixel})}. \code{(\var{data}, \var{width}, \var{height}, \var{bytesperpixel})}.
Again, the data is suitable to pass to lrectwrite. Again, the data is suitable to pass to \code{lrectwrite}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setoption}{name\, value} \begin{funcdesc}{setoption}{name\, value}
Set various options. Subsequent compress and decompress calls Set various options. Subsequent compress and decompress calls
will use these options. The following options are available: will use these options. The following options are available:
\begin{description} \begin{description}
\item[\code{'forcegray'}] \item[\code{'forcegray' }]
Force output to be grayscale, even if input is RGB. Force output to be grayscale, even if input is RGB.
\item[\code{'quality'}] \item[\code{'quality' }]
Set the quality of the compressed image to a Set the quality of the compressed image to a
value between \code{0} and \code{100} (default is \code{75}). Compress only. value between \code{0} and \code{100} (default is \code{75}). Compress only.
\item[\code{'optimize'}] \item[\code{'optimize' }]
Perform Huffman table optimization. Takes longer, but results in Perform Huffman table optimization. Takes longer, but results in
smaller compressed image. Compress only. smaller compressed image. Compress only.
\item[\code{'smooth'}] \item[\code{'smooth' }]
Perform inter-block smoothing on uncompressed image. Only useful for Perform inter-block smoothing on uncompressed image. Only useful for
low-quality images. Decompress only. low-quality images. Decompress only.
\end{description} \end{description}
\end{funcdesc} \end{funcdesc}
Compress and uncompress raise the error jpeg.error in case of errors. Compress and uncompress raise the error \code{jpeg.error} in case of errors.
...@@ -23,13 +23,13 @@ etc). ...@@ -23,13 +23,13 @@ etc).
\end{datadesc} \end{datadesc}
\begin{funcdesc}{copen}{} \begin{funcdesc}{copen}{}
Open a new console window. Returns a console window object. Open a new console window. Return a console window object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fopen}{fp} \begin{funcdesc}{fopen}{fp}
Return the console window object corresponding with the given file Return the console window object corresponding with the given file
object. \var{Fp} should be one of \var{sys.stdin}, \var{sys.stdout} or object. \var{fp} should be one of \code{sys.stdin}, \code{sys.stdout} or
\var{sys.stderr}. \code{sys.stderr}.
\end{funcdesc} \end{funcdesc}
\subsection{macconsole options object} \subsection{macconsole options object}
...@@ -57,8 +57,7 @@ The title of the window. ...@@ -57,8 +57,7 @@ The title of the window.
\end{datadesc} \end{datadesc}
\begin{datadesc}{pause_atexit} \begin{datadesc}{pause_atexit}
If set non-zero, the window will wait for user action before closing If set non-zero, the window will wait for user action before closing.
the window.
\end{datadesc} \end{datadesc}
\subsection{console window object} \subsection{console window object}
...@@ -88,13 +87,13 @@ Clear to end-of-line. ...@@ -88,13 +87,13 @@ Clear to end-of-line.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{inverse}{onoff} \begin{funcdesc}{inverse}{onoff}
Enable inverse-video mode: characters with the high bit set are Enable inverse-video mode:\ characters with the high bit set are
displayed in inverse video (this disables the upper half of a displayed in inverse video (this disables the upper half of a
non-ascii character set). non-\ASCII{} character set).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{gotoxy}{x\, y} \begin{funcdesc}{gotoxy}{x\, y}
Set the cursor to position \code{(x, y)}. Set the cursor to position \code{(\var{x}, \var{y})}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{hide}{} \begin{funcdesc}{hide}{}
......
...@@ -7,9 +7,9 @@ This module provides access to macintosh FSSpec handling, the Alias ...@@ -7,9 +7,9 @@ This module provides access to macintosh FSSpec handling, the Alias
Manager, finder aliases and the Standard File package. Manager, finder aliases and the Standard File package.
Whenever a function or method expects a \var{file} argument, this Whenever a function or method expects a \var{file} argument, this
argument can be one of three things: (1) a full or partial macintosh argument can be one of three things:\ (1) a full or partial Macintosh
pathname, (2) an FSSpec object or (3) a 3-tuple \code{(wdRefNum, pathname, (2) an FSSpec object or (3) a 3-tuple \code{(wdRefNum,
parID, name)} as described in Inside Mac VI. A description of aliases parID, name)} as described in Inside Mac VI\@. A description of aliases
and the standard file package can also be found there. and the standard file package can also be found there.
\begin{funcdesc}{FSSpec}{file} \begin{funcdesc}{FSSpec}{file}
...@@ -26,15 +26,15 @@ Create an Alias object given the raw data for the alias. ...@@ -26,15 +26,15 @@ Create an Alias object given the raw data for the alias.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ResolveAliasFile}{file} \begin{funcdesc}{ResolveAliasFile}{file}
Resolve an alias file. Returns a 3-tuple \code{(fsspec, isfolder, Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, \var{isfolder},
aliased)} where \var{fsspec} is the resulting FSSpec object, \var{aliased})} where \var{fsspec} is the resulting FSSpec object,
\var{isfolder} is true if \var{fsspec} points to a folder and \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 \var{aliased} is true if the file was an alias in the first place
(otherwise the FSSpec object for the file itself is returned). (otherwise the FSSpec object for the file itself is returned).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{StandardGetFile}{\optional{type\, ...}} \begin{funcdesc}{StandardGetFile}{\optional{type\, ...}}
Present the user with a standard ``open onput file'' Present the user with a standard ``open input file''
dialog. Optionally, you can pass up to four 4-char file types to limit dialog. Optionally, you can pass up to four 4-char file types to limit
the files the user can choose from. The function returns an FSSpec the files the user can choose from. The function returns an FSSpec
object and a flag indicating that the user completed the dialog object and a flag indicating that the user completed the dialog
...@@ -44,14 +44,14 @@ without cancelling. ...@@ -44,14 +44,14 @@ without cancelling.
\begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}} \begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}}
Present the user with a standard ``open output file'' Present the user with a standard ``open output file''
dialog. \var{prompt} is the prompt string, and the optional dialog. \var{prompt} is the prompt string, and the optional
\var{default} argument initialized the output file name. The function \var{default} argument initializes the output file name. The function
returns an FSSpec object and a flag indicating that the user completed returns an FSSpec object and a flag indicating that the user completed
the dialog without cancelling. the dialog without cancelling.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetDirectory}{} \begin{funcdesc}{GetDirectory}{}
Present the user with a non-standard ``select a directory'' Present the user with a non-standard ``select a directory''
dialog. Returns an FSSpec object and a success-indicator. dialog. Return an FSSpec object and a success-indicator.
\end{funcdesc} \end{funcdesc}
\subsection{FSSpec objects} \subsection{FSSpec objects}
...@@ -67,13 +67,13 @@ Return the full pathname of the file described by the FSSpec object. ...@@ -67,13 +67,13 @@ Return the full pathname of the file described by the FSSpec object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{as_tuple}{} \begin{funcdesc}{as_tuple}{}
Return the \code{(wdRefNum, parID, name)} tuple of the file described Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of the file described
by the FSSpec object. by the FSSpec object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{NewAlias}{\optional{file}} \begin{funcdesc}{NewAlias}{\optional{file}}
Create an Alias object pointing to the file described by this Create an Alias object pointing to the file described by this
FSSpec. If the optional \code{file} parameter is present the alias FSSpec. If the optional \var{file} parameter is present the alias
will be relative to that file, otherwise it will be absolute. will be relative to that file, otherwise it will be absolute.
\end{funcdesc} \end{funcdesc}
...@@ -99,7 +99,7 @@ or transmitting to other programs. ...@@ -99,7 +99,7 @@ or transmitting to other programs.
\begin{funcdesc}{Resolve}{\optional{file}} \begin{funcdesc}{Resolve}{\optional{file}}
Resolve the alias. If the alias was created as a relative alias you Resolve the alias. If the alias was created as a relative alias you
should pass the file relative to which it is. Returns the FSSpec for should pass the file relative to which it is. Return the FSSpec for
the file pointed to and a flag indicating whether the alias object the file pointed to and a flag indicating whether the alias object
itself was modified during the search process. itself was modified during the search process.
\end{funcdesc} \end{funcdesc}
...@@ -113,9 +113,9 @@ Update the alias to point to the \var{file} given. If \var{file2} is ...@@ -113,9 +113,9 @@ Update the alias to point to the \var{file} given. If \var{file2} is
present a relative alias will be created. present a relative alias will be created.
\end{funcdesc} \end{funcdesc}
Note that is currently not possible to directly manipulate a resource Note that it is currently not possible to directly manipulate a resource
as an alias object. Hence, after calling \var{Update} or after as an alias object. Hence, after calling \var{Update} or after
\var{Resolve} indicates that the alias has changed the python program \var{Resolve} indicates that the alias has changed the Python program
is responsible for getting the \var{data} from the alias object and is responsible for getting the \var{data} from the alias object and
modifying the resource. modifying the resource.
......
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
\renewcommand{\indexsubitem}{(in module macspeech)} \renewcommand{\indexsubitem}{(in module macspeech)}
This module provides an interface to the Macintosh Speech Manager, This module provides an interface to the Macintosh Speech Manager,
allowing you to let the macintosh utter phrases. You need a version of 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 the speech manager extension (version 1 and 2 have been tested) in
your \code{Extensions} folder for this to work. The module does not your \code{Extensions} folder for this to work. The module does not
provide full access to all features of the Speech Manager yet. provide full access to all features of the Speech Manager yet.
\begin{funcdesc}{Available}{} \begin{funcdesc}{Available}{}
Test availability of the Speech Manager extension (and, on the Test availability of the Speech Manager extension (and, on the
PowerPC, the Speech Manager shared library). Returns 0 or 1. PowerPC, the Speech Manager shared library). Return 0 or 1.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Version}{} \begin{funcdesc}{Version}{}
Return the (integer) version of the Speech Manager. Return the (integer) version number of the Speech Manager.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{SpeakString}{str} \begin{funcdesc}{SpeakString}{str}
...@@ -43,7 +43,7 @@ yet possible to access the parameters of a voice. ...@@ -43,7 +43,7 @@ yet possible to access the parameters of a voice.
\renewcommand{\indexsubitem}{(voice object method)} \renewcommand{\indexsubitem}{(voice object method)}
\begin{funcdesc}{GetGender}{} \begin{funcdesc}{GetGender}{}
Return the gender of the voice: 0 for male, 1 for female and -1 for neuter. Return the gender of the voice:\ 0 for male, 1 for female and $-1$ for neuter.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{NewChannel}{} \begin{funcdesc}{NewChannel}{}
...@@ -54,7 +54,7 @@ Return a new speech channel object using this voice. ...@@ -54,7 +54,7 @@ Return a new speech channel object using this voice.
A speech channel object allows you to speak strings with slightly more A speech channel object allows you to speak strings with slightly more
control than \code{SpeakString()}, and allows you to use multiple control than \code{SpeakString()}, and allows you to use multiple
speakers at the same time. Please note that channel pitch and rate are 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 interrelated in some way, so that to make your Macintosh sing you will
have to adjust both. have to adjust both.
\renewcommand{\indexsubitem}{(speech channel object method)} \renewcommand{\indexsubitem}{(speech channel object method)}
...@@ -67,7 +67,7 @@ Stop babbling. ...@@ -67,7 +67,7 @@ Stop babbling.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetPitch}{} \begin{funcdesc}{GetPitch}{}
Returns the current pitch of the channel, as a floating-point number. Return the current pitch of the channel, as a floating-point number.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{SetPitch}{pitch} \begin{funcdesc}{SetPitch}{pitch}
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
\renewcommand{\indexsubitem}{(in module mactcp)} \renewcommand{\indexsubitem}{(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 \var{macdnr} which provides an MacTCP\@. There is an accompanying module \code{macdnr} which provides an
interface to the name-server (allowing you to translate hostnames to interface to the name-server (allowing you to translate hostnames to
ip-addresses), a module \var{MACTCP} which has symbolic names for ip-addresses), a module \code{MACTCP} which has symbolic names for
constants constants used by MacTCP and a wrapper module \var{socket} constants constants used by MacTCP and a wrapper module \code{socket}
which mimics the unix socket interface (as far as possible). which mimics the \UNIX{} socket interface (as far as possible).
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.
...@@ -26,14 +26,14 @@ Return the 32-bit integer network mask of the interface. ...@@ -26,14 +26,14 @@ Return the 32-bit integer network mask of the interface.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{TCPCreate}{size} \begin{funcdesc}{TCPCreate}{size}
Create a TCP Stream object. \var{Size} is the size of the receive Create a TCP Stream object. \var{size} is the size of the receive
buffer, \code{4096} is suggested by various sources. 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}
...@@ -41,30 +41,30 @@ datagrams on, a value of zero will make MacTCP select a free port. ...@@ -41,30 +41,30 @@ datagrams on, a value of zero will make MacTCP select a free port.
\renewcommand{\indexsubitem}{(TCP stream method)} \renewcommand{\indexsubitem}{(TCP stream method)}
\begin{datadesc}{asr} \begin{datadesc}{asr}
When set to a value different than \var{None} this should point to a When set to a value different than \code{None} this should point 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. In addition, it is called with eventcode
\var{MACTCP.PassiveOpenDone} when a \var{PassiveOpen} completes. This \code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen} completes. This
is a python addition to the MacTCP semantics. is a Python addition to the MacTCP semantics.
It is safe to do further calls from the asr. It is safe to do further calls from the \code{asr}.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{PassiveOpen}{port} \begin{funcdesc}{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 immedeately, 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 \var{wait} to wait for completion. You should not issue any method
calls other than calls other than
\var{wait}, \var{isdone} or \var{GetSockName} before the call \code{wait}, \code{isdone} or \code{GetSockName} before the call
completes. completes.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{wait}{} \begin{funcdesc}{wait}{}
Wait for \var{PassiveOpen} to complete. Wait for \code{PassiveOpen} to complete.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{isdone}{} \begin{funcdesc}{isdone}{}
Return 1 if a \var{PassiveOpen} is completed. Return 1 if a \code{PassiveOpen} has completed.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetSockName}{} \begin{funcdesc}{GetSockName}{}
...@@ -73,9 +73,9 @@ Return the TCP address of this side of a connection as a 2-tuple ...@@ -73,9 +73,9 @@ Return the TCP address of this side of a connection as a 2-tuple
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ActiveOpen}{lport\, host\, rport} \begin{funcdesc}{ActiveOpen}{lport\, host\, rport}
Open an outgoing connection to TCP address \code{(host, 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 is established. call blocks until the connection has been established.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Send}{buf\, push\, urgent} \begin{funcdesc}{Send}{buf\, push\, urgent}
...@@ -87,7 +87,7 @@ are flags as specified by the TCP standard. ...@@ -87,7 +87,7 @@ are flags as specified by the TCP standard.
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{(data, urgent, mark)}. If urgent data is outstanding \var{Rcv} \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 will always return that before looking at any normal data. The first
call returning urgent data will have the \var{urgent} flag set, the call returning urgent data will have the \var{urgent} flag set, the
last will have the \var{mark} flag set. last will have the \var{mark} flag set.
...@@ -95,7 +95,7 @@ last will have the \var{mark} flag set. ...@@ -95,7 +95,7 @@ last will have the \var{mark} flag set.
\begin{funcdesc}{Close}{} \begin{funcdesc}{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 returnes 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{funcdesc}
...@@ -131,7 +131,7 @@ amtUnackedData} is what you can pass to \code{Send} without blocking. ...@@ -131,7 +131,7 @@ amtUnackedData} is what you can pass to \code{Send} without blocking.
\end{datadesc} \end{datadesc}
\begin{datadesc}{amtUnreadData} \begin{datadesc}{amtUnreadData}
The number of bytes received but not yet read (what you can \var{Recv} The number of bytes received but not yet read (what you can \code{Recv}
without blocking). without blocking).
\end{datadesc} \end{datadesc}
...@@ -145,7 +145,7 @@ about UDP. ...@@ -145,7 +145,7 @@ about UDP.
\begin{datadesc}{asr} \begin{datadesc}{asr}
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 \var{Read} call. The asr has a datagram arrival without outstanding \code{Read} call. The \code{asr} has a
single argument, the event code. single argument, the event code.
\end{datadesc} \end{datadesc}
...@@ -154,8 +154,8 @@ A read-only member giving the port number of this UDP stream. ...@@ -154,8 +154,8 @@ A read-only member giving the port number of this UDP stream.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{Read}{timeout} \begin{funcdesc}{Read}{timeout}
Read a datagram, waiting at most \var{timeout} seconds (-1 is Read a datagram, waiting at most \var{timeout} seconds ($-1$ is
indefinite). Returns the data. indefinite). Return the data.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Write}{host\, port\, buf} \begin{funcdesc}{Write}{host\, port\, buf}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
This module implements the interface to RSA's MD5 message digest This module implements the interface to RSA's MD5 message digest
algorithm (see also the file \file{md5.doc}). Its use is quite algorithm (see also the file \file{md5.doc}). Its use is quite
straightforward: use the function \code{md5} to create an straightforward:\ use the function \code{new} to create an
\dfn{md5}-object. You can now ``feed'' this object with arbitrary \dfn{md5}-object. You can now ``feed'' this object with arbitrary
strings. strings.
......
...@@ -8,15 +8,15 @@ arithmetic routines. Only the interfaces to the \emph{integer} ...@@ -8,15 +8,15 @@ arithmetic routines. Only the interfaces to the \emph{integer}
otherwise, the description in the GNU MP documentation can be applied. otherwise, the description in the GNU MP documentation can be applied.
In general, \dfn{mpz}-numbers can be used just like other standard In general, \dfn{mpz}-numbers can be used just like other standard
Python numbers, e.g. you can use the built-in operators like \code{+}, Python numbers, e.g.\ you can use the built-in operators like \code{+},
\code{*}, etc., as well as the standard built-in functions like \code{*}, etc., as well as the standard built-in functions like
\code{abs}, \code{int}, \ldots, \code{divmod}, \code{pow}. \code{abs}, \code{int}, \ldots, \code{divmod}, \code{pow}.
\strong{Please note:} the {\it bitwise-xor} operation has been implemented as \strong{Please note:} the {\it bitwise-xor} operation has been implemented as
a bunch of {\it and}s, {\it invert}s and {\it or}s, because the library a bunch of {\it and}s, {\it invert}s and {\it or}s, because the library
lacks an \code{mpz_xor} function, and I didn't need one. lacks an \code{mpz_xor} function, and I didn't need one.
You create an mpz-number, by calling the function called \code{mpz} (see You create an mpz-number by calling the function called \code{mpz} (see
below for an excact description). An mpz-number is printed like this: below for an exact description). An mpz-number is printed like this:
\code{mpz(\var{value})}. \code{mpz(\var{value})}.
\renewcommand{\indexsubitem}{(in module mpz)} \renewcommand{\indexsubitem}{(in module mpz)}
...@@ -59,7 +59,7 @@ return mpz-numbers. ...@@ -59,7 +59,7 @@ return mpz-numbers.
\begin{funcdesc}{divm}{numerator\, denominator\, modulus} \begin{funcdesc}{divm}{numerator\, denominator\, modulus}
Returns a number \var{q}. such that Returns a number \var{q}. such that
\code{\var{q} * \var{denominator} \%{} \var{modulus} == \var{numerator}}. \code{\var{q} * \var{denominator} \%{} \var{modulus} == \var{numerator}}.
One could also implement this function in python, using \code{gcdext}. One could also implement this function in Python, using \code{gcdext}.
\end{funcdesc} \end{funcdesc}
An mpz-number has one method: An mpz-number has one method:
...@@ -69,6 +69,6 @@ An mpz-number has one method: ...@@ -69,6 +69,6 @@ An mpz-number has one method:
Convert this mpz-number to a binary string, where the number has been Convert this mpz-number to a binary string, where the number has been
stored as an array of radix-256 digits, least significant digit first. stored as an array of radix-256 digits, least significant digit first.
The mpz-number must have a value greater than- or equal to zero, The mpz-number must have a value greater than or equal to zero,
otherwise a \code{ValueError}-exception will be raised. otherwise a \code{ValueError}-exception will be raised.
\end{funcdesc} \end{funcdesc}
...@@ -9,7 +9,7 @@ When the optional built-in module \code{posix} is available, this ...@@ -9,7 +9,7 @@ When the optional built-in module \code{posix} is available, this
module exports the same functions and data as \code{posix}; otherwise, module exports the same functions and data as \code{posix}; otherwise,
it searches for an OS dependent built-in module like \code{mac} and it searches for an OS dependent built-in module like \code{mac} and
exports the same functions and data as found there. The design of all exports the same functions and data as found there. The design of all
Python's built-in OS dependen modules is such that as long as the same Python's built-in OS dependent modules is such that as long as the same
functionality is available, it uses the same interface; e.g., the functionality is available, it uses the same interface; e.g., the
function \code{os.stat(\var{file})} returns stat info about a \var{file} in a function \code{os.stat(\var{file})} returns stat info about a \var{file} in a
format compatible with the POSIX interface. format compatible with the POSIX interface.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
\indexii{pickling}{objects} \indexii{pickling}{objects}
The \code{pickle} module implements a basic but powerful algorithm for The \code{pickle} module implements a basic but powerful algorithm for
``pickling'' (a.k.a. serializing, marshalling or flattening) nearly ``pickling'' (a.k.a.\ serializing, marshalling or flattening) nearly
arbitrary Python objects. This is a more primitive notion than arbitrary Python objects. This is a more primitive notion than
persistency --- although \code{pickle} reads and writes file objects, persistency --- although \code{pickle} reads and writes file objects,
it does not handle the issue of naming persistent objects, nor the it does not handle the issue of naming persistent objects, nor the
...@@ -32,7 +32,7 @@ following correctly: ...@@ -32,7 +32,7 @@ following correctly:
\item pointer sharing \item pointer sharing
\item instances uf user-defined classes \item instances of user-defined classes
\end{itemize} \end{itemize}
...@@ -105,11 +105,11 @@ module. ...@@ -105,11 +105,11 @@ module.
\ttindex{__dict__} \ttindex{__dict__}
Note that when class instances are pickled, their class's code and Note that when class instances are pickled, their class's code and
data is not pickled along with them. Only the instance data is data are not pickled along with them. Only the instance data are
pickled. This is done on purpose, so you can fix bugs in a class or pickled. This is done on purpose, so you can fix bugs in a class or
add methods and still load objects that were created with an earlier add methods and still load objects that were created with an earlier
version of the class. If you plan to have long-lived objects that version of the class. If you plan to have long-lived objects that
will see many versions of a class, it may be worth to put a version will see many versions of a class, it may be worthwhile to put a version
number in the objects so that suitable conversions can be made by the number in the objects so that suitable conversions can be made by the
class's \code{__setstate__()} method. class's \code{__setstate__()} method.
...@@ -157,7 +157,7 @@ the file argument. ...@@ -157,7 +157,7 @@ the file argument.
It is possible to make multiple calls to \code{Pickler.dump()} or to It is possible to make multiple calls to \code{Pickler.dump()} or to
\code{Unpickler.load()}, as long as there is a one-to-one \code{Unpickler.load()}, as long as there is a one-to-one
correspondence between pickler and \code{Unpickler} objects and correspondence between \code{Pickler} and \code{Unpickler} objects and
between \code{dump} and \code{load} calls for any pair of between \code{dump} and \code{load} calls for any pair of
corresponding \code{Pickler} and \code{Unpicklers}. {\em Warning}: corresponding \code{Pickler} and \code{Unpicklers}. {\em Warning}:
this is intended for pickling multiple objects without intervening this is intended for pickling multiple objects without intervening
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
\bimodindex{posix} \bimodindex{posix}
This module provides access to operating system functionality that is This module provides access to operating system functionality that is
standardized by the C Standard and the POSIX standard (a thinly diguised standardized by the C Standard and the POSIX standard (a thinly disguised
\UNIX{} interface). \UNIX{} interface).
It is available in all Python versions except on the Macintosh; It is available in all Python versions except on the Macintosh;
the MS-DOS version does not support certain functions. the MS-DOS version does not support certain functions.
...@@ -31,7 +31,7 @@ in C. ...@@ -31,7 +31,7 @@ in C.
\renewcommand{\indexsubitem}{(exception in module posix)} \renewcommand{\indexsubitem}{(exception in module posix)}
\begin{excdesc}{error} \begin{excdesc}{error}
This exception is raised when an POSIX function returns a This exception is raised when a POSIX function returns a
POSIX-related error (e.g., not for illegal argument types). Its POSIX-related error (e.g., not for illegal argument types). Its
string value is \code{'posix.error'}. The accompanying value is a string value is \code{'posix.error'}. The accompanying value is a
pair containing the numeric error code from \code{errno} and the pair containing the numeric error code from \code{errno} and the
...@@ -279,7 +279,7 @@ systems without symbolic links, this always raises ...@@ -279,7 +279,7 @@ systems without symbolic links, this always raises
\begin{funcdesc}{system}{command} \begin{funcdesc}{system}{command}
Execute the command (a string) in a subshell. This is implemented by Execute the command (a string) in a subshell. This is implemented by
calling the Standard C function \code{system()}, and has the same calling the Standard C function \code{system()}, and has the same
limitations. Changes to \code{posix.environ}, \code{sys.stdin} etc. are limitations. Changes to \code{posix.environ}, \code{sys.stdin} etc.\ are
not reflected in the environment of the executed command. The return not reflected in the environment of the executed command. The return
value is the exit status of the process as returned by Standard C value is the exit status of the process as returned by Standard C
\code{system()}. \code{system()}.
...@@ -302,7 +302,7 @@ Return a 5-tuple containing information identifying the current ...@@ -302,7 +302,7 @@ Return a 5-tuple containing information identifying the current
operating system. The tuple contains 5 strings: operating system. The tuple contains 5 strings:
\code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}. \code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}.
Some systems truncate the nodename to 8 Some systems truncate the nodename to 8
characters or to the leading component; an better way to get the characters or to the leading component; a better way to get the
hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older
\UNIX{} systems.) \UNIX{} systems.)
\end{funcdesc} \end{funcdesc}
......
...@@ -48,13 +48,13 @@ Return true if \var{p} is an absolute pathname (begins with a slash). ...@@ -48,13 +48,13 @@ Return true if \var{p} is an absolute pathname (begins with a slash).
\begin{funcdesc}{isfile}{p} \begin{funcdesc}{isfile}{p}
Return true if \var{p} is an existing regular file. This follows Return true if \var{p} is an existing regular file. This follows
symbolic links, so both islink() and isfile() can be true for the same symbolic links, so both \code{islink()} and \code{isfile()} can be true for the same
path. path.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{isdir}{p} \begin{funcdesc}{isdir}{p}
Return true if \var{p} is an existing directory. This follows Return true if \var{p} is an existing directory. This follows
symbolic links, so both islink() and isdir() can be true for the same symbolic links, so both \code{islink()} and \code{isdir()} can be true for the same
path. path.
\end{funcdesc} \end{funcdesc}
...@@ -109,7 +109,7 @@ everything leading up to that. If \var{p} ends in a slash (except if ...@@ -109,7 +109,7 @@ everything leading up to that. If \var{p} ends in a slash (except if
it is the root), the trailing slash is removed and the operation it is the root), the trailing slash is removed and the operation
applied to the result; otherwise, \code{join(\var{head}, \var{tail})} equals applied to the result; otherwise, \code{join(\var{head}, \var{tail})} equals
\var{p}. The \var{tail} part never contains a slash. Some boundary \var{p}. The \var{tail} part never contains a slash. Some boundary
cases: if \var{p} is the root, \var{head} equals \var{p} and cases:\ if \var{p} is the root, \var{head} equals \var{p} and
\var{tail} is empty; if \var{p} is empty, both \var{head} and \var{tail} is empty; if \var{p} is empty, both \var{head} and
\var{tail} are empty; if \var{p} contains no slash, \var{head} is \var{tail} are empty; if \var{p} contains no slash, \var{head} is
empty and \var{tail} equals \var{p}. empty and \var{tail} equals \var{p}.
......
\section{Standard Module \sectcode{rand}} \section{Standard Module \sectcode{rand}}
\stmodindex{rand} This module implements a pseudo-random number \stmodindex{rand} This module implements a pseudo-random number
generator with an interface similar to \code{rand()} in C. It defines generator with an interface similar to \code{rand()} in C\@. It defines
the following functions: the following functions:
\renewcommand{\indexsubitem}{(in module rand)} \renewcommand{\indexsubitem}{(in module rand)}
......
...@@ -22,7 +22,7 @@ are currently supported. ...@@ -22,7 +22,7 @@ are currently supported.
\begin{funcdesc}{longimagedata}{file} \begin{funcdesc}{longimagedata}{file}
This function reads and decodes the image on the specified file, and This function reads and decodes the image on the specified file, and
returns it as a python string. The string has 4 byte RGBA pixels. returns it as a Python string. The string has 4 byte RGBA pixels.
The bottom left pixel is the first in The bottom left pixel is the first in
the string. This format is suitable to pass to \code{gl.lrectwrite}, the string. This format is suitable to pass to \code{gl.lrectwrite},
for instance. for instance.
...@@ -41,5 +41,5 @@ These are the formats returned by \code{gl.lrectread}. ...@@ -41,5 +41,5 @@ These are the formats returned by \code{gl.lrectread}.
This function sets a global flag which defines whether the scan lines This function sets a global flag which defines whether the scan lines
of the image are read or written from bottom to top (flag is zero, of the image are read or written from bottom to top (flag is zero,
compatible with SGI GL) or from top to bottom(flag is one, compatible with SGI GL) or from top to bottom(flag is one,
compatible with X). The default is zero. compatible with X)\@. The default is zero.
\end{funcdesc} \end{funcdesc}
...@@ -25,7 +25,7 @@ The available functions in this module are: ...@@ -25,7 +25,7 @@ The available functions in this module are:
\renewcommand{\indexsubitem}{(in module rotor)} \renewcommand{\indexsubitem}{(in module rotor)}
\begin{funcdesc}{newrotor}{key\optional{\, numrotors}} \begin{funcdesc}{newrotor}{key\optional{\, numrotors}}
Returns a rotor object. \var{key} is a string containing the encryption key Return a rotor object. \var{key} is a string containing the encryption key
for the object; it can contain arbitrary binary data. The key will be used for the object; it can contain arbitrary binary data. The key will be used
to randomly generate the rotor permutations and their initial positions. to randomly generate the rotor permutations and their initial positions.
\var{numrotors} is the number of rotor permutations in the returned object; \var{numrotors} is the number of rotor permutations in the returned object;
...@@ -36,28 +36,28 @@ Rotor objects have the following methods: ...@@ -36,28 +36,28 @@ Rotor objects have the following methods:
\renewcommand{\indexsubitem}{(rotor method)} \renewcommand{\indexsubitem}{(rotor method)}
\begin{funcdesc}{setkey}{} \begin{funcdesc}{setkey}{}
Resets the rotor to its initial state. Reset the rotor to its initial state.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{encrypt}{plaintext} \begin{funcdesc}{encrypt}{plaintext}
Resets the rotor object to its initial state and encrypts \var{plaintext}, Reset the rotor object to its initial state and encrypt \var{plaintext},
returning a string containing the ciphertext. The ciphertext is always the returning a string containing the ciphertext. The ciphertext is always the
same length as the original plaintext. same length as the original plaintext.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{encryptmore}{plaintext} \begin{funcdesc}{encryptmore}{plaintext}
Encrypts \var{plaintext} without resetting the rotor object, and returns a Encrypt \var{plaintext} without resetting the rotor object, and return a
string containing the ciphertext. string containing the ciphertext.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{decrypt}{ciphertext} \begin{funcdesc}{decrypt}{ciphertext}
Resets the rotor object to its initial state and decrypts \var{ciphertext}, Reset the rotor object to its initial state and decrypt \var{ciphertext},
returning a string containing the ciphertext. The plaintext string will returning a string containing the ciphertext. The plaintext string will
always be the same length as the ciphertext. always be the same length as the ciphertext.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{decryptmore}{ciphertext} \begin{funcdesc}{decryptmore}{ciphertext}
Decrypts \var{ciphertext} without resetting the rotor object, and returns a Decrypt \var{ciphertext} without resetting the rotor object, and return a
string containing the ciphertext. string containing the ciphertext.
\end{funcdesc} \end{funcdesc}
......
...@@ -12,20 +12,20 @@ it is explicitly reset (i.e. Python uses the BSD style interface). ...@@ -12,20 +12,20 @@ it is explicitly reset (i.e. Python uses the BSD style interface).
\item \item
There is no way to ``block'' signals temporarily from critical There is no way to ``block'' signals temporarily from critical
sections (since this is not supported by all Unix flavors). sections (since this is not supported by all \UNIX{} flavors).
\item \item
Although Python signal handlers are called asynchronously as far as Although Python signal handlers are called asynchronously as far as
the Python user is concerned, they can only occur between the the Python user is concerned, they can only occur between the
``atomic'' instructions of the Python interpreter. This means that ``atomic'' instructions of the Python interpreter. This means that
signals arriving during long calculations implemented purely in C signals arriving during long calculations implemented purely in C
(e.g. regular expression matches on large bodies of text) may be (e.g.\ regular expression matches on large bodies of text) may be
delayed for an arbitrary time. delayed for an arbitrary time.
\item \item
When a signal arrives during an I/O operation, it is possible that the When a signal arrives during an I/O operation, it is possible that the
I/O operation raises an exception after the signal handler returns. I/O operation raises an exception after the signal handler returns.
This is dependent on the underlying Unix system's semantics regarding This is dependent on the underlying \UNIX{} system's semantics regarding
interrupted system calls. interrupted system calls.
\item \item
...@@ -44,8 +44,8 @@ overridden. ...@@ -44,8 +44,8 @@ overridden.
\item \item
Some care must be taken if both signals and threads are used in the Some care must be taken if both signals and threads are used in the
same program. The fundamental thing to remember in using signals and same program. The fundamental thing to remember in using signals and
threads simultaneously is: always perform \code{signal()} operations threads simultaneously is:\ always perform \code{signal()} operations
in the main thread of execution. Any thread can perform a in the main thread of execution. Any thread can perform an
\code{alarm()}, \code{getsignal()}, or \code{pause()}; only the main \code{alarm()}, \code{getsignal()}, or \code{pause()}; only the main
thread can set a new signal handler, and the main thread will be the thread can set a new signal handler, and the main thread will be the
only one to receive signals. This means that signals can't be used as only one to receive signals. This means that signals can't be used as
...@@ -73,7 +73,7 @@ The variables defined in the signal module are: ...@@ -73,7 +73,7 @@ The variables defined in the signal module are:
hangup signal is defined as \code{signal.SIGHUP}; the variable names hangup signal is defined as \code{signal.SIGHUP}; the variable names
are identical to the names used in C programs, as found in are identical to the names used in C programs, as found in
\file{signal.h}. \file{signal.h}.
The UNIX man page for \file{signal} lists the existing signals (on The \UNIX{} man page for \file{signal} lists the existing signals (on
some systems this is \file{signal(2)}, on others the list is in some systems this is \file{signal(2)}, on others the list is in
\file{signal(7)}). \file{signal(7)}).
Note that not all systems define the same set of signal names; only Note that not all systems define the same set of signal names; only
...@@ -89,18 +89,18 @@ The signal module defines the following functions: ...@@ -89,18 +89,18 @@ The signal module defines the following functions:
\begin{funcdesc}{alarm}{time} \begin{funcdesc}{alarm}{time}
If \var{time} is non-zero, this function requests that a If \var{time} is non-zero, this function requests that a
\code{SIGALRM} signal be sent to the process in \var{time} seconds. \code{SIGALRM} signal be sent to the process in \var{time} seconds.
Any previously scheduled alarm is canceled (i.e. only one alarm can Any previously scheduled alarm is canceled (i.e.\ only one alarm can
be scheduled at any time). The returned value is then the number of be scheduled at any time). The returned value is then the number of
seconds before any previously set alarm was to have been delivered. seconds before any previously set alarm was to have been delivered.
If \var{time} is zero, no alarm id scheduled, and any scheduled If \var{time} is zero, no alarm id scheduled, and any scheduled
alarm is canceled. The return value is the number of seconds alarm is canceled. The return value is the number of seconds
remaining before a previously scheduled alarm. If the return value remaining before a previously scheduled alarm. If the return value
is zero, no alarm is currently scheduled. (See the UNIX man page is zero, no alarm is currently scheduled. (See the \UNIX{} man page
\code{alarm(2)}.) \code{alarm(2)}.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getsignal}{signalnum} \begin{funcdesc}{getsignal}{signalnum}
Returns the current signal handler for the signal \var{signalnum}. Return the current signal handler for the signal \var{signalnum}.
The returned value may be a callable Python object, or one of the The returned value may be a callable Python object, or one of the
special values \code{signal.SIG_IGN}, \code{signal.SIG_DFL} or special values \code{signal.SIG_IGN}, \code{signal.SIG_DFL} or
\code{None}. Here, \code{signal.SIG_IGN} means that the signal was \code{None}. Here, \code{signal.SIG_IGN} means that the signal was
...@@ -110,20 +110,20 @@ The signal module defines the following functions: ...@@ -110,20 +110,20 @@ The signal module defines the following functions:
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pause}{} \begin{funcdesc}{pause}{}
Causes the process to sleep until a signal is received; the Cause the process to sleep until a signal is received; the
appropriate handler will then be called. Returns nothing. (See the appropriate handler will then be called. Returns nothing. (See the
UNIX man page \code{signal(2)}.) \UNIX{} man page \code{signal(2)}.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{signal}{signalnum\, handler} \begin{funcdesc}{signal}{signalnum\, handler}
Sets the handler for signal \var{signalnum} to the function Set the handler for signal \var{signalnum} to the function
\var{handler}. \var{handler} can be any callable Python object, or \var{handler}. \var{handler} can be any callable Python object, or
one of the special values \code{signal.SIG_IGN} or one of the special values \code{signal.SIG_IGN} or
\code{signal.SIG_DFL}. The previous signal handler will be returned \code{signal.SIG_DFL}. The previous signal handler will be returned
(see the description of \code{getsignal()} above). (See the UNIX (see the description of \code{getsignal()} above). (See the \UNIX{}
man page \code{signal(2)}.) man page \code{signal(2)}.)
When threads are enabled, this function can only be called from the When threads are enabled, this function can only be called from the
main thread; attempting to call it from other threads will cause a main thread; attempting to call it from other threads will cause a
\code{ValueError} exception will be raised. \code{ValueError} exception to be raised.
\end{funcdesc} \end{funcdesc}
...@@ -10,7 +10,7 @@ Tutorial}, by Stuart Sechrest and \emph{An Advanced 4.3BSD Interprocess ...@@ -10,7 +10,7 @@ Tutorial}, by Stuart Sechrest and \emph{An Advanced 4.3BSD Interprocess
Communication Tutorial}, by Samuel J. Leffler et al, both in the Communication Tutorial}, by Samuel J. Leffler et al, both in the
\UNIX{} Programmer's Manual, Supplementary Documents 1 (sections PS1:7 \UNIX{} Programmer's Manual, Supplementary Documents 1 (sections PS1:7
and PS1:8). The \UNIX{} manual pages for the various socket-related and PS1:8). The \UNIX{} manual pages for the various socket-related
system calls also a valuable source of information on the details of system calls are also a valuable source of information on the details of
socket semantics. socket semantics.
The Python interface is a straightforward transliteration of the The Python interface is a straightforward transliteration of the
...@@ -77,11 +77,11 @@ used for the second argument to \code{socket()}. ...@@ -77,11 +77,11 @@ used for the second argument to \code{socket()}.
\dataline{IPPORT_*} \dataline{IPPORT_*}
\dataline{INADDR_*} \dataline{INADDR_*}
\dataline{IP_*} \dataline{IP_*}
Many constants of these forms, documented in the Unix documentation on Many constants of these forms, documented in the \UNIX{} documentation on
sockets and/or the IP protocol, are also defined in the socket module. sockets and/or the IP protocol, are also defined in the socket module.
They are generally used in arguments to the \code{setsockopt} and They are generally used in arguments to the \code{setsockopt} and
\code{getsockopt} methods of socket objects. In most cases, only \code{getsockopt} methods of socket objects. In most cases, only
those symbols that are defined in the Unix header files are defined; those symbols that are defined in the \UNIX{} header files are defined;
for a few symbols, default values are provided. for a few symbols, default values are provided.
\end{datadesc} \end{datadesc}
...@@ -113,7 +113,7 @@ for that service. The protocol name should be \code{'tcp'} or ...@@ -113,7 +113,7 @@ for that service. The protocol name should be \code{'tcp'} or
\code{'udp'}. \code{'udp'}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{socket}{family\, type\, proto} \begin{funcdesc}{socket}{family\, type\optional{\, proto}}
Create a new socket using the given address family, socket type and Create a new socket using the given address family, socket type and
protocol number. The address family should be \code{AF_INET} or protocol number. The address family should be \code{AF_INET} or
\code{AF_UNIX}. The socket type should be \code{SOCK_STREAM}, \code{AF_UNIX}. The socket type should be \code{SOCK_STREAM},
...@@ -121,7 +121,7 @@ protocol number. The address family should be \code{AF_INET} or ...@@ -121,7 +121,7 @@ protocol number. The address family should be \code{AF_INET} or
The protocol number is usually zero and may be omitted in that case. The protocol number is usually zero and may be omitted in that case.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fromfd}{fd\, family\, type\, proto} \begin{funcdesc}{fromfd}{fd\, family\, type\optional{\, proto}}
Build a socket object from an existing file descriptor (an integer as Build a socket object from an existing file descriptor (an integer as
returned by a file object's \code{fileno} method). Address family, returned by a file object's \code{fileno} method). Address family,
socket type and protocol number are as for the \code{socket} function socket type and protocol number are as for the \code{socket} function
...@@ -129,7 +129,7 @@ above. The file descriptor should refer to a socket, but this is not ...@@ -129,7 +129,7 @@ above. The file descriptor should refer to a socket, but this is not
checked --- subsequent operations on the object may fail if the file checked --- subsequent operations on the object may fail if the file
descriptor is invalid. This function is rarely needed, but can be descriptor is invalid. This function is rarely needed, but can be
used to get or set socket options on a socket passed to a program as used to get or set socket options on a socket passed to a program as
standard input or output (e.g. a server started by the \UNIX{} inet standard input or output (e.g.\ a server started by the \UNIX{} inet
daemon). daemon).
\end{funcdesc} \end{funcdesc}
...@@ -185,7 +185,7 @@ number of an IP socket, for instance. ...@@ -185,7 +185,7 @@ number of an IP socket, for instance.
see above.) see above.)
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getsockopt}{level\, optname\, buflen} \begin{funcdesc}{getsockopt}{level\, optname\optional{\, buflen}}
Return the value of the given socket option (see the \UNIX{} man page Return the value of the given socket option (see the \UNIX{} man page
{\it getsockopt}(2)). The needed symbolic constants are defined in {\it getsockopt}(2)). The needed symbolic constants are defined in
the \code{socket} module (\code{SO_*} etc.). If the optional third the \code{socket} module (\code{SO_*} etc.). If the optional third
...@@ -211,7 +211,7 @@ descriptor, so the file object and socket object may be closed or ...@@ -211,7 +211,7 @@ descriptor, so the file object and socket object may be closed or
garbage-collected independently. garbage-collected independently.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{recv}{bufsize\, flags} \begin{funcdesc}{recv}{bufsize\optional{\, flags}}
Receive data from the socket. The return value is a string representing Receive data from the socket. The return value is a string representing
the data received. The maximum amount of data to be received the data received. The maximum amount of data to be received
at once is specified by \var{bufsize}. See the \UNIX{} manual page at once is specified by \var{bufsize}. See the \UNIX{} manual page
...@@ -271,7 +271,7 @@ Note that there are no methods \code{read()} or \code{write()}; use ...@@ -271,7 +271,7 @@ Note that there are no methods \code{read()} or \code{write()}; use
\subsection{Example} \subsection{Example}
\nodename{Socket Example} \nodename{Socket Example}
Here are two minimal example programs using the TCP/IP protocol: a Here are two minimal example programs using the TCP/IP protocol:\ a
server that echoes all data that it receives back (servicing only one server that echoes all data that it receives back (servicing only one
client), and a client using it. Note that a server must perform the client), and a client using it. Note that a server must perform the
sequence \code{socket}, \code{bind}, \code{listen}, \code{accept} sequence \code{socket}, \code{bind}, \code{listen}, \code{accept}
......
...@@ -72,7 +72,7 @@ or more digits, optionally preceded by a sign (\samp{+} or \samp{-}). ...@@ -72,7 +72,7 @@ or more digits, optionally preceded by a sign (\samp{+} or \samp{-}).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{expandtabs}{s\, tabsize} \begin{funcdesc}{expandtabs}{s\, tabsize}
Expand tabs in a string, i.e. replace them by one or more spaces, Expand tabs in a string, i.e.\ replace them by one or more spaces,
depending on the current column and the given tab size. The column depending on the current column and the given tab size. The column
number is reset to zero after each newline occurring in the string. number is reset to zero after each newline occurring in the string.
This doesn't understand other non-printing characters or escape This doesn't understand other non-printing characters or escape
...@@ -88,7 +88,7 @@ negative, \code{len(\var{s})} is added. ...@@ -88,7 +88,7 @@ negative, \code{len(\var{s})} is added.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{rfind}{s\, sub\optional{\, start}} \begin{funcdesc}{rfind}{s\, sub\optional{\, start}}
Like \code{find} but finds the highest index. Like \code{find} but find the highest index.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{index}{s\, sub\optional{\, start}} \begin{funcdesc}{index}{s\, sub\optional{\, start}}
...@@ -101,7 +101,7 @@ Like \code{rfind} but raise \code{ValueError} when the substring is ...@@ -101,7 +101,7 @@ Like \code{rfind} but raise \code{ValueError} when the substring is
not found. not found.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{count}{s\, sub\, i} \begin{funcdesc}{count}{s\, sub\optional{\, i}}
Return the number of (non-overlapping) occurrences of substring Return the number of (non-overlapping) occurrences of substring
\var{sub} in string \var{s} with index at least \var{i}. \var{sub} in string \var{s} with index at least \var{i}.
If \var{i} is omitted, it defaults to \code{0}. If \var{i} is omitted, it defaults to \code{0}.
...@@ -112,12 +112,12 @@ Convert letters to lower case. ...@@ -112,12 +112,12 @@ Convert letters to lower case.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{split}{s} \begin{funcdesc}{split}{s}
Returns a list of the whitespace-delimited words of the string Return a list of the whitespace-delimited words of the string
\var{s}. \var{s}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{splitfields}{s\, sep} \begin{funcdesc}{splitfields}{s\, sep}
Returns a list containing the fields of the string \var{s}, using Return a list containing the fields of the string \var{s}, using
the string \var{sep} as a separator. The list will have one more the string \var{sep} as a separator. The list will have one more
items than the number of non-overlapping occurrences of the items than the number of non-overlapping occurrences of the
separator in the string. Thus, \code{string.splitfields(\var{s}, ' separator in the string. Thus, \code{string.splitfields(\var{s}, '
...@@ -139,12 +139,12 @@ equals \var{t}. ...@@ -139,12 +139,12 @@ equals \var{t}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{strip}{s} \begin{funcdesc}{strip}{s}
Removes leading and trailing whitespace from the string Remove leading and trailing whitespace from the string
\var{s}. \var{s}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{swapcase}{s} \begin{funcdesc}{swapcase}{s}
Converts lower case letters to upper case and vice versa. Convert lower case letters to upper case and vice versa.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{upper}{s} \begin{funcdesc}{upper}{s}
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
\renewcommand{\indexsubitem}{(in module tempfile)} \renewcommand{\indexsubitem}{(in module tempfile)}
This module generates temporary file names. It is not UNIX specific, This module generates temporary file names. It is not \UNIX{} specific,
but it may require some help on non-UNIX systems. but it may require some help on non-\UNIX{} systems.
Note: the modules does not create temporary files, nor does it Note: the modules does not create temporary files, nor does it
automatically remove them when the current process exits or dies. automatically remove them when the current process exits or dies.
...@@ -27,7 +27,7 @@ are initialized at the first call to \code{mktemp()}. ...@@ -27,7 +27,7 @@ are initialized at the first call to \code{mktemp()}.
When set to a value other than \code{None}, this variable defines the When set to a value other than \code{None}, this variable defines the
directory in which filenames returned by \code{mktemp()} reside. The directory in which filenames returned by \code{mktemp()} reside. The
default is taken from the environment variable \code{TMPDIR}; if this default is taken from the environment variable \code{TMPDIR}; if this
is not set, either \code{/usr/tmp} is used (on UNIX), or the current is not set, either \code{/usr/tmp} is used (on \UNIX{}), or the current
working directory (all other systems). No check is made to see working directory (all other systems). No check is made to see
whether its value is valid. whether its value is valid.
\end{datadesc} \end{datadesc}
...@@ -38,11 +38,11 @@ When set to a value other than \code{None}, this variable defines the ...@@ -38,11 +38,11 @@ When set to a value other than \code{None}, this variable defines the
prefix of the final component of the filenames returned by prefix of the final component of the filenames returned by
\code{mktemp()}. A string of decimal digits is added to generate \code{mktemp()}. A string of decimal digits is added to generate
unique filenames. The default is either ``\code{@\var{pid}.}'' where unique filenames. The default is either ``\code{@\var{pid}.}'' where
\var{pid} is the current process ID (on UNIX), or ``\code{tmp}'' (all \var{pid} is the current process ID (on \UNIX{}), or ``\code{tmp}'' (all
other systems). other systems).
\end{datadesc} \end{datadesc}
Warning: if a UNIX process uses \code{mktemp()}, then calls Warning: if a \UNIX{} process uses \code{mktemp()}, then calls
\code{fork()} and both parent and child continue to use \code{fork()} and both parent and child continue to use
\code{mktemp()}, the processes will generate conflicting temporary \code{mktemp()}, the processes will generate conflicting temporary
names. To resolve this, the child process should assign \code{None} names. To resolve this, the child process should assign \code{None}
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
\bimodindex{thread} \bimodindex{thread}
This module provides low-level primitives for working with multiple This module provides low-level primitives for working with multiple
threads (a.k.a. \dfn{light-weight processes} or \dfn{tasks}) --- multiple threads (a.k.a.\ \dfn{light-weight processes} or \dfn{tasks}) --- multiple
threads of control sharing their global data space. For threads of control sharing their global data space. For
synchronization, simple locks (a.k.a. \dfn{mutexes} or \dfn{binary synchronization, simple locks (a.k.a.\ \dfn{mutexes} or \dfn{binary
semaphores}) are provided. semaphores}) are provided.
The module is optional and supported on SGI IRIX 4.x and 5.x and Sun The module is optional and supported on SGI IRIX 4.x and 5.x and Sun
Solaris 2.x systems, as well as on systems that have a PTHREAD Solaris 2.x systems, as well as on systems that have a PTHREAD
implementation (e.g. KSR). implementation (e.g.\ KSR).
It defines the following constant and functions: It defines the following constant and functions:
...@@ -21,7 +21,7 @@ Raised on thread-specific errors. ...@@ -21,7 +21,7 @@ Raised on thread-specific errors.
\begin{funcdesc}{start_new_thread}{func\, arg} \begin{funcdesc}{start_new_thread}{func\, arg}
Start a new thread. The thread executes the function \var{func} Start a new thread. The thread executes the function \var{func}
with the argument list \var{arg} (which must be a tuple). When the with the argument list \var{arg} (which must be a tuple). When the
function returns, the thread silently exits. When the function raises function returns, the thread silently exits. When the function
terminates with an unhandled exception, a stack trace is printed and terminates with an unhandled exception, a stack trace is printed and
then the thread exits (but other threads continue to run). then the thread exits (but other threads continue to run).
\end{funcdesc} \end{funcdesc}
...@@ -59,7 +59,7 @@ Without the optional argument, this method acquires the lock ...@@ -59,7 +59,7 @@ Without the optional argument, this method acquires the lock
unconditionally, if necessary waiting until it is released by another unconditionally, if necessary waiting until it is released by another
thread (only one thread at a time can acquire a lock --- that's their thread (only one thread at a time can acquire a lock --- that's their
reason for existence), and returns \code{None}. If the integer reason for existence), and returns \code{None}. If the integer
\var{waitflag} argument is present, the action depends on its value: \var{waitflag} argument is present, the action depends on its value:\
if it is zero, the lock is only acquired if it can be acquired if it is zero, the lock is only acquired if it can be acquired
immediately without waiting, while if it is nonzero, the lock is immediately without waiting, while if it is nonzero, the lock is
acquired unconditionally as before. If an argument is present, the acquired unconditionally as before. If an argument is present, the
...@@ -72,7 +72,7 @@ necessarily by the same thread. ...@@ -72,7 +72,7 @@ necessarily by the same thread.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{locked}{} \begin{funcdesc}{locked}{}
Return the status of the lock: 1 if it has been acquired by some Return the status of the lock:\ 1 if it has been acquired by some
thread, 0 if not. thread, 0 if not.
\end{funcdesc} \end{funcdesc}
......
\chapter{UNIX ONLY} \chapter{UNIX ONLY}
The modules described in this chapter provide interfaces to features The modules described in this chapter provide interfaces to features
that are unique to the UNIX operating system, or in some cases to that are unique to the \UNIX{} operating system, or in some cases to
some or many variants of it. some or many variants of it.
...@@ -30,14 +30,14 @@ Bits in the status as returned by \var{Status}. ...@@ -30,14 +30,14 @@ Bits in the status as returned by \var{Status}.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{available}{} \begin{funcdesc}{available}{}
Returns 1 if the communication toolbox is available, zero otherwise. Return 1 if the communication toolbox is available, zero otherwise.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{CMNew}{name\, sizes} \begin{funcdesc}{CMNew}{name\, sizes}
Create a connection object using the connection tool named Create a connection object using the connection tool named
\var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in, \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. data out, control in, control out, attention in and attention out.
Alternatively, passing \var{None} will result in default buffer sizes. Alternatively, passing \code{None} will result in default buffer sizes.
\end{funcdesc} \end{funcdesc}
\subsection{connection object} \subsection{connection object}
...@@ -47,14 +47,14 @@ of \code{-1} is indefinite, meaning that the command runs to completion. ...@@ -47,14 +47,14 @@ of \code{-1} is indefinite, meaning that the command runs to completion.
\renewcommand{\indexsubitem}{(connection object method)} \renewcommand{\indexsubitem}{(connection object method)}
\begin{datadesc}{callback} \begin{datadesc}{callback}
If this member is set to a value other than \var{None} it should point If this member is set to a value other than \code{None} it should point
to a function accepting a single argument (the connection to a function accepting a single argument (the connection
object). This will make all connection object methods work object). This will make all connection object methods work
asynchronously, with the callback routine being called upon asynchronously, with the callback routine being called upon
completion. completion.
{\em Note:} for reasons beyond my understanding the callback routine {\em Note:} for reasons beyond my understanding the callback routine
is never called currently. You are advised against using asynchronous is currently never called. You are advised against using asynchronous
calls for the time being. calls for the time being.
\end{datadesc} \end{datadesc}
...@@ -76,15 +76,15 @@ Accept (when \var{yesno} is non-zero) or reject an incoming call after ...@@ -76,15 +76,15 @@ Accept (when \var{yesno} is non-zero) or reject an incoming call after
\begin{funcdesc}{Close}{timeout\, now} \begin{funcdesc}{Close}{timeout\, now}
Close a connection. When \var{now} is zero, the close is orderly Close a connection. When \var{now} is zero, the close is orderly
(i.e. outstanding output is flushed, etc) with a timeout of (i.e.\ outstanding output is flushed, etc.)\ with a timeout of
\var{timeout} seconds. When \var{now} is non-zero the close is \var{timeout} seconds. When \var{now} is non-zero the close is
immedeate, discarding output. immediate, discarding output.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Read}{len\, chan\, timeout} \begin{funcdesc}{Read}{len\, chan\, timeout}
Read \var{len} bytes or until \var{timeout} seconds have passed from Read \var{len} bytes, or until \var{timeout} seconds have passed, from
the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or the channel \var{chan} (which is one of \var{cmData}, \var{cmCntl} or
\var{cmAttn}). Returns a 2-tuple: the data read and the end-of-message \var{cmAttn}). Return a 2-tuple:\ the data read and the end-of-message
flag. flag.
\end{funcdesc} \end{funcdesc}
...@@ -97,8 +97,8 @@ the number of bytes written. ...@@ -97,8 +97,8 @@ the number of bytes written.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Status}{} \begin{funcdesc}{Status}{}
Return connection status as the 2-tuple \code{(sizes, Return connection status as the 2-tuple \code{(\var{sizes},
flags)}. \var{Sizes} is a 6-tuple giving the actual buffer sizes used \var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used
(see \var{CMNew}), \var{flags} is a set of bits describing the state (see \var{CMNew}), \var{flags} is a set of bits describing the state
of the connection. of the connection.
\end{funcdesc} \end{funcdesc}
......
...@@ -23,13 +23,13 @@ etc). ...@@ -23,13 +23,13 @@ etc).
\end{datadesc} \end{datadesc}
\begin{funcdesc}{copen}{} \begin{funcdesc}{copen}{}
Open a new console window. Returns a console window object. Open a new console window. Return a console window object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{fopen}{fp} \begin{funcdesc}{fopen}{fp}
Return the console window object corresponding with the given file Return the console window object corresponding with the given file
object. \var{Fp} should be one of \var{sys.stdin}, \var{sys.stdout} or object. \var{fp} should be one of \code{sys.stdin}, \code{sys.stdout} or
\var{sys.stderr}. \code{sys.stderr}.
\end{funcdesc} \end{funcdesc}
\subsection{macconsole options object} \subsection{macconsole options object}
...@@ -57,8 +57,7 @@ The title of the window. ...@@ -57,8 +57,7 @@ The title of the window.
\end{datadesc} \end{datadesc}
\begin{datadesc}{pause_atexit} \begin{datadesc}{pause_atexit}
If set non-zero, the window will wait for user action before closing If set non-zero, the window will wait for user action before closing.
the window.
\end{datadesc} \end{datadesc}
\subsection{console window object} \subsection{console window object}
...@@ -88,13 +87,13 @@ Clear to end-of-line. ...@@ -88,13 +87,13 @@ Clear to end-of-line.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{inverse}{onoff} \begin{funcdesc}{inverse}{onoff}
Enable inverse-video mode: characters with the high bit set are Enable inverse-video mode:\ characters with the high bit set are
displayed in inverse video (this disables the upper half of a displayed in inverse video (this disables the upper half of a
non-ascii character set). non-\ASCII{} character set).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{gotoxy}{x\, y} \begin{funcdesc}{gotoxy}{x\, y}
Set the cursor to position \code{(x, y)}. Set the cursor to position \code{(\var{x}, \var{y})}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{hide}{} \begin{funcdesc}{hide}{}
......
...@@ -7,9 +7,9 @@ This module provides access to macintosh FSSpec handling, the Alias ...@@ -7,9 +7,9 @@ This module provides access to macintosh FSSpec handling, the Alias
Manager, finder aliases and the Standard File package. Manager, finder aliases and the Standard File package.
Whenever a function or method expects a \var{file} argument, this Whenever a function or method expects a \var{file} argument, this
argument can be one of three things: (1) a full or partial macintosh argument can be one of three things:\ (1) a full or partial Macintosh
pathname, (2) an FSSpec object or (3) a 3-tuple \code{(wdRefNum, pathname, (2) an FSSpec object or (3) a 3-tuple \code{(wdRefNum,
parID, name)} as described in Inside Mac VI. A description of aliases parID, name)} as described in Inside Mac VI\@. A description of aliases
and the standard file package can also be found there. and the standard file package can also be found there.
\begin{funcdesc}{FSSpec}{file} \begin{funcdesc}{FSSpec}{file}
...@@ -26,15 +26,15 @@ Create an Alias object given the raw data for the alias. ...@@ -26,15 +26,15 @@ Create an Alias object given the raw data for the alias.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ResolveAliasFile}{file} \begin{funcdesc}{ResolveAliasFile}{file}
Resolve an alias file. Returns a 3-tuple \code{(fsspec, isfolder, Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, \var{isfolder},
aliased)} where \var{fsspec} is the resulting FSSpec object, \var{aliased})} where \var{fsspec} is the resulting FSSpec object,
\var{isfolder} is true if \var{fsspec} points to a folder and \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 \var{aliased} is true if the file was an alias in the first place
(otherwise the FSSpec object for the file itself is returned). (otherwise the FSSpec object for the file itself is returned).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{StandardGetFile}{\optional{type\, ...}} \begin{funcdesc}{StandardGetFile}{\optional{type\, ...}}
Present the user with a standard ``open onput file'' Present the user with a standard ``open input file''
dialog. Optionally, you can pass up to four 4-char file types to limit dialog. Optionally, you can pass up to four 4-char file types to limit
the files the user can choose from. The function returns an FSSpec the files the user can choose from. The function returns an FSSpec
object and a flag indicating that the user completed the dialog object and a flag indicating that the user completed the dialog
...@@ -44,14 +44,14 @@ without cancelling. ...@@ -44,14 +44,14 @@ without cancelling.
\begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}} \begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}}
Present the user with a standard ``open output file'' Present the user with a standard ``open output file''
dialog. \var{prompt} is the prompt string, and the optional dialog. \var{prompt} is the prompt string, and the optional
\var{default} argument initialized the output file name. The function \var{default} argument initializes the output file name. The function
returns an FSSpec object and a flag indicating that the user completed returns an FSSpec object and a flag indicating that the user completed
the dialog without cancelling. the dialog without cancelling.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetDirectory}{} \begin{funcdesc}{GetDirectory}{}
Present the user with a non-standard ``select a directory'' Present the user with a non-standard ``select a directory''
dialog. Returns an FSSpec object and a success-indicator. dialog. Return an FSSpec object and a success-indicator.
\end{funcdesc} \end{funcdesc}
\subsection{FSSpec objects} \subsection{FSSpec objects}
...@@ -67,13 +67,13 @@ Return the full pathname of the file described by the FSSpec object. ...@@ -67,13 +67,13 @@ Return the full pathname of the file described by the FSSpec object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{as_tuple}{} \begin{funcdesc}{as_tuple}{}
Return the \code{(wdRefNum, parID, name)} tuple of the file described Return the \code{(\var{wdRefNum}, \var{parID}, \var{name})} tuple of the file described
by the FSSpec object. by the FSSpec object.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{NewAlias}{\optional{file}} \begin{funcdesc}{NewAlias}{\optional{file}}
Create an Alias object pointing to the file described by this Create an Alias object pointing to the file described by this
FSSpec. If the optional \code{file} parameter is present the alias FSSpec. If the optional \var{file} parameter is present the alias
will be relative to that file, otherwise it will be absolute. will be relative to that file, otherwise it will be absolute.
\end{funcdesc} \end{funcdesc}
...@@ -99,7 +99,7 @@ or transmitting to other programs. ...@@ -99,7 +99,7 @@ or transmitting to other programs.
\begin{funcdesc}{Resolve}{\optional{file}} \begin{funcdesc}{Resolve}{\optional{file}}
Resolve the alias. If the alias was created as a relative alias you Resolve the alias. If the alias was created as a relative alias you
should pass the file relative to which it is. Returns the FSSpec for should pass the file relative to which it is. Return the FSSpec for
the file pointed to and a flag indicating whether the alias object the file pointed to and a flag indicating whether the alias object
itself was modified during the search process. itself was modified during the search process.
\end{funcdesc} \end{funcdesc}
...@@ -113,9 +113,9 @@ Update the alias to point to the \var{file} given. If \var{file2} is ...@@ -113,9 +113,9 @@ Update the alias to point to the \var{file} given. If \var{file2} is
present a relative alias will be created. present a relative alias will be created.
\end{funcdesc} \end{funcdesc}
Note that is currently not possible to directly manipulate a resource Note that it is currently not possible to directly manipulate a resource
as an alias object. Hence, after calling \var{Update} or after as an alias object. Hence, after calling \var{Update} or after
\var{Resolve} indicates that the alias has changed the python program \var{Resolve} indicates that the alias has changed the Python program
is responsible for getting the \var{data} from the alias object and is responsible for getting the \var{data} from the alias object and
modifying the resource. modifying the resource.
......
...@@ -4,18 +4,18 @@ ...@@ -4,18 +4,18 @@
\renewcommand{\indexsubitem}{(in module macspeech)} \renewcommand{\indexsubitem}{(in module macspeech)}
This module provides an interface to the Macintosh Speech Manager, This module provides an interface to the Macintosh Speech Manager,
allowing you to let the macintosh utter phrases. You need a version of 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 the speech manager extension (version 1 and 2 have been tested) in
your \code{Extensions} folder for this to work. The module does not your \code{Extensions} folder for this to work. The module does not
provide full access to all features of the Speech Manager yet. provide full access to all features of the Speech Manager yet.
\begin{funcdesc}{Available}{} \begin{funcdesc}{Available}{}
Test availability of the Speech Manager extension (and, on the Test availability of the Speech Manager extension (and, on the
PowerPC, the Speech Manager shared library). Returns 0 or 1. PowerPC, the Speech Manager shared library). Return 0 or 1.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Version}{} \begin{funcdesc}{Version}{}
Return the (integer) version of the Speech Manager. Return the (integer) version number of the Speech Manager.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{SpeakString}{str} \begin{funcdesc}{SpeakString}{str}
...@@ -43,7 +43,7 @@ yet possible to access the parameters of a voice. ...@@ -43,7 +43,7 @@ yet possible to access the parameters of a voice.
\renewcommand{\indexsubitem}{(voice object method)} \renewcommand{\indexsubitem}{(voice object method)}
\begin{funcdesc}{GetGender}{} \begin{funcdesc}{GetGender}{}
Return the gender of the voice: 0 for male, 1 for female and -1 for neuter. Return the gender of the voice:\ 0 for male, 1 for female and $-1$ for neuter.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{NewChannel}{} \begin{funcdesc}{NewChannel}{}
...@@ -54,7 +54,7 @@ Return a new speech channel object using this voice. ...@@ -54,7 +54,7 @@ Return a new speech channel object using this voice.
A speech channel object allows you to speak strings with slightly more A speech channel object allows you to speak strings with slightly more
control than \code{SpeakString()}, and allows you to use multiple control than \code{SpeakString()}, and allows you to use multiple
speakers at the same time. Please note that channel pitch and rate are 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 interrelated in some way, so that to make your Macintosh sing you will
have to adjust both. have to adjust both.
\renewcommand{\indexsubitem}{(speech channel object method)} \renewcommand{\indexsubitem}{(speech channel object method)}
...@@ -67,7 +67,7 @@ Stop babbling. ...@@ -67,7 +67,7 @@ Stop babbling.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetPitch}{} \begin{funcdesc}{GetPitch}{}
Returns the current pitch of the channel, as a floating-point number. Return the current pitch of the channel, as a floating-point number.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{SetPitch}{pitch} \begin{funcdesc}{SetPitch}{pitch}
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
\renewcommand{\indexsubitem}{(in module mactcp)} \renewcommand{\indexsubitem}{(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 \var{macdnr} which provides an MacTCP\@. There is an accompanying module \code{macdnr} which provides an
interface to the name-server (allowing you to translate hostnames to interface to the name-server (allowing you to translate hostnames to
ip-addresses), a module \var{MACTCP} which has symbolic names for ip-addresses), a module \code{MACTCP} which has symbolic names for
constants constants used by MacTCP and a wrapper module \var{socket} constants constants used by MacTCP and a wrapper module \code{socket}
which mimics the unix socket interface (as far as possible). which mimics the \UNIX{} socket interface (as far as possible).
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.
...@@ -26,14 +26,14 @@ Return the 32-bit integer network mask of the interface. ...@@ -26,14 +26,14 @@ Return the 32-bit integer network mask of the interface.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{TCPCreate}{size} \begin{funcdesc}{TCPCreate}{size}
Create a TCP Stream object. \var{Size} is the size of the receive Create a TCP Stream object. \var{size} is the size of the receive
buffer, \code{4096} is suggested by various sources. 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}
...@@ -41,30 +41,30 @@ datagrams on, a value of zero will make MacTCP select a free port. ...@@ -41,30 +41,30 @@ datagrams on, a value of zero will make MacTCP select a free port.
\renewcommand{\indexsubitem}{(TCP stream method)} \renewcommand{\indexsubitem}{(TCP stream method)}
\begin{datadesc}{asr} \begin{datadesc}{asr}
When set to a value different than \var{None} this should point to a When set to a value different than \code{None} this should point 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. In addition, it is called with eventcode
\var{MACTCP.PassiveOpenDone} when a \var{PassiveOpen} completes. This \code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen} completes. This
is a python addition to the MacTCP semantics. is a Python addition to the MacTCP semantics.
It is safe to do further calls from the asr. It is safe to do further calls from the \code{asr}.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{PassiveOpen}{port} \begin{funcdesc}{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 immedeately, 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 \var{wait} to wait for completion. You should not issue any method
calls other than calls other than
\var{wait}, \var{isdone} or \var{GetSockName} before the call \code{wait}, \code{isdone} or \code{GetSockName} before the call
completes. completes.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{wait}{} \begin{funcdesc}{wait}{}
Wait for \var{PassiveOpen} to complete. Wait for \code{PassiveOpen} to complete.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{isdone}{} \begin{funcdesc}{isdone}{}
Return 1 if a \var{PassiveOpen} is completed. Return 1 if a \code{PassiveOpen} has completed.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{GetSockName}{} \begin{funcdesc}{GetSockName}{}
...@@ -73,9 +73,9 @@ Return the TCP address of this side of a connection as a 2-tuple ...@@ -73,9 +73,9 @@ Return the TCP address of this side of a connection as a 2-tuple
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{ActiveOpen}{lport\, host\, rport} \begin{funcdesc}{ActiveOpen}{lport\, host\, rport}
Open an outgoing connection to TCP address \code{(host, 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 is established. call blocks until the connection has been established.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Send}{buf\, push\, urgent} \begin{funcdesc}{Send}{buf\, push\, urgent}
...@@ -87,7 +87,7 @@ are flags as specified by the TCP standard. ...@@ -87,7 +87,7 @@ are flags as specified by the TCP standard.
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{(data, urgent, mark)}. If urgent data is outstanding \var{Rcv} \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 will always return that before looking at any normal data. The first
call returning urgent data will have the \var{urgent} flag set, the call returning urgent data will have the \var{urgent} flag set, the
last will have the \var{mark} flag set. last will have the \var{mark} flag set.
...@@ -95,7 +95,7 @@ last will have the \var{mark} flag set. ...@@ -95,7 +95,7 @@ last will have the \var{mark} flag set.
\begin{funcdesc}{Close}{} \begin{funcdesc}{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 returnes 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{funcdesc}
...@@ -131,7 +131,7 @@ amtUnackedData} is what you can pass to \code{Send} without blocking. ...@@ -131,7 +131,7 @@ amtUnackedData} is what you can pass to \code{Send} without blocking.
\end{datadesc} \end{datadesc}
\begin{datadesc}{amtUnreadData} \begin{datadesc}{amtUnreadData}
The number of bytes received but not yet read (what you can \var{Recv} The number of bytes received but not yet read (what you can \code{Recv}
without blocking). without blocking).
\end{datadesc} \end{datadesc}
...@@ -145,7 +145,7 @@ about UDP. ...@@ -145,7 +145,7 @@ about UDP.
\begin{datadesc}{asr} \begin{datadesc}{asr}
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 \var{Read} call. The asr has a datagram arrival without outstanding \code{Read} call. The \code{asr} has a
single argument, the event code. single argument, the event code.
\end{datadesc} \end{datadesc}
...@@ -154,8 +154,8 @@ A read-only member giving the port number of this UDP stream. ...@@ -154,8 +154,8 @@ A read-only member giving the port number of this UDP stream.
\end{datadesc} \end{datadesc}
\begin{funcdesc}{Read}{timeout} \begin{funcdesc}{Read}{timeout}
Read a datagram, waiting at most \var{timeout} seconds (-1 is Read a datagram, waiting at most \var{timeout} seconds ($-1$ is
indefinite). Returns the data. indefinite). Return the data.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{Write}{host\, port\, buf} \begin{funcdesc}{Write}{host\, port\, buf}
......
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