diff options
62 files changed, 394 insertions, 406 deletions
diff --git a/Doc/lib/libaifc.tex b/Doc/lib/libaifc.tex index 0a56ca6..7b4e4c8 100644 --- a/Doc/lib/libaifc.tex +++ b/Doc/lib/libaifc.tex @@ -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 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 -frame consists of nchannels*framesize bytes, and a second's worth of -audio consists of nchannels*framesize*framerate bytes. +frame consists of \var{nchannels}*\var{framesize} bytes, and a second's worth of +audio consists of \var{nchannels}*\var{framesize}*\var{framerate} bytes. Module \code{aifc} defines the following function: \renewcommand{\indexsubitem}{(in module aifc)} \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 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 @@ -75,7 +75,7 @@ the given id. \end{funcdesc} \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 samples of all channels. \end{funcdesc} @@ -175,6 +175,6 @@ not updated. \begin{funcdesc}{close}{} 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. \end{funcdesc} diff --git a/Doc/lib/libaudioop.tex b/Doc/lib/libaudioop.tex index 61ab7fc..03e074d 100644 --- a/Doc/lib/libaudioop.tex +++ b/Doc/lib/libaudioop.tex @@ -1,8 +1,8 @@ \section{Built-in module \sectcode{audioop}} \bimodindex{audioop} -The audioop module contains some useful operations on sound fragments. -It operates on sound fragments consisting of signed integer samples of +The \code{audioop} module contains some useful operations on sound fragments. +It operates on sound fragments consisting of signed integer samples 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 scalar items are integers, unless specified otherwise. @@ -19,7 +19,7 @@ per sample, etc. \end{excdesc} \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 \code{1}, \code{2} or \code{4}. Both fragments should have the same length. \end{funcdesc} @@ -60,8 +60,8 @@ passed as an argument. \begin{funcdesc}{findfactor}{fragment\, reference} This routine (which only accepts 2-byte sample fragments) calculates a factor \var{F} such that \code{rms(add(fragment, mul(reference, -F)))} -is minimal, i.e. it calculates the factor with which you should -multiply \var{reference} to make it match as good as possible to +is minimal, i.e.\ it calculates the factor with which you should +multiply \var{reference} to make it match as well as possible to \var{fragment}. The fragments should be the same size. 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} 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 (conceptually) does this by taking slices out of \var{fragment}, using \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}. \begin{funcdesc}{findmax}{fragment\, length} This routine (which only accepts 2-byte sample fragments) searches -\var{fragment} for a slice of length \var{length} samples (not bytes!) -with maximum energy, i.e. it returns \var{i} for which +\var{fragment} for a slice of length \var{length} samples (not bytes!)\ +with maximum energy, i.e.\ it returns \var{i} for which \code{rms(fragment[i*2:(i+length)*2])} is maximal. 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. \end{funcdesc} \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 silently ignored. \end{funcdesc} @@ -150,25 +150,6 @@ This function reverses the samples in a fragment and returns the modified fragment. \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} Returns the root-mean-square of the fragment, i.e. \iftexi @@ -184,6 +165,19 @@ divided by the sumber of samples. This is a measure of the power in an audio signal. \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} This function converts sound fragments in ULAW encoding to linearly 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} 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 into two mono fragments first and recombined later. Here is an example of how to do that: @@ -207,10 +201,10 @@ def mul_stereo(sample, width, lfactor, rfactor): \end{verbatim}\ecode 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 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 binary you can code the first element (the predicted value) in 16 bits and the second (the delta index) in 8. diff --git a/Doc/lib/libcopy.tex b/Doc/lib/libcopy.tex index f7f9744..c141e05 100644 --- a/Doc/lib/libcopy.tex +++ b/Doc/lib/libcopy.tex @@ -10,8 +10,8 @@ Interface summary: \begin{verbatim} import copy -x = copy.copy(y) # make a shallow copy of y -x = copy.deepcopy(y) # make a deep copy of y +x = copy.copy(y) # make a shallow copy of y +x = copy.deepcopy(y) # make a deep copy of y \end{verbatim} For module specific errors, \code{copy.Error} is raised. @@ -44,7 +44,7 @@ Recursive objects (compound objects that, directly or indirectly, contain a reference to themselves) may cause a recursive loop. \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 copies. diff --git a/Doc/lib/libdbm.tex b/Doc/lib/libdbm.tex index 7ff4ee5..6e72567 100644 --- a/Doc/lib/libdbm.tex +++ b/Doc/lib/libdbm.tex @@ -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 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 -\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. \end{funcdesc} diff --git a/Doc/lib/libfcntl.tex b/Doc/lib/libfcntl.tex index e361d5e..46b41a5 100644 --- a/Doc/lib/libfcntl.tex +++ b/Doc/lib/libfcntl.tex @@ -1,11 +1,11 @@ % Manual text by Jaap Vermeulen \section{Built-in module \sectcode{fcntl}} \bimodindex{fcntl} -\indexii{UNIX}{file control} -\indexii{UNIX}{IO control} +\indexii{\UNIX{}}{file control} +\indexii{\UNIX{}}{I/O control} -This module performs file control and IO control on file descriptors. -It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX routines. +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. File descriptors can be obtained with the \dfn{fileno()} method of a file or socket object. @@ -23,10 +23,10 @@ The module defines the following functions: the argument missing or an integer value, the return value of this function is the integer return value of the real \code{fcntl()} 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()} 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. \end{funcdesc} diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index 9ebe210..0eb6857 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -405,7 +405,7 @@ returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns \end{verbatim}\ecode \end{funcdesc} -\begin{funcdesc}{vars}{} +\begin{funcdesc}{vars}{\optional{object}} Without arguments, return a dictionary corresponding to the current local symbol table. With a module, class or class instance object as argument (or anything else that has a \code{__dict__} attribute), diff --git a/Doc/lib/libgdbm.tex b/Doc/lib/libgdbm.tex index 40facad..177627f 100644 --- a/Doc/lib/libgdbm.tex +++ b/Doc/lib/libgdbm.tex @@ -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 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 -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 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} -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} diff --git a/Doc/lib/libgrp.tex b/Doc/lib/libgrp.tex index 1c4dd15..6310498 100644 --- a/Doc/lib/libgrp.tex +++ b/Doc/lib/libgrp.tex @@ -28,5 +28,5 @@ Return the group database entry for the given group name. \end{funcdesc} \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} diff --git a/Doc/lib/libimageop.tex b/Doc/lib/libimageop.tex index 4481e61..836ae76 100644 --- a/Doc/lib/libimageop.tex +++ b/Doc/lib/libimageop.tex @@ -1,9 +1,9 @@ \section{Built-in module \sectcode{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 -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. The module defines the following variables and functions: @@ -17,20 +17,20 @@ per pixel, etc. \begin{funcdesc}{crop}{image\, psize\, width\, height\, x0\, y0\, x1\, y1} -This function takes the image in \code{image}, which should by -\code{width} by \code{height} in size and consist of pixels of -\code{psize} bytes, and returns the selected part of that image. \code{x0}, -\code{y0}, \code{x1} and \code{y1} are like the \code{lrectread} +This function takes the image in \var{image}, which should by +\var{width} by \var{height} in size and consist of pixels of +\var{psize} bytes, and returns the selected part of that image. \var{x0}, +\var{y0}, \var{x1} and \var{y1} are like the \code{lrectread} parameters, i.e. the boundary is included in the new image. The new boundaries need not be inside the picture. Pixels that fall 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. \end{funcdesc} \begin{funcdesc}{scale}{image\, psize\, width\, height\, newwidth\, newheight} -This function returns a \code{image} scaled to size \code{newwidth} by -\code{newheight}. No interpolation is done, scaling is done by +This function returns an \var{image} scaled to size \var{newwidth} by +\var{newheight}. No interpolation is done, scaling is done by simple-minded pixel duplication or removal. Therefore, computer-generated images or dithered images will not look nice after scaling. \end{funcdesc} @@ -57,7 +57,7 @@ monochrome image but it uses a (simple-minded) dithering algorithm. \begin{funcdesc}{mono2grey}{image\, width\, height\, p0\, p1} 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 -\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 pass the values \code{0} and \code{255} respectively. \end{funcdesc} diff --git a/Doc/lib/libimp.tex b/Doc/lib/libimp.tex index 72f71a2..9ead176 100644 --- a/Doc/lib/libimp.tex +++ b/Doc/lib/libimp.tex @@ -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 object. If the module was already initialized, it will be initialized {\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. \end{funcdesc} diff --git a/Doc/lib/libjpeg.tex b/Doc/lib/libjpeg.tex index a4e931f..b5c14a4 100644 --- a/Doc/lib/libjpeg.tex +++ b/Doc/lib/libjpeg.tex @@ -1,19 +1,19 @@ \section{Built-in Module \sectcode{jpeg}} \bimodindex{jpeg} -The module jpeg provides access to the jpeg compressor and -decompressor written by the Independent JPEG Group. JPEG is a (draft?) +The module \code{jpeg} provides access to the jpeg compressor and +decompressor written by the Independent JPEG Group. JPEG is a (draft?)\ standard for compressing pictures. For details on jpeg or the Independent JPEG Group software refer to the JPEG standard or the documentation provided with the software. -The jpeg module defines these functions: +The \code{jpeg} module defines these functions: \renewcommand{\indexsubitem}{(in module jpeg)} \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 -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 pixels are allowed, the former being treated as greyscale and the latter as RGB color. Compress returns a string that contains the @@ -24,28 +24,28 @@ compressed picture, in JFIF format. Data is a string containing a picture in JFIF format. It returns a tuple \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} \begin{funcdesc}{setoption}{name\, value} Set various options. Subsequent compress and decompress calls will use these options. The following options are available: \begin{description} -\item[\code{'forcegray'}] +\item[\code{'forcegray' }] 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 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 smaller compressed image. Compress only. -\item[\code{'smooth'}] +\item[\code{'smooth' }] Perform inter-block smoothing on uncompressed image. Only useful for low-quality images. Decompress only. \end{description} \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. diff --git a/Doc/lib/libmd5.tex b/Doc/lib/libmd5.tex index 3e22820..0dfa65e 100644 --- a/Doc/lib/libmd5.tex +++ b/Doc/lib/libmd5.tex @@ -3,7 +3,7 @@ This module implements the interface to RSA's MD5 message digest 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 strings. diff --git a/Doc/lib/libmpz.tex b/Doc/lib/libmpz.tex index ea0d1b7..1fd03f7 100644 --- a/Doc/lib/libmpz.tex +++ b/Doc/lib/libmpz.tex @@ -8,15 +8,15 @@ arithmetic routines. Only the interfaces to the \emph{integer} otherwise, the description in the GNU MP documentation can be applied. 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{abs}, \code{int}, \ldots, \code{divmod}, \code{pow}. \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 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 -below for an excact description). An mpz-number is printed like this: +You create an mpz-number by calling the function called \code{mpz} (see +below for an exact description). An mpz-number is printed like this: \code{mpz(\var{value})}. \renewcommand{\indexsubitem}{(in module mpz)} @@ -59,7 +59,7 @@ return mpz-numbers. \begin{funcdesc}{divm}{numerator\, denominator\, modulus} Returns a number \var{q}. such that \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} 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 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. \end{funcdesc} diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index 6763ed4..5109f5d 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -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, 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 -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 function \code{os.stat(\var{file})} returns stat info about a \var{file} in a format compatible with the POSIX interface. diff --git a/Doc/lib/libpickle.tex b/Doc/lib/libpickle.tex index a9d5fa4..5c01d36 100644 --- a/Doc/lib/libpickle.tex +++ b/Doc/lib/libpickle.tex @@ -8,7 +8,7 @@ \indexii{pickling}{objects} 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 persistency --- although \code{pickle} reads and writes file objects, it does not handle the issue of naming persistent objects, nor the @@ -32,7 +32,7 @@ following correctly: \item pointer sharing -\item instances uf user-defined classes +\item instances of user-defined classes \end{itemize} @@ -105,11 +105,11 @@ module. \ttindex{__dict__} 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 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 -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 class's \code{__setstate__()} method. @@ -157,7 +157,7 @@ the file argument. 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 -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 corresponding \code{Pickler} and \code{Unpicklers}. {\em Warning}: this is intended for pickling multiple objects without intervening diff --git a/Doc/lib/libposix.tex b/Doc/lib/libposix.tex index 1a05d47..c749d74 100644 --- a/Doc/lib/libposix.tex +++ b/Doc/lib/libposix.tex @@ -3,7 +3,7 @@ \bimodindex{posix} 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). It is available in all Python versions except on the Macintosh; the MS-DOS version does not support certain functions. @@ -31,7 +31,7 @@ in C. \renewcommand{\indexsubitem}{(exception in module posix)} \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 string value is \code{'posix.error'}. The accompanying value is a pair containing the numeric error code from \code{errno} and the @@ -279,7 +279,7 @@ systems without symbolic links, this always raises \begin{funcdesc}{system}{command} Execute the command (a string) in a subshell. This is implemented by 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 value is the exit status of the process as returned by Standard C \code{system()}. @@ -302,7 +302,7 @@ Return a 5-tuple containing information identifying the current operating system. The tuple contains 5 strings: \code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}. 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 \UNIX{} systems.) \end{funcdesc} diff --git a/Doc/lib/libppath.tex b/Doc/lib/libppath.tex index 731d344..c7c2b63 100644 --- a/Doc/lib/libppath.tex +++ b/Doc/lib/libppath.tex @@ -48,13 +48,13 @@ Return true if \var{p} is an absolute pathname (begins with a slash). \begin{funcdesc}{isfile}{p} 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. \end{funcdesc} \begin{funcdesc}{isdir}{p} 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. \end{funcdesc} @@ -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 applied to the result; otherwise, \code{join(\var{head}, \var{tail})} equals \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} are empty; if \var{p} contains no slash, \var{head} is empty and \var{tail} equals \var{p}. diff --git a/Doc/lib/librand.tex b/Doc/lib/librand.tex index b03ac41..4991e59 100644 --- a/Doc/lib/librand.tex +++ b/Doc/lib/librand.tex @@ -1,7 +1,7 @@ \section{Standard Module \sectcode{rand}} \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: \renewcommand{\indexsubitem}{(in module rand)} diff --git a/Doc/lib/librgbimg.tex b/Doc/lib/librgbimg.tex index 367851b..f25921e 100644 --- a/Doc/lib/librgbimg.tex +++ b/Doc/lib/librgbimg.tex @@ -22,7 +22,7 @@ are currently supported. \begin{funcdesc}{longimagedata}{file} 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 string. This format is suitable to pass to \code{gl.lrectwrite}, for instance. @@ -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 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 X). The default is zero. +compatible with X)\@. The default is zero. \end{funcdesc} diff --git a/Doc/lib/librotor.tex b/Doc/lib/librotor.tex index b931333..f2ea074 100644 --- a/Doc/lib/librotor.tex +++ b/Doc/lib/librotor.tex @@ -25,7 +25,7 @@ The available functions in this module are: \renewcommand{\indexsubitem}{(in module rotor)} \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 to randomly generate the rotor permutations and their initial positions. \var{numrotors} is the number of rotor permutations in the returned object; @@ -36,28 +36,28 @@ Rotor objects have the following methods: \renewcommand{\indexsubitem}{(rotor method)} \begin{funcdesc}{setkey}{} -Resets the rotor to its initial state. +Reset the rotor to its initial state. \end{funcdesc} \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 same length as the original plaintext. \end{funcdesc} \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. \end{funcdesc} \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 always be the same length as the ciphertext. \end{funcdesc} \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. \end{funcdesc} diff --git a/Doc/lib/libsignal.tex b/Doc/lib/libsignal.tex index 88116d7..13139d7 100644 --- a/Doc/lib/libsignal.tex +++ b/Doc/lib/libsignal.tex @@ -12,20 +12,20 @@ it is explicitly reset (i.e. Python uses the BSD style interface). \item 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 Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the ``atomic'' instructions of the Python interpreter. This means that 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. \item 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. -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. \item @@ -44,8 +44,8 @@ overridden. \item 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 -threads simultaneously is: always perform \code{signal()} operations -in the main thread of execution. Any thread can perform a +threads simultaneously is:\ always perform \code{signal()} operations +in the main thread of execution. Any thread can perform an \code{alarm()}, \code{getsignal()}, or \code{pause()}; only the main 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 @@ -73,7 +73,7 @@ The variables defined in the signal module are: hangup signal is defined as \code{signal.SIGHUP}; the variable names are identical to the names used in C programs, as found in \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 \file{signal(7)}). Note that not all systems define the same set of signal names; only @@ -89,18 +89,18 @@ The signal module defines the following functions: \begin{funcdesc}{alarm}{time} If \var{time} is non-zero, this function requests that a \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 seconds before any previously set alarm was to have been delivered. If \var{time} is zero, no alarm id scheduled, and any scheduled alarm is canceled. The return value is the number of seconds 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)}.) \end{funcdesc} \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 special values \code{signal.SIG_IGN}, \code{signal.SIG_DFL} or \code{None}. Here, \code{signal.SIG_IGN} means that the signal was @@ -110,20 +110,20 @@ The signal module defines the following functions: \end{funcdesc} \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 - UNIX man page \code{signal(2)}.) + \UNIX{} man page \code{signal(2)}.) \end{funcdesc} \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 one of the special values \code{signal.SIG_IGN} or \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)}.) When threads are enabled, this function can only be called from the 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} diff --git a/Doc/lib/libsocket.tex b/Doc/lib/libsocket.tex index 25658d9..b826601 100644 --- a/Doc/lib/libsocket.tex +++ b/Doc/lib/libsocket.tex @@ -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 \UNIX{} Programmer's Manual, Supplementary Documents 1 (sections PS1:7 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. The Python interface is a straightforward transliteration of the @@ -77,11 +77,11 @@ used for the second argument to \code{socket()}. \dataline{IPPORT_*} \dataline{INADDR_*} \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. They are generally used in arguments to the \code{setsockopt} and \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. \end{datadesc} @@ -113,7 +113,7 @@ for that service. The protocol name should be \code{'tcp'} or \code{'udp'}. \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 protocol number. The address family should be \code{AF_INET} or \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 The protocol number is usually zero and may be omitted in that case. \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 returned by a file object's \code{fileno} method). Address family, 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 checked --- subsequent operations on the object may fail if the file 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 -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). \end{funcdesc} @@ -185,7 +185,7 @@ number of an IP socket, for instance. see above.) \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 {\it getsockopt}(2)). The needed symbolic constants are defined in 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 garbage-collected independently. \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 the data received. The maximum amount of data to be received 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 \subsection{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 client), and a client using it. Note that a server must perform the sequence \code{socket}, \code{bind}, \code{listen}, \code{accept} diff --git a/Doc/lib/libstring.tex b/Doc/lib/libstring.tex index 84d73e8..0c9ad7d 100644 --- a/Doc/lib/libstring.tex +++ b/Doc/lib/libstring.tex @@ -72,7 +72,7 @@ or more digits, optionally preceded by a sign (\samp{+} or \samp{-}). \end{funcdesc} \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 number is reset to zero after each newline occurring in the string. This doesn't understand other non-printing characters or escape @@ -88,7 +88,7 @@ negative, \code{len(\var{s})} is added. \end{funcdesc} \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} \begin{funcdesc}{index}{s\, sub\optional{\, start}} @@ -101,7 +101,7 @@ Like \code{rfind} but raise \code{ValueError} when the substring is not found. \end{funcdesc} -\begin{funcdesc}{count}{s\, sub\, i} +\begin{funcdesc}{count}{s\, sub\optional{\, i}} Return the number of (non-overlapping) occurrences of substring \var{sub} in string \var{s} with index at least \var{i}. If \var{i} is omitted, it defaults to \code{0}. @@ -112,12 +112,12 @@ Convert letters to lower case. \end{funcdesc} \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}. \end{funcdesc} \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 items than the number of non-overlapping occurrences of the separator in the string. Thus, \code{string.splitfields(\var{s}, ' @@ -139,12 +139,12 @@ equals \var{t}. \end{funcdesc} \begin{funcdesc}{strip}{s} -Removes leading and trailing whitespace from the string +Remove leading and trailing whitespace from the string \var{s}. \end{funcdesc} \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} \begin{funcdesc}{upper}{s} diff --git a/Doc/lib/libtempfile.tex b/Doc/lib/libtempfile.tex index 84bd641..f67821d 100644 --- a/Doc/lib/libtempfile.tex +++ b/Doc/lib/libtempfile.tex @@ -5,8 +5,8 @@ \renewcommand{\indexsubitem}{(in module tempfile)} -This module generates temporary file names. It is not UNIX specific, -but it may require some help on non-UNIX systems. +This module generates temporary file names. It is not \UNIX{} specific, +but it may require some help on non-\UNIX{} systems. Note: the modules does not create temporary files, nor does it automatically remove them when the current process exits or dies. @@ -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 directory in which filenames returned by \code{mktemp()} reside. The 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 whether its value is valid. \end{datadesc} @@ -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 \code{mktemp()}. A string of decimal digits is added to generate 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). \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{mktemp()}, the processes will generate conflicting temporary names. To resolve this, the child process should assign \code{None} diff --git a/Doc/lib/libthread.tex b/Doc/lib/libthread.tex index 4208c2d..7147ebf 100644 --- a/Doc/lib/libthread.tex +++ b/Doc/lib/libthread.tex @@ -2,14 +2,14 @@ \bimodindex{thread} 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 -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. 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 -implementation (e.g. KSR). +implementation (e.g.\ KSR). It defines the following constant and functions: @@ -21,7 +21,7 @@ Raised on thread-specific errors. \begin{funcdesc}{start_new_thread}{func\, arg} Start a new thread. The thread executes the function \var{func} 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 then the thread exits (but other threads continue to run). \end{funcdesc} @@ -59,7 +59,7 @@ Without the optional argument, this method acquires the lock unconditionally, if necessary waiting until it is released by another thread (only one thread at a time can acquire a lock --- that's their 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 immediately without waiting, while if it is nonzero, the lock is acquired unconditionally as before. If an argument is present, the @@ -72,7 +72,7 @@ necessarily by the same thread. \end{funcdesc} \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. \end{funcdesc} diff --git a/Doc/lib/libunix.tex b/Doc/lib/libunix.tex index ca4ec97..eca2371 100644 --- a/Doc/lib/libunix.tex +++ b/Doc/lib/libunix.tex @@ -1,5 +1,5 @@ \chapter{UNIX ONLY} 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. diff --git a/Doc/libaifc.tex b/Doc/libaifc.tex index 0a56ca6..7b4e4c8 100644 --- a/Doc/libaifc.tex +++ b/Doc/libaifc.tex @@ -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 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 -frame consists of nchannels*framesize bytes, and a second's worth of -audio consists of nchannels*framesize*framerate bytes. +frame consists of \var{nchannels}*\var{framesize} bytes, and a second's worth of +audio consists of \var{nchannels}*\var{framesize}*\var{framerate} bytes. Module \code{aifc} defines the following function: \renewcommand{\indexsubitem}{(in module aifc)} \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 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 @@ -75,7 +75,7 @@ the given id. \end{funcdesc} \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 samples of all channels. \end{funcdesc} @@ -175,6 +175,6 @@ not updated. \begin{funcdesc}{close}{} 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. \end{funcdesc} diff --git a/Doc/libaudioop.tex b/Doc/libaudioop.tex index 61ab7fc..03e074d 100644 --- a/Doc/libaudioop.tex +++ b/Doc/libaudioop.tex @@ -1,8 +1,8 @@ \section{Built-in module \sectcode{audioop}} \bimodindex{audioop} -The audioop module contains some useful operations on sound fragments. -It operates on sound fragments consisting of signed integer samples of +The \code{audioop} module contains some useful operations on sound fragments. +It operates on sound fragments consisting of signed integer samples 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 scalar items are integers, unless specified otherwise. @@ -19,7 +19,7 @@ per sample, etc. \end{excdesc} \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 \code{1}, \code{2} or \code{4}. Both fragments should have the same length. \end{funcdesc} @@ -60,8 +60,8 @@ passed as an argument. \begin{funcdesc}{findfactor}{fragment\, reference} This routine (which only accepts 2-byte sample fragments) calculates a factor \var{F} such that \code{rms(add(fragment, mul(reference, -F)))} -is minimal, i.e. it calculates the factor with which you should -multiply \var{reference} to make it match as good as possible to +is minimal, i.e.\ it calculates the factor with which you should +multiply \var{reference} to make it match as well as possible to \var{fragment}. The fragments should be the same size. 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} 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 (conceptually) does this by taking slices out of \var{fragment}, using \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}. \begin{funcdesc}{findmax}{fragment\, length} This routine (which only accepts 2-byte sample fragments) searches -\var{fragment} for a slice of length \var{length} samples (not bytes!) -with maximum energy, i.e. it returns \var{i} for which +\var{fragment} for a slice of length \var{length} samples (not bytes!)\ +with maximum energy, i.e.\ it returns \var{i} for which \code{rms(fragment[i*2:(i+length)*2])} is maximal. 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. \end{funcdesc} \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 silently ignored. \end{funcdesc} @@ -150,25 +150,6 @@ This function reverses the samples in a fragment and returns the modified fragment. \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} Returns the root-mean-square of the fragment, i.e. \iftexi @@ -184,6 +165,19 @@ divided by the sumber of samples. This is a measure of the power in an audio signal. \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} This function converts sound fragments in ULAW encoding to linearly 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} 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 into two mono fragments first and recombined later. Here is an example of how to do that: @@ -207,10 +201,10 @@ def mul_stereo(sample, width, lfactor, rfactor): \end{verbatim}\ecode 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 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 binary you can code the first element (the predicted value) in 16 bits and the second (the delta index) in 8. diff --git a/Doc/libcopy.tex b/Doc/libcopy.tex index f7f9744..c141e05 100644 --- a/Doc/libcopy.tex +++ b/Doc/libcopy.tex @@ -10,8 +10,8 @@ Interface summary: \begin{verbatim} import copy -x = copy.copy(y) # make a shallow copy of y -x = copy.deepcopy(y) # make a deep copy of y +x = copy.copy(y) # make a shallow copy of y +x = copy.deepcopy(y) # make a deep copy of y \end{verbatim} For module specific errors, \code{copy.Error} is raised. @@ -44,7 +44,7 @@ Recursive objects (compound objects that, directly or indirectly, contain a reference to themselves) may cause a recursive loop. \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 copies. diff --git a/Doc/libctb.tex b/Doc/libctb.tex index d15177e..3928498 100644 --- a/Doc/libctb.tex +++ b/Doc/libctb.tex @@ -30,14 +30,14 @@ Bits in the status as returned by \var{Status}. \end{datadesc} \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} \begin{funcdesc}{CMNew}{name\, sizes} Create a connection object using the connection tool named \var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in, data out, control in, control out, attention in and attention out. -Alternatively, passing \var{None} will result in default buffer sizes. +Alternatively, passing \code{None} will result in default buffer sizes. \end{funcdesc} \subsection{connection object} @@ -47,14 +47,14 @@ of \code{-1} is indefinite, meaning that the command runs to completion. \renewcommand{\indexsubitem}{(connection object method)} \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 object). This will make all connection object methods work asynchronously, with the callback routine being called upon completion. {\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. \end{datadesc} @@ -76,15 +76,15 @@ Accept (when \var{yesno} is non-zero) or reject an incoming call after \begin{funcdesc}{Close}{timeout\, now} Close a connection. When \var{now} is zero, the close is orderly -(i.e. outstanding output is flushed, etc) with a timeout of +(i.e.\ outstanding output is flushed, etc.)\ with a timeout of \var{timeout} seconds. When \var{now} is non-zero the close is -immedeate, discarding output. +immediate, discarding output. \end{funcdesc} \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 -\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. \end{funcdesc} @@ -97,8 +97,8 @@ the number of bytes written. \end{funcdesc} \begin{funcdesc}{Status}{} -Return connection status as the 2-tuple \code{(sizes, -flags)}. \var{Sizes} is a 6-tuple giving the actual buffer sizes used +Return connection status as the 2-tuple \code{(\var{sizes}, +\var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used (see \var{CMNew}), \var{flags} is a set of bits describing the state of the connection. \end{funcdesc} diff --git a/Doc/libdbm.tex b/Doc/libdbm.tex index 7ff4ee5..6e72567 100644 --- a/Doc/libdbm.tex +++ b/Doc/libdbm.tex @@ -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 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 -\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. \end{funcdesc} diff --git a/Doc/libfcntl.tex b/Doc/libfcntl.tex index e361d5e..46b41a5 100644 --- a/Doc/libfcntl.tex +++ b/Doc/libfcntl.tex @@ -1,11 +1,11 @@ % Manual text by Jaap Vermeulen \section{Built-in module \sectcode{fcntl}} \bimodindex{fcntl} -\indexii{UNIX}{file control} -\indexii{UNIX}{IO control} +\indexii{\UNIX{}}{file control} +\indexii{\UNIX{}}{I/O control} -This module performs file control and IO control on file descriptors. -It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX routines. +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. File descriptors can be obtained with the \dfn{fileno()} method of a file or socket object. @@ -23,10 +23,10 @@ The module defines the following functions: the argument missing or an integer value, the return value of this function is the integer return value of the real \code{fcntl()} 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()} 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. \end{funcdesc} diff --git a/Doc/libfuncs.tex b/Doc/libfuncs.tex index 9ebe210..0eb6857 100644 --- a/Doc/libfuncs.tex +++ b/Doc/libfuncs.tex @@ -405,7 +405,7 @@ returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns \end{verbatim}\ecode \end{funcdesc} -\begin{funcdesc}{vars}{} +\begin{funcdesc}{vars}{\optional{object}} Without arguments, return a dictionary corresponding to the current local symbol table. With a module, class or class instance object as argument (or anything else that has a \code{__dict__} attribute), diff --git a/Doc/libgdbm.tex b/Doc/libgdbm.tex index 40facad..177627f 100644 --- a/Doc/libgdbm.tex +++ b/Doc/libgdbm.tex @@ -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 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 -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 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} -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} diff --git a/Doc/libgrp.tex b/Doc/libgrp.tex index 1c4dd15..6310498 100644 --- a/Doc/libgrp.tex +++ b/Doc/libgrp.tex @@ -28,5 +28,5 @@ Return the group database entry for the given group name. \end{funcdesc} \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} diff --git a/Doc/libimageop.tex b/Doc/libimageop.tex index 4481e61..836ae76 100644 --- a/Doc/libimageop.tex +++ b/Doc/libimageop.tex @@ -1,9 +1,9 @@ \section{Built-in module \sectcode{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 -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. The module defines the following variables and functions: @@ -17,20 +17,20 @@ per pixel, etc. \begin{funcdesc}{crop}{image\, psize\, width\, height\, x0\, y0\, x1\, y1} -This function takes the image in \code{image}, which should by -\code{width} by \code{height} in size and consist of pixels of -\code{psize} bytes, and returns the selected part of that image. \code{x0}, -\code{y0}, \code{x1} and \code{y1} are like the \code{lrectread} +This function takes the image in \var{image}, which should by +\var{width} by \var{height} in size and consist of pixels of +\var{psize} bytes, and returns the selected part of that image. \var{x0}, +\var{y0}, \var{x1} and \var{y1} are like the \code{lrectread} parameters, i.e. the boundary is included in the new image. The new boundaries need not be inside the picture. Pixels that fall 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. \end{funcdesc} \begin{funcdesc}{scale}{image\, psize\, width\, height\, newwidth\, newheight} -This function returns a \code{image} scaled to size \code{newwidth} by -\code{newheight}. No interpolation is done, scaling is done by +This function returns an \var{image} scaled to size \var{newwidth} by +\var{newheight}. No interpolation is done, scaling is done by simple-minded pixel duplication or removal. Therefore, computer-generated images or dithered images will not look nice after scaling. \end{funcdesc} @@ -57,7 +57,7 @@ monochrome image but it uses a (simple-minded) dithering algorithm. \begin{funcdesc}{mono2grey}{image\, width\, height\, p0\, p1} 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 -\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 pass the values \code{0} and \code{255} respectively. \end{funcdesc} diff --git a/Doc/libimp.tex b/Doc/libimp.tex index 72f71a2..9ead176 100644 --- a/Doc/libimp.tex +++ b/Doc/libimp.tex @@ -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 object. If the module was already initialized, it will be initialized {\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. \end{funcdesc} diff --git a/Doc/libjpeg.tex b/Doc/libjpeg.tex index a4e931f..b5c14a4 100644 --- a/Doc/libjpeg.tex +++ b/Doc/libjpeg.tex @@ -1,19 +1,19 @@ \section{Built-in Module \sectcode{jpeg}} \bimodindex{jpeg} -The module jpeg provides access to the jpeg compressor and -decompressor written by the Independent JPEG Group. JPEG is a (draft?) +The module \code{jpeg} provides access to the jpeg compressor and +decompressor written by the Independent JPEG Group. JPEG is a (draft?)\ standard for compressing pictures. For details on jpeg or the Independent JPEG Group software refer to the JPEG standard or the documentation provided with the software. -The jpeg module defines these functions: +The \code{jpeg} module defines these functions: \renewcommand{\indexsubitem}{(in module jpeg)} \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 -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 pixels are allowed, the former being treated as greyscale and the latter as RGB color. Compress returns a string that contains the @@ -24,28 +24,28 @@ compressed picture, in JFIF format. Data is a string containing a picture in JFIF format. It returns a tuple \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} \begin{funcdesc}{setoption}{name\, value} Set various options. Subsequent compress and decompress calls will use these options. The following options are available: \begin{description} -\item[\code{'forcegray'}] +\item[\code{'forcegray' }] 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 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 smaller compressed image. Compress only. -\item[\code{'smooth'}] +\item[\code{'smooth' }] Perform inter-block smoothing on uncompressed image. Only useful for low-quality images. Decompress only. \end{description} \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. diff --git a/Doc/libmacconsole.tex b/Doc/libmacconsole.tex index 0be429b..2f60890 100644 --- a/Doc/libmacconsole.tex +++ b/Doc/libmacconsole.tex @@ -23,13 +23,13 @@ etc). \end{datadesc} \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} \begin{funcdesc}{fopen}{fp} Return the console window object corresponding with the given file -object. \var{Fp} should be one of \var{sys.stdin}, \var{sys.stdout} or -\var{sys.stderr}. +object. \var{fp} should be one of \code{sys.stdin}, \code{sys.stdout} or +\code{sys.stderr}. \end{funcdesc} \subsection{macconsole options object} @@ -57,8 +57,7 @@ The title of the window. \end{datadesc} \begin{datadesc}{pause_atexit} -If set non-zero, the window will wait for user action before closing -the window. +If set non-zero, the window will wait for user action before closing. \end{datadesc} \subsection{console window object} @@ -88,13 +87,13 @@ Clear to end-of-line. \end{funcdesc} \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 -non-ascii character set). +non-\ASCII{} character set). \end{funcdesc} \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} \begin{funcdesc}{hide}{} diff --git a/Doc/libmacfs.tex b/Doc/libmacfs.tex index bd22498..80ec76d 100644 --- a/Doc/libmacfs.tex +++ b/Doc/libmacfs.tex @@ -7,9 +7,9 @@ This module provides access to macintosh FSSpec handling, the Alias Manager, finder aliases and the Standard File package. 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, -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. \begin{funcdesc}{FSSpec}{file} @@ -26,15 +26,15 @@ Create an Alias object given the raw data for the alias. \end{funcdesc} \begin{funcdesc}{ResolveAliasFile}{file} -Resolve an alias file. Returns a 3-tuple \code{(fsspec, isfolder, -aliased)} where \var{fsspec} is the resulting FSSpec object, +Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, \var{isfolder}, +\var{aliased})} where \var{fsspec} is the resulting FSSpec object, \var{isfolder} is true if \var{fsspec} points to a folder and \var{aliased} is true if the file was an alias in the first place (otherwise the FSSpec object for the file itself is returned). \end{funcdesc} \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 the files the user can choose from. The function returns an FSSpec object and a flag indicating that the user completed the dialog @@ -44,14 +44,14 @@ without cancelling. \begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}} Present the user with a standard ``open output file'' dialog. \var{prompt} is the prompt string, and the optional -\var{default} argument 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 the dialog without cancelling. \end{funcdesc} \begin{funcdesc}{GetDirectory}{} 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} \subsection{FSSpec objects} @@ -67,13 +67,13 @@ Return the full pathname of the file described by the FSSpec object. \end{funcdesc} \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. \end{funcdesc} \begin{funcdesc}{NewAlias}{\optional{file}} 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. \end{funcdesc} @@ -99,7 +99,7 @@ or transmitting to other programs. \begin{funcdesc}{Resolve}{\optional{file}} Resolve the alias. If the alias was created as a relative alias you -should pass the file relative to which it is. 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 itself was modified during the search process. \end{funcdesc} @@ -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. \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 -\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 modifying the resource. diff --git a/Doc/libmacspeech.tex b/Doc/libmacspeech.tex index 0c1d88c..737016e 100644 --- a/Doc/libmacspeech.tex +++ b/Doc/libmacspeech.tex @@ -4,18 +4,18 @@ \renewcommand{\indexsubitem}{(in module macspeech)} 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 your \code{Extensions} folder for this to work. The module does not provide full access to all features of the Speech Manager yet. \begin{funcdesc}{Available}{} 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} \begin{funcdesc}{Version}{} -Return the (integer) version of the Speech Manager. +Return the (integer) version number of the Speech Manager. \end{funcdesc} \begin{funcdesc}{SpeakString}{str} @@ -43,7 +43,7 @@ yet possible to access the parameters of a voice. \renewcommand{\indexsubitem}{(voice object method)} \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} \begin{funcdesc}{NewChannel}{} @@ -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 control than \code{SpeakString()}, and allows you to use multiple speakers at the same time. Please note that channel pitch and rate are -interrelated in some way, so that to make your macintosh sing you will +interrelated in some way, so that to make your Macintosh sing you will have to adjust both. \renewcommand{\indexsubitem}{(speech channel object method)} @@ -67,7 +67,7 @@ Stop babbling. \end{funcdesc} \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} \begin{funcdesc}{SetPitch}{pitch} diff --git a/Doc/libmactcp.tex b/Doc/libmactcp.tex index 6f8719e..11c0114 100644 --- a/Doc/libmactcp.tex +++ b/Doc/libmactcp.tex @@ -3,11 +3,11 @@ \renewcommand{\indexsubitem}{(in module mactcp)} 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 -ip-addresses), a module \var{MACTCP} which has symbolic names for -constants constants used by MacTCP and a wrapper module \var{socket} -which mimics the unix socket interface (as far as possible). +ip-addresses), a module \code{MACTCP} which has symbolic names for +constants constants used by MacTCP and a wrapper module \code{socket} +which mimics the \UNIX{} socket interface (as far as possible). A complete description of the MacTCP interface can be found in the Apple MacTCP API documentation. @@ -26,14 +26,14 @@ Return the 32-bit integer network mask of the interface. \end{funcdesc} \begin{funcdesc}{TCPCreate}{size} -Create a TCP Stream object. \var{Size} is the size of the receive +Create a TCP Stream object. \var{size} is the size of the receive buffer, \code{4096} is suggested by various sources. \end{funcdesc} \begin{funcdesc}{UDPCreate}{size, port} -Create a UDP stream object. \var{Size} is the size of the receive +Create a UDP stream object. \var{size} is the size of the receive buffer (and, hence, the size of the biggest datagram you can receive -on this port). \var{Port} is the UDP port number you want to receive +on this port). \var{port} is the UDP port number you want to receive datagrams on, a value of zero will make MacTCP select a free port. \end{funcdesc} @@ -41,30 +41,30 @@ datagrams on, a value of zero will make MacTCP select a free port. \renewcommand{\indexsubitem}{(TCP stream method)} \begin{datadesc}{asr} -When set to a value different than \var{None} this should point to a -function with two integer parameters: an event code and a detail. This +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 will be called upon network-generated events such as urgent data arrival. In addition, it is called with eventcode -\var{MACTCP.PassiveOpenDone} when a \var{PassiveOpen} completes. This -is a python addition to the MacTCP semantics. -It is safe to do further calls from the asr. +\code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen} completes. This +is a Python addition to the MacTCP semantics. +It is safe to do further calls from the \code{asr}. \end{datadesc} \begin{funcdesc}{PassiveOpen}{port} 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 calls other than -\var{wait}, \var{isdone} or \var{GetSockName} before the call +\code{wait}, \code{isdone} or \code{GetSockName} before the call completes. \end{funcdesc} \begin{funcdesc}{wait}{} -Wait for \var{PassiveOpen} to complete. +Wait for \code{PassiveOpen} to complete. \end{funcdesc} \begin{funcdesc}{isdone}{} -Return 1 if a \var{PassiveOpen} is completed. +Return 1 if a \code{PassiveOpen} has completed. \end{funcdesc} \begin{funcdesc}{GetSockName}{} @@ -73,9 +73,9 @@ Return the TCP address of this side of a connection as a 2-tuple \end{funcdesc} \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 -call blocks until the connection is established. +call blocks until the connection has been established. \end{funcdesc} \begin{funcdesc}{Send}{buf\, push\, urgent} @@ -87,7 +87,7 @@ are flags as specified by the TCP standard. Receive data. The call returns when \var{timeout} seconds have passed or when (according to the MacTCP documentation) ``a reasonable amount of data has been received''. The return value is a 3-tuple -\code{(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 call returning urgent data will have the \var{urgent} flag set, the last will have the \var{mark} flag set. @@ -95,7 +95,7 @@ last will have the \var{mark} flag set. \begin{funcdesc}{Close}{} 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. \end{funcdesc} @@ -131,7 +131,7 @@ amtUnackedData} is what you can pass to \code{Send} without blocking. \end{datadesc} \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). \end{datadesc} @@ -145,7 +145,7 @@ about UDP. \begin{datadesc}{asr} 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. \end{datadesc} @@ -154,8 +154,8 @@ A read-only member giving the port number of this UDP stream. \end{datadesc} \begin{funcdesc}{Read}{timeout} -Read a datagram, waiting at most \var{timeout} seconds (-1 is -indefinite). Returns the data. +Read a datagram, waiting at most \var{timeout} seconds ($-1$ is +indefinite). Return the data. \end{funcdesc} \begin{funcdesc}{Write}{host\, port\, buf} diff --git a/Doc/libmd5.tex b/Doc/libmd5.tex index 3e22820..0dfa65e 100644 --- a/Doc/libmd5.tex +++ b/Doc/libmd5.tex @@ -3,7 +3,7 @@ This module implements the interface to RSA's MD5 message digest 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 strings. diff --git a/Doc/libmpz.tex b/Doc/libmpz.tex index ea0d1b7..1fd03f7 100644 --- a/Doc/libmpz.tex +++ b/Doc/libmpz.tex @@ -8,15 +8,15 @@ arithmetic routines. Only the interfaces to the \emph{integer} otherwise, the description in the GNU MP documentation can be applied. 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{abs}, \code{int}, \ldots, \code{divmod}, \code{pow}. \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 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 -below for an excact description). An mpz-number is printed like this: +You create an mpz-number by calling the function called \code{mpz} (see +below for an exact description). An mpz-number is printed like this: \code{mpz(\var{value})}. \renewcommand{\indexsubitem}{(in module mpz)} @@ -59,7 +59,7 @@ return mpz-numbers. \begin{funcdesc}{divm}{numerator\, denominator\, modulus} Returns a number \var{q}. such that \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} 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 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. \end{funcdesc} diff --git a/Doc/libos.tex b/Doc/libos.tex index 6763ed4..5109f5d 100644 --- a/Doc/libos.tex +++ b/Doc/libos.tex @@ -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, 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 -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 function \code{os.stat(\var{file})} returns stat info about a \var{file} in a format compatible with the POSIX interface. diff --git a/Doc/libpickle.tex b/Doc/libpickle.tex index a9d5fa4..5c01d36 100644 --- a/Doc/libpickle.tex +++ b/Doc/libpickle.tex @@ -8,7 +8,7 @@ \indexii{pickling}{objects} 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 persistency --- although \code{pickle} reads and writes file objects, it does not handle the issue of naming persistent objects, nor the @@ -32,7 +32,7 @@ following correctly: \item pointer sharing -\item instances uf user-defined classes +\item instances of user-defined classes \end{itemize} @@ -105,11 +105,11 @@ module. \ttindex{__dict__} 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 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 -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 class's \code{__setstate__()} method. @@ -157,7 +157,7 @@ the file argument. 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 -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 corresponding \code{Pickler} and \code{Unpicklers}. {\em Warning}: this is intended for pickling multiple objects without intervening diff --git a/Doc/libposix.tex b/Doc/libposix.tex index 1a05d47..c749d74 100644 --- a/Doc/libposix.tex +++ b/Doc/libposix.tex @@ -3,7 +3,7 @@ \bimodindex{posix} 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). It is available in all Python versions except on the Macintosh; the MS-DOS version does not support certain functions. @@ -31,7 +31,7 @@ in C. \renewcommand{\indexsubitem}{(exception in module posix)} \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 string value is \code{'posix.error'}. The accompanying value is a pair containing the numeric error code from \code{errno} and the @@ -279,7 +279,7 @@ systems without symbolic links, this always raises \begin{funcdesc}{system}{command} Execute the command (a string) in a subshell. This is implemented by 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 value is the exit status of the process as returned by Standard C \code{system()}. @@ -302,7 +302,7 @@ Return a 5-tuple containing information identifying the current operating system. The tuple contains 5 strings: \code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}. 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 \UNIX{} systems.) \end{funcdesc} diff --git a/Doc/libppath.tex b/Doc/libppath.tex index 731d344..c7c2b63 100644 --- a/Doc/libppath.tex +++ b/Doc/libppath.tex @@ -48,13 +48,13 @@ Return true if \var{p} is an absolute pathname (begins with a slash). \begin{funcdesc}{isfile}{p} 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. \end{funcdesc} \begin{funcdesc}{isdir}{p} 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. \end{funcdesc} @@ -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 applied to the result; otherwise, \code{join(\var{head}, \var{tail})} equals \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} are empty; if \var{p} contains no slash, \var{head} is empty and \var{tail} equals \var{p}. diff --git a/Doc/librand.tex b/Doc/librand.tex index b03ac41..4991e59 100644 --- a/Doc/librand.tex +++ b/Doc/librand.tex @@ -1,7 +1,7 @@ \section{Standard Module \sectcode{rand}} \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: \renewcommand{\indexsubitem}{(in module rand)} diff --git a/Doc/librgbimg.tex b/Doc/librgbimg.tex index 367851b..f25921e 100644 --- a/Doc/librgbimg.tex +++ b/Doc/librgbimg.tex @@ -22,7 +22,7 @@ are currently supported. \begin{funcdesc}{longimagedata}{file} 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 string. This format is suitable to pass to \code{gl.lrectwrite}, for instance. @@ -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 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 X). The default is zero. +compatible with X)\@. The default is zero. \end{funcdesc} diff --git a/Doc/librotor.tex b/Doc/librotor.tex index b931333..f2ea074 100644 --- a/Doc/librotor.tex +++ b/Doc/librotor.tex @@ -25,7 +25,7 @@ The available functions in this module are: \renewcommand{\indexsubitem}{(in module rotor)} \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 to randomly generate the rotor permutations and their initial positions. \var{numrotors} is the number of rotor permutations in the returned object; @@ -36,28 +36,28 @@ Rotor objects have the following methods: \renewcommand{\indexsubitem}{(rotor method)} \begin{funcdesc}{setkey}{} -Resets the rotor to its initial state. +Reset the rotor to its initial state. \end{funcdesc} \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 same length as the original plaintext. \end{funcdesc} \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. \end{funcdesc} \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 always be the same length as the ciphertext. \end{funcdesc} \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. \end{funcdesc} diff --git a/Doc/libsignal.tex b/Doc/libsignal.tex index 88116d7..13139d7 100644 --- a/Doc/libsignal.tex +++ b/Doc/libsignal.tex @@ -12,20 +12,20 @@ it is explicitly reset (i.e. Python uses the BSD style interface). \item 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 Although Python signal handlers are called asynchronously as far as the Python user is concerned, they can only occur between the ``atomic'' instructions of the Python interpreter. This means that 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. \item 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. -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. \item @@ -44,8 +44,8 @@ overridden. \item 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 -threads simultaneously is: always perform \code{signal()} operations -in the main thread of execution. Any thread can perform a +threads simultaneously is:\ always perform \code{signal()} operations +in the main thread of execution. Any thread can perform an \code{alarm()}, \code{getsignal()}, or \code{pause()}; only the main 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 @@ -73,7 +73,7 @@ The variables defined in the signal module are: hangup signal is defined as \code{signal.SIGHUP}; the variable names are identical to the names used in C programs, as found in \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 \file{signal(7)}). Note that not all systems define the same set of signal names; only @@ -89,18 +89,18 @@ The signal module defines the following functions: \begin{funcdesc}{alarm}{time} If \var{time} is non-zero, this function requests that a \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 seconds before any previously set alarm was to have been delivered. If \var{time} is zero, no alarm id scheduled, and any scheduled alarm is canceled. The return value is the number of seconds 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)}.) \end{funcdesc} \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 special values \code{signal.SIG_IGN}, \code{signal.SIG_DFL} or \code{None}. Here, \code{signal.SIG_IGN} means that the signal was @@ -110,20 +110,20 @@ The signal module defines the following functions: \end{funcdesc} \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 - UNIX man page \code{signal(2)}.) + \UNIX{} man page \code{signal(2)}.) \end{funcdesc} \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 one of the special values \code{signal.SIG_IGN} or \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)}.) When threads are enabled, this function can only be called from the 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} diff --git a/Doc/libsocket.tex b/Doc/libsocket.tex index 25658d9..b826601 100644 --- a/Doc/libsocket.tex +++ b/Doc/libsocket.tex @@ -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 \UNIX{} Programmer's Manual, Supplementary Documents 1 (sections PS1:7 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. The Python interface is a straightforward transliteration of the @@ -77,11 +77,11 @@ used for the second argument to \code{socket()}. \dataline{IPPORT_*} \dataline{INADDR_*} \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. They are generally used in arguments to the \code{setsockopt} and \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. \end{datadesc} @@ -113,7 +113,7 @@ for that service. The protocol name should be \code{'tcp'} or \code{'udp'}. \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 protocol number. The address family should be \code{AF_INET} or \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 The protocol number is usually zero and may be omitted in that case. \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 returned by a file object's \code{fileno} method). Address family, 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 checked --- subsequent operations on the object may fail if the file 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 -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). \end{funcdesc} @@ -185,7 +185,7 @@ number of an IP socket, for instance. see above.) \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 {\it getsockopt}(2)). The needed symbolic constants are defined in 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 garbage-collected independently. \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 the data received. The maximum amount of data to be received 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 \subsection{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 client), and a client using it. Note that a server must perform the sequence \code{socket}, \code{bind}, \code{listen}, \code{accept} diff --git a/Doc/libstring.tex b/Doc/libstring.tex index 84d73e8..0c9ad7d 100644 --- a/Doc/libstring.tex +++ b/Doc/libstring.tex @@ -72,7 +72,7 @@ or more digits, optionally preceded by a sign (\samp{+} or \samp{-}). \end{funcdesc} \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 number is reset to zero after each newline occurring in the string. This doesn't understand other non-printing characters or escape @@ -88,7 +88,7 @@ negative, \code{len(\var{s})} is added. \end{funcdesc} \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} \begin{funcdesc}{index}{s\, sub\optional{\, start}} @@ -101,7 +101,7 @@ Like \code{rfind} but raise \code{ValueError} when the substring is not found. \end{funcdesc} -\begin{funcdesc}{count}{s\, sub\, i} +\begin{funcdesc}{count}{s\, sub\optional{\, i}} Return the number of (non-overlapping) occurrences of substring \var{sub} in string \var{s} with index at least \var{i}. If \var{i} is omitted, it defaults to \code{0}. @@ -112,12 +112,12 @@ Convert letters to lower case. \end{funcdesc} \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}. \end{funcdesc} \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 items than the number of non-overlapping occurrences of the separator in the string. Thus, \code{string.splitfields(\var{s}, ' @@ -139,12 +139,12 @@ equals \var{t}. \end{funcdesc} \begin{funcdesc}{strip}{s} -Removes leading and trailing whitespace from the string +Remove leading and trailing whitespace from the string \var{s}. \end{funcdesc} \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} \begin{funcdesc}{upper}{s} diff --git a/Doc/libtempfile.tex b/Doc/libtempfile.tex index 84bd641..f67821d 100644 --- a/Doc/libtempfile.tex +++ b/Doc/libtempfile.tex @@ -5,8 +5,8 @@ \renewcommand{\indexsubitem}{(in module tempfile)} -This module generates temporary file names. It is not UNIX specific, -but it may require some help on non-UNIX systems. +This module generates temporary file names. It is not \UNIX{} specific, +but it may require some help on non-\UNIX{} systems. Note: the modules does not create temporary files, nor does it automatically remove them when the current process exits or dies. @@ -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 directory in which filenames returned by \code{mktemp()} reside. The 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 whether its value is valid. \end{datadesc} @@ -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 \code{mktemp()}. A string of decimal digits is added to generate 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). \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{mktemp()}, the processes will generate conflicting temporary names. To resolve this, the child process should assign \code{None} diff --git a/Doc/libthread.tex b/Doc/libthread.tex index 4208c2d..7147ebf 100644 --- a/Doc/libthread.tex +++ b/Doc/libthread.tex @@ -2,14 +2,14 @@ \bimodindex{thread} 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 -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. 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 -implementation (e.g. KSR). +implementation (e.g.\ KSR). It defines the following constant and functions: @@ -21,7 +21,7 @@ Raised on thread-specific errors. \begin{funcdesc}{start_new_thread}{func\, arg} Start a new thread. The thread executes the function \var{func} 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 then the thread exits (but other threads continue to run). \end{funcdesc} @@ -59,7 +59,7 @@ Without the optional argument, this method acquires the lock unconditionally, if necessary waiting until it is released by another thread (only one thread at a time can acquire a lock --- that's their 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 immediately without waiting, while if it is nonzero, the lock is acquired unconditionally as before. If an argument is present, the @@ -72,7 +72,7 @@ necessarily by the same thread. \end{funcdesc} \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. \end{funcdesc} diff --git a/Doc/libunix.tex b/Doc/libunix.tex index ca4ec97..eca2371 100644 --- a/Doc/libunix.tex +++ b/Doc/libunix.tex @@ -1,5 +1,5 @@ \chapter{UNIX ONLY} 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. diff --git a/Doc/mac/libctb.tex b/Doc/mac/libctb.tex index d15177e..3928498 100644 --- a/Doc/mac/libctb.tex +++ b/Doc/mac/libctb.tex @@ -30,14 +30,14 @@ Bits in the status as returned by \var{Status}. \end{datadesc} \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} \begin{funcdesc}{CMNew}{name\, sizes} Create a connection object using the connection tool named \var{name}. \var{sizes} is a 6-tuple given buffer sizes for data in, data out, control in, control out, attention in and attention out. -Alternatively, passing \var{None} will result in default buffer sizes. +Alternatively, passing \code{None} will result in default buffer sizes. \end{funcdesc} \subsection{connection object} @@ -47,14 +47,14 @@ of \code{-1} is indefinite, meaning that the command runs to completion. \renewcommand{\indexsubitem}{(connection object method)} \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 object). This will make all connection object methods work asynchronously, with the callback routine being called upon completion. {\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. \end{datadesc} @@ -76,15 +76,15 @@ Accept (when \var{yesno} is non-zero) or reject an incoming call after \begin{funcdesc}{Close}{timeout\, now} Close a connection. When \var{now} is zero, the close is orderly -(i.e. outstanding output is flushed, etc) with a timeout of +(i.e.\ outstanding output is flushed, etc.)\ with a timeout of \var{timeout} seconds. When \var{now} is non-zero the close is -immedeate, discarding output. +immediate, discarding output. \end{funcdesc} \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 -\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. \end{funcdesc} @@ -97,8 +97,8 @@ the number of bytes written. \end{funcdesc} \begin{funcdesc}{Status}{} -Return connection status as the 2-tuple \code{(sizes, -flags)}. \var{Sizes} is a 6-tuple giving the actual buffer sizes used +Return connection status as the 2-tuple \code{(\var{sizes}, +\var{flags})}. \var{sizes} is a 6-tuple giving the actual buffer sizes used (see \var{CMNew}), \var{flags} is a set of bits describing the state of the connection. \end{funcdesc} diff --git a/Doc/mac/libmacconsole.tex b/Doc/mac/libmacconsole.tex index 0be429b..2f60890 100644 --- a/Doc/mac/libmacconsole.tex +++ b/Doc/mac/libmacconsole.tex @@ -23,13 +23,13 @@ etc). \end{datadesc} \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} \begin{funcdesc}{fopen}{fp} Return the console window object corresponding with the given file -object. \var{Fp} should be one of \var{sys.stdin}, \var{sys.stdout} or -\var{sys.stderr}. +object. \var{fp} should be one of \code{sys.stdin}, \code{sys.stdout} or +\code{sys.stderr}. \end{funcdesc} \subsection{macconsole options object} @@ -57,8 +57,7 @@ The title of the window. \end{datadesc} \begin{datadesc}{pause_atexit} -If set non-zero, the window will wait for user action before closing -the window. +If set non-zero, the window will wait for user action before closing. \end{datadesc} \subsection{console window object} @@ -88,13 +87,13 @@ Clear to end-of-line. \end{funcdesc} \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 -non-ascii character set). +non-\ASCII{} character set). \end{funcdesc} \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} \begin{funcdesc}{hide}{} diff --git a/Doc/mac/libmacfs.tex b/Doc/mac/libmacfs.tex index bd22498..80ec76d 100644 --- a/Doc/mac/libmacfs.tex +++ b/Doc/mac/libmacfs.tex @@ -7,9 +7,9 @@ This module provides access to macintosh FSSpec handling, the Alias Manager, finder aliases and the Standard File package. 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, -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. \begin{funcdesc}{FSSpec}{file} @@ -26,15 +26,15 @@ Create an Alias object given the raw data for the alias. \end{funcdesc} \begin{funcdesc}{ResolveAliasFile}{file} -Resolve an alias file. Returns a 3-tuple \code{(fsspec, isfolder, -aliased)} where \var{fsspec} is the resulting FSSpec object, +Resolve an alias file. Returns a 3-tuple \code{(\var{fsspec}, \var{isfolder}, +\var{aliased})} where \var{fsspec} is the resulting FSSpec object, \var{isfolder} is true if \var{fsspec} points to a folder and \var{aliased} is true if the file was an alias in the first place (otherwise the FSSpec object for the file itself is returned). \end{funcdesc} \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 the files the user can choose from. The function returns an FSSpec object and a flag indicating that the user completed the dialog @@ -44,14 +44,14 @@ without cancelling. \begin{funcdesc}{StandardPutFile}{prompt\, \optional{default}} Present the user with a standard ``open output file'' dialog. \var{prompt} is the prompt string, and the optional -\var{default} argument 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 the dialog without cancelling. \end{funcdesc} \begin{funcdesc}{GetDirectory}{} 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} \subsection{FSSpec objects} @@ -67,13 +67,13 @@ Return the full pathname of the file described by the FSSpec object. \end{funcdesc} \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. \end{funcdesc} \begin{funcdesc}{NewAlias}{\optional{file}} 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. \end{funcdesc} @@ -99,7 +99,7 @@ or transmitting to other programs. \begin{funcdesc}{Resolve}{\optional{file}} Resolve the alias. If the alias was created as a relative alias you -should pass the file relative to which it is. 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 itself was modified during the search process. \end{funcdesc} @@ -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. \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 -\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 modifying the resource. diff --git a/Doc/mac/libmacspeech.tex b/Doc/mac/libmacspeech.tex index 0c1d88c..737016e 100644 --- a/Doc/mac/libmacspeech.tex +++ b/Doc/mac/libmacspeech.tex @@ -4,18 +4,18 @@ \renewcommand{\indexsubitem}{(in module macspeech)} 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 your \code{Extensions} folder for this to work. The module does not provide full access to all features of the Speech Manager yet. \begin{funcdesc}{Available}{} 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} \begin{funcdesc}{Version}{} -Return the (integer) version of the Speech Manager. +Return the (integer) version number of the Speech Manager. \end{funcdesc} \begin{funcdesc}{SpeakString}{str} @@ -43,7 +43,7 @@ yet possible to access the parameters of a voice. \renewcommand{\indexsubitem}{(voice object method)} \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} \begin{funcdesc}{NewChannel}{} @@ -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 control than \code{SpeakString()}, and allows you to use multiple speakers at the same time. Please note that channel pitch and rate are -interrelated in some way, so that to make your macintosh sing you will +interrelated in some way, so that to make your Macintosh sing you will have to adjust both. \renewcommand{\indexsubitem}{(speech channel object method)} @@ -67,7 +67,7 @@ Stop babbling. \end{funcdesc} \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} \begin{funcdesc}{SetPitch}{pitch} diff --git a/Doc/mac/libmactcp.tex b/Doc/mac/libmactcp.tex index 6f8719e..11c0114 100644 --- a/Doc/mac/libmactcp.tex +++ b/Doc/mac/libmactcp.tex @@ -3,11 +3,11 @@ \renewcommand{\indexsubitem}{(in module mactcp)} 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 -ip-addresses), a module \var{MACTCP} which has symbolic names for -constants constants used by MacTCP and a wrapper module \var{socket} -which mimics the unix socket interface (as far as possible). +ip-addresses), a module \code{MACTCP} which has symbolic names for +constants constants used by MacTCP and a wrapper module \code{socket} +which mimics the \UNIX{} socket interface (as far as possible). A complete description of the MacTCP interface can be found in the Apple MacTCP API documentation. @@ -26,14 +26,14 @@ Return the 32-bit integer network mask of the interface. \end{funcdesc} \begin{funcdesc}{TCPCreate}{size} -Create a TCP Stream object. \var{Size} is the size of the receive +Create a TCP Stream object. \var{size} is the size of the receive buffer, \code{4096} is suggested by various sources. \end{funcdesc} \begin{funcdesc}{UDPCreate}{size, port} -Create a UDP stream object. \var{Size} is the size of the receive +Create a UDP stream object. \var{size} is the size of the receive buffer (and, hence, the size of the biggest datagram you can receive -on this port). \var{Port} is the UDP port number you want to receive +on this port). \var{port} is the UDP port number you want to receive datagrams on, a value of zero will make MacTCP select a free port. \end{funcdesc} @@ -41,30 +41,30 @@ datagrams on, a value of zero will make MacTCP select a free port. \renewcommand{\indexsubitem}{(TCP stream method)} \begin{datadesc}{asr} -When set to a value different than \var{None} this should point to a -function with two integer parameters: an event code and a detail. This +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 will be called upon network-generated events such as urgent data arrival. In addition, it is called with eventcode -\var{MACTCP.PassiveOpenDone} when a \var{PassiveOpen} completes. This -is a python addition to the MacTCP semantics. -It is safe to do further calls from the asr. +\code{MACTCP.PassiveOpenDone} when a \code{PassiveOpen} completes. This +is a Python addition to the MacTCP semantics. +It is safe to do further calls from the \code{asr}. \end{datadesc} \begin{funcdesc}{PassiveOpen}{port} 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 calls other than -\var{wait}, \var{isdone} or \var{GetSockName} before the call +\code{wait}, \code{isdone} or \code{GetSockName} before the call completes. \end{funcdesc} \begin{funcdesc}{wait}{} -Wait for \var{PassiveOpen} to complete. +Wait for \code{PassiveOpen} to complete. \end{funcdesc} \begin{funcdesc}{isdone}{} -Return 1 if a \var{PassiveOpen} is completed. +Return 1 if a \code{PassiveOpen} has completed. \end{funcdesc} \begin{funcdesc}{GetSockName}{} @@ -73,9 +73,9 @@ Return the TCP address of this side of a connection as a 2-tuple \end{funcdesc} \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 -call blocks until the connection is established. +call blocks until the connection has been established. \end{funcdesc} \begin{funcdesc}{Send}{buf\, push\, urgent} @@ -87,7 +87,7 @@ are flags as specified by the TCP standard. Receive data. The call returns when \var{timeout} seconds have passed or when (according to the MacTCP documentation) ``a reasonable amount of data has been received''. The return value is a 3-tuple -\code{(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 call returning urgent data will have the \var{urgent} flag set, the last will have the \var{mark} flag set. @@ -95,7 +95,7 @@ last will have the \var{mark} flag set. \begin{funcdesc}{Close}{} 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. \end{funcdesc} @@ -131,7 +131,7 @@ amtUnackedData} is what you can pass to \code{Send} without blocking. \end{datadesc} \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). \end{datadesc} @@ -145,7 +145,7 @@ about UDP. \begin{datadesc}{asr} 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. \end{datadesc} @@ -154,8 +154,8 @@ A read-only member giving the port number of this UDP stream. \end{datadesc} \begin{funcdesc}{Read}{timeout} -Read a datagram, waiting at most \var{timeout} seconds (-1 is -indefinite). Returns the data. +Read a datagram, waiting at most \var{timeout} seconds ($-1$ is +indefinite). Return the data. \end{funcdesc} \begin{funcdesc}{Write}{host\, port\, buf} |