From 1b1ca0cc2b0a31de89535d77a2b8d0081bee4c5e Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Fri, 5 Sep 2003 15:43:58 +0000 Subject: normalize whitespace; detabify --- Doc/perl/python.perl | 320 +++++++++++++++++++++++++-------------------------- 1 file changed, 160 insertions(+), 160 deletions(-) diff --git a/Doc/perl/python.perl b/Doc/perl/python.perl index cddba8c..c1ebd19 100644 --- a/Doc/perl/python.perl +++ b/Doc/perl/python.perl @@ -1,4 +1,4 @@ -# python.perl by Fred L. Drake, Jr. -*- perl -*- +# python.perl by Fred L. Drake, Jr. -*- perl -*- # # Heavily based on Guido van Rossum's myformat.perl (now obsolete). # @@ -16,7 +16,7 @@ sub next_argument{ my $param; $param = missing_braces() unless ((s/$next_pair_pr_rx/$param=$2;''/eo) - ||(s/$next_pair_rx/$param=$2;''/eo)); + ||(s/$next_pair_rx/$param=$2;''/eo)); return $param; } @@ -65,20 +65,20 @@ sub do_cmd_let{ my $matched = 0; s/[\\]([a-zA-Z]+)\s*(=\s*)?[\\]([a-zA-Z]*)/$matched=1; ''/e; if ($matched) { - my($new, $old) = ($1, $3); - eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }'; - print "\ndefining handler for \\$new using \\$old\n"; + my($new, $old) = ($1, $3); + eval "sub do_cmd_$new { do_cmd_$old" . '(@_); }'; + print "\ndefining handler for \\$new using \\$old\n"; } else { - s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es; - if ($matched) { - my($new, $char) = ($1, $3); - eval "sub do_cmd_$new { \"\\$char\" . \$_[0]; }"; - print "\ndefining handler for \\$new to insert '$char'\n"; - } - else { - write_warnings("Could not interpret \\let construct..."); - } + s/[\\]([a-zA-Z]+)\s*(=\s*)?([^\\])/$matched=1; ''/es; + if ($matched) { + my($new, $char) = ($1, $3); + eval "sub do_cmd_$new { \"\\$char\" . \$_[0]; }"; + print "\ndefining handler for \\$new to insert '$char'\n"; + } + else { + write_warnings("Could not interpret \\let construct..."); + } } return $_; } @@ -304,7 +304,7 @@ sub do_cmd_envvar{ # The here is really to keep buildindex.py from making # the variable name case-insensitive. add_index_entry("environment variables!$envvar@$envvar", - $ahref); + $ahref); add_index_entry("$envvar (environment variable)", $ahref); $aname =~ s/" . $_; @@ -483,7 +483,7 @@ sub do_cmd_makemodindex{ return $_[0]; } open(IDXFILE, '>index.dat') || die "\n$!\n"; open(INTLABELS, '>intlabels.pl') || die "\n$!\n"; print INTLABELS "%internal_labels = ();\n"; -print INTLABELS "1; # hack in case there are no entries\n\n"; +print INTLABELS "1; # hack in case there are no entries\n\n"; # Using \0 for this is bad because we can't use common tools to work with the # resulting files. Things like grep can be useful with this stuff! @@ -522,43 +522,43 @@ sub define_indexing_macro(@){ my $count = @_; my $i = 0; for (; $i < $count; ++$i) { - my $name = $_[$i]; - my $cmd = "idx_cmd_$name"; - die "\nNo function $cmd() defined!\n" - if (!defined &$cmd); - eval ("sub do_cmd_$name { return process_index_macros(" - . "\$_[0], '$name'); }"); - if (length($IndexMacroPattern) == 0) { - $IndexMacroPattern = "$name"; - } - else { - $IndexMacroPattern .= "|$name"; - } + my $name = $_[$i]; + my $cmd = "idx_cmd_$name"; + die "\nNo function $cmd() defined!\n" + if (!defined &$cmd); + eval ("sub do_cmd_$name { return process_index_macros(" + . "\$_[0], '$name'); }"); + if (length($IndexMacroPattern) == 0) { + $IndexMacroPattern = "$name"; + } + else { + $IndexMacroPattern .= "|$name"; + } } } $DEBUG_INDEXING = 0; sub process_index_macros($$){ local($_) = @_; - my $cmdname = $_[1]; # This is what triggered us in the first place; - # we know it's real, so just process it. + my $cmdname = $_[1]; # This is what triggered us in the first place; + # we know it's real, so just process it. my($name, $aname, $ahref) = new_link_info(); my $cmd = "idx_cmd_$cmdname"; print "\nIndexing: \\$cmdname" if $DEBUG_INDEXING; - &$cmd($ahref); # modifies $_ and adds index entries + &$cmd($ahref); # modifies $_ and adds index entries while (/^[\s\n]*\\($IndexMacroPattern))/; my $nstr = $1; - $Modules{$nstr} .= $ahref; + $Modules{$nstr} .= $ahref; } return "$aname$anchor_invisible_mark2"; } @@ -664,10 +664,10 @@ sub define_module($$){ my($word, $name) = @_; my $section_tag = join('', @curr_sec_id); if ($word ne "built-in" && $word ne "extension" - && $word ne "standard" && $word ne "") { - write_warnings("Bad module type '$word'" - . " for \\declaremodule (module $name)"); - $word = ""; + && $word ne "standard" && $word ne "") { + write_warnings("Bad module type '$word'" + . " for \\declaremodule (module $name)"); + $word = ""; } $word = "$word " if $word; $THIS_MODULE = "$name"; @@ -706,7 +706,7 @@ sub ref_module_index_helper($$){ # these should be adjusted a bit.... define_indexing_macro('refmodindex', 'refbimodindex', - 'refexmodindex', 'refstmodindex'); + 'refexmodindex', 'refstmodindex'); sub idx_cmd_refmodindex($){ return ref_module_index_helper('', $_[0]); } sub idx_cmd_refbimodindex($){ @@ -897,9 +897,9 @@ sub load_refcounts(){ $REFCOUNTS_LOADED = 1; my($myname, $mydir, $myext) = fileparse(__FILE__, '\..*'); - chop $mydir; # remove trailing '/' + chop $mydir; # remove trailing '/' ($myname, $mydir, $myext) = fileparse($mydir, '\..*'); - chop $mydir; # remove trailing '/' + chop $mydir; # remove trailing '/' $mydir = getcwd() . "$dd$mydir" unless $mydir =~ s|^/|/|; local $_; @@ -931,7 +931,7 @@ sub cfuncline_helper($$$){ my $idx = make_str_index_entry( "$name()" . get_indexsubitem()); $idx =~ s/ \(.*\)//; - $idx =~ s/\(\)//; # ???? - why both of these? + $idx =~ s/\(\)//; # ???? - why both of these? $args =~ s/(\s|\*)([a-z_][a-z_0-9]*),/$1$2<\/var>,/g; $args =~ s/(\s|\*)([a-z_][a-z_0-9]*)$/$1$2<\/var>/s; return ('' @@ -1028,7 +1028,7 @@ sub do_env_cvardesc{ my $var_type = next_argument(); my $var_name = next_argument(); my $idx = make_str_index_entry("$var_name" - . get_indexsubitem()); + . get_indexsubitem()); $idx =~ s/ \(.*\)//; return "
$var_type $idx
\n" . '
' @@ -1056,7 +1056,7 @@ sub do_env_funcdesc{ my $arg_list = convert_args(next_argument()); my $idx = make_str_index_entry("$function_name()" . '' - . get_indexsubitem()); + . get_indexsubitem()); $idx =~ s/ \(.*\)//; $idx =~ s/\(\)<\/tt>/<\/tt>/; return funcline_helper(1, $idx, $arg_list) . $_ . '
'; @@ -1102,16 +1102,16 @@ sub do_env_opcodedesc{ my $arg_list = next_argument(); my $idx; if ($INDEX_OPCODES) { - $idx = make_str_index_entry("$opcode_name" + $idx = make_str_index_entry("$opcode_name" . ' (byte code instruction)'); - $idx =~ s/ \(byte code instruction\)//; + $idx =~ s/ \(byte code instruction\)//; } else { - $idx = "$opcode_name"; + $idx = "$opcode_name"; } my $stuff = "
$idx"; if ($arg_list) { - $stuff .= "    $arg_list"; + $stuff .= "    $arg_list"; } return $stuff . "
\n
" . $_ . '
'; } @@ -1123,14 +1123,14 @@ sub do_env_datadesc{ $idx =~ s/ \(.*\)//; return "
$idx
\n
" . $_ - . '
'; + . ''; } sub do_env_datadescni{ local($_) = @_; my $idx = next_argument(); if (! $STRING_INDEX_TT) { - $idx = "$idx"; + $idx = "$idx"; } return "
$idx
\n
" . $_ . '
'; } @@ -1167,7 +1167,7 @@ sub handle_classlike_descriptor($$){ $THIS_CLASS = next_argument(); my $arg_list = convert_args(next_argument()); $idx = make_str_index_entry( - "$THIS_CLASS ($what in $THIS_MODULE)" ); + "$THIS_CLASS ($what in $THIS_MODULE)" ); $idx =~ s/ \(.*\)//; my $prefix = "$TLSTART$what$TLEND$idx"; return funcline_helper(1, $prefix, $arg_list) . $_ . ''; @@ -1181,7 +1181,7 @@ sub do_env_classdescstar{ local($_) = @_; $THIS_CLASS = next_argument(); $idx = make_str_index_entry( - "$THIS_CLASS (class in $THIS_MODULE)"); + "$THIS_CLASS (class in $THIS_MODULE)"); $idx =~ s/ \(.*\)//; my $prefix = "${TLSTART}class$TLEND$idx"; # Can't use funcline_helper() since there is no args list. @@ -1202,7 +1202,7 @@ sub do_env_methoddesc{ my $arg_list = convert_args(next_argument()); my $extra = ''; if ($class_name) { - $extra = " ($class_name method)"; + $extra = " ($class_name method)"; } my $idx = make_str_index_entry( "$method()$extra"); @@ -1221,7 +1221,7 @@ sub do_cmd_methodline{ my $arg_list = convert_args(next_argument()); my $extra = ''; if ($class_name) { - $extra = " ($class_name method)"; + $extra = " ($class_name method)"; } my $idx = make_str_index_entry( "$method()$extra"); @@ -1383,16 +1383,16 @@ sub do_env_tableii{ my $a2 = $col_aligns[1]; s/\\lineii' - . "\n " - . "\n " - . "\n $th1$h1\ " - . "\n $th2$h2\ " - . "\n " - . "\n " - . "\n " - . $_ - . "\n " - . "\n
"; + . "\n " + . "\n " + . "\n $th1$h1\ " + . "\n $th2$h2\ " + . "\n " + . "\n " + . "\n " + . $_ + . "\n " + . "\n"; } sub do_env_longtableii{ @@ -1415,7 +1415,7 @@ sub do_cmd_lineii{ } return "\n $c1align$sfont$c1$efont$padding\n" . " $c2align$c2" - . $_; + . $_; } sub do_env_tableiii{ @@ -1433,17 +1433,17 @@ sub do_env_tableiii{ my $a3 = $col_aligns[2]; s/\\lineiii' - . "\n " - . "\n " - . "\n $th1$h1\ " - . "\n $th2$h2\ " - . "\n $th3$h3\ " - . "\n " - . "\n " - . "\n " - . $_ - . "\n " - . "\n"; + . "\n " + . "\n " + . "\n $th1$h1\ " + . "\n $th2$h2\ " + . "\n $th3$h3\ " + . "\n " + . "\n " + . "\n " + . $_ + . "\n " + . "\n"; } sub do_env_longtableiii{ @@ -1468,8 +1468,8 @@ sub do_cmd_lineiii{ } return "\n $c1align$sfont$c1$efont$padding\n" . " $c2align$c2\n" - . " $c3align$c3" - . $_; + . " $c3align$c3" + . $_; } sub do_env_tableiv{ @@ -1489,18 +1489,18 @@ sub do_env_tableiv{ my $a4 = $col_aligns[3]; s/\\lineiv' - . "\n " - . "\n " - . "\n $th1$h1\ " - . "\n $th2$h2\ " - . "\n $th3$h3\ " - . "\n $th4$h4\ " - . "\n " - . "\n " - . "\n " - . $_ - . "\n " - . "\n"; + . "\n " + . "\n " + . "\n $th1$h1\ " + . "\n $th2$h2\ " + . "\n $th3$h3\ " + . "\n $th4$h4\ " + . "\n " + . "\n " + . "\n " + . $_ + . "\n " + . "\n"; } sub do_env_longtableiv{ @@ -1511,7 +1511,7 @@ sub do_cmd_lineiv{ local($_) = @_; my $aligns = next_optional_argument(); my $c1 = next_argument(); - my $c2 = next_argument(); + my $c2 = next_argument(); my $c3 = next_argument(); my $c4 = next_argument(); s/[\s\n]+//; @@ -1527,9 +1527,9 @@ sub do_cmd_lineiv{ } return "\n $c1align$sfont$c1$efont$padding\n" . " $c2align$c2\n" - . " $c3align$c3\n" - . " $c4align$c4" - . $_; + . " $c3align$c3\n" + . " $c4align$c4" + . $_; } sub do_env_tablev{ @@ -1551,19 +1551,19 @@ sub do_env_tablev{ my $a5 = $col_aligns[4]; s/\\linev' - . "\n " - . "\n " - . "\n $th1$h1\ " - . "\n $th2$h2\ " - . "\n $th3$h3\ " - . "\n $th4$h4\ " - . "\n $th5$h5\ " - . "\n " - . "\n " - . "\n " - . $_ - . "\n " - . "\n"; + . "\n " + . "\n " + . "\n $th1$h1\ " + . "\n $th2$h2\ " + . "\n $th3$h3\ " + . "\n $th4$h4\ " + . "\n $th5$h5\ " + . "\n " + . "\n " + . "\n " + . $_ + . "\n " + . "\n"; } sub do_env_longtablev{ @@ -1592,10 +1592,10 @@ sub do_cmd_linev{ } return "\n $c1align$sfont$c1$efont$padding\n" . " $c2align$c2\n" - . " $c3align$c3\n" - . " $c4align$c4\n" - . " $c5align$c5" - . $_; + . " $c3align$c3\n" + . " $c4align$c4\n" + . " $c5align$c5" + . $_; } @@ -1620,23 +1620,23 @@ sub do_cmd_linev{ sub make_my_titlepage(){ my $the_title = ""; if ($t_title) { - $the_title .= "\n

$t_title

"; + $the_title .= "\n

$t_title

"; } else { write_warnings("\nThis document has no title."); } if ($t_author) { - if ($t_authorURL) { - my $href = translate_commands($t_authorURL); - $href = make_named_href('author', $href, - "$t_author" + if ($t_authorURL) { + my $href = translate_commands($t_authorURL); + $href = make_named_href('author', $href, + "$t_author" . ''); - $the_title .= "\n

$href

"; - } + $the_title .= "\n

$href

"; + } else { - $the_title .= ("\n

$t_author" + $the_title .= ("\n

$t_author" . '

'); - } + } } else { write_warnings("\nThere is no author for this document."); @@ -1648,24 +1648,24 @@ sub make_my_titlepage(){ $the_title .= "\n

$DEVELOPER_ADDRESS

"; } if ($t_affil) { - $the_title .= "\n

$t_affil

"; + $the_title .= "\n

$t_affil

"; } if ($t_date) { - $the_title .= "\n

"; - if ($PACKAGE_VERSION) { - $the_title .= ('Release ' + $the_title .= "\n

"; + if ($PACKAGE_VERSION) { + $the_title .= ('Release ' . "$PACKAGE_VERSION$RELEASE_INFO
\n"); } - $the_title .= "$t_date

" + $the_title .= "$t_date

" } if ($t_address) { - $the_title .= "\n

$t_address

"; + $the_title .= "\n

$t_address

"; } else { $the_title .= "\n

"; } if ($t_email) { - $the_title .= "\n

$t_email

"; + $the_title .= "\n

$t_email

"; } return $the_title; } @@ -1747,9 +1747,9 @@ sub get_synopsis_table($){ my $chap = $_[0]; my $key; foreach $key (keys %ModuleSynopses) { - if ($key eq $chap) { - return $ModuleSynopses{$chap}; - } + if ($key eq $chap) { + return $ModuleSynopses{$chap}; + } } my $st = SynopsisTable->new(); $ModuleSynopses{$chap} = $st; @@ -1821,11 +1821,11 @@ sub process_localmoduletables_in_file($){ close(MYFILE); # need to get contents of file in $_ while (/<(\d+)>/) { - my $match = $&; - my $chap = $1; - my $st = get_synopsis_table($chap); - my $data = $st->tohtml(); - s/$match/$data/; + my $match = $&; + my $chap = $1; + my $st = get_synopsis_table($chap); + my $data = $st->tohtml(); + s/$match/$data/; } open(MYFILE,">$file"); print MYFILE $_; @@ -1865,7 +1865,7 @@ sub do_cmd_seemodule{ $key = $module unless $key; if ($text =~ /\.$/) { - $period = ''; + $period = ''; } return ('
' . "\n
Module " @@ -2007,20 +2007,20 @@ sub do_env_alltt{ local($local_closures, $local_reopens); ($local_closures, $local_reopens,@open_block_tags) = &preserve_open_block_tags - if (@$open_tags_R); + if (@$open_tags_R); $open_tags_R = [ @open_block_tags ]; do { - local($open_tags_R) = [ @open_block_tags ]; - local(@save_open_tags) = (); + local($open_tags_R) = [ @open_block_tags ]; + local(@save_open_tags) = (); - local($cnt) = ++$global{'max_id'}; - $_ = join('',"$O$cnt$C\\tt$O", ++$global{'max_id'}, $C - , $_ , $O, $global{'max_id'}, "$C$O$cnt$C"); + local($cnt) = ++$global{'max_id'}; + $_ = join('',"$O$cnt$C\\tt$O", ++$global{'max_id'}, $C + , $_ , $O, $global{'max_id'}, "$C$O$cnt$C"); - $_ = &translate_environments($_); - $_ = &translate_commands($_) if (/\\/); + $_ = &translate_environments($_); + $_ = &translate_commands($_) if (/\\/); # remove spurious
someone sticks in; not sure where they # actually come from @@ -2029,11 +2029,11 @@ sub do_env_alltt{ # the environment s/
/ /gi; - $_ = join('', $closures, $alltt_start, $local_reopens - , $_ - , &balance_tags() #, $local_closures - , $alltt_end, $reopens); - undef $open_tags_R; undef @save_open_tags; + $_ = join('', $closures, $alltt_start, $local_reopens + , $_ + , &balance_tags() #, $local_closures + , $alltt_end, $reopens); + undef $open_tags_R; undef @save_open_tags; }; $open_tags_R = [ @keep_open_tags ]; $_; @@ -2152,4 +2152,4 @@ sub do_cmd_verbatiminput{ . $_); } -1; # This must be the last line +1; # This must be the last line -- cgit v0.12