# HG changeset patch # User Rik # Date 1339092510 25200 # Node ID a52b03df22cbe492137e2a2d0258bc52dfb0de8f # Parent b7675598094a398e1761a60448dd072a512a4f4c maint: Use Octave 2-space indent for helper Perl scripts. * doc/interpreter/munge-texi.pl, scripts/mkdoc.pl: Use Octave 2-space indent for helper Perl scripts. diff --git a/doc/interpreter/munge-texi.pl b/doc/interpreter/munge-texi.pl --- a/doc/interpreter/munge-texi.pl +++ b/doc/interpreter/munge-texi.pl @@ -16,29 +16,29 @@ # Load DOCSTRINGS into memory while expanding @seealso references foreach $DOCSTRING_file (@ARGV) { - open (DOCFH, $DOCSTRING_file) or die "Unable to open $DOCSTRING_file\n"; + open (DOCFH, $DOCSTRING_file) or die "Unable to open $DOCSTRING_file\n"; - # Skip comments - while (defined ($_ = ) and /$comment_line/o) {;} + # Skip comments + while (defined ($_ = ) and /$comment_line/o) {;} - # Validate DOCSTRING file format - die "invalid doc file format\n" if (! /$doc_delim/o); - - do - { - chomp; - $symbol = substr ($_,1); - $docstring = extract_docstring (); - if ($help_text{$symbol}) - { - warn "ignoring duplicate entry for $symbol\n"; - } - else - { - $help_text{$symbol} = $docstring; - } + # Validate DOCSTRING file format + die "invalid doc file format\n" if (! /$doc_delim/o); + + do + { + chomp; + $symbol = substr ($_,1); + $docstring = extract_docstring (); + if ($help_text{$symbol}) + { + warn "ignoring duplicate entry for $symbol\n"; + } + else + { + $help_text{$symbol} = $docstring; + } - } while (! eof); + } while (! eof); } @@ -50,40 +50,40 @@ TXI_LINE: while () { - if (/^\s*\@DOCSTRING\((\S+)\)/) - { - $func = $1; - $docstring = $help_text{$func}; - if (! $docstring) - { - warn "no docstring entry for $func\n"; - next TXI_LINE; - } - - $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' - $docstring =~ s/^$tex_delim$/\@anchor{doc-$func}/m; - print $docstring,"\n"; - + if (/^\s*\@DOCSTRING\((\S+)\)/) + { + $func = $1; + $docstring = $help_text{$func}; + if (! $docstring) + { + warn "no docstring entry for $func\n"; next TXI_LINE; - } - if (/^\s*\@EXAMPLEFILE\((\S+)\)/) - { - $fname = "$top_srcdir/examples/$1"; - print '@verbatim',"\n"; - open (EXAMPFH, $fname) or die "unable to open example file $fname\n"; - while () - { - print $_; - print "\n" if (eof and substr ($_, -1) ne "\n"); - } - close (EXAMPFH); - print '@end verbatim',"\n\n"; + } + + $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' + $docstring =~ s/^$tex_delim$/\@anchor{doc-$func}/m; + print $docstring,"\n"; - next TXI_LINE; - } + next TXI_LINE; + } + if (/^\s*\@EXAMPLEFILE\((\S+)\)/) + { + $fname = "$top_srcdir/examples/$1"; + print '@verbatim',"\n"; + open (EXAMPFH, $fname) or die "unable to open example file $fname\n"; + while () + { + print $_; + print "\n" if (eof and substr ($_, -1) ne "\n"); + } + close (EXAMPFH); + print '@end verbatim',"\n\n"; - # pass ordinary lines straight through to output - print $_; + next TXI_LINE; + } + + # pass ordinary lines straight through to output + print $_; } @@ -92,33 +92,33 @@ ################################################################################ sub extract_docstring { - my ($docstring, $arg_list, $func_list, $repl, $rest_of_line); - - while (defined ($_ = ) and ! /$doc_delim/o) - { - # expand any @seealso references - if (m'^@seealso{') - { - # Join multiple lines until full macro body found - while (! /}/m) { $_ .= ; } + my ($docstring, $arg_list, $func_list, $repl, $rest_of_line); + + while (defined ($_ = ) and ! /$doc_delim/o) + { + # expand any @seealso references + if (m'^@seealso{') + { + # Join multiple lines until full macro body found + while (! /}/m) { $_ .= ; } - ($arg_list, $rest_of_line) = m'^@seealso{(.*)}(.*)?'s; - - $func_list = $arg_list; - $func_list =~ s/\s+//gs; - $repl = ""; - foreach $func (split (/,/, $func_list)) - { - $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' - $repl .= "\@ref{doc-$func,,$func}, "; - } - substr($repl,-2) = ""; # Remove last ', ' - $_ = "\@seealso{$repl}$rest_of_line"; + ($arg_list, $rest_of_line) = m'^@seealso{(.*)}(.*)?'s; + + $func_list = $arg_list; + $func_list =~ s/\s+//gs; + $repl = ""; + foreach $func (split (/,/, $func_list)) + { + $func =~ s/^@/@@/; # Texinfo uses @@ to produce '@' + $repl .= "\@ref{doc-$func,,$func}, "; } + substr($repl,-2) = ""; # Remove last ', ' + $_ = "\@seealso{$repl}$rest_of_line"; + } - $docstring .= $_; - } + $docstring .= $_; + } - return $docstring; + return $docstring; } diff --git a/scripts/mkdoc.pl b/scripts/mkdoc.pl --- a/scripts/mkdoc.pl +++ b/scripts/mkdoc.pl @@ -44,11 +44,10 @@ $full_fname = $srcdir . $m_fname; next MFILE unless ( $full_fname =~ m{(.*)/(@|)([^/]*)/(.*)\.m} ); - if ($2) { - $fcn = "$2$3/$4"; - } else { - $fcn = $4; - } + if ($2) + { $fcn = "$2$3/$4"; } + else + { $fcn = $4; } @help_txt = gethelp ($fcn, $full_fname); next MFILE if ($help_txt[0] eq "");