Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16d6e71

Browse files
committed
Lots of small corrections by Andrew Kuchling (plus all new rotor docs)
1 parent 4b4c664 commit 16d6e71

62 files changed

Lines changed: 520 additions & 282 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/Makefile

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,69 @@ LIBDEST=$LIBDESTDIR/python
44
DOCDESTDIR=$LIBDEST/doc
55
DVIPS= dvips -f
66

7-
all: tut lib ref ext
7+
all: tut.dvi lib.dvi ref.dvi ext.dvi
88

9-
tut:
9+
ext: ext.dvi
10+
tut: tut.dvi
11+
qua: qua.dvi
12+
ref: ref.dvi
13+
lib: lib.dvi
14+
15+
tut.dvi lib.dvi ref.dvi ext.dvi: myformat.sty fix_hack
16+
17+
tut.dvi: tut.tex
1018
latex tut
1119
latex tut
1220
$(DVIPS) tut >tut.ps
1321

14-
ref:
22+
ref.dvi: ref.tex ref1.tex ref2.tex ref3.tex ref4.tex ref5.tex ref6.tex \
23+
ref7.tex ref8.tex
1524
touch ref.ind
1625
latex ref
1726
./fix_hack ref.idx
1827
makeindex ref
1928
latex ref
2029
$(DVIPS) ref >ref.ps
2130

22-
lib:
31+
# LaTeX source files for the Python Library Reference
32+
LIBFILES = lib.tex \
33+
libal.tex libamoeba.tex libarray.tex libaudio.tex libaudioop.tex \
34+
libbltin.tex \
35+
libcrypto.tex \
36+
libdbm.tex \
37+
libexcs.tex \
38+
libfcntl.tex libfl.tex libfm.tex libfuncs.tex \
39+
libgdbm.tex libgetopt.tex libgl.tex libgrp.tex \
40+
libimageop.tex libimgfile.tex libintro.tex \
41+
libjpeg.tex \
42+
libmac.tex libmain.tex libmarshal.tex libmath.tex \
43+
libmd5.tex libmm.tex libmods.tex libmpz.tex \
44+
libobjs.tex libos.tex \
45+
libpanel.tex libposix.tex libposixfile.tex libppath.tex libpwd.tex \
46+
librand.tex libregex.tex libregsub.tex librgbimg.tex librotor.tex \
47+
libselect.tex libsgi.tex libsocket.tex libstd.tex libstdwin.tex \
48+
libstring.tex libstruct.tex libsun.tex libsys.tex \
49+
libthread.tex libtime.tex libtypes.tex \
50+
libunix.tex \
51+
libwhrandom.tex
52+
53+
lib.dvi: $(LIBFILES)
2354
touch lib.ind
2455
latex lib
2556
./fix_hack lib.idx
2657
makeindex lib
2758
latex lib
2859
$(DVIPS) lib >lib.ps
2960

30-
ext:
61+
ext.dvi: ext.tex
3162
touch ext.ind
3263
latex ext
3364
./fix_hack ext.idx
3465
makeindex ext
3566
latex ext
3667
$(DVIPS) ext >ext.ps
3768

38-
qua:
69+
qua.dvi: qua.tex quabib.bib
3970
latex qua
4071
bibtex qua
4172
latex qua

Doc/ext.tex

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
E-mail: {\tt [email protected]}
1010
}
1111

12-
\date{14 Jul 1994 \\ Release 1.0.3} % XXX update before release!
12+
\date{14 July 1994 \\ Release 1.0.3} % XXX update before release!
1313

1414
% Tell \index to actually write the .idx file
1515
\makeindex
@@ -23,7 +23,7 @@
2323
\begin{abstract}
2424

2525
\noindent
26-
This document describes how to write modules in C or C++ to extend the
26+
This document describes how to write modules in C or \Cpp{} to extend the
2727
Python interpreter. It also describes how to use Python as an
2828
`embedded' language, and how extension modules can be loaded
2929
dynamically (at run time) into the interpreter, if the operating
@@ -43,7 +43,7 @@
4343
\pagenumbering{arabic}
4444

4545

46-
\chapter{Extending Python with C or C++ code}
46+
\chapter{Extending Python with C or \Cpp{} code}
4747

4848

4949
\section{Introduction}
@@ -57,12 +57,9 @@ \section{Introduction}
5757

5858
Extension modules can do two things that can't be done directly in
5959
Python: they can implement new data types (which are different from
60-
classes by the way), and they can make system calls or call C library
61-
functions. Since the latter is usually the most important reason for
62-
adding an extension, I'll concentrate on adding `wrappers' around C
63-
library functions; the concrete example uses the wrapper for
64-
\code{system()} in module \code{posix}, found in (of course) the file
65-
\file{Modules/posixmodule.c}.
60+
classes, by the way), and they can make system calls or call C library
61+
functions. We'll see how both types of extension are implemented by
62+
examining the code for a Python curses interface.
6663

6764
Note: unless otherwise mentioned, all file references in this
6865
document are relative to the toplevel directory of the Python
@@ -112,7 +109,7 @@ \section{A first look at the code}
112109
are passed to the C function. The C function always has two
113110
parameters, conventionally named \var{self} and \var{args}. The
114111
\var{self} argument is used when the C function implements a builtin
115-
method --- this is advanced material and not covered in this document.
112+
method---this will be discussed later.
116113
In the example, \var{self} will always be a \code{NULL} pointer, since
117114
we are defining a function, not a method (this is done so that the
118115
interpreter doesn't have to understand two different types of C
@@ -780,9 +777,9 @@ \section{Reference counts}
780777
\code{DECREF()} on your object. You should use \code{DEL()} instead.
781778

782779

783-
\section{Writing extensions in C++}
780+
\section{Writing extensions in \Cpp{}}
784781

785-
It is possible to write extension modules in C++. Some restrictions
782+
It is possible to write extension modules in \Cpp{}. Some restrictions
786783
apply: since the main program (the Python interpreter) is compiled and
787784
linked by the C compiler, global or static objects with constructors
788785
cannot be used. All functions that will be called directly or
@@ -797,7 +794,7 @@ \chapter{Embedding Python in another application}
797794

798795
Embedding Python is similar to extending it, but not quite. The
799796
difference is that when you extend Python, the main program of the
800-
application is still the Python interpreter, while of you embed
797+
application is still the Python interpreter, while if you embed
801798
Python, the main program may have nothing to do with Python ---
802799
instead, some parts of the application occasionally call the Python
803800
interpreter to run some Python code.
@@ -820,13 +817,13 @@ \chapter{Embedding Python in another application}
820817
\file{Demo/embed}.
821818

822819

823-
\section{Embedding Python in C++}
820+
\section{Embedding Python in \Cpp{}}
824821

825-
It is also possible to embed Python in a C++ program; how this is done
826-
exactly will depend on the details of the C++ system used; in general
827-
you will need to write the main program in C++, and use the C++
828-
compiler to compile and link your program. There is no need to
829-
recompile Python itself with C++.
822+
It is also possible to embed Python in a \Cpp{} program; precisely how this
823+
is done will depend on the details of the \Cpp{} system used; in general you
824+
will need to write the main program in \Cpp{}, and use the \Cpp{} compiler
825+
to compile and link your program. There is no need to recompile Python
826+
itself using \Cpp{}.
830827

831828

832829
\chapter{Dynamic Loading}
@@ -860,7 +857,7 @@ \section{Configuring and building the interpreter for dynamic loading}
860857

861858
\subsection{Shared libraries}
862859

863-
The following systems supports dynamic loading using shared libraries:
860+
The following systems support dynamic loading using shared libraries:
864861
SunOS 4; Solaris 2; SGI IRIX 5 (but not SGI IRIX 4!); and probably all
865862
systems derived from SVR4, or at least those SVR4 derivatives that
866863
support shared libraries (are there any that don't?).

Doc/ext/ext.tex

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
E-mail: {\tt [email protected]}
1010
}
1111

12-
\date{14 Jul 1994 \\ Release 1.0.3} % XXX update before release!
12+
\date{14 July 1994 \\ Release 1.0.3} % XXX update before release!
1313

1414
% Tell \index to actually write the .idx file
1515
\makeindex
@@ -23,7 +23,7 @@
2323
\begin{abstract}
2424

2525
\noindent
26-
This document describes how to write modules in C or C++ to extend the
26+
This document describes how to write modules in C or \Cpp{} to extend the
2727
Python interpreter. It also describes how to use Python as an
2828
`embedded' language, and how extension modules can be loaded
2929
dynamically (at run time) into the interpreter, if the operating
@@ -43,7 +43,7 @@
4343
\pagenumbering{arabic}
4444

4545

46-
\chapter{Extending Python with C or C++ code}
46+
\chapter{Extending Python with C or \Cpp{} code}
4747

4848

4949
\section{Introduction}
@@ -57,12 +57,9 @@ \section{Introduction}
5757

5858
Extension modules can do two things that can't be done directly in
5959
Python: they can implement new data types (which are different from
60-
classes by the way), and they can make system calls or call C library
61-
functions. Since the latter is usually the most important reason for
62-
adding an extension, I'll concentrate on adding `wrappers' around C
63-
library functions; the concrete example uses the wrapper for
64-
\code{system()} in module \code{posix}, found in (of course) the file
65-
\file{Modules/posixmodule.c}.
60+
classes, by the way), and they can make system calls or call C library
61+
functions. We'll see how both types of extension are implemented by
62+
examining the code for a Python curses interface.
6663

6764
Note: unless otherwise mentioned, all file references in this
6865
document are relative to the toplevel directory of the Python
@@ -112,7 +109,7 @@ \section{A first look at the code}
112109
are passed to the C function. The C function always has two
113110
parameters, conventionally named \var{self} and \var{args}. The
114111
\var{self} argument is used when the C function implements a builtin
115-
method --- this is advanced material and not covered in this document.
112+
method---this will be discussed later.
116113
In the example, \var{self} will always be a \code{NULL} pointer, since
117114
we are defining a function, not a method (this is done so that the
118115
interpreter doesn't have to understand two different types of C
@@ -780,9 +777,9 @@ \section{Reference counts}
780777
\code{DECREF()} on your object. You should use \code{DEL()} instead.
781778

782779

783-
\section{Writing extensions in C++}
780+
\section{Writing extensions in \Cpp{}}
784781

785-
It is possible to write extension modules in C++. Some restrictions
782+
It is possible to write extension modules in \Cpp{}. Some restrictions
786783
apply: since the main program (the Python interpreter) is compiled and
787784
linked by the C compiler, global or static objects with constructors
788785
cannot be used. All functions that will be called directly or
@@ -797,7 +794,7 @@ \chapter{Embedding Python in another application}
797794

798795
Embedding Python is similar to extending it, but not quite. The
799796
difference is that when you extend Python, the main program of the
800-
application is still the Python interpreter, while of you embed
797+
application is still the Python interpreter, while if you embed
801798
Python, the main program may have nothing to do with Python ---
802799
instead, some parts of the application occasionally call the Python
803800
interpreter to run some Python code.
@@ -820,13 +817,13 @@ \chapter{Embedding Python in another application}
820817
\file{Demo/embed}.
821818

822819

823-
\section{Embedding Python in C++}
820+
\section{Embedding Python in \Cpp{}}
824821

825-
It is also possible to embed Python in a C++ program; how this is done
826-
exactly will depend on the details of the C++ system used; in general
827-
you will need to write the main program in C++, and use the C++
828-
compiler to compile and link your program. There is no need to
829-
recompile Python itself with C++.
822+
It is also possible to embed Python in a \Cpp{} program; precisely how this
823+
is done will depend on the details of the \Cpp{} system used; in general you
824+
will need to write the main program in \Cpp{}, and use the \Cpp{} compiler
825+
to compile and link your program. There is no need to recompile Python
826+
itself using \Cpp{}.
830827

831828

832829
\chapter{Dynamic Loading}
@@ -860,7 +857,7 @@ \section{Configuring and building the interpreter for dynamic loading}
860857

861858
\subsection{Shared libraries}
862859

863-
The following systems supports dynamic loading using shared libraries:
860+
The following systems support dynamic loading using shared libraries:
864861
SunOS 4; Solaris 2; SGI IRIX 5 (but not SGI IRIX 4!); and probably all
865862
systems derived from SVR4, or at least those SVR4 derivatives that
866863
support shared libraries (are there any that don't?).

Doc/lib.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
E-mail: {\tt [email protected]}
1010
}
1111

12-
\date{14 Jul 1994 \\ Release 1.0.3} % XXX update before release!
12+
\date{14 July 1994 \\ Release 1.0.3} % XXX update before release!
1313

1414
\makeindex % tell \index to actually write the .idx file
1515

Doc/lib/lib.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
E-mail: {\tt [email protected]}
1010
}
1111

12-
\date{14 Jul 1994 \\ Release 1.0.3} % XXX update before release!
12+
\date{14 July 1994 \\ Release 1.0.3} % XXX update before release!
1313

1414
\makeindex % tell \index to actually write the .idx file
1515

Doc/lib/libal.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ \section{Built-in Module \sectcode{al}}
2323
Module \code{al} defines the following functions:
2424

2525
\renewcommand{\indexsubitem}{(in module al)}
26-
\begin{funcdesc}{openport}{name\, direction\, config}
26+
\begin{funcdesc}{openport}{name\, direction\optional{\, config}}
2727
Equivalent to the C function ALopenport(). The name and direction
2828
arguments are strings. The optional config argument is an opaque
2929
configuration object as returned by \code{al.newconfig()}. The return

Doc/lib/libarray.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ \section{Built-in module \sectcode{array}}
2020
\end{tableiii}
2121

2222
The actual representation of values is determined by the machine
23-
architecture (strictly spoken, by the C implementation). The actual
23+
architecture (strictly speaking, by the C implementation). The actual
2424
size can be accessed through the \var{typecode} attribute.
2525

2626
The module defines the following function:
2727

2828
\renewcommand{\indexsubitem}{(in module array)}
2929

30-
\begin{funcdesc}{array}{typecode\, initializer}
30+
\begin{funcdesc}{array}{typecode\optional{\, initializer}}
3131
Return a new array whose items are restricted by \var{typecode}, and
3232
initialized from the optional \var{initializer} value, which must be a
3333
list or a string. The list or string is passed to the new array's
@@ -51,7 +51,7 @@ \section{Built-in module \sectcode{array}}
5151

5252
\begin{funcdesc}{byteswap}{x}
5353
``Byteswap'' all items of the array. This is only supported for
54-
integer values. It is useful when reading data ffrom a file written
54+
integer values. It is useful when reading data from a file written
5555
on a machine with a different byte order.
5656
\end{funcdesc}
5757

Doc/lib/libaudioop.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ \section{Built-in module \sectcode{audioop}}
4343

4444
\begin{funcdesc}{avgpp}{fragment\, width}
4545
This function returns the average peak-peak value over all samples in
46-
the fragment. No filtering is done, so the useability of this routine
46+
the fragment. No filtering is done, so the usefulness of this routine
4747
is questionable.
4848
\end{funcdesc}
4949

@@ -74,9 +74,9 @@ \section{Built-in module \sectcode{audioop}}
7474
(conceptually) does this by taking slices out of \var{fragment}, using
7575
\code{findfactor} to compute the best match, and minimizing the
7676
result.
77-
It returns a tuple \code{(\var{offset}, \var{factor})} with offset the
77+
It returns a tuple \code{(\var{offset}, \var{factor})} with \var{offset} the
7878
(integer) offset into \var{fragment} where the optimal match started
79-
and \var{factor} the floating-point factor as per findfactor.
79+
and \var{factor} the floating-point factor as per \code{findfactor}.
8080
\end{funcdesc}
8181

8282
\begin{funcdesc}{findmax}{fragment\, length}
@@ -101,8 +101,8 @@ \section{Built-in module \sectcode{audioop}}
101101
This function converts samples to 4 bit Intel/DVI ADPCM encoding.
102102
ADPCM coding is an adaptive coding scheme, whereby each 4 bit number
103103
is the difference between one sample and the next, divided by a
104-
(varying) step. The Intel/DVI ADPCM algorythm has been selected for
105-
use by the IMA, so may well become a standard.
104+
(varying) step. The Intel/DVI ADPCM algorithm has been selected for
105+
use by the IMA, so it may well become a standard.
106106

107107
\code{State} is a tuple containing the state of the coder. The coder
108108
returns a tuple \code{(\var{adpcmfrag}, \var{newstate})}, and the
@@ -120,7 +120,7 @@ \section{Built-in module \sectcode{audioop}}
120120

121121
\begin{funcdesc}{lin2ulaw}{fragment\, width}
122122
This function converts samples in the audio fragment to U-LAW encoding
123-
and returns this as a python string. U-LAW is an audio encoding format
123+
and returns this as a Python string. U-LAW is an audio encoding format
124124
whereby you get a dynamic range of about 14 bits using only 8 bit
125125
samples. It is used by the Sun audio hardware, among others.
126126
\end{funcdesc}

Doc/lib/libcrypto.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@ \chapter{CRYPTOGRAPHIC EXTENSIONS}
22

33
The modules described in this chapter implement various algorithms of
44
a cryptographic nature. They are available at the discretion of the
5-
installation.
5+
installation.
6+
\index{cryptography}
7+
8+
%Hardcore cypherpunks will probably find the Python Cryptography Kit of
9+
%further interest; the package adds built-in modules for DES and IDEA
10+
%encryption, and provides a Python module for reading and decrypting PGP files.
11+
%\index{PGP}\indexii{DES}{cipher}\indexii{IDEA}{cipher}
12+
%\index{Python Cryptography Kit}

0 commit comments

Comments
 (0)