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

Skip to content

Commit 95cd2ef

Browse files
committed
Incorporated Jan-Hein's changes and texinfo conversion.
1 parent 2a7178e commit 95cd2ef

17 files changed

Lines changed: 4681 additions & 19 deletions

Doc/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ref:
2020
lib:
2121
touch lib.ind
2222
latex lib
23+
./fix_hack lib.idx
2324
makeindex lib
2425
latex lib
2526
dvips lib >lib.ps
@@ -31,10 +32,15 @@ qua:
3132
latex qua
3233
dvips lib >lib.ps
3334

35+
libinfo:
36+
@echo This may take a while...
37+
python -c 'import partparse; partparse.main()' lib[1-5].tex
38+
sh fix.sh
39+
3440
clean:
3541
rm -f @* *~ *.aux *.idx *.ilg *.ind *.log *.toc *.blg *.bbl
3642
# Sources: .tex, .bib, .sty
3743
# Useful results: .dvi, .ps
3844

3945
clobber: clean
40-
rm -f *.dvi *.ps
46+
rm -f *.dvi *.ps *.info *.info-[0-9]*

Doc/README

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The following are the LaTeX source files:
88

99
tut.tex The tutorial
1010
lib.tex, lib[1-5].tex The library reference
11-
ref.tex The reference manual
11+
ref.tex, ref[1-8].tex The reference manual
1212
qua.tex, quabib.bib Article published in CWI Quarterly
1313

1414
All except qua.tex use the style option file "myformat.sty". This
@@ -35,3 +35,53 @@ local conventions; at my site, I use dvips and lpr. For example:
3535
If you don't have latex, you can ftp the pre-formatted PosytScript
3636
versions of the documents; see "../misc/FTP" for information about
3737
ftp-ing Python files.
38+
39+
Making the INFO version of the Library Reference
40+
------------------------------------------------
41+
42+
The Library Reference can now also be read in hypertext form using the
43+
Emacs INFO system. This uses Texinfo format as an intermediate step.
44+
It requires texinfo version 2 (we have used 2.14).
45+
46+
To build the info files (python-lib.info*), say "make libinfo". This
47+
takes a while, even on machines with 33 MIPS and 16 Mbytes :-) You can
48+
ignore the output.
49+
50+
But first you'll have to change a site dependency in fix.el: if
51+
texinfo 2.xx is installed by default at your site, comment out the two
52+
lines starting with "(setq load-path"; if it isn't, change the path!
53+
(I'm afraid that if you don't have texinfo 2.xx this won't work -- use
54+
archie to locate a version and ftp to fetch it.)
55+
56+
The files used by the conversion process are:
57+
58+
partparse.py the dirty-written Python script that converts
59+
LaTeX sources to texi files. Output is left in
60+
`@out.texi'
61+
62+
texi{pre,post}.dat these files will be put before and after the
63+
result
64+
65+
fix.sh calls emacs in order to update all the nodes and
66+
menus. After this, makeinfo will convert the
67+
texinfo-source to the info-file(s). Assumption:
68+
the texi-source is called `@out.texi'
69+
70+
fix.el the elisp-file executed by emacs. Two calls to
71+
'texinfo-all-menus-update are necessary in
72+
some cases
73+
74+
fix_hack executable shell script that fixes the results
75+
of the underscore hack. {\ptt \char'137} is
76+
back-translated to a simple underscore. This is
77+
needed for the texindex program
78+
79+
handy.el some handy Emacs-macro's that helped converting
80+
``old'' documentation to a format that could be
81+
understood by the converter scipt (partparse.py).
82+
(You don't really need this, but, as the name
83+
says, these macros are "handy")
84+
85+
A Million thanks for Jan-Hein B\"uhrman for writing and debugging the
86+
convertor and related scripts, and for fixing the LaTeX sources and
87+
writing new macros for myformat.sty!

Doc/fix.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; load the new texinfo package (2.xx) if not installed by default
2+
(setq load-path
3+
(cons "/ufs/jh/lib/emacs/texinfo" load-path))
4+
(find-file "@out.texi")
5+
(texinfo-all-menus-update t)
6+
(texinfo-all-menus-update t)

Doc/fix_hack

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sed -e 's/{\\ptt[ ]*\\char[ ]*'"'"'137}/_/g' <"$1" > "@$1" && mv "@$1" $1

Doc/info/texipost.dat

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@node Function Index, , ,
2+
@unnumbered Function Index
3+
4+
@printindex fn
5+
6+
@node Variable Index, , ,
7+
@unnumbered Variable Index
8+
9+
@printindex vr
10+
11+
@node Module Index, , ,
12+
@unnumbered Module Index
13+
14+
@printindex pg
15+
16+
@node Concept Index, , ,
17+
@unnumbered Concept Index
18+
19+
@printindex cp
20+
21+
@summarycontents
22+
@contents
23+
@bye

Doc/info/texipre.dat

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
\input texinfo @c -*-texinfo-*-
2+
@c %**start of header
3+
@setfilename python-lib.info
4+
@settitle Python library reference
5+
@setchapternewpage odd
6+
@footnotestyle end
7+
@c %**end of header
8+
9+
@ifinfo
10+
This file describes the built-in types, exceptions and functions and the
11+
standard modules that come with the Python system. It assumes basic
12+
knowledge about the Python language. For an informal introduction to
13+
the language, see the Python Tutorial. The Python Reference Manual
14+
gives a more formal definition of the language. (These manuals are not
15+
yet available in INFO or Texinfo format.)
16+
17+
Copyright (C) 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam,
18+
The Netherlands.
19+
20+
All Rights Reserved
21+
22+
Permission to use, copy, modify, and distribute this software and its
23+
documentation for any purpose and without fee is hereby granted,
24+
provided that the above copyright notice appear in all copies and that
25+
both that copyright notice and this permission notice appear in
26+
supporting documentation, and that the names of Stichting Mathematisch
27+
Centrum or CWI not be used in advertising or publicity pertaining to
28+
distribution of the software without specific, written prior permission.
29+
30+
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
31+
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
32+
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
33+
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
34+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
35+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
36+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
37+
@end ifinfo
38+
39+
@titlepage
40+
@title Python library reference
41+
@author Guido van Rossum
42+
43+
@c The following two commands start the copyright page.
44+
@page
45+
@vskip 0pt plus 1filll
46+
Copyright @copyright{} 1991, 1992 by Stichting Mathematisch Centrum,
47+
Amsterdam, The Netherlands.
48+
49+
@center All Rights Reserved
50+
51+
Permission to use, copy, modify, and distribute this software and its
52+
documentation for any purpose and without fee is hereby granted,
53+
provided that the above copyright notice appear in all copies and that
54+
both that copyright notice and this permission notice appear in
55+
supporting documentation, and that the names of Stichting Mathematisch
56+
Centrum or CWI not be used in advertising or publicity pertaining to
57+
distribution of the software without specific, written prior permission.
58+
59+
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
60+
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
61+
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
62+
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
63+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
64+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
65+
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
66+
@end titlepage
67+
68+
69+
@node Top, Overview, (dir), (dir)
70+
@top The Python library
71+
72+
@ifinfo
73+
This file describes the built-in types, exceptions and functions and the
74+
standard modules that come with the Python system. It assumes basic
75+
knowledge about the Python language. For an informal introduction to
76+
the language, see the @cite{Python Tutorial}. The @cite{Python
77+
Reference Manual} gives a more formal definition of the language.
78+
(These manuals are not yet available in INFO or Texinfo format.)
79+
80+
This version corresponds roughly to Python version 0.9.8 (yet to be
81+
released).
82+
83+
@strong{Warning:} we have just finished converting the original LaTeX
84+
manual into Texinfo. This is a difficult process and it is quite
85+
possible that errors have been introduced in the conversion. Please
86+
report any errors you find by e-mail to the author,
87+
@t{Guido.van.Rossum@@cwi.nl}.
88+
89+
@end ifinfo
90+
91+
@c placeholder for the master menu -- patched by texinfo-all-menus-update
92+
@menu
93+
@end menu

Doc/lib.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
\documentstyle[twoside,11pt,myformat]{report}
2+
%\includeonly{lib5}
23

34
\title{\bf
45
Python Library Reference
@@ -15,7 +16,8 @@
1516
\makeindex
1617

1718
\begin{document}
18-
19+
%\showthe\fam
20+
%\showthe\ttfam
1921
\pagenumbering{roman}
2022

2123
\maketitle
@@ -42,7 +44,6 @@
4244
\pagebreak
4345

4446
\pagenumbering{arabic}
45-
4647
\include{lib1} % intro; built-in types, functions and exceptions
4748
\include{lib2} % built-in modules
4849
\include{lib3} % standard modules

Doc/lib/lib.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
\documentstyle[twoside,11pt,myformat]{report}
2+
%\includeonly{lib5}
23

34
\title{\bf
45
Python Library Reference
@@ -15,7 +16,8 @@
1516
\makeindex
1617

1718
\begin{document}
18-
19+
%\showthe\fam
20+
%\showthe\ttfam
1921
\pagenumbering{roman}
2022

2123
\maketitle
@@ -42,7 +44,6 @@
4244
\pagebreak
4345

4446
\pagenumbering{arabic}
45-
4647
\include{lib1} % intro; built-in types, functions and exceptions
4748
\include{lib2} % built-in modules
4849
\include{lib3} % standard modules

Doc/myformat.sty

Lines changed: 93 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
\parskip = 2mm
1414

1515
% Frequently used system name
16-
\newcommand{\UNIX}{U{\sc nix}}
16+
%\newcommand{\UNIX}{U{\sc nix}}
1717

1818
% Variable used by begin code command
1919
\newlength{\codewidth}
@@ -40,7 +40,9 @@
4040

4141
% Underscores are not magic throughout the Python documentation.
4242
% This still only gives the right effect in the tt font!!!
43-
\catcode`_=12
43+
\def\_{\ifnum\fam=\ttfam \char'137\else{\tt\char'137}\fi}
44+
\catcode`\_=12
45+
\catcode`\_=\active\def_{\ifnum\fam=\ttfam \char'137 \else{\tt\char'137}\fi}
4446

4547
% Define \itembreak: force the text after an item to start on a new line
4648
\newcommand{\itembreak}{
@@ -94,22 +96,104 @@
9496
}
9597

9698
% Define \funcitem{func}{args}: define a function item
97-
\newcommand{\funcitem}[2]{
98-
\ttindex{#1}
99-
\item[{\tt #1(#2)}]
99+
\newcommand{\funcitem}[2]{%
100+
\ttindex{#1}%
101+
%\item[{\tt #1(#2)}]
102+
\item[\code{#1(\varvars{#2})}]
100103
\
101104
}
102105

106+
107+
% from user-level, fulllineitems should be called as an environment
108+
\def\fulllineitems{\list{}{\labelwidth \leftmargin \labelsep 0pt
109+
\rightmargin 0pt \topsep -\parskip \partopsep \parskip
110+
\itemsep -\parsep
111+
\let\makelabel\itemnewline}}
112+
\let\endfulllineitems\endlist
113+
114+
115+
% funcdesc should be called as an \begin{funcdesc} ... \end{funcdesc}
116+
\newcommand{\funcline}[2]{\item[\code{#1(\varvars{#2})}]\ttindex{#1}}
117+
\newcommand{\funcdesc}[2]{\fulllineitems\funcline{#1}{#2}}
118+
\let\endfuncdesc\endfulllineitems
119+
120+
% same for excdesc
121+
\newcommand{\excline}[1]{\item[\code{#1}]\ttindex{#1}}
122+
\newcommand{\excdesc}[1]{\fulllineitems\excline{#1}}
123+
\let\endexcdesc\endfulllineitems
124+
125+
% same for datadesc
126+
\newcommand{\dataline}[1]{\item[\code{#1}]\ttindex{#1}}
127+
\newcommand{\datadesc}[1]{\fulllineitems\dataline{#1}}
128+
\let\enddatadesc\endfulllineitems
129+
130+
103131
% Define \dataitem{name}: define a data item
104-
\newcommand{\dataitem}[1]{
105-
\ttindex{#1}
132+
\newcommand{\dataitem}[1]{%
133+
\ttindex{#1}%
106134
\item[{\tt #1}]
107135
\
108136
}
109137

110138
% Define \excitem{name}: define an exception item
111-
\newcommand{\excitem}[1]{
112-
\ttindex{#1}
139+
\newcommand{\excitem}[1]{%
140+
\ttindex{#1}%
113141
\item[{\tt #1}]
114142
\itembreak
115143
}
144+
145+
\let\nodename=\label
146+
147+
\newcommand{\ABC}{{\sc abc}}
148+
\newcommand{\UNIX}{{\sc Unix}}
149+
\newcommand{\ASCII}{{\sc ascii}}
150+
%\newcommand{\C}{{\bf C}}
151+
\newcommand{\C}{C}
152+
\newcommand{\EOF}{{\sc eof}}
153+
154+
% code is the most difficult one...
155+
%\frenchspacing removed, because \section, etc., can't handle it
156+
\newcommand{\code}[1]{{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}%
157+
\mbox{\tt #1}}}
158+
%This one does not work
159+
%%%% myspecials, same as dospecials, but without {, } and \
160+
%%%\def\myspecials{\do\ \do\$\do\&%
161+
%%% \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~}
162+
%%%\newcommand{\code}[1]{\begingroup \catcode``=13 \@noligs
163+
%%%\tt \let\do\@makeother \myspecials
164+
%%%#1\endgroup}
165+
\newcommand{\kbd}[1]{\mbox{\tt #1}}
166+
\newcommand{\key}[1]{\mbox{\tt #1}}
167+
\newcommand{\samp}[1]{\mbox{`\code{#1}'}}
168+
\newcommand{\var}[1]{\mbox{\it#1\/}}
169+
\let\file=\samp
170+
\newcommand{\dfn}[1]{{\sl #1\/}}
171+
\newcommand{\emph}[1]{{\em #1\/}}
172+
\newcommand{\strong}[1]{{\bf #1}}
173+
174+
%\newcommand{\varvars}[1]{{\catcode`\,=\active\def,{\tt\char`\,\/tt}\var{#1}}}
175+
%\newcommand{\varvars}[1]{{\def\,{\/{\tt\char`\,}}\var{#1}}}
176+
\newcommand{\varvars}[1]{{\def\,{\/{\tt\char`\,}}\def\({\/{\tt\char`\(}}\def\){\/{\tt\char`\)}}\var{#1}}}
177+
178+
\newif\iftexi\texifalse
179+
%not supported yet%\newif\iflatex\latextrue
180+
181+
\newenvironment{tableiii}[5]{\begin{center}\def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}\begin{tabular}{#1}\hline#3&#4&#5\\
182+
\hline}{\hline\end{tabular}\end{center}}
183+
184+
\newcommand{\itemnewline}[1]{\@tempdima\linewidth
185+
\advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}}
186+
187+
\newcommand{\sectcode}[1]{{\tt #1}}
188+
%%%
189+
%%%\let\orgchapter\chapter
190+
%%%\def\chapter#1{{\let\code\sectcode\orgchapter{#1}}}
191+
%%%\let\orgsection\section
192+
%%%\def\section#1{{\let\code\sectcode\orgsection{#1}}}
193+
%%%\let\orgsubsection\subsection
194+
%%%\def\subsection#1{{\let\code\sectcode\orgsubsection{#1}}}
195+
%%%\let\orgsubsubsection\subsubsection
196+
%%%\def\subsubsection#1{{\let\code\sectcode\orgsubsubsection{#1}}}
197+
%%%\let\orgsubsubsubsection\subsubsubsection
198+
%%%\def\subsubsubsection#1{{\let\code\sectcode\orgsubsubsubsection{#1}}}
199+

0 commit comments

Comments
 (0)