diff options
author | Fred Drake <fdrake@acm.org> | 2000-04-03 04:51:13 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2000-04-03 04:51:13 (GMT) |
commit | e15956b46515dfc5cf258b7109e2b7b330c27e5f (patch) | |
tree | 0776ca09eb49808534b37e8f5320af8da5c0290c /Doc | |
parent | 20082d92f2e5fc7736b3fb1839380cc7c0133165 (diff) | |
download | cpython-e15956b46515dfc5cf258b7109e2b7b330c27e5f.zip cpython-e15956b46515dfc5cf258b7109e2b7b330c27e5f.tar.gz cpython-e15956b46515dfc5cf258b7109e2b7b330c27e5f.tar.bz2 |
Merged changes from the 1.5.2p2 release.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/doc/doc.tex | 24 | ||||
-rw-r--r-- | Doc/html/Makefile | 4 | ||||
-rw-r--r-- | Doc/html/index.html.in | 4 | ||||
-rw-r--r-- | Doc/paper-letter/.cvsignore | 1 | ||||
-rw-r--r-- | Doc/paper-letter/Makefile | 11 | ||||
-rw-r--r-- | Doc/perl/SynopsisTable.pm | 10 | ||||
-rw-r--r-- | Doc/perl/l2hinit.perl | 71 | ||||
-rw-r--r-- | Doc/perl/ltxmarkup.perl | 13 | ||||
-rw-r--r-- | Doc/perl/python.perl | 357 | ||||
-rw-r--r-- | Doc/ref/ref2.tex | 14 | ||||
-rw-r--r-- | Doc/ref/ref3.tex | 35 | ||||
-rw-r--r-- | Doc/ref/ref4.tex | 14 | ||||
-rw-r--r-- | Doc/ref/ref5.tex | 10 | ||||
-rw-r--r-- | Doc/ref/ref7.tex | 4 |
14 files changed, 371 insertions, 201 deletions
diff --git a/Doc/doc/doc.tex b/Doc/doc/doc.tex index 7ea9b35..2ce3857 100644 --- a/Doc/doc/doc.tex +++ b/Doc/doc/doc.tex @@ -226,6 +226,19 @@ distribution, to create or maintain whole documents or sections. macros. This section contains the reference material for these facilities. + \subsection{Meta-information Markup \label{meta-info}} + + \begin{macrodesc}{sectionauthor}{\p{author}\p{email}} + Identifies the author of the current section. \var{author} + should be the author's name such that it can be used for + presentation (though it isn't), and \var{email} should be the + author's email address. The domain name portion of + the address should be lower case. + + No presentation is generated from this markup, but it is used to + help keep track of contributions. + \end{macrodesc} + \subsection{Information Units \label{info-units}} XXX Explain terminology, or come up with something more ``lay.'' @@ -412,7 +425,8 @@ distribution, to create or maintain whole documents or sections. \begin{macrodesc}{email}{\p{address}} An email address. Note that this is \emph{not} hyperlinked in - any of the possible output formats. + any of the possible output formats. The domain name portion of + the address should be lower case. \end{macrodesc} \begin{macrodesc}{emph}{\p{text}} @@ -689,8 +703,8 @@ distribution, to create or maintain whole documents or sections. An additional table-like environment is \env{synopsistable}. The table generated by this environment contains two columns, and each row is defined by an alternate definition of - \macro{modulesynopsis}. This environment is not normally use by - the user, but is created by the \macro{localmoduletable} macro. + \macro{modulesynopsis}. This environment is not normally used by + authors, but is created by the \macro{localmoduletable} macro. \subsection{Reference List Markup \label{references}} @@ -726,7 +740,7 @@ distribution, to create or maintain whole documents or sections. \subsection{Index-generating Markup \label{indexing}} Effective index generation for technical documents can be very - difficult, especially for someone familliar with the topic but not + difficult, especially for someone familiar with the topic but not the creation of indexes. Much of the difficulty arises in the area of terminology: including the terms an expert would use for a concept is not sufficient. Coming up with the terms that a novice @@ -735,7 +749,7 @@ distribution, to create or maintain whole documents or sections. The truly difficult aspects of index generation are not areas with which the documentation tools can help. However, ease - of producing the index once content decisions are make is within + of producing the index once content decisions are made is within the scope of the tools. Markup is provided which the processing software is able to use to generate a variety of kinds of index entry with minimal effort. Additionally, many of the environments diff --git a/Doc/html/Makefile b/Doc/html/Makefile index 0fd1956..aa61088 100644 --- a/Doc/html/Makefile +++ b/Doc/html/Makefile @@ -53,7 +53,9 @@ mac: mac/mac.html ref: ref/ref.html tut: tut/tut.html -$(INDEXFILES): $(COMMONPERL) $(TOPDIR)/html/about.dat +$(INDEXFILES): $(COMMONPERL) \ + $(TOPDIR)/html/about.dat \ + $(TOPDIR)/tools/node2label.pl # The index.html target is at the end since it screws up font-lock. diff --git a/Doc/html/index.html.in b/Doc/html/index.html.in index 1ccacaa..a921cd2 100644 --- a/Doc/html/index.html.in +++ b/Doc/html/index.html.in @@ -1,6 +1,6 @@ <html> <head> - <title>Python 1.5.2 Documentation</title> + <title>Python @RELEASE@ Documentation - @DATE@</title> <link rel=STYLESHEET href="lib/lib.css" type="text/css"> <style type="text/css"> a.title { font-weight: bold; font-size: 110%; } @@ -38,7 +38,7 @@ </p> </div> - <table> + <table align="center"> <tbody> <tr><td> <ul> diff --git a/Doc/paper-letter/.cvsignore b/Doc/paper-letter/.cvsignore index 31923f4..90687b6 100644 --- a/Doc/paper-letter/.cvsignore +++ b/Doc/paper-letter/.cvsignore @@ -13,3 +13,4 @@ *.l2h *.how README +api.tex diff --git a/Doc/paper-letter/Makefile b/Doc/paper-letter/Makefile index a87653b..50067c3 100644 --- a/Doc/paper-letter/Makefile +++ b/Doc/paper-letter/Makefile @@ -58,17 +58,20 @@ pdf: $(PDFFILES) ps: $(PSFILES) -README: $(PSFILES) +README: $(PSFILES) $(TOOLSDIR)/getpagecounts $(TOOLSDIR)/getpagecounts >$@ # Python/C API Reference Manual -api.dvi: $(APIFILES) +api.dvi: api.tex $(APIFILES) $(MKDVI) api -api.pdf: $(APIFILES) +api.pdf: api.tex $(APIFILES) $(MKPDF) api +api.tex: ../api/api.tex ../api/refcounts.dat ../tools/anno-api.py + $(PYTHON) ../tools/anno-api.py -o $@ ../api/api.tex + # Documenting Python doc.dvi: $(DOCFILES) $(MKHOWTO) --dvi ../doc/doc.tex @@ -113,7 +116,7 @@ tut.pdf: $(TUTFILES) clean: - rm -f *~ *.aux *.idx *.ilg *.ind *.log *.toc *.bkm *.syn *.pla + rm -f *~ *.aux *.idx *.ilg *.ind *.log *.toc *.bkm *.syn *.pla api.tex clobber: clean rm -f $(DVIFILES) $(PSFILES) $(PDFFILES) diff --git a/Doc/perl/SynopsisTable.pm b/Doc/perl/SynopsisTable.pm index e12f2e7..fb063d4 100644 --- a/Doc/perl/SynopsisTable.pm +++ b/Doc/perl/SynopsisTable.pm @@ -38,14 +38,14 @@ sub show{ sub tohtml{ my $self = shift; - my $data = "<table class=\"synopsistable\">\n"; + my $data = "<table class='synopsistable'>\n"; my $name; foreach $name (split /,/, $self->{names}) { my($key,$type,$synopsis) = $self->get($name); - my $link = "<a href=\"module-$key.html\">"; - $data .= (" <tr>" - . "<td><b><tt class=module>$link$name</a></tt></b></td>\n" - . " <td class=synopsis>$synopsis</td></tr>\n"); + my $link = "<a href='module-$key.html'>"; + $data .= (' <tr>' + . "<td><b><tt class='module'>$link$name</a></tt></b></td>\n" + . " <td class='synopsis'>$synopsis</td></tr>\n"); } $data .= "</table>\n"; $data; diff --git a/Doc/perl/l2hinit.perl b/Doc/perl/l2hinit.perl index e9bef64..407f396 100644 --- a/Doc/perl/l2hinit.perl +++ b/Doc/perl/l2hinit.perl @@ -16,6 +16,7 @@ package main; $HTML_VERSION = 4.0; $MAX_LINK_DEPTH = 2; +$MAX_SPLIT_DEPTH = 5; # split at subsections but not sub-subsections $ADDRESS = ''; $NO_FOOTNODE = 1; @@ -143,22 +144,22 @@ sub adjust_icon_information{ $BLANK_ICON =~ s/alt="blank"/alt=""/; $NAV_BGCOLOR = " bgcolor=\"#99CCFF\""; } + adjust_icon_information(); sub make_nav_sectref{ my($label,$title) = @_; if ($title) { - $title =~ s/<A/<A class=sectref/; - return ("<b class=navlabel>$label:</b> " - . "$title\n"); + return ("<b class='navlabel'>$label:</b> " + . "<span class='sectref'>$title</span>\n"); } return ''; } sub make_nav_panel{ my $s; - $s = "<table align=center width=\"100%\" cellpadding=0 cellspacing=2>" + $s = "<table align='center' width='100%' cellpadding='0' cellspacing='2'>" . "\n<tr>" . "\n<td>$NEXT</td>" . "\n<td>$UP</td>" @@ -184,13 +185,13 @@ sub make_nav_panel{ } sub top_navigation_panel { - "<div class=navigation>\n" + "<div class='navigation'>\n" . make_nav_panel() . '<br><hr></div>'; } sub bot_navigation_panel { - "<p>\n<div class=navigation><hr>" + "<p>\n<div class='navigation'><hr>" . make_nav_panel() . '</div>'; } @@ -334,13 +335,11 @@ sub add_module_idx{ my $plat = ''; $key =~ s/<tt>([a-zA-Z0-9._]*)<\/tt>/\1/; if ($ModulePlatforms{$key} && !$allthesame) { - $plat = (" <em>(<span class=platform>$ModulePlatforms{$key}" + $plat = (" <em>(<span class='platform'>$ModulePlatforms{$key}" . '</span>)</em>'); } - print MODIDXFILE - $moditem - . $IDXFILE_FIELD_SEP - . "<tt class=module>$key</tt>$plat###\n"; + print MODIDXFILE $moditem . $IDXFILE_FIELD_SEP + . "<tt class='module'>$key</tt>$plat###\n"; } close(MODIDXFILE); if (!$allthesame) { @@ -556,9 +555,55 @@ sub protect_useritems { # # Note that this *must* be done in the init file, not the python.perl # style support file. The %declarations must be set before initialize() -# is called in the main script. +# is called in the main LaTeX2HTML script (which happens before style files +# are loaded). # -%declarations = ('preform' => '<dl><dd><pre class=verbatim></pre></dl>', +%declarations = ('preform' => '<dl><dd><pre class="verbatim"></pre></dl>', %declarations); + +# This is added to get rid of the long comment that follows the doctype +# declaration; MSIE5 on NT4 SP4 barfs on it and drops the content of the +# page. +sub make_head_and_body { + local($title,$body) = @_; + local($DTDcomment) = ''; + local($version,$isolanguage) = ($HTML_VERSION, 'EN'); + local(%isolanguages) = ( 'english', 'EN' , 'USenglish', 'EN.US' + , 'original', 'EN' , 'german' , 'DE' + , 'austrian', 'DE.AT', 'french' , 'FR' + , 'spanish', 'ES' + , %isolanguages ); + $isolanguage = $isolanguages{$default_language}; + $isolanguage = 'EN' unless $isolanguage; + $title = &purify($title,1); + eval("\$title = ". $default_title ) unless ($title); + + # allow user-modification of the <TITLE> tag; thanks Dan Young + if (defined &custom_TITLE_hook) { + $title = &custom_TITLE_hook($title, $toc_sec_title); + } + + if ($DOCTYPE =~ /\/\/[\w\.]+\s*$/) { # language spec included + $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE\">\n"; + } else { + $DTDcomment = "<!DOCTYPE html PUBLIC \"$DOCTYPE//" + . ($ISO_LANGUAGE ? $ISO_LANGUAGE : $isolanguage) . "\">\n"; + } + + $STYLESHEET = $FILE.".css" unless $STYLESHEET; + if (!$charset && $CHARSET) { $charset = $CHARSET; $charset =~ s/_/\-/go; } + + join('', ($DOCTYPE ? $DTDcomment : '' ) + ,"<html>\n<head>\n<title>", $title, "</title>\n" + , &meta_information($title) + , ($CHARSET && $HTML_VERSION ge "2.1" ? + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$charset\">\n" + : "" ) + , ($BASE ? "<base href=\"$BASE\">\n" : "" ) + , "<link rel=\"STYLESHEET\" href=\"$STYLESHEET\">" + , $more_links_mark + , "\n</head>\n<body $body>\n"); +} + 1; # This must be the last line diff --git a/Doc/perl/ltxmarkup.perl b/Doc/perl/ltxmarkup.perl index 07e93ca..290e79b 100644 --- a/Doc/perl/ltxmarkup.perl +++ b/Doc/perl/ltxmarkup.perl @@ -15,13 +15,13 @@ sub ltx_next_argument{ sub do_cmd_macro{ local($_) = @_; my $macro = ltx_next_argument(); - return "<tt class=macro>\$macro</tt>" . $_; + return "<tt class='macro'>\$macro</tt>" . $_; } sub do_cmd_env{ local($_) = @_; my $env = ltx_next_argument(); - return "<tt class=environment>\$env</tt>" . $_; + return "<tt class='environment'>\$env</tt>" . $_; } sub ltx_process_params{ @@ -43,8 +43,8 @@ sub do_env_macrodesc{ local($_) = @_; my $macro = ltx_next_argument(); my $params = ltx_process_params(ltx_next_argument()); - return "\n<dl class=macrodesc>" - . "\n<dt><b><tt class=macro>\$macro</tt></b>" + return "\n<dl class='macrodesc'>" + . "\n<dt><b><tt class='macro'>\$macro</tt></b>" . "\n $params" . "\n<dd>" . $_ @@ -55,9 +55,10 @@ sub do_env_envdesc{ local($_) = @_; my $env = ltx_next_argument(); my $params = ltx_process_params(ltx_next_argument()); - return "\n<dl class=envdesc>" - . "\n<dt><tt>\begin{<b class=environment>$env</b>}</tt>" + return "\n<dl class='envdesc'>" + . "\n<dt><tt>\begin{<b class='environment'>$env</b>}</tt>" . "\n $params" + . "\n<br /><tt>\end{<b class='environment'>$env</b>}</tt>" . "\n<dd>" . $_ . "</dl>"; diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index 57a19ed..6b67df5 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -61,7 +61,7 @@ sub do_cmd_POSIX{ 'POSIX' . @_[0]; } sub do_cmd_C{ 'C' . @_[0]; } sub do_cmd_Cpp{ 'C++' . @_[0]; } sub do_cmd_EOF{ 'EOF' . @_[0]; } -sub do_cmd_NULL{ '<tt>NULL</tt>' . @_[0]; } +sub do_cmd_NULL{ '<tt class="constant">NULL</tt>' . @_[0]; } sub do_cmd_e{ '\' . @_[0]; } @@ -119,53 +119,55 @@ sub do_cmd_optional{ sub do_cmd_pytype{ return @_[0]; } sub do_cmd_makevar{ return @_[0]; } sub do_cmd_code{ - return use_wrappers(@_[0], '<tt>', '</tt>'); } + return use_wrappers(@_[0], '<code>', '</code>'); } sub do_cmd_module{ - return use_wrappers(@_[0], '<tt class=module>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="module">', '</tt>'); } sub do_cmd_keyword{ - return use_wrappers(@_[0], '<tt class=keyword>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="keyword">', '</tt>'); } sub do_cmd_exception{ - return use_wrappers(@_[0], '<tt class=exception>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="exception">', '</tt>'); } sub do_cmd_class{ - return use_wrappers(@_[0], '<tt class=class>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="class">', '</tt>'); } sub do_cmd_function{ - return use_wrappers(@_[0], '<tt class=function>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="function">', '</tt>'); } sub do_cmd_constant{ - return use_wrappers(@_[0], '<tt class=constant>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="constant">', '</tt>'); } sub do_cmd_member{ - return use_wrappers(@_[0], '<tt class=member>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="member">', '</tt>'); } sub do_cmd_method{ - return use_wrappers(@_[0], '<tt class=method>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="method">', '</tt>'); } sub do_cmd_cfunction{ - return use_wrappers(@_[0], '<tt class=cfunction>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="cfunction">', '</tt>'); } sub do_cmd_cdata{ - return use_wrappers(@_[0], '<tt class=cdata>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="cdata">', '</tt>'); } sub do_cmd_ctype{ - return use_wrappers(@_[0], '<tt class=ctype>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="ctype">', '</tt>'); } sub do_cmd_regexp{ - return use_wrappers(@_[0], '<tt class=regexp>', '</tt>'); } + return use_wrappers(@_[0], '<tt class="regexp">', '</tt>'); } sub do_cmd_character{ - return use_wrappers(@_[0], '"<tt class=character>', '</tt>"'); } + return use_wrappers(@_[0], '"<tt class="character">', '</tt>"'); } sub do_cmd_program{ - return use_wrappers(@_[0], '<b class=program>', '</b>'); } + return use_wrappers(@_[0], '<b class="program">', '</b>'); } sub do_cmd_programopt{ return use_wrappers(@_[0], '<b class="programopt">', '</b>'); } sub do_cmd_email{ - return use_wrappers(@_[0], '<span class=email>', '</span>'); } + return use_wrappers(@_[0], '<span class="email">', '</span>'); } sub do_cmd_mimetype{ - return use_wrappers(@_[0], '<span class=mimetype>', '</span>'); } + return use_wrappers(@_[0], '<span class="mimetype">', '</span>'); } sub do_cmd_var{ return use_wrappers(@_[0], "<var>", "</var>"); } sub do_cmd_dfn{ - return use_wrappers(@_[0], '<i class=dfn>', '</i>'); } + return use_wrappers(@_[0], '<i class="dfn">', '</i>'); } sub do_cmd_emph{ return use_italics(@_); } sub do_cmd_file{ - return use_wrappers(@_[0], '<tt class=file>', '</tt>'); } + return use_wrappers(@_[0], + '<font class="file" face="sans-serif">', + '</font>'); } sub do_cmd_filenq{ - return use_wrappers(@_[0], '<tt class=file>', '</tt>'); } + return do_cmd_file(@_[0]); } sub do_cmd_samp{ - return use_wrappers(@_[0], '"<tt class=samp>', '</tt>"'); } + return use_wrappers(@_[0], '"<tt class="samp">', '</tt>"'); } sub do_cmd_kbd{ return use_wrappers(@_[0], '<kbd>', '</kbd>'); } sub do_cmd_strong{ @@ -183,13 +185,15 @@ sub do_cmd_refmodule{ my $module = next_argument(); $key = $module unless $key; - return "<tt class=module><a href=\"module-$key.html\">$module</a></tt>" . $_; + return "<tt class='module'><a href='module-$key.html'>$module</a></tt>" + . $_; } sub do_cmd_newsgroup{ local($_) = @_; my $newsgroup = next_argument(); - my $stuff = "<a class=newsgroup href=\"news:$newsgroup\">$newsgroup</a>"; + my $stuff = "<span class='newsgroup'><a href='news:$newsgroup'>" + . "$newsgroup</a></span>"; return $stuff . $_; } @@ -202,7 +206,7 @@ sub do_cmd_envvar{ add_index_entry("environment variables!$envvar@<tt>\$$envvar</tt>", $ahref); add_index_entry("$envvar@\$$envvar", $ahref); - $aname =~ s/<a/<a class=envvar/; + $aname =~ s/<a/<a class="envvar"/; return "$aname\$$envvar</a>" . $_; } @@ -211,7 +215,7 @@ sub do_cmd_url{ local($_) = @_; my $url = next_argument(); $url =~ s/~/~/g; - return "<a class=url href=\"$url\">$url</a>" . $_; + return "<a class=\"url\" href=\"$url\">$url</a>" . $_; } sub do_cmd_manpage{ @@ -219,7 +223,7 @@ sub do_cmd_manpage{ local($_) = @_; my $page = next_argument(); my $section = next_argument(); - return "<span class=manpage><i>$page</i>($section)</span>" . $_; + return "<span class='manpage'><i>$page</i>($section)</span>" . $_; } sub do_cmd_rfc{ @@ -231,7 +235,7 @@ sub do_cmd_rfc{ # Save the reference my $nstr = gen_index_id("RFC!RFC $rfcnumber", ''); $index{$nstr} .= make_half_href("$CURRENT_FILE#$id"); - return ("<a class=rfc name=\"$id\"\nhref=\"$href\">RFC $rfcnumber</a>" + return ("<a class=\"rfc\" name=\"$id\"\nhref=\"$href\">RFC $rfcnumber</a>" . $_); } @@ -280,11 +284,11 @@ sub do_cmd_versionchanged{ sub do_cmd_platform{ local($_) = @_; my $platform = next_argument(); - $ModulePlatforms{$THIS_MODULE} = $platform; + $ModulePlatforms{"<tt class='module'>$THIS_MODULE</tt>"} = $platform; $platform = "Macintosh" if $platform eq 'Mac'; - return "\n<p class=availability>Availability: <span" - . "\n class=platform>$platform</span>.</p>\n" . $_; + return "\n<p class='availability'>Availability: <span" + . "\n class='platform'>$platform</span>.</p>\n" . $_; } $IGNORE_PLATFORM_ANNOTATION = ''; @@ -353,7 +357,7 @@ sub write_idxfile{ sub gen_link{ my($node,$target) = @_; print INTLABELS "\$internal_labels{\"$target\"} = \"$URL/$node\";\n"; - return "<a href=\"$node#$target\">"; + return "<a href='$node#$target'>"; } sub add_index_entry{ @@ -366,7 +370,7 @@ sub add_index_entry{ sub new_link_info{ my $name = "l2h-" . ++$globals{'max_id'}; - my $aname = '<a name="' . $name . '">'; + my $aname = "<a name='$name'>"; my $ahref = gen_link($CURRENT_FILE, $name); return ($name, $aname, $ahref); } @@ -483,7 +487,8 @@ sub idx_cmd_obindex{ my_typed_index_helper('object', @_[0]); } define_indexing_macro('bifuncindex'); sub idx_cmd_bifuncindex{ my $str = next_argument(); - add_index_entry("<tt>$str()</tt> (built-in function)", @_[0]); + add_index_entry("<tt class='function'>$str()</tt> (built-in function)", + @_[0]); } @@ -499,7 +504,8 @@ sub make_mod_index_entry{ if ($define eq 'DEF') { # add to the module index - my($nstr,$garbage) = split / /, $str, 2; + $str =~ /(<tt.*<\/tt>)/; + my $nstr = $1; $Modules{$nstr} .= $ahref; } return "$aname$anchor_invisible_mark</a>"; @@ -522,7 +528,8 @@ sub define_module{ $THIS_MODULE = "$name"; $INDEX_SUBITEM = "(in $name)"; print "[$name]"; - return make_mod_index_entry("<tt>$name</tt> (${word}module)", 'DEF'); + return make_mod_index_entry( + "<tt class='module'>$name</tt> (${word}module)", 'DEF'); } sub my_module_index_helper{ @@ -540,7 +547,7 @@ sub ref_module_index_helper{ local($word, $ahref) = @_; my $str = next_argument(); $word = "$word " if $word; - $str = "<tt>$str</tt> (${word}module)"; + $str = "<tt class='module'>$str</tt> (${word}module)"; # can't use add_index_entry() since the 2nd arg to gen_index_id() is used; # just inline it all here $str = gen_index_id($str, 'REF'); @@ -575,27 +582,85 @@ sub make_str_index_entry{ return "$aname$str</a>"; } +$REFCOUNTS_LOADED = 0; + +sub load_refcounts{ + $REFCOUNTS_LOADED = 1; + + use File::Basename; + my $myname, $mydir, $myext; + ($myname, $mydir, $myext) = fileparse(__FILE__, '\..*'); + chop $mydir; # remove trailing '/' + ($myname, $mydir, $myext) = fileparse($mydir, '\..*'); + chop $mydir; # remove trailing '/' + $mydir = getcwd() . "$dd$mydir" + unless $mydir =~ s|^/|/|; + local $_; + my $filename = "$mydir${dd}api${dd}refcounts.dat"; + open(REFCOUNT_FILE, "<$filename") || die "\n$!\n"; + print "[loading API refcount data]"; + while (<REFCOUNT_FILE>) { + if (/([a-zA-Z0-9_]+):PyObject\*:([a-zA-Z0-9_]*):(0|[-+]1):(.*)$/) { + my($func, $param, $count, $comment) = ($1, $2, $3, $4); + #print "\n$func($param) --> $count"; + $REFCOUNTS{"$func:$param"} = $count; + } + } +} + +sub get_refcount{ + my ($func, $param) = @_; + load_refcounts() + unless $REFCOUNTS_LOADED; + return $REFCOUNTS{"$func:$param"}; +} + sub do_env_cfuncdesc{ local($_) = @_; my $return_type = next_argument(); my $function_name = next_argument(); my $arg_list = next_argument(); - my $idx = make_str_index_entry("<tt class=cfunction>$function_name()</tt>" - . get_indexsubitem()); + my $idx = make_str_index_entry( + "<tt class='cfunction'>$function_name()</tt>" . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; # ???? + my $result_rc = get_refcount($function_name, ''); + my $rcinfo = ''; + if ($result_rc eq '+1') { + $rcinfo = '<span class="label">Return value:</span>' + . "\n <span class=\"value\">New reference.</span>"; + } + elsif ($result_rc eq '0') { + $rcinfo = '<span class="label">Return value:</span>' + . "\n <span class=\"value\">Borrowed reference.</span>"; + } + if ($rcinfo ne '') { + $rcinfo = "\n<div class=\"refcount-info\">\n $rcinfo\n</div>"; + } return "<dl><dt>$return_type <b>$idx</b> (<var>$arg_list</var>)\n<dd>" + . $rcinfo . $_ . '</dl>'; } +sub do_env_csimplemacrodesc{ + local($_) = @_; + my $name = next_argument(); + my $idx = make_str_index_entry("<tt class='macro'>$name</tt>"); + return "<dl><dt><b>$idx</b>\n<dd>" + . $_ + . '</dl>' +} + sub do_env_ctypedesc{ local($_) = @_; + my $index_name = next_optional_argument(); my $type_name = next_argument(); - my $idx = make_str_index_entry("<tt class=ctype>$type_name</tt>" - . get_indexsubitem()); - $idx =~ s/ \(.*\)//; - return "<dl><dt><b>$idx</b>\n<dd>" + $index_name = $type_name + unless $index_name; + my($name,$aname,$ahref) = new_link_info(); + add_index_entry("<tt class='ctype'>$index_name</tt> (C type)", $ahref); + return "<dl><dt><b><tt class='ctype'>$aname$type_name</a></tt></b>\n<dd>" . $_ . '</dl>' } @@ -604,7 +669,7 @@ sub do_env_cvardesc{ local($_) = @_; my $var_type = next_argument(); my $var_name = next_argument(); - my $idx = make_str_index_entry("<tt class=cdata>$var_name</tt>" + my $idx = make_str_index_entry("<tt class='cdata'>$var_name</tt>" . get_indexsubitem()); $idx =~ s/ \(.*\)//; return "<dl><dt>$var_type <b>$idx</b>\n" @@ -617,7 +682,7 @@ sub do_env_funcdesc{ local($_) = @_; my $function_name = next_argument(); my $arg_list = next_argument(); - my $idx = make_str_index_entry("<tt class=function>$function_name()</tt>" + my $idx = make_str_index_entry("<tt class='function'>$function_name()</tt>" . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; @@ -628,7 +693,7 @@ sub do_env_funcdescni{ local($_) = @_; my $function_name = next_argument(); my $arg_list = next_argument(); - return "<dl><dt><b><tt class=function>$function_name</tt></b>" + return "<dl><dt><b><tt class='function'>$function_name</tt></b>" . " (<var>$arg_list</var>)\n" . '<dd>' . $_ @@ -639,7 +704,7 @@ sub do_cmd_funcline{ local($_) = @_; my $function_name = next_argument(); my $arg_list = next_argument(); - my $prefix = "<tt class=function>$function_name()</tt>"; + my $prefix = "<tt class='function'>$function_name()</tt>"; my $idx = make_str_index_entry($prefix . get_indexsubitem()); $prefix =~ s/\(\)//; @@ -650,7 +715,7 @@ sub do_cmd_funclineni{ local($_) = @_; my $function_name = next_argument(); my $arg_list = next_argument(); - my $prefix = "<tt class=function>$function_name</tt>"; + my $prefix = "<tt class='function'>$function_name</tt>"; return "<dt><b>$prefix</b> (<var>$arg_list</var>)\n<dd>" . $_; } @@ -667,12 +732,12 @@ sub do_env_opcodedesc{ my $arg_list = next_argument(); my $idx; if ($INDEX_OPCODES) { - $idx = make_str_index_entry( - "<tt class=opcode>$opcode_name</tt> (byte code instruction)"); + $idx = make_str_index_entry("<tt class='opcode'>$opcode_name</tt>" + . " (byte code instruction)"); $idx =~ s/ \(byte code instruction\)//; } else { - $idx = "<tt class=opcode>$opcode_name</tt>"; + $idx = "<tt class='opcode'>$opcode_name</tt>"; } my $stuff = "<dl><dt><b>$idx</b>"; if ($arg_list) { @@ -711,7 +776,7 @@ sub do_cmd_dataline{ sub do_env_excdesc{ local($_) = @_; my $excname = next_argument(); - my $idx = make_str_index_entry("<tt class=exception>$excname</tt>"); + my $idx = make_str_index_entry("<tt class='exception'>$excname</tt>"); return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>' } @@ -723,7 +788,7 @@ sub do_env_classdesc{ $THIS_CLASS = next_argument(); my $arg_list = next_argument(); $idx = make_str_index_entry( - "<tt class=class>$THIS_CLASS</tt> (class in $THIS_MODULE)" ); + "<tt class='class'>$THIS_CLASS</tt> (class in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; } @@ -740,7 +805,7 @@ sub do_env_methoddesc{ if ($class_name) { $extra = " ($class_name method)"; } - my $idx = make_str_index_entry("<tt class=method>$method()</tt>$extra"); + my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "<dl><dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" . $_ . '</dl>'; @@ -758,7 +823,7 @@ sub do_cmd_methodline{ if ($class_name) { $extra = " ($class_name method)"; } - my $idx = make_str_index_entry("<tt class=method>$method()</tt>$extra"); + my $idx = make_str_index_entry("<tt class='method'>$method()</tt>$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "<dt><b>$idx</b> (<var>$arg_list</var>)\n<dd>" @@ -795,7 +860,7 @@ sub do_env_memberdesc{ my $extra = ''; $extra = " ($class attribute)" if ($class ne ''); - my $idx = make_str_index_entry("<tt class=member>$member</tt>$extra"); + my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "<dl><dt><b>$idx</b>\n<dd>" . $_ . '</dl>'; @@ -811,7 +876,7 @@ sub do_cmd_memberline{ my $extra = ''; $extra = " ($class attribute)" if ($class ne ''); - my $idx = make_str_index_entry("<tt class=member>$member</tt>$extra"); + my $idx = make_str_index_entry("<tt class='member'>$member</tt>$extra"); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)//; return "<dt><b>$idx</b><dd>" . $_; @@ -821,7 +886,9 @@ sub do_env_memberdescni{ local($_) = @_; next_optional_argument(); my $member = next_argument(); - return "<dl><dt><b><tt class=member>$member</tt></b>\n<dd>" . $_ . '</dl>'; + return "<dl><dt><b><tt class='member'>$member</tt></b>\n<dd>" + . $_ + . '</dl>'; } @@ -829,25 +896,13 @@ sub do_cmd_memberlineni{ local($_) = @_; next_optional_argument(); my $member = next_argument(); - return "<dt><b><tt class=member>$member</tt></b><dd>" . $_; + return "<dt><b><tt class='member'>$member</tt></b><dd>" . $_; } -@col_aligns = ("<td>", "<td>", "<td>", "<td>"); +@col_aligns = ('<td>', '<td>', '<td>', '<td>'); $TABLE_HEADER_BGCOLOR = $NAV_BGCOLOR; -sub get_th{ - my $a = @_[0]; - my $r = '<th>'; - if ($a eq 'l') - { $r = '<th align=left>'; } - elsif (substr($a, 0, 1) eq 'p') - { $r = '<th align=left>'; } - elsif ($a eq 'r') - { $r = '<th align=right>'; } - return $r; -} - sub fix_font{ # do a little magic on a font name to get the right behavior in the first # column of the output table @@ -856,22 +911,53 @@ sub fix_font{ $font = ''; } elsif ($font eq 'file' || $font eq 'filenq') { - $font = 'tt class=file'; + $font = 'tt class="file"'; + } + elsif ($font eq 'member') { + $font = 'tt class="member"'; } return $font; } +sub figure_column_alignment{ + my $a = @_[0]; + my $mark = substr($a, 0, 1); + my $r = ''; + if ($mark eq 'c') + { $r = ' align="center"'; } + elsif ($mark eq 'r') + { $r = ' align="right"'; } + elsif ($mark eq 'l') + { $r = ' align="left"'; } + elsif ($mark eq 'p') + { $r = ' align="left"'; } + return $r; +} + sub setup_column_alignments{ local($_) = @_; - my($a1,$a2,$a3,$a4) = split(/[|]/,$_); - my($th1,$th2,$th3,$th4) = ('<th>', '<th>', '<th>', '<th>'); - $col_aligns[0] = (($a1 eq 'c') ? '<td align=center valign=baseline>' - : '<td valign=baseline>'); - $col_aligns[1] = (($a2 eq 'c') ? '<td align=center>' : '<td>'); - $col_aligns[2] = (($a3 eq 'c') ? '<td align=center>' : '<td>'); - $col_aligns[3] = (($a4 eq 'c') ? '<td align=center>' : '<td>'); + my($s1,$s2,$s3,$s4) = split(/[|]/,$_); + my $a1 = figure_column_alignment($s1); + my $a2 = figure_column_alignment($s2); + my $a3 = figure_column_alignment($s3); + my $a4 = figure_column_alignment($s4); + $col_aligns[0] = "<td$a1 valign=\"baseline\">"; + $col_aligns[1] = "<td$a2>"; + $col_aligns[2] = "<td$a3>"; + $col_aligns[3] = "<td$a4>"; # return the aligned header start tags - return (get_th($a1), get_th($a2), get_th($a3), get_th($a4)); + return ("<th$a1>", "<th$a2>", "<th$a3>", "<th$a4>"); +} + +sub get_table_col1_fonts{ + my $font = $globals{'lineifont'}; + my ($sfont,$efont) = ('', ''); + if ($font) { + $sfont = "<$font>"; + $efont = "</$font>"; + $efont =~ s/ .*>/>/; + } + return ($font, $sfont, $efont); } sub do_env_tableii{ @@ -882,32 +968,36 @@ sub do_env_tableii{ my $h2 = next_argument(); s/[\s\n]+//; $globals{'lineifont'} = $font; - return '<table border align=center style="border-collapse: collapse">' + my $a1 = $col_aligns[0]; + my $a2 = $col_aligns[1]; + s/\\lineii</\\lineii[$a1|$a2]</g; + return '<table border align="center" style="border-collapse: collapse">' . "\n <thead>" . "\n <tr$TABLE_HEADER_BGCOLOR>" - . "\n $th1<b>$h1</b>\ \ </th>" - . "\n $th2<b>$h2</b>\ \ </th>" + . "\n $th1<b>$h1</b>\ </th>" + . "\n $th2<b>$h2</b>\ </th>" . "\n </thead>" - . "\n <tbody valign=baseline>" - . $_ + . "\n <tbody valign='baseline'>" + . $_ . "\n </tbody>" . "\n</table>"; } sub do_cmd_lineii{ local($_) = @_; + my $aligns = next_optional_argument(); my $c1 = next_argument(); my $c2 = next_argument(); s/[\s\n]+//; - my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); - if ($font) { - $sfont = "<$font>"; - $efont = "</$font>"; - $efont =~ s/ .*>/>/; + my($font,$sfont,$efont) = get_table_col1_fonts(); + $c2 = ' ' if ($c2 eq ''); + my($c1align,$c2align) = split('\|', $aligns); + my $padding = ''; + if ($c1align =~ /align="right"/) { + $padding = ' '; } - my($c1align,$c2align) = @col_aligns[0,1]; - return "\n <tr>$c1align$sfont$c1$efont</td>\n" - . " $c2align$c2\ </td>" + return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n" + . " $c2align$c2</td>" . $_; } @@ -920,14 +1010,18 @@ sub do_env_tableiii{ my $h3 = next_argument(); s/[\s\n]+//; $globals{'lineifont'} = $font; - return '<table border align=center style="border-collapse: collapse">' + my $a1 = $col_aligns[0]; + my $a2 = $col_aligns[1]; + my $a3 = $col_aligns[2]; + s/\\lineiii</\\lineiii[$a1|$a2|$a3]</g; + return '<table border align="center" style="border-collapse: collapse">' . "\n <thead>" . "\n <tr$TABLE_HEADER_BGCOLOR>" - . "\n $th1<b>$h1</b>\ \ </th>" - . "\n $th2<b>$h2</b>\ \ </th>" - . "\n $th3<b>$h3</b>\ \ </th>" + . "\n $th1<b>$h1</b>\ </th>" + . "\n $th2<b>$h2</b>\ </th>" + . "\n $th3<b>$h3</b>\ </th>" . "\n </thead>" - . "\n <tbody valign=baseline>" + . "\n <tbody valign='baseline'>" . $_ . "\n </tbody>" . "\n</table>"; @@ -935,20 +1029,21 @@ sub do_env_tableiii{ sub do_cmd_lineiii{ local($_) = @_; + my $aligns = next_optional_argument(); my $c1 = next_argument(); my $c2 = next_argument(); my $c3 = next_argument(); s/[\s\n]+//; - my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); - if ($font) { - $sfont = "<$font>"; - $efont = "</$font>"; - $efont =~ s/ .*>/>/; + my($font,$sfont,$efont) = get_table_col1_fonts(); + $c3 = ' ' if ($c3 eq ''); + my($c1align,$c2align,$c3align) = split('\|', $aligns); + my $padding = ''; + if ($c1align =~ /align="right"/) { + $padding = ' '; } - my($c1align,$c2align,$c3align) = @col_aligns[0,1,2]; - return "\n <tr>$c1align$sfont$c1$efont</td>\n" + return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n" . " $c2align$c2</td>\n" - . " $c3align$c3\ </td>" + . " $c3align$c3</td>" . $_; } @@ -962,15 +1057,20 @@ sub do_env_tableiv{ my $h4 = next_argument(); s/[\s\n]+//; $globals{'lineifont'} = $font; - return '<table border align=center style="border-collapse: collapse">' + my $a1 = $col_aligns[0]; + my $a2 = $col_aligns[1]; + my $a3 = $col_aligns[2]; + my $a4 = $col_aligns[3]; + s/\\lineiv</\\lineiv[$a1|$a2|$a3|$a4]</g; + return '<table border align="center" style="border-collapse: collapse">' . "\n <thead>" . "\n <tr$TABLE_HEADER_BGCOLOR>" - . "\n $th1<b>$h1</b>\ \ </th>" - . "\n $th2<b>$h2</b>\ \ </th>" - . "\n $th3<b>$h3</b>\ \ </th>" - . "\n $th4<b>$h4</b>\ \ </th>" + . "\n $th1<b>$h1</b>\ </th>" + . "\n $th2<b>$h2</b>\ </th>" + . "\n $th3<b>$h3</b>\ </th>" + . "\n $th4<b>$h4</b>\ </th>" . "\n </thead>" - . "\n <tbody valign=baseline>" + . "\n <tbody valign='baseline'>" . $_ . "\n </tbody>" . "\n</table>"; @@ -978,28 +1078,29 @@ sub do_env_tableiv{ sub do_cmd_lineiv{ local($_) = @_; + my $aligns = next_optional_argument(); my $c1 = next_argument(); my $c2 = next_argument(); my $c3 = next_argument(); my $c4 = next_argument(); s/[\s\n]+//; - my($font,$sfont,$efont) = ($globals{'lineifont'}, '', ''); - if ($font) { - $sfont = "<$font>"; - $efont = "</$font>"; - $efont =~ s/ .*>/>/; + my($font,$sfont,$efont) = get_table_col1_fonts(); + $c4 = ' ' if ($c4 eq ''); + my($c1align,$c2align,$c3align,$c4align) = split('\|', $aligns); + my $padding = ''; + if ($c1align =~ /align="right"/) { + $padding = ' '; } - my($c1align,$c2align,$c3align,$c4align) = @col_aligns; - return "\n <tr>$c1align$sfont$c1$efont</td>\n" + return "\n <tr>$c1align$sfont$c1$efont$padding</td>\n" . " $c2align$c2</td>\n" . " $c3align$c3</td>\n" - . " $c4align$c4\ </td>" + . " $c4align$c4</td>" . $_; } sub do_cmd_maketitle { local($_) = @_; - my $the_title = "\n<div class=titlepage><center>"; + my $the_title = "\n<div class='titlepage'><center>"; if ($t_title) { $the_title .= "\n<h1>$t_title</h1>"; } else { write_warnings("\nThis document has no title."); } @@ -1125,8 +1226,8 @@ sub process_python_state{ # sub do_env_seealso{ - return "<div class=seealso>\n " - . "<p class=heading><b>See Also:</b></p>\n" + return "<div class='seealso'>\n " + . "<p class='heading'><b>See Also:</b></p>\n" . @_[0] . '</div>'; } @@ -1144,8 +1245,8 @@ sub do_cmd_seemodule{ if ($text =~ /\.$/) { $period = ''; } - return '<dl compact class=seemodule>' - . "\n <dt>Module <b><tt class=module><a href=\"module-$key.html\">" + return '<dl compact class="seemodule">' + . "\n <dt>Module <b><tt class='module'><a href='module-$key.html'>" . "$module</a></tt>:</b>" . "\n <dd>$text$period\n </dl>" . $_; @@ -1154,7 +1255,7 @@ sub do_cmd_seemodule{ sub do_cmd_seetext{ local($_) = @_; my $content = next_argument(); - return '<div class=seetext><p>' . $content . '</div>' . $_; + return '<div class="seetext"><p>' . $content . '</div>' . $_; } @@ -1164,7 +1265,7 @@ sub do_cmd_seetext{ sub do_env_definitions{ local($_) = @_; - return "<dl class=definitions>$_</dl>\n"; + return "<dl class='definitions'>$_</dl>\n"; } sub do_cmd_term{ diff --git a/Doc/ref/ref2.tex b/Doc/ref/ref2.tex index 8d106b6..ba4c684 100644 --- a/Doc/ref/ref2.tex +++ b/Doc/ref/ref2.tex @@ -148,7 +148,7 @@ text editors on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for the indentation in a single source file. A formfeed character may be present at the start of the line; it will -be ignored for the indentation calculations above. A formfeed +be ignored for the indentation calculations above. Formfeed characters occurring elsewhere in the leading whitespace have an undefined effect (for instance, they may reset the space count to zero). @@ -369,7 +369,9 @@ characters: a backslash and a double quote; \code{r"\e"} is not a value string literal (even a raw string cannot end in an odd number of backslashes). Specifically, \emph{a raw string cannot end in a single backslash} (since the backslash would escape the following quote -character). +character). Note also that a single backslash followed by a newline +is interpreted as those two characters as part of the string, +\emph{not} as a line continuation. \subsection{String literal concatenation\label{string-catenation}} @@ -464,7 +466,9 @@ exponent: ("e"|"E") ["+"|"-"] digit+ \end{verbatim} Note that the integer part of a floating point number cannot look like -an octal integer. +an octal integer, though the exponent may look like an octal literal +but will always be interpreted using radix 10. For example, +\samp{1e010} is legal, while \samp{07.1} is a syntax error. The allowed range of floating point literals is implementation-dependent. Some examples of floating point literals: @@ -485,7 +489,7 @@ Imaginary literals are described by the following lexical definitions: imagnumber: (floatnumber | intpart) ("j"|"J") \end{verbatim} -An imaginary literals yields a complex number with a real part of +An imaginary literal yields a complex number with a real part of 0.0. Complex numbers are represented as a pair of floating point numbers and have the same restrictions on their range. To create a complex number with a nonzero real part, add a floating point number @@ -522,7 +526,7 @@ The following tokens serve as delimiters in the grammar: \end{verbatim} The period can also occur in floating-point and imaginary literals. A -sequence of three periods has a special meaning as ellipses in slices. +sequence of three periods has a special meaning as an ellipsis in slices. The following printing ASCII characters have special meaning as part of other tokens or are otherwise significant to the lexical analyzer: diff --git a/Doc/ref/ref3.tex b/Doc/ref/ref3.tex index cb861cd..7cc0762 100644 --- a/Doc/ref/ref3.tex +++ b/Doc/ref/ref3.tex @@ -144,7 +144,6 @@ arithmetic operators and arithmetic built-in functions. Numeric objects are immutable; once created their value never changes. Python numbers are of course strongly related to mathematical numbers, but subject to the limitations of numerical representation in computers. -\obindex{number} \obindex{numeric} Python distinguishes between integers and floating point numbers: @@ -162,7 +161,7 @@ There are two types of integers: These represent numbers in the range -2147483648 through 2147483647. (The range may be larger on machines with a larger natural word size, but not smaller.) -When the result of an operation falls outside this range, the +When the result of an operation would fall outside this range, the exception \exception{OverflowError} is raised. For the purpose of shift and mask operations, integers are assumed to have a binary, 2's complement notation using 32 or more bits, and @@ -221,7 +220,7 @@ number of items of a sequence. When the lenth of a sequence is \var{n}, the index set contains the numbers 0, 1, \ldots, \var{n}-1. Item \var{i} of sequence \var{a} is selected by \code{\var{a}[\var{i}]}. -\obindex{seqence} +\obindex{sequence} \index{index operation} \index{item selection} \index{subscription} @@ -618,7 +617,7 @@ instance dictionary directly. Class instances can pretend to be numbers, sequences, or mappings if they have methods with certain special names. See section \ref{specialnames}, ``Special method names.'' -\obindex{number} +\obindex{numeric} \obindex{sequence} \obindex{mapping} @@ -702,15 +701,14 @@ a number of flags for the interpreter. \ttindex{co_stacksize} \ttindex{co_varnames}} -The following flag bits are defined for \member{co_flags}: bit 2 is set -if the function uses the \samp{*arguments} syntax to accept an -arbitrary number of positional arguments; bit 3 is set if the function -uses the \samp{**keywords} syntax to accept arbitrary keyword -arguments; other bits are used internally or reserved for future use. -If a code object represents a function, the first item in -\member{co_consts} is the documentation string of the -function, or \code{None} if undefined. -\index{documentation string} +The following flag bits are defined for \member{co_flags}: bit +\code{0x04} is set if the function uses the \samp{*arguments} syntax +to accept an arbitrary number of positional arguments; bit +\code{0x08} is set if the function uses the \samp{**keywords} syntax +to accept arbitrary keyword arguments; other bits are used internally +or reserved for future use. If\index{documentation string} a code +object represents a function, the first item in \member{co_consts} is +the documentation string of the function, or \code{None} if undefined. \item[Frame objects] Frame objects represent execution frames. They may occur in traceback @@ -1098,10 +1096,13 @@ three methods. Called to implement evaluation of \code{\var{self}[\var{i}:\var{j}]}. The returned object should be of the same type as \var{self}. Note that missing \var{i} or \var{j} in the slice expression are replaced -by zero or \code{sys.maxint}, respectively, and no further -transformations on the indices is performed. The interpretation of -negative indices and indices larger than the length of the sequence is -up to the method. +by zero or \code{sys.maxint}, respectively. If negative indexes are +used in the slice, the length of the sequence is added to that index. +If the instance does not implement the \method{__len__()} method, an +\exception{AttributeError} is raised. +No guarantee is made that indexes adjusted this way are not still +negative. Indexes which are greater than the length of the sequence +are not modified. \end{methoddesc} \begin{methoddesc}[sequence object]{__setslice__}{self, i, j, sequence} diff --git a/Doc/ref/ref4.tex b/Doc/ref/ref4.tex index 673fea3..636bc1d 100644 --- a/Doc/ref/ref4.tex +++ b/Doc/ref/ref4.tex @@ -183,11 +183,11 @@ statement. The \keyword{try} ... \keyword{finally} statement specifies cleanup code which does not handle the exception, but is executed whether an exception occurred or not in the preceding code. -Python uses the ``termination'' model of error handling: an exception -handler can find out what happened and continue execution at an outer -level, but it cannot repair the cause of the error and retry the -failing operation (except by re-entering the offending piece of -code from the top). +Python uses the ``termination'' \index{termination model}model of +error handling: an exception handler can find out what happened and +continue execution at an outer level, but it cannot repair the cause +of the error and retry the failing operation (except by re-entering +the offending piece of code from the top). When an exception is not handled at all, the interpreter terminates execution of the program, or returns to its interactive main loop. In @@ -210,5 +210,5 @@ selected exception handler as additional information. For class exceptions, this object must be an instance of the exception class being raised. -See also the description of the \keyword{try} and \keyword{raise} -statements in chapter \ref{compound}. +See also the description of the \keyword{try} statement in section +\ref{try} and \keyword{raise} statement in section \ref{raise}. diff --git a/Doc/ref/ref5.tex b/Doc/ref/ref5.tex index 72a2053..5bca8ed 100644 --- a/Doc/ref/ref5.tex +++ b/Doc/ref/ref5.tex @@ -115,7 +115,7 @@ evaluations of literals with the same value (either the same occurrence in the program text or a different occurrence) may obtain the same object or a different object with the same value. \indexiii{immutable}{data}{type} -\indexii{immutable}{objects} +\indexii{immutable}{object} \subsection{Parenthesized forms\label{parenthesized}} \index{parenthesized form} @@ -189,7 +189,7 @@ section \ref{types}. (To summarize,the key type should be hashable, which excludes all mutable objects.) Clashes between duplicate keys are not detected; the last datum (textually rightmost in the display) stored for a given key value prevails. -\indexii{immutable}{objects} +\indexii{immutable}{object} \subsection{String conversions\label{string-conversions}} \indexii{string}{conversion} @@ -338,7 +338,7 @@ extended slicing.\indexii{extended}{slicing} The semantics for a simple slicing are as follows. The primary must evaluate to a sequence object. The lower and upper bound expressions, if present, must evaluate to plain integers; defaults are zero and the -sequence's length, respectively. If either bound is negative, the +\code{sys.maxint}, respectively. If either bound is negative, the sequence's length is added to it. The slicing now selects all items with index \var{k} such that \code{\var{i} <= \var{k} < \var{j}} where \var{i} @@ -507,7 +507,7 @@ power, or a negative floating point number to a broken power), a \exception{TypeError} exception is raised. -\section{Unary arithmetic operations\label{unary}} +\section{Unary arithmetic operations \label{unary}} \indexiii{unary}{arithmetic}{operation} \indexiii{unary}{bit-wise}{operation} @@ -526,7 +526,7 @@ The unary \code{+} (plus) operator yields its numeric argument unchanged. \index{plus} -The unary \code{~} (invert) operator yields the bit-wise inversion +The unary \code{\~} (invert) operator yields the bit-wise inversion of its plain or long integer argument. The bit-wise inversion of \code{x} is defined as \code{-(x+1)}. It only applies to integral numbers. diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex index 7538caa..097bbcd 100644 --- a/Doc/ref/ref7.tex +++ b/Doc/ref/ref7.tex @@ -306,9 +306,7 @@ default value, the corresponding argument may be omitted from a call, in which case the parameter's default value is substituted. If a parameter has a default value, all following parameters must also have a default value --- this is a syntactic restriction that is not -expressed by the grammar.\footnote{ -Currently this is not checked; instead, \code{def f(a=1, b)} is -interpreted as \code{def f(a=1, b=None)}.} +expressed by the grammar. \indexiii{default}{parameter}{value} \strong{Default parameter values are evaluated when the function |