Mercurial > forge
changeset 2402:05105be999dc octave-forge
remove redundant admin directory
author | adb014 |
---|---|
date | Wed, 23 Aug 2006 22:54:00 +0000 |
parents | 4f2373c69368 |
children | db9486696ca1 |
files | main/gsl/src/admin/CONTENTS main/gsl/src/admin/OctRe.pm main/gsl/src/admin/change_va_arg.pm main/gsl/src/admin/find_changes main/gsl/src/admin/fntests.m main/gsl/src/admin/get_authors main/gsl/src/admin/get_contents main/gsl/src/admin/make_index main/gsl/src/admin/mkdoc main/gsl/src/admin/mkpkgadd main/gsl/src/admin/mktests.sh main/gsl/src/admin/mktexi main/gsl/src/admin/no_vr_val.pm main/gsl/src/admin/octlink.sh main/gsl/src/admin/run_forge main/gsl/src/admin/template.ndev main/gsl/src/admin/template.readme |
diffstat | 17 files changed, 0 insertions(+), 3222 deletions(-) [+] |
line wrap: on
line diff
--- a/main/gsl/src/admin/CONTENTS Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -Contains files and scripts used to administer the octave-forge -website and build the release files. Nothing in here is needed -by octave-forge users.
--- a/main/gsl/src/admin/OctRe.pm Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME OctRe - Regexes for octave code - -Regexpes come in pairs, I<$XYZ_re>,which don't set I<$1, $2, ...> -and I<$XYZ_rx>, which do. - -=over 4 - -=item I<$var_r[ex]> match an octave variable (sets I<$1>) - -=item I<$dot_r[ex]> match an ellipsis (sets I<$1>) - -=item I<$vl_r[ex]> match a variable list, as it appears in a function -call (sets I<$1>). The individual variables in $1 can be retrieved -with /$var_rx/g. Example : "x, y, z". - -=item I<retl_r[xe]> match a return list, as it appears in a function -declaration (sets I<$1>). The individual variables in $1 can be -retrieved with /$var_rx/g. Example : "[x]", "[ x, y]", "[x,y,z]", -"[x,...]". - -=item I<retl_r[xe]> match an argument list, as it appears in a -function declaration (sets I<$1>). The individual variables in $1 can -be retrieved with /$var_rx/g. Example : "(x)", "( x, y)", "(x,y,z)", -"(x,...)". - -=back - -Rem : This is not a true module, as no package is used. It just declares -some regexes. - -=cut - -## Variable $1 : variable name -$var_re = qr{\s*[A-Za-z\_]+\w*\s*} ; -$var_rx = qr{\s*([A-Za-z\_]+\w*)\s*} ; - -## Ellipsis $1 : ellipsis -$dot_re = qr{\.\.\.} ; -$dot_rx = qr{(\.\.\.)} ; # qr{(${var_re})(?:\,(${var_re}))*} ; - -## Variable list : $1, $2 ... variable names -$vl_re = qr{${var_re}(?:\,${var_re})*} ; -$vl_rx = qr{(${var_re})(?:\,(${var_re}))*} ; - -## Return list (as in function declaration) -## $1, $2 ... : variable names (or ellipsis at end) -$retl_re = qr{(?:\[\s*(?:${vl_re}(?:,$dot_re)?|$dot_re|)\s*\]|${var_re})\s*\=|} ; -$retl_rx = qr{(?:\[\s*(?:${vl_rx}(?:,$dot_rx)?|$dot_rx|)\s*\]|${var_rx})\s*\=|} ; - -# Simple assignment $1 : lhs name -$sas_re = qr{${var_re}\s*\=} ; -$sas_rx = qr{${var_rx}\s*\=} ; - -## Return list, as in function call. Call it "mas" like multiple -## assignment. -# $1, $2, ... : variable names -$mas_re = qr{(?:\[(?:${vl_re})\]|${var_re})\s*\=} ; -$mas_rx = qr{(?:\[(?:${vl_rx})\]|${var_rx})\s*\=} ; - -## Arg list as in function declaration -## $1, $2, ... : variable names -$argl_re = qr{(?:\((?:${vl_re}(?:,$dot_re)?|$dot_re|)\)|)} ; -$argl_rx = qr{(?:\((?:${vl_rx}(?:,$dot_rx)?|$dot_rx|)\)|)} ; - -## $retl_re = qr{(?:\((?:${vl_re}(?:,$dot_re)?|$dot_re|)\)|)} ; - -## $argl_re = qr{\((?:${var_re}(?:\,${var_re})*)?\)|} ; - -## Function definition -# $1 : return list; $2 : function name; $3 : arg list. -$defun_re = qr{^\s*function\s+${retl_re}\s*${var_re}${argl_re}} ; -$defun_rx = qr{^\s*function\s+(${retl_re})\s*(${var_rx})(${argl_re})} ; -## Two quoting chars -$qch2_re = qr{\\\\} ; - -## Quotes next character -$qch_re = qr{\\${qch2_re}*} ; - -## String -$str_re = qr{\'(?:[^'\n]|(?<!\\)${qch2_re}+\')*\'|\"(?:[^"\n]|(?<!\\)${qch2_re}+\")*\"} ; -$str_rx = qr{(\'(?:[^'\n]|(?<!\\)${qch2_re}+\')*\'|\"(?:[^"\n]|(?<!\\)${qch2_re}+\")*\")} ; - -## Parenthesis " -$oppar = qr{[\(\{\[]}; -$noppar = qr{[^\(\{\[]}; -$opparx = qr{([\(\{\[])}; - -$mcp = {"("=>")", "["=>"]", "{"=>"}"}; - - -## Comments -## Not perfect, but should catch most cases -## $com_re = qr{\#((?:[^'"]|(?<!\\)${qch2_re}*['"])*['"]|.*)} ; - -$cch_re = qr{[\#%]+}; -$cch_rx = qr{([\#%]+)}; - -1; -
--- a/main/gsl/src/admin/change_va_arg.pm Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -#!/usr/bin/perl -w -n - -## defines function change_line that transforms old-style variable argument -## lists (...) into new-style varargin. va_arg() etc are also transformed. - -BEGIN{ - - $va_arg_re = qr!^(\s*function\s*\w*.*?\(.*?)\.\.\.(\s*\).*)$!; - -} - -## Does necessary changes inplace on $_[0]. -sub change_line { - - if ($_[0] !~ /^\s*\#/) { # Don't do obvious comment lines - - # Transform ... in function decalaration - - $_[0] =~ s{$va_arg_re}{$1varargin$2}og; - - # list(all_va_args) becomes varargin - - $_[0] =~ s!list\s*\(\s*all_va_args\s*\)!varargin!og; - - # all_va_args becomes varargin{:} - - $_[0] =~ s!all_va_args!varargin{:}!og; - - # va_start() can be delicate, so add a - # warning. - - # declare a va_arg_cnt counter - - $_[0] =~ s!(.*\b)va_start\b(\s*\(\s*\)|)(.*)!$1va_arg_cnt = 1$3\nwarn ("va_start should be transformed\\n");\n!g; - - # Use that counter to substitute va_arg by - # nth (varargin, va_arg_cnt++) - - $_[0] =~ s!(.*\b)va_arg\b(\s*\(\s*\)|)(.*)!$1nth (varargin, va_arg_cnt++)$3!g; - } -} - -## Does it look like an underlined func that is not a function call? -sub comment_line { - 0 ? - "## Hmmm ... is that a function call?\n" : ""; -} -1;
--- a/main/gsl/src/admin/find_changes Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -#!/usr/bin/perl -w - -=head1 NAME find_changes.pl - Find patterns in text files and propose changes. - -This script passes lines of text through a perl function with the aim of -reporting the occurence of patterns and proposing changes to be -done. L<patch> should be used to actually modify the original files. - -=head1 SYNOPSIS - -find_changes.pl [options] changes_def file(s).txt ... E<gt> changes_patch - -Reads and executes the perl F<changes_def> file, which must contain the -definition of a function called C<change_line()>, and then reads the -F<file(s).txt> line by line. - -For each line of each file, the function F<change_line()> is called with the -line as single argument, which can be modified inplace. - -If any change is done to the line, it is reported by printing to stdout a -universal diff patch. - -=head2 Modifying files - -It is then recommended to inspect and edit the file F<changes_patch>, -removing lines that should not be changed. Once this is done, the changes -can be done in the original files by using C<patch -p0 < changes_patch>. - -=head2 Commenting on lines - -If a function C<comment_line()> is present, each line will be passed to it -and its output will be shown on standard error. - -=head1 OPTIONS - -=over 4 - -=item -p, --patch - -Output a patch (default). - -=item -d - -Use another output format, adapted to some F<do_changes.pl> script. - -=item -v, --verbose - -Print some info on stderr during execution. - -=item -h, --help - -Print a help message and exit. - -=head1 COPYRIGHT - -This file is distributed under the terms of the GNU General Public Licence. - -=head1 AUTHOR Etienne Grossmann E<lt>etienne@isr.ist.utl.ptE<gt> - -=cut - -### -sub help {system ("perldoc $0|cat")} - -$patch = 1; -$verbose = 0; - # Read options - -while (@ARGV && ($ARGV[0] =~ /^\-/)) { - if ($ARGV[0] =~ /^\-(h|\-help)$/){ help(); exit 0;} - elsif ($ARGV[0] =~ /^\-(v|\-verbose)$/){ $verbose = 1;} - elsif ($ARGV[0] =~ /^\-(p|\-patch)$/) { - $patch = 1; - } elsif ($ARGV[0] =~ /^\-(d)$/) { - $patch = 0; - } else { - die "Unknown option '$ARGV[0]'. Try '$0 --help'"; - } - - shift @ARGV; -} - -die "No definition file specified" unless @ARGV; - -$dfile = shift @ARGV; - - # Read and compile definition file -print STDERR "Definition file is $dfile\n" if $verbose; - -if (!defined (do ($dfile))) { - if ($!) { - print STDERR "Can't find $dfile : '$!'\n"; - exit 1; - } elsif ($@) { - print STDERR "Can't compile $dfile : '$@'\n"; - exit 1; - } else { - print STDERR "Problem with $dfile : do returns undefined\n"; - exit 1; - } -} - -if (!defined (&change_line)) { - print STDERR "File '$dfile' does not define a function 'change_line()'\n"; - exit 1; -} - -$has_comment = defined (&comment_line); - -foreach my $f (@ARGV) { - - if (!$patch) { - unless (open FF, "<$f") { - print "## Whoa!!! Can't open file '$f'. Skipping"; - next; - } - print STDERR "Scanning file $f\n" if $verbose; - - - local $lnum = 0; - while (! eof (FF)) { - - my $line = <FF>; # Read a line - my $olin = $line; - $lnum++; - - if ($has_comment) { - if ($comment = &comment_line ($line)) { - $comment = "## $comment" if $comment !~ /^\s*\#/; - $comment .= "\n" if $comment !~ /\n$/; - print "$f:$.:$comment"; - } - } - - &change_line ($line); - if ($olin ne $line) { - print "$f:$.:$olin"; - } - } - close FF; - } else { # Do a patch. Using diff, what else? - my $nf = "$f.new"; - my $i = 1; - while (-e $nf) { # Find a name for the temp file. - $nf = $f . ".new." . $i ; - } - unless (open FF, "<$f") { - print STDERR "## Whoa!!! Can't open file '$f'. Skipping\n"; - } - unless (open GG, ">$nf") { - print STDERR "## Whoa!!! Can't open temp file '$nf'. Skipping\n"; - next; - } - print STDERR "## Scanning file $f\n" if $verbose; - - while (! eof (FF)) { # Create (temp) transformed file - - my $line = <FF>; # Read a line - - &change_line ($line); - print GG $line; - } - close FF; close GG; - # Call diff and modify slightly the output - my $tmp = `diff -u $f $nf`; - $tmp =~ s{^\+\+\+ $nf}{+++ $f}m; - print $tmp; - - unlink($nf) or print STDERR "## Whoa!!! Can't remove temp file '$nf'\n"; - } -} -
--- a/main/gsl/src/admin/fntests.m Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -fid=fopen('fntests.log','wt'); -if fid<0,error('could not open fntests.log for writing');end -test('','explain',fid); -passes=0; tests=0; -printf('passes %d out of %d tests',passes,tests);disp(''); -printf('see fntests.log for details');disp(''); -fclose(fid);
--- a/main/gsl/src/admin/get_authors Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -#!/usr/bin/env perl -# -# Traverse the directory tree and extract author information from .m -# files. Put author information in the file 'AUTHORS'. -# Understands variations of these entries: -# -# ## Copyright (C) year(s) name1 <email> -# ## Copyright (C) year(s) name2 <email> -# ## Author: name3 <email> -# ## Author: name4 <email> -# -# Albert Danial Dec 15 2001 -# Nov 30 2002 - Attribute to 'Anonymous' any file which has -# licensing terms (ie, granted to public domain) -# but no author. Show code and comment line -# counts. -# Apr 25 2005 - Added -s option, better logic to identify -# public domain files. -# Dirk Eddelbuettel 07 Jul 2004 also look at .cc files and // comments -# -# Usage: admin/get_authors [-s <# lines>] -# Scans .m and .cc files and extracts author and copyright -# information. Creates the AUTHORS file. -# Option: -s <n> Set the size of a "short" program -# to <n> non-commented lines. -# Copyrights aren't needed for short -# programs. Default <n> is 5. -# -use warnings; -use strict; -use vars qw($opt_s ); -use Cwd; -use Getopt::Std; -use File::Find; - -getopts('s:'); -$opt_s = 5 unless $opt_s; # set the default value -my $location = getcwd; -my $PATH = ""; -if ($location =~ m{^(.*)/admin$}) { - chdir ".."; - $PATH = "$1/"; -} - -my @files = (); # to contain relative path names of each .m file -find(\&wanted, "."); # start here & descend recursively; populate @files - -my %file_data = (); -classify_files(\@files, # in - \%file_data); # out file_data{file}{'name'} = [ names ] - # {'year'} = [ years ] - # {'mail'} = [ email addrs ] - # {'cpyr'} = [ 'C' or ' ' ] - # {'n_code'} = # lines code - # {'n_comment'} = # lines of - # comments - -# traverse file_data and extract -# - files without copyrights -# - files without authors -# - files grouped by author -# - author to email map -# - number of lines of code, number of lines of comments -my @unattributed_files = (); -my @uncopyrighted_files = (); -my @short_files = (); -my @public_domain = (); -my %email = (); # email{ author name } = email address -my %files = (); # files{ author name } = [ list of files ] -foreach my $f (sort @files) { - # each file can have multiple authors, loop over each author - if (!defined @{$file_data{$f}{name}}) { - if ($file_data{$f}{n_code} > $opt_s) { # not a short program - push @unattributed_files, $f; - } else { - push @short_files , $f; - } - next; - } - my $copyrighted = 0; - for (my $i = 0; $i < scalar @{$file_data{$f}{name}}; $i++) { - if (defined $file_data{$f}{mail}[$i]) { - $email{ $file_data{$f}{name}[$i] } = $file_data{$f}{mail}[$i]; - } - if (defined $file_data{$f}{cpyr}[$i]) { - $copyrighted = 1; - push @public_domain, $f if $file_data{$f}{cpyr}[$i] eq "P"; - } - $files{ $file_data{$f}{name}[$i] }{$f} = 1; - } - next if $copyrighted; - if ($file_data{$f}{n_code} > $opt_s) { # then it is not a short program - push @uncopyrighted_files, $f; - } else { - push @short_files , $f; - } -} - -printf "%3d uncopyrighted files:%s lines of code/lines of comments\n", - scalar @uncopyrighted_files, ' ' x 22; -foreach my $f (sort @uncopyrighted_files) { - printf " %-50s %3d/%3d\n", - $f, $file_data{$f}{n_code}, $file_data{$f}{n_comment}; -} - -printf "\n%3d unattributed files:%s lines of code/lines of comments\n", - scalar @unattributed_files, ' ' x 23; -foreach my $f (sort @unattributed_files) { - printf " %-50s %3d/%3d\n", - $f, $file_data{$f}{n_code}, $file_data{$f}{n_comment}; -} - -printf "\n%3d public domain files:%s lines of code/lines of comments\n", - scalar @public_domain, ' ' x 22; -foreach my $f (sort @public_domain) { - printf " %-50s %3d/%3d\n", - $f, $file_data{$f}{n_code}, $file_data{$f}{n_comment}; -} - -printf "\n%3d uncopyrighted short (<= %2d lines) files:%s lines of code/lines of comments\n", - scalar @short_files, $opt_s, ' ' x 2; -foreach my $f (sort @short_files) { - printf " %-50s %3d/%3d\n", - $f, $file_data{$f}{n_code}, $file_data{$f}{n_comment}; -} - -my $Auth_file = "AUTHORS"; -open(OUT, ">$Auth_file") or die "Cannot write $Auth_file: $!\n"; -printf "%3d authors:\n", scalar keys %files; -foreach my $n (sort keys %files) { - printf "%-28s", $n; - printf OUT "%-28s", $n; - print $email{$n} if defined $email{$n}; - print OUT $email{$n} if defined $email{$n}; - print "\n"; - print OUT "\n"; - my $i = 0; - foreach my $f (sort keys %{$files{$n}}) { - printf "%3d. %-50s %3d/%3d\n", - ++$i, $f, $file_data{$f}{n_code}, $file_data{$f}{n_comment}; - } -} -close OUT; -warn "Wrote ${PATH}${Auth_file}\n"; - -# # # # # # # - -#sub by_last_name { # {{{1 for sorting on names -# (my $A = $a) =~ s/.*?(\w+)$/$1/; -# (my $B = $b) =~ s/.*?(\w+)$/$1/; -# return lc($A) cmp lc($B); -#} # 1}}} - -# # # # # # # - -sub classify_files { # {{{1 - my ($ra_files, # in, list of files - $rhha_data, # out, data{file}{ name | year | cpyr } = [entries] - ) = @_; - warn "Found ", scalar grep (/\.m$/, @{$ra_files}), " .m files; ", - scalar grep (/\.cc$/, @{$ra_files}), " .cc files", - "\n"; - foreach my $f (@{$ra_files}) { - open(IN, $f) or die "Cannot read $f: $!\n"; - my $found_copyright = 0; - my $found_author = 0; - $rhha_data->{$f}{n_code} = 0; - $rhha_data->{$f}{n_comment} = 0; - while (<IN>) { - # find the copyright line and extract author info from it - if (/^[#%\/]+/) { # a comment - ++$rhha_data->{$f}{n_comment}; - } elsif (!/^\s*$/) { # not a blank line - ++$rhha_data->{$f}{n_code}; - } - s/all\s+rights\s+reserved\.?//i; - s/\bby\s+//i; - - if (/^\s*[#%\/\*]* # one or more leading comment markers - \s*copyright # Copyright - \s*(\(c\))? # (c) - optional $1 - \s*(\d[,\- 0-9]+) # Year (or years) $2 - \s+(\w.*?) # name $3 - \s*(<.*>)? # email - optional $4 - \s*$/ix) { - $found_copyright = 1; - $found_author = 1; - my $year = $2; - my $name = $3; - $name = "John W. Eaton" if $name eq "jwe"; - $name =~ s/\.\s*$//; # strip trailing period - my $email = "" || $4; - $name =~ s/^\s+//; # strip leading whitespace - $name =~ s/\s+$//; # strip trailing whitespace - push @{$rhha_data->{$f}{name}}, $name; - push @{$rhha_data->{$f}{year}}, $year; - push @{$rhha_data->{$f}{mail}}, $email; - push @{$rhha_data->{$f}{cpyr}}, 'C'; - # don't exit w/last because there could be multiple copyrights - } elsif ( - /^\s*[#%\/\*]* # one or more leading comment markers - \s*author\s*:? # Author - \s+(\w.*?) # name $1 - \s*(<.*>)? # email - optional $2 - \s*$/ix) { - my $name = $1; - $name =~ s/\.\s*$//; # strip trailing period - $name = "John W. Eaton" if $name eq "jwe"; - my $email = "" || $2; - push @{$rhha_data->{$f}{name}}, $name; - push @{$rhha_data->{$f}{year}}, ""; - push @{$rhha_data->{$f}{mail}}, $email; - $found_author = 1; - } elsif ( - /^\s*[#%\/\*]* # one or more leading comment markers - .*? # some leading text - \b(grant(ed)?|place(d)?|give(n)?|is)(\s+this)? - (\s+(file|program|script|code|algorithm))?(\s+(in|to))? - (\s+the)? - \s+public\s+domain - /ix) { - push @{$rhha_data->{$f}{cpyr}}, 'P'; - $found_copyright = 1; - } - } - if ($found_copyright and !$found_author) { - push @{$rhha_data->{$f}{name}}, "Anonymous"; - push @{$rhha_data->{$f}{year}}, ""; - push @{$rhha_data->{$f}{mail}}, ""; - push @{$rhha_data->{$f}{cpyr}}, 'C'; - } - close IN; - } -} # 1}}} - -# # # # # # # - -sub wanted { # {{{1 populates global array @files - return unless -f and /\.(m|cc)$/; # only want .m files (for now) - push @files, "$File::Find::name"; -} # 1}}}
--- a/main/gsl/src/admin/get_contents Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -#!/usr/bin/env perl -# -# Traverse the directory tree and look for files called 'CONTENTS'. -# Insert the text from these files into octave-forge documentation -# files such as the top-level README, and the developer's guide. -# Issues: -# - Entries in the README appear in the sort order of -# the directory names the CONTENTS files are in. This -# isn't necessarily the best sequence since some directories -# such as main/ should appear first. -# - At the moment the text in the CONTENTS files should be plain -# text. Planning to allow texinfo for layout control in .html -# files. -# -# Albert Danial Jan 2 2002 - -use strict; -use File::Find; - -my $location = `pwd`; -my $PATH = ""; -if ($location =~ m{^(.*)/admin$}) { - chdir ".."; - $PATH = "$1/"; -} - -my @files = (); # to contain relative path names of each CONTENTS file -find(\&wanted, "."); # start here & descend recursively; populate @files - -fill_README(@files); # creates 'README' from 'template.readme' -fill_developer_html(@files); # creates 'new_developer.html' from 'template.ndev' - -# # # # # # # - -sub fill_README { # {{{1 - my (@files, ) = @_; - my $template = "admin/template.readme"; # -> reads - my $RM = "README"; # -> writes - if (!-r $template) { - warn "Unable to read the file '$template'; cannot make README\n"; - return; - } - open(IN, $template) or die "Unable to read $template: $!\n"; - my @template_data = <IN>; # slurp the entire file - close IN; - - my $added_contents = 0; - my $top_of_file = 1; - open(README, ">$RM") or die "Unable to write $RM: $!\n"; - foreach my $t (@template_data) { - if ($top_of_file) { # skip over warning lines in - next if $t =~ /^-> /; # template starting with '->' - $top_of_file = 0; - } elsif ($added_contents) { - print README $t; - next; - } elsif ($t =~ /^Project organization/) { - print README "$t\n"; - foreach (sort @files) { - open(CONTENTS, $_) or die "Cannot read $_: $!\n"; - my @c = <CONTENTS>; - close CONTENTS; - m{^(.*)/(.*?)$}; # match directory and file's basename - my $dir = $1; - my $file = $2; - $dir =~ s{^\./}{}; # strip leading ./ - print README "$dir/\n"; - foreach my $line (@c) { - print README "\t$line"; - } - print README "\n"; - } - $added_contents = 1; - } else { - print README $t; - } - } - close README; - warn "Use 'cvs diff ${PATH}${RM}' to determine if updates are needed.\n"; - warn "Use 'cvs commit ${PATH}${RM}' to update README.\n"; -} # 1}}} - -# # # # # # # - -sub fill_developer_html { # {{{1 - my (@files, ) = @_; - my $template = "admin/template.ndev"; # <- reads - my $RM = "doc/new_developer.html"; # <- writes - if (!-r $template) { - warn "Unable to read the file '$template'; cannot make README\n"; - return; - } - open(IN, $template) or die "Unable to read $template: $!\n"; - my @template_data = <IN>; # slurp the entire file - close IN; - - my $added_contents = 0; - my $top_of_file = 1; - open(README, ">$RM") or die "Unable to write $RM: $!\n"; - foreach my $t (@template_data) { - if ($top_of_file) { # skip over warning lines in - next if $t =~ /^-> /; # template starting with '->' - $top_of_file = 0; - } elsif ($added_contents) { - print README $t; - next; - } elsif ($t =~ /^>>>INSERT CONTENTS HERE<<</) { - foreach (sort @files) { - open(CONTENTS, $_) or die "Cannot read $_: $!\n"; - my @c = <CONTENTS>; - close CONTENTS; - text_bullet_list_to_HTML(\@c); - m{^(.*)/(.*?)$}; # match directory and file's basename - my $dir = $1; - my $file = $2; - $dir =~ s{^\./}{}; # strip leading ./ - print README "\t<li> <b><tt>$dir/</tt></b><br>\n"; - foreach my $line (@c) { - # use fixed font for words that end with / - # (ie, directory names). - $line =~ s{\s(\S+/)([.,\s])}{ <tt>$1</tt>$2}g; - print README "\t$line"; - } - print README "\n"; - } - $added_contents = 1; - } else { - print README $t; - } - } - close README; - warn "Use 'scp ${PATH}${RM} \$OFHOME' to update the web.\n"; -} # 1}}} - -# # # # # # # - -sub text_bullet_list_to_HTML { # {{{1 - # Takes an array of plain text lines and embeds <ul>, <li>, and </ul> - # tags as appropriate to turn a text bullet list (denoted by *) into - # an html equivalent. - # Can only handle a single bullet list. - my ($ra_contents, ) = @_; - my $found_list = 0; - foreach my $l (@{$ra_contents}) { - if ($l =~ /^\s*\*/) { - $found_list = 1; - last; - } - } - return unless $found_list; # bail if no list found - - # find the first and last lines of the bullet list - my $start_line = 0; - for (my $i = 0; $i < scalar @{$ra_contents}; $i++) { - if ($ra_contents->[$i] =~ /^\s*\*/) { - $start_line = $i; - last; - } - } - my $end_line = 0; - for (my $i = scalar @{$ra_contents} - 1; $i >= 0; $i--) { - if ($ra_contents->[$i] =~ /^\s*\*/) { - $end_line = $i; - last; - } - } - - # finally, insert the HTML - for (my $i = 0; $i < scalar @{$ra_contents}; $i++) { - $ra_contents->[$i] =~ s{^(\s*)\*}{$1 <li>}; - $ra_contents->[$i] = "<ul> " . $ra_contents->[$i] if $i == $start_line; - $ra_contents->[$i] = $ra_contents->[$i] . "</ul>" if $i == $end_line; - } -} # 1}}} - -# # # # # # # - -sub wanted { # populates global array @files - return unless -f and /^CONTENTS$/; - push @files, "$File::Find::dir/$_"; -}
--- a/main/gsl/src/admin/make_index Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1148 +0,0 @@ -#!/usr/bin/env perl -# -# Albert Danial Mar 21 2002 -# -# Creates .html files documenting all the functions in octave and -# octave-forge. - -use strict; -use File::Find; -use File::Basename; -use Text::Wrap; -use FileHandle; -use IPC::Open3; -use POSIX ":sys_wait_h"; - -## Local configuration; the OCTAVE directory should contain -# src/DOCSTRINGS (which is a build product) and scripts/. -my $OCTAVE = "../octave"; -my $tmpdir = "/tmp"; # temp directory -my $catdir = "index"; # output directory - -## Commands to grab the last few defs from octave -## Use the first def if you want to extract from -## a locally compiled version, or the second if you -## want to use the installed version. -#my $OCTAVECMD = "LD_LIBRARY_PATH=$OCTAVE/src/:$OCTAVE/liboctave:$OCTAVE/libcruft $OCTAVE/src/octave -q"; -#my $OCTAVEINIT = "path='.:$OCTAVE/src//:$OCTAVE/scripts//'; suppress_verbose_help_message = 1;"; -my $OCTAVECMD = "octave -q"; -my $OCTAVEINIT = "suppress_verbose_help_message = 1;"; - -# Links to octave/octave-forge web CVS -my $OCTAVECVS = "http://www.octave.org/cgi-bin/viewcvs.cgi/~checkout~/octave"; -my $FORGECVS = "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/octave/octave-forge/"; - -#my $script = basename($0); - -my $forgebar = qq~<center> -<A href="http://octave.sourceforge.net">Home</A> | -<A href="http://sourceforge.net/projects/octave/">Summary</A> | -<A href="http://sourceforge.net/forum/?group_id=2888">Forums</A> | -<A href="http://sourceforge.net/bugs/?group_id=2888">Bugs</A> | -<A href="http://sourceforge.net/support/?group_id=2888">Support</A> | -<A href="http://sourceforge.net/patch/?group_id=2888">Patches</A> | -<A href="http://sourceforge.net/mail/?group_id=2888">Lists</A> | -<A href="http://sourceforge.net/pm/?group_id=2888">Tasks</A> | -<A href="http://sourceforge.net/docman/?group_id=2888">Docs</A> | -<A href="http://sourceforge.net/survey/?group_id=2888">Surveys</A> | -<A href="http://sourceforge.net/news/?group_id=2888">News</A> | -<A href="http://sourceforge.net/cvs/?group_id=2888">CVS</A> | -<A href="http://sourceforge.net/project/showfiles.php?group_id=2888">Files</A> -</center> - ~; - -my $forgelink = qq~ -<hr><center> -<small>Hosted by</small> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=2888&type=4" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a> -</center> - ~; - -# initialize the indexing variables -my %index_by_TB_cat = (); # i_TB_cat{toolbox}{category} = list of functions -my %index_by_function = (); # i_function{function} =[ [toolbox_1,category_1], -# [toolbox_2,category_2],..] -my %TB_description = (); -my %index_notes = (); # index_notes{function} = comment - -# find and load all indices -my @index_files = (); -find(\&index_files, "."); -sub index_files { # {{{1 populates global array @files - return unless -f and /INDEX$/; # INDEX files - my $path = "$File::Find::dir/$_"; - $path =~ s|^[.]/||; - push @index_files, $path; -} # 1}}} -foreach my $f ( @index_files ) { - load_index($f, - \%index_by_TB_cat, - \%TB_description, - \%index_by_function); -} - -# XXX FIXME XXX should die if the index is empty -# die "No INDEX in current directory" if !-e "INDEX"; -my $summary = !-e "admin/make_index"; # if not in the root, just summarize -my $include_octave = !$summary; # only include octave if not summarizing - -# locate all C++ and m-files in octave-forge, and all m-files in octave -# don't need C++ files from octave because we have DOCSTRINGS -my @m_files = (); -my @C_files = (); -find(\&cc_and_m_files, "$OCTAVE/scripts") if $include_octave; -find(\&cc_and_m_files, "$OCTAVE/src") if $include_octave; - # or just use $OCTAVE/{src,scripts}/DOCSTRINGS .... -find(\&cc_and_m_files, "."); -sub cc_and_m_files { # {{{1 populates global array @files - return unless -f and /\.(m|cc|l|y)$/; # .m and .cc files (lex & yacc too!) - my $path = "$File::Find::dir/$_"; - $path =~ s|^[.]/||; - if (/\.m$/) { - push @m_files, $path; - } else { - push @C_files, $path; - } -} # 1}}} - -my %function_description = (); -my %octave_forge_function = (); -my @uncategorized = (); -my @skipped = (); -my %n_appearances = (); -my $n_functions = 0; -my @shadow_paths = ('FIXES', 'extra/NaN', 'extra/Windows', 'extra/ver20'); -my @shadowed = (); - -# grab help from C++ files -foreach my $f ( @C_files ) { - if ( open(IN,$f) ) { - while (<IN>) { - # skip to the next function - next unless /^\s*DEF(UN[ (]|UN_MAPPER|UN_DLD|CMD|VAR|CONST)/; - - # print "looking at $_"; - # extract function name to pattern space - /\((\w*)\s*,/; - # remember function name - my $function = $1; - # print " found function $function\n"; - - # skip to second , to skip default string options of DEFVAR - # comment if third or higher arg - # XXX FIXME XXX What about if the string arg includes , - # XXX FIXME XXX What if second , is not on first line!! - # Special cases - # * for DEFCONST (I, Complex (0., 1.), - s/\(\w*\s*,\s*Complex\s*\(\s*[0-9.]*\s*,\s*[0-9.]*\s*\),//; - # * for macro containing DEFUN_DLD - s/\w*\s*\(\w*\s*,\s*"/"/; - # Main case - s/\(\w*\s*,.*?,//; - - # If we have nothing but a newline, skip - $_ = <IN> if /^\s*DEF(UN[ (]|UN_MAPPER|UN_DLD|CMD|VAR|CONST)\s*,*\s*\n/; - - # if line contains \w+_DOC_STRING we have a macro for the - # help text - my $desc; - if (/\w+_DOC_STRING/) { - my $macro = $_; - $macro =~ s/^.*?\s*(\w*_DOC_STRING).*$/$1/; - $macro =~ s/\n//; - - my $line; - if ( open(IN2, $f) ) { - while ($line = <IN2>) { - next unless $line =~ /^\#\s*define\s+$macro\s+\"/; - $desc = $line; - $desc =~ s/^\#\s*define\s+$macro\s+\"(.*\n)$/$1/; - while ($desc !~ /[^\\]\"/ && $desc !~ /^\"/) { - $desc =~ s/\\\s*\n//; - # join with the next line - $desc .= <IN2>; - } - $desc = "" if $desc =~ /^\"/; # chop everything if it was "" - $desc =~ s/\\n/\n/g; # insert fake line ends - $desc =~ s/([^\"])\".*$/$1/; # chop everything after final '"' - $desc =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\" - last; - } - close (IN2); - } else { - print STDERR "Could not open file ($f): $!\n"; - } - } else { - # skip to next line if comment doesn't start on this line - # XXX FIXME XXX maybe we want a loop here? - $_ = <IN> unless /\"/; - # skip to the beginning of the comment string by - # chopping everything up to opening " - $desc = $_; - $desc =~ s/^[^\"]*\"//; - - # join lines until you get the end of the comment string - # plus a bit more. You need the "plus a bit more" because - # C compilers allow implicitly concatenated string constants - # "A" "B" ==> "AB". - while ($desc !~ /[^\\]\"\s*[\,\)]/ && $desc !~ /^\"/) { - # if line ends in '\', chop it and the following '\n' - $desc =~ s/\\\s*\n//; - # join with the next line - $desc .= <IN>; - # eliminate consecutive quotes, being careful to ignore - # preceding slashes. XXX FIXME XXX what about \\" ? - $desc =~ s/([^\\])\"\s*\"/$1/; - } - $desc = "" if $desc =~ /^\"/; # chop everything if it was "" - - # Now check for text included in help messages as macros - # XXX FIXME XXX These macros are often compile dependent, so - # how to we get the correct version of the macro in this case - # without actually compiling the code??? - while ($desc =~ /[^\\]\"\s*\S+\s*[^\\]\"/) { - my $macro = $desc; - # Deal with issues of multiple macros... - # $macro =~ s/^.*[^\\]\"\s*(\S+?)\s*[^\\]\".*$/$1/; - ($macro) = ($macro =~ /[^\\]\"\s*(\S+?)\s*\".*$/); - $macro =~ s/\n//; - my $macro_defn; - my $line; - if ( open(IN2, $f) ) { - while ($line = <IN2>) { - next unless $line =~ /^\#\s*define\s+$macro\s+\"/; - $macro_defn = $line; - $macro_defn =~ s/^\#\s*define\s+$macro\s+\"(.*)\n$/$1/; - while ($macro_defn !~ /[^\\]\"/ && $macro_defn !~ /^\"/) { - $macro_defn =~ s/\\\s*\n//; - # join with the next line - $macro_defn .= <IN2>; - } - $macro_defn = "" if $macro_defn =~ /^\"/; # chop everything if it was "" - $macro_defn =~ s/\\n/\n/g; # insert fake line ends - $macro_defn =~ s/([^\"])\".*$/$1/; # chop everything after final '"' - $macro_defn =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\" - last; - } - close (IN2); - } else { - print STDERR "Could not open file ($f): $!\n"; - } - $desc =~ s/\"\s*$macro\s*\"/$macro_defn/; - } - } - - $desc =~ s/\\n/\n/g; # insert fake line ends - $desc =~ s/([^\"])\".*$/$1/; # chop everything after final '"' - $desc =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\" -# print " description: $desc"; - - # register the function with a brief description - register_function($function,$desc,$f,0); - } - close (IN); - } else { - print STDERR "Could not open file ($f): $!\n"; - } -} - -# grab help from m-files (octave-forge and octave) -foreach my $f ( @m_files ) { - my $desc = extract_description($f); - my $function = basename($f, ('.m')); - die "Null function?? [$f]\n" unless $function; - register_function($function,$desc,$f,0); -} - -# grab help from octave's DOCSTRINGS -if ( !$include_octave ) { - # skip DOCSTRINGS if just summary -} -else { - - if (open (IN,"$OCTAVE/src/DOCSTRINGS")) { - process_docstrings(); - } else { - print STDERR "could not open $OCTAVE/src/DOCSTRINGS !\n"; - } - if (open (IN,"$OCTAVE/scripts/DOCSTRINGS")) { - process_docstrings(); - } else { - print STDERR "could not open $OCTAVE/scripts/DOCSTRINGS !\n"; - } -} - -# Desperate last measure. Try help <func> within octave. Good for getting -# keyword and operator descriptions -print "Perl hacker: please make the following faster\n"; -# XXX FIXME XXX, we shouldn't respawn a new octave process each time !!! -foreach my $TB ( toolbox_list()) { - foreach my $cat ( cat_list($TB) ) { - foreach my $func ( cat_funcs($TB,$cat) ) { - if (! defined $function_description{$func}[1] && ! defined $index_notes{$func} ) { - open3(*Writer, *Reader, *Errer, $OCTAVECMD) or die "Could not run octave"; - print Writer $OCTAVEINIT; - print Writer "help $func; 1"; close(Writer); - my @lines = <Reader>; close(Reader); - my @err = <Errer>; close(Errer); - waitpid(-1,&WNOHANG); - - # Display errors, if any - if (@err) { - print "help $func\n>>> @err"; - } else { - my $body = join("",@lines); - if ($body =~ /help: `(.*)' not found/ || $body =~ /help: sorry,/) { - # do nothing - } else { - print "help $func\n"; - - my $start; - if ($body =~ /^\n\*\*\*/) { - # clipping assuming ops/keywords only - $start = index($body,"$func") + 1 + length($func); - } else { - # first lines till \n\n will be octave tell us the type - # of variable/funtion and where it is found - $start = index($body,"\n\n") + 2; - } - my $stop = index($body,"ans ="); - $body = substr($body,$start,$stop-$start); - register_function($func,$body,$OCTAVE,0); - } - } - } - } - } -} - -# print a summary table rather than generating the html -if ( $summary ) { - write_ascii("% "); -} -else { - write_html(); -} - - -if (@skipped) { - print "skipped ", scalar(@skipped), " functions "; - my $rs = $,; $, = "\n "; - print " ", sort(@skipped); $, = $rs; - print "\n"; -} - -print_missing(); - -if (@uncategorized) { - print scalar(@uncategorized), " uncategorized functions "; - print "(out of ", $n_functions, " total)"; - my $rs = $,; $, = "\n "; - print " ", sort(@uncategorized); $, = $rs; - print "\n"; -# print wrap("\t", "\t", join(" ", sort @uncategorized)), "\n"; -} - -if (@shadowed) { - print "unexpected shadowing of ", scalar(@shadowed), " Octave functions"; - my $rs = $,; $, = "\n "; - print " ", sort(@shadowed); $, = $rs; - print "\n"; -# print wrap("\t", "\t", join(" ", sort @shadowed)), "\n"; -} - -sub process_docstrings { - my $function = ""; - my $desc = ""; - while (<IN>) { - if (/^\037/) { - register_function($function,$desc,$OCTAVE,1) unless $function eq ""; - $function = $_; - $function =~ s/^\037//; - $function =~ s/\n$//; - $desc = ""; - } else { - $desc .= $_; - } - } - register_function($function,$desc,$OCTAVE,1) unless $function eq ""; - close(IN); -} - -sub first_sentence { # {{{1 -# grab the first real sentence from the function documentation - my ($desc) = @_; - my $retval = ''; - my $line; - my $next; - my @lines; - - my $trace = 0; - # $trace = 1 if $desc =~ /Levenberg/; - return "" unless defined $desc; - if ($desc =~ /^\s*-[*]- texinfo -[*]-/) { - - # help text contains texinfo. Strip the indicator and run it - # through makeinfo. (XXX FIXME XXX this needs to be a function) - $desc =~ s/^\s*-[*]- texinfo -[*]-\s*//; - my $cmd = "makeinfo --fill-column 1600 --no-warn --no-validate --no-headers --force --ifinfo"; - open3(*Writer, *Reader, *Errer, $cmd) or die "Could not run info"; - print Writer "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n"; - print Writer "$desc"; close(Writer); - @lines = <Reader>; close(Reader); - my @err = <Errer>; close(Errer); - waitpid(-1,&WNOHANG); - - # Display source and errors, if any - if (@err) { - my $n = 1; - foreach $line ( split(/\n/,$desc) ) { - printf "%2d: %s\n",$n++,$line; - } - print ">>> @err"; - } - - # Print trace showing formatted output -# print "<texinfo--------------------------------\n"; -# print @lines; -# print "--------------------------------texinfo>\n"; - - # Skip prototype and blank lines - while (1) { - return "" unless @lines; - $line = shift @lines; - next if $line =~ /^\s*-/; - next if $line =~ /^\s*$/; - last; - } - - } else { - -# print "<plain--------------------------------\n"; -# print $desc; -# print "--------------------------------plain>\n"; - - # Skip prototype and blank lines - @lines = split(/\n/,$desc); - while (1) { - return "" if ($#lines < 0); - $line = shift @lines; - next if $line =~ /^\s*[Uu][Ss][Aa][Gg][Ee]/; # skip " usage " - next if $line =~ /^\s*-/; # skip " -- blah" - - $line =~ s/^\s*\w+\s*://; # chop " blah : " - print "strip blah: $line\n" if $trace; - $line =~ s/^\s*[Ff]unction\s+//; # chop " function " - print "strip function $line\n" if $trace; - $line =~ s/^\s*\[.*\]\s*=\s*//; # chop " [a,b] = " - print "strip []= $line\n" if $trace; - $line =~ s/^\s*\w+\s*=\s*//; # chop " a = " - print "strip a= $line\n" if $trace; - $line =~ s/^\s*\w+\s*\([^\)]*\)\s*//; # chop " f(x) " - print "strip f(x) $line\n" if $trace; - $line =~ s/^\s*[;:]\s*//; # chop " ; " - print "strip ; $line\n" if $trace; - - $line =~ s/^\s*[[:upper:]][[:upper:]0-9_]+//; # chop " BLAH" - print "strip BLAH $line\n" if $trace; - $line =~ s/^\s*\w*\s*[-]+\s+//; # chop " blah --- " - print "strip blah --- $line\n" if $trace; - $line =~ s/^\s*\w+ *\t\s*//; # chop " blah <TAB> " - print "strip blah <TAB> $line\n" if $trace; - $line =~ s/^\s*\w+\s\s+//; # chop " blah " - print "strip blah <NL> $line\n" if $trace; - -# next if $line =~ /^\s*\[/; # skip [a,b] = f(x) -# next if $line =~ /^\s*\w+\s*(=|\()/; # skip a = f(x) OR f(x) - next if $line =~ /^\s*or\s*$/; # skip blah \n or \n blah - next if $line =~ /^\s*$/; # skip blank line - next if $line =~ /^\s?!\//; # skip # !/usr/bin/octave - # XXX FIXME XXX should be testing for unmatched () in proto - # before going to the next line! - last; - } - } - - # Try to make a complete sentence, including the '.' - if ( "$line " !~ /[^.][.]\s/ && $#lines >= 0) { - my $next = $lines[0]; - $line =~ s/\s*$//; # trim trailing blanks on last - $next =~ s/^\s*//; # trim leading blanks on next - $line .= " $next" if "$next " =~ /[^.][.]\s/; # ends the sentence - } - - # Tidy up the sentence. - chomp $line; # trim trailing newline, if there is one - $line =~ s/^\s*//; # trim leading blanks on line - $line =~ s/([^.][.])\s.*$/$1/; # trim everything after the sentence - print "Skipping:\n$desc---\n" if $line eq ""; - - # And return it. - return $line; - -} # 1}}} -sub shadow_path { # {{{1 -# shadow_path($f) returns true if $f is on a known Octave shadow path - my ($file) = @_; - $file =~ s|/[^/]*$||; - my @matches = grep(/^$file$/,@shadow_paths); -# print "looking for $file in @shadow_paths\n"; -# print "returns ",@matches,"\n"; - return scalar(@matches) > 0 || $file =~ /alternatives$/; - -} # 1}}} -sub register_function { # {{{1 -# register the function and its one-line description - my ($function, # in $index{toolbox}{category} = [functions] - $desc, # in $toolbox_desc{toolbox} = description - $file, - $replace_shadow, - ) = @_; - ++$n_appearances{$function}; - if ($n_appearances{$function} > 1) { - if ($replace_shadow != 0) { - push @shadowed, "$file:$function" if $file =~ /^$OCTAVE/ - and !shadow_path($function_description{$function}[0]); - # print "$file:$function appeared previously\n"; - } - } else { - ++$n_functions; - } - - $octave_forge_function{$function} = 1 unless $file =~ /^$OCTAVE/; - if (!defined $index_by_function{$function}) { - my $entry = $file; - $entry = "$file: $function" if $file !~ /[.]m$/; - if ($function =~ /__/ || $file =~ /test/ - || $function =~ /^[Cc]ontents?$/) { - push @skipped, $entry; - } else { - push @uncategorized, $entry; - } - } - - my $oneline = first_sentence($desc); - #printf "%30s %s\n", $function, $oneline; - if ($replace_shadow == 0 && defined @function_description{$function}) { - @function_description{$function} = [ $function_description{$function}[0], $oneline, $desc ]; - } elsif (!defined @function_description{$function}) { - @function_description{$function} = [ $file, $oneline, $desc ]; - } -# push @function_description{$function}}, "$file\n$oneline\n$desc"; - #printf "%-12s %-20s %s\n", $function, - # $index_by_function{$function}[0], - # $index_by_function{$function}[1]; -} # 1}}} -sub extract_description { # {{{1 -# grab the entire documentation comment from an m-file - my ($file) = @_; - my $retval = ''; - - if( open( IN, "$file")) { - # skip leading blank lines - while (<IN>) { - last if /\S/; - } - if( m/\s*[%\#][\s\#%]* Copyright/) { - # next block is copyright statement, skip it - while (<IN>) { - last unless /^\s*[%\#]/; - } - } - # Skip everything until the next comment block - while ( !/^\s*[\#%]/ ) { - $_ = <IN>; - last if not defined $_; - } - # Return the next comment block as the documentation - while (/^\s*[\#%]/) { - s/^[\s%\#]*//; # strip leading comment characters - s/[\cM\s]*$//; # strip trailing spaces. - $retval .= "$_\n"; - $_ = <IN>; - last if not defined $_; - } - close(IN); - return $retval; - } - else { - print STDERR "Could not open file ($file): $!\n"; - } -} # 1}}} -sub load_index { # {{{1 - my ($file) = @_; # in - my $toolbox = "extra"; - my $category = ""; - my $description = ""; - my $function = ""; - open(IN, $file) or die "Cannot read $file: $!\n"; - my %map; # simple macros for use in notes - while (<IN>) { - next if /^\s*$/; # skip blank lines - next if /^\s*\#/; # skip comment lines - chomp; - if (/^(.*?)\s*>>\s*(.*?)$/) { - # toolbox lines contain "word >> description" - $toolbox = $1; - $description = $2; - $category = ""; - $TB_description{$toolbox} = $description; - } elsif (/^\s*\$(\w+)\s*=\s*(\S.*\S)\s*$/) { - # define a variable as "$var = expansion" - $map{$1} = $2; - } elsif (/^(\w.*?)\s*$/) { - # category lines start in the left most column - $category = $1; - } elsif (/^\s+(\S.*[^=~!><])=\s*(\S.*\S)\s*$/) { - # Process "function = notes" explicit descriptions - $function = $1; - $description = $2; - - # We used ...(\S.*)=... rather than (\S.*\S)\s*= to allow for - # single character function names, but that means we may have - # to trim some extra spaces of the function name. Single - # character descriptions get the treatment they deserve. - $function =~ s/\s+$//; - - # expand all $var in the description - my @parts = split('\$', $description); - foreach my $i ( 1 .. $#parts ) { - $parts[$i] =~ /^(\w+)(\W.*)$/ or $parts[$i] =~ /^(\w+)()$/; - $parts[$i] = "$map{$1}$2"; - } - $description = join("",@parts); - - # record the function->description mapping - $index_notes{$function} = $description; - die "Function $function (line $.) has no category" unless $category; - push @{$index_by_TB_cat{$toolbox}{$category}}, $function; - push @{$index_by_function{$function}}, [$toolbox, $category]; - } else { - s/^\s+//; - my @list = split /\s+/; - while ($#list >= 0) { - $function = shift @list; - die "Function $function (line $.) has no category" unless $category; - push @{$index_by_TB_cat{$toolbox}{$category}}, $function; - push @{$index_by_function{$function}}, [$toolbox, $category]; - - } - } - } - close(IN); -} # 1}}} -sub write_html { # {{{1 - # make empty html directories - unlink <$catdir/*.html>; - unlink <$catdir/f/*.html>; - mkdir "$catdir"; - mkdir "$catdir/f"; - - write_main(); - write_forgebar(); - write_intro(); - write_alphabetic_navbar(); - write_TBnavbar(); - foreach ( toolbox_list() ) { - write_TBnavbar($_); - write_TBdetails($_); - } - - # Write one file for each letter. - # - - my $Letter = chr(0); - foreach my $func ( indexed_funcs() ) { - # The source file - - my $body = long_desc($func); - if ($body ne "") { - # XXX FIXME XXX this will die if the punctuation is too wild - open FUNC, ">$catdir/f/$func.html" or die "Could not open $func.html"; - print FUNC "<html><head><title>$func</title></head>\n"; - print FUNC "<body>\n"; - print FUNC "<table width=100%><tr><td align=left><b>$func</b>\n"; - # The toolboxes to which it belongs - foreach my $pair ( @{$index_by_function{$func}} ) { - my ( $TB, $cat ) = @{$pair}; - print FUNC " ", cat_ref_up($TB, $cat, "[$TB]"), "\n"; - } - print FUNC " <td align=right>", download_ref($func), "</table>\n"; - print FUNC "$body\n"; - print FUNC "$forgelink\n</body></html>"; - close FUNC; - } - - # Check if need to go to the next letter - # This is particularly complicated because we - # want to include all punctuation in the - my $next = uc(substr($func, 0, 1)); - if ($next ne $Letter) { - if ($Letter =~ /[A-Y]/) { - print OUT "</dl>\n$forgelink\n</body></html>\n"; - close OUT; - } else { - print OUT "</dl>\n"; - } - if ($Letter =~ /[\0A-Y]/) { - my $head = ""; - if ( $next =~ /[A-Z]/ ) { - $head = $next; - } elsif ( $next lt "A" ) { - $head = "A"; - } else { - $head = "Z"; - } - my $file = ">$catdir/$head.html"; - open(OUT, $file) or die "Cannot write $file"; - print OUT "<html><head>\n"; - print OUT "<title>Octave Functions: $head</title>\n"; - print OUT "<meta name=\"keywords\" content=\"\"></head>\n"; - print OUT "<body>\n"; - } - $Letter = $next; - print OUT "<h1><a name=\"$Letter\">$Letter</a></h1>"; - print OUT "<dl>\n"; - } - - # Function reference - print OUT "<dt><table width=100%><tr><td align=left><b>",func_ref($func,$func),"</b>\n"; - # The toolboxes to which it belongs - foreach my $pair ( @{$index_by_function{$func}} ) { - my ( $TB, $cat ) = @{$pair}; - print OUT " ", cat_ref($TB, $cat, "[$TB]"), "\n"; - } - print OUT " <td align=right>", download_ref($func), "</table>\n"; - - - # column 3: the function description - # XXX FIXME XXX multiple functions??? - print OUT " <dd>",html_desc($func),"\n"; - } - - print OUT "</dl>\n$forgelink\n</body></html>\n"; - close(OUT); -} # 1}}} -sub writenav { # 1{{{ - my ($cat) = @_; - -} # 1}}} -sub write_main { # {{{1 - open(OUT,">$catdir/index.html") or die "Could not open $catdir/index.html"; - print OUT <<EOF; -<HTML><HEAD> -<TITLE>Octave-forge combined index</TITLE> -</HEAD> -<FRAMESET rows="50, *"> - <FRAME src="forgebar.html" noresize frameborder="0"> - <FRAMESET cols="33%, 67%"> - <FRAME name=navbar src="categorical.html"> - <FRAMESET rows="50, *"> - <FRAME src="alphabetic.html"> - <FRAME name=content src="intro.html"> - </FRAMESET> - </FRAMESET> -<NOFRAMES> -$forgebar -<H1>Octave-Forge Combined Index</H1> -<ul> -<li><A HREF="categorical.html">Categorical index</a> -<li><A HREF="alphabetic.html">Alphabetic index</a> -</ul> -</NOFRAMES> -</FRAMESET> -</HTML> -EOF - close OUT; -} # 1}}} -sub write_forgebar { - open(OUT,">$catdir/forgebar.html") or die "Could not open index/forgebar.html"; - print OUT <<EOF; -<html><title>Octave Forge site navigator</title> -<base target=_top> -<body> -$forgebar -</body></html> -EOF -} -sub download_ref { -# download_ref($func,$desc) returns a link to download $func described by $desc - my ($func) = @_; - - my $path = $function_description{$func}[0]; - if ($path ne "" && $path !~ /^$OCTAVE/) { - return "[<a href=\"$FORGECVS$path\?rev=HEAD\&content-type=text/plain\">octave-forge/$path</a>]"; - } elsif ($path =~ /^$OCTAVE/) { - $path =~ s/^$OCTAVE//; - return "[<a href=\"$OCTAVECVS$path\?rev=HEAD\&content-type=text/plain\">octave$path</a>]"; - } else { - return ""; - } -} -sub write_intro { # 1{{{ - open(OUT,">$catdir/intro.html") or die "Could not open $catdir/intro.html"; - print OUT <<EOF; -<HTML><HEAD><TITLE>Octave-forge index intro</TITLE></HEAD> -<BODY> -<H1>Welcome to Octave-forge</H1> -$forgelink -</BODY></HTML> -EOF - close OUT; -} # 1}}} -sub write_TBnavbar { # 1{{{ - my $openTB = shift; - my $file = "categorical"; - $file = "nav$openTB" if $openTB ne ""; - open(OUT,">$catdir/$file.html") or die "Could not open $catdir/$file.html"; - print OUT <<EOF; -<html><head><title>Octave-forge categorical index</title></head> -<body> -What\'s available: -<ol> -EOF - foreach my $TB (toolbox_list()) { -# print OUT "<li><a href=\"$TB.html\" target=content><a href=\"nav$TB.html#$TB\" target=navbar>$TB_description{$TB}</a></a>"; - print OUT "<li>"; - if ($openTB eq $TB) { - print OUT "<a name=\"$TB\"><a href=\"categorical.html#$TB\" target=navbar> -$TB_description{$TB}</a></a>"; - print OUT "<ul>\n"; - foreach my $cat ( cat_list($TB) ) { - my $anchor = cat_anchor($cat); - print OUT " <li><a href=\"$TB.html#$anchor\" target=content>$cat</a></li>\n"; - } - print OUT "</ul>\n"; - } else { - print OUT "<a name=\"$TB\"><a href=\"nav$TB.html#$TB\" target=navbar>$TB_description{$TB}</a></a>"; - } - } - print OUT "</ol>\n</body></html>"; - close OUT; -} # 1}}} -sub write_TBdetails { # 1{{{ - my $TB = shift; - my $file = "$catdir/$TB.html"; - - open(OUT, ">$file") or die "Cannot write $file: $!\n"; - print OUT <<EOF; -<html><head> -<title>$TB</title> -<meta name=\"keywords\" content=\"\"> -</head> -<body> -<h1>$TB_description{$TB}</h1> -EOF - - # summary list of categories - print OUT "<ul>\n"; - foreach my $cat ( cat_list($TB) ) { - my $anchor = cat_anchor($cat); - print OUT " <li><a href=\"#$anchor\">$cat</a></li>\n"; - } - print OUT "</ul>\n"; - - # Each category has a table of its functions and their descriptions. - foreach my $cat ( cat_list($TB) ) { - my $anchor = cat_anchor($cat); - print OUT "<h2><a name=\"$anchor\">$cat</a></h2>\n"; - print OUT "<dl>\n"; - foreach my $func ( cat_funcs($TB,$cat) ) { - - # column 1: the function (x-ref to full description in - # cvs-tree's html file) - print OUT "<dt><table width=100%><tr><td align=left><b>",func_ref($func,$func),"</b>\n"; - print OUT " <td align=right>", download_ref($func), "</table>\n"; - - # column 2: the description, if it exists - # - print OUT "<dd>",html_desc($func),"\n"; - } - print OUT "</dl>\n"; - } - print OUT "$forgelink\n</body></html>\n"; - close(OUT); -} # 1}}} -sub write_alphabetic_navbar { # 1{{{ - open(OUT,">$catdir/alphabetic.html") or die "Could not open $catdir/alphabetic.html"; - print OUT <<EOF; -<html><head><title>Octave-Forge alphabetic list</title></head> -<base target=content> -<body> -EOF - my $A_to_Z = ""; - foreach (first_letters (indexed_funcs())) { - $A_to_Z .= letter_ref($_) . "|"; - } - $A_to_Z =~ s/\s*\|\s*$//; # strip last pipe separator - print OUT "<center>$A_to_Z</center>\n</body></html>\n"; - close OUT; -} # 1}}} -sub oldnavbar { # 1{{{ - my $max_TB_across_top = 7; - my $all_toolboxes = "<center>\n"; - my $n = 0; - - foreach my $TB (toolbox_list()) { - ++$n; - if ($n > $max_TB_across_top) { - $n = 0; - $all_toolboxes .= "<a href=\"$TB.html\">$TB</a> <br> "; - } else { - $all_toolboxes .= "<a href=\"$TB.html\">$TB</a> | "; - } - } - $all_toolboxes =~ s/\s+\|\s*$//; # strip last pipe separator - $all_toolboxes .= "<br><br>"; - my $A_to_Z = ""; - foreach (first_letters (indexed_funcs())) { - $A_to_Z .= letter_ref($_); - $A_to_Z .= " | "; - } - $A_to_Z =~ s/\s+\|\s*$//; # strip last pipe separator - my $all_toolboxes_A_Z = $all_toolboxes . "$A_to_Z </center>\n"; - $all_toolboxes .= "</center>\n"; - -} # 1}}} -sub print_missing { - my $printmissing = 1; - foreach my $TB ( toolbox_list() ) { - my $printTB = 1; - foreach my $cat ( cat_list($TB) ) { - my $printcat = 1; - foreach my $func ( cat_funcs($TB,$cat) ) { - if (! defined $function_description{$func}[1] && ! defined $index_notes{$func} ) { - print "missing functions:" if $printmissing; - print "\n [$TB]" if $printTB; - print "\n $cat\n >" if $printcat; - print " $func"; - $printTB = 0; - $printcat = 0; - $printmissing = 0; - } - } - } - } - print "\n" unless $printmissing; -} -sub write_ascii { # 1{{{ -# output all toolboxes as a contents.m file - my ($prefix) = @_; - my $indent = 16 - 3 - length($prefix); - - # XXX FIXME XXX add an option to spit out contents.m - # XXX FIXME XXX what if there is no toolbox? - # XXX FIXME XXX preserve category order - foreach my $TB ( toolbox_list() ) { - print wrap($prefix,$prefix,$TB_description{$TB}),"\n$prefix\n"; - foreach my $cat ( cat_list($TB) ) { - print wrap($prefix,$prefix,$cat), "\n"; - foreach my $func ( cat_funcs($TB,$cat) ) { - my $entry = sprintf("%-*s %s",$indent,$func,ascii_desc($func)); - print wrap("$prefix","$prefix\t\t"," $entry"), "\n"; - } - print "$prefix\n"; - } - } -} # 1}}} -sub cat_ref { # 1{{{ -# cat_ref($TB,$cat,$ref) returns an html link to $cat described by $ref - my ($TB,$cat,$ref) = @_; - my $anchor = cat_anchor($cat); - return "<a href=\"$TB.html#$anchor\">$ref</a>"; -} # 1}}} -sub cat_ref_up { # 1{{{ -# cat_ref($TB,$cat,$ref) returns an html link to $cat described by $ref - my ($TB,$cat,$ref) = @_; - my $anchor = cat_anchor($cat); - return "<a href=\"../$TB.html#$anchor\">$ref</a>"; -} # 1}}} -sub cat_anchor { # 1{{{ -# cat_anchor($cat) returns the anchor word generated for category $cat - my ($cat) = @_; - $cat =~ s/\W+//g; - return $cat; -} # 1}}} -sub func_ref { # 1{{{ -# func_ref($func) returns an html link to $func described by $ref - my ($func,$ref) = @_; - if ( defined $function_description{$func}[2] && - $function_description{$func}[2] ne "") { - return "<a href=\"f/$func.html\">$ref</a>"; - } elsif ( $ref ne $func ) { - # XXX FIXME XXX do we want "$ref ($func)"? Check how it is called. - return $ref; - } else { - return $ref; - } -} # 1}}} -sub split_long_name { # 1{{{ -# html magic to break long variable/function names - # XXX FIXME XXX this function is probably not used - my ( $nicefunc ) = @_; - # $nicefunc =~ s/([^_])_([^_])/$1_ $2/g; - return $nicefunc; -} # 1}}} -sub first_letters { # 1{{{ -# return a list of all first letters in the arguments -# The argument list must come sorted with a case-insensitive sort. - my $Letter = chr(0); - my @ret = (); - foreach my $name ( @_ ) { - # Check if need to go to the next letter - if (uc(substr($name, 0, 1)) ne $Letter) { - $Letter = uc(substr($name, 0, 1)); - push @ret, $Letter; - } - } - return @ret; -} # 1}}} -sub letter_file { # 1{{{ - return "$_.html" if /[A-Z]/; - return "A.html" if $_ lt "A"; - return "Z.html"; -} # 1}}} -sub letter_ref { # 1{{{ -# letter_ref($letter) returns a link to the letter - return "<a href=\"" . letter_file($_) . "#$_\">$_</a>"; -} # 1}}} -sub ascii_desc { # 1{{{ -# ascii_desc($func) returns a decription of $func using ascii markup - my ( $func ) = @_; - if (! defined $function_description{$func}[1] ) { - my $notes = $index_notes{$func}; - $notes = "<missing>" if $notes eq ""; - # convert "<a link>desc</a>" to "desc (link)" - $notes =~ s|<a href=\"?([^>]*)\"?>([^<]*)</a>|$2 ($1)|g; - # strip all remaining html formatting - $notes =~ s|<[^>]*>||g; - return $notes; - } else { - my $desc = $function_description{$func}[1]; - if ($desc eq "") { - return "<no description>"; - } else { - return $desc; - } - } -} #}}} -sub html_desc { # 1{{{ -# html_desc($func) returns a description of $func using html markup - my ( $func ) = @_; - my $notes = $index_notes{$func}; - if (! defined $function_description{$func}[1] ) { - $notes = "not implemented" if $notes eq ""; - # shut of the bold italics during "code" formatting - $notes =~ s|<code>|</i><code>|g; - $notes =~ s|</code>|</code><i>|g; - $notes =~ s|<f>(\w+)</f>|</i><code><a href="f/$1.html">$1</a></code><i>|g; - return "<i>$notes</i>"; - } else { - print "ignoring $func = $notes\n" if $notes ne ""; - my $desc = $function_description{$func}[1]; - if ($desc eq "") { - return "<i>no description</i>"; - } else { - return $desc; - } - } -} # 1}}} -sub long_desc { - my ( $func ) = @_; - my $body = $function_description{$func}[2]; - if ($body =~ /^\s*-[*]- texinfo -[*]-/) { - $body = info2html($func, $body); - } elsif ($body ne "") { - $body = "<pre>$body</pre>"; - } - return $body -} # 1}}} -sub info2html_texi2html { # 1{{{ -# run body through texi2html to produce html - my ( $func, $body ) = @_; - $body =~ s/^\s*-[*]- texinfo -[*]-//; - open(SRC, ">$func.texi"); - print SRC "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n"; - print SRC "BEGINCUT $body ENDCUT"; - close SRC; - system ("texi2html -expand info $tmpdir/$func.texi"); - open(SRC, "<$func.html"); - my @lines = <SRC>; - close SRC; - $body = join("",@lines); - my $start = index($body,"BEGINCUT") + 8; - my $stop = index($body,"ENDCUT"); - $body = substr($body,$start,$stop-$start); - unlink "$func.texi", "$func.html"; -} # 1}}} -sub info2html { # 1{{{ -# run body through makeinfo to produce html - my ( $func, $body ) = @_; - $body =~ s/^\s*-[*]- texinfo -[*]-//; - my $cmd = "makeinfo --fill-column 80 --no-warn --no-validate --force --html --ifinfo -o -"; - open3(*Writer, *Reader, *Errer, $cmd) or die "Could not run info"; - print Writer "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n"; - # I have no idea why but makeinfo is introducing some weirdness with <p> - # at the front of the document. The following works for my particular - # version but I have little hope for it working in general - print Writer "-CUT HERE $body"; close(Writer); - my @lines = <Reader>; close(Reader); - my @err = <Errer>; close(Errer); - waitpid(-1,&WNOHANG); - # strip everything before <body> and after </body> - $body = join("",@lines); - my $start = index($body,"CUT HERE") + 8; - my $stop = index($body,"</body"); - $body = substr($body,$start,$stop-$start); - $body =~ s|\@var\{([^\}]*)\}|<var>$1</var>|g; - return $body; -} # 1}}} -sub toolbox_list { # 1{{{ -# toolbox_list() returns an ordered list of toolboxes. - return sort { uc($a) cmp uc($b) } keys %index_by_TB_cat; -} # 1}}} -sub cat_list { # 1{{{ -# cat_list($TB) returns an ordered list of categories in a toolbox $TB. - my ($TB) = @_; - return sort keys %{$index_by_TB_cat{$TB}}; -} # 1}}} -sub cat_funcs { # 1{{{ -# cat_funcs($TB,$cat) returns an ordered list of functions in $TB,$cat - my ($TB,$cat) = @_; - return sort { uc($a) cmp uc($b) } @{$index_by_TB_cat{$TB}{$cat}} -} # 1}}} -sub indexed_funcs { # 1{{{ -# indexed_funcs() returns an ordered list of all functions in the index - return sort { uc($a) cmp uc($b) } keys %index_by_function; -} # 1}}} -sub forge_funcs { # 1{{{ -# forge_funcs() returns an ordered list of functions only found in octave forge - return sort { uc($a) cmp uc($b) } keys %octave_forge_function; -} # 1}}} -sub scanned_funcs { # 1{{{ -# scanned_funcs() returns an ordered list of all functions found in m-files and oct-files - return sort { uc($a) cmp uc($b) } %function_description; -} # 1}}} -__END__ -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -This program is granted to the public domain. -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE.
--- a/main/gsl/src/admin/mkdoc Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -#!/usr/bin/env perl -# -# David Bateman Feb 02 2003 -# -# Extracts the help in texinfo format from *.cc and *.m files for use -# in documentation. Based on make_index script from octave_forge. - -use strict; -use File::Find; -use File::Basename; -use FileHandle; - -my $docdir = "."; -if (@ARGV) { - $docdir = @ARGV[0]; -} - -# locate all C++ and m-files in current directory -my @m_files = (); -my @C_files = (); -find(\&cc_and_m_files, $docdir); - -sub cc_and_m_files { # {{{1 populates global array @files - return unless -f and /\.(m|cc)$/; # .m and .cc files - my $path = "$File::Find::dir/$_"; - $path =~ s|^[.]/||; - if (/\.m$/) { - push @m_files, $path; - } else { - push @C_files, $path; - } -} # 1}}} - -# grab help from C++ files -foreach my $f ( @C_files ) { - # XXX FIXME XXX. Should run the preprocessor over the file first, since - # the help might include defines that are compile dependent. - if ( open(IN,$f) ) { - while (<IN>) { - # skip to the next function - next unless /^DEFUN_DLD/; - - # extract function name to pattern space - /\((\w*)\s*,/; - # remember function name - my $function = $1; - # skip to next line if comment doesn't start on this line - # XXX FIXME XXX maybe we want a loop here? - $_ = <IN> unless /\"/; - # skip to the beginning of the comment string by - # chopping everything up to opening " - my $desc = $_; - $desc =~ s/^[^\"]*\"//; - # join lines until you get the end of the comment string - # plus a bit more. You need the "plus a bit more" because - # C compilers allow implicitly concatenated string constants - # "A" "B" ==> "AB". - while ($desc !~ /[^\\]\"\s*\S/ && $desc !~ /^\"/) { - # if line ends in '\', chop it and the following '\n' - $desc =~ s/\\\s*\n//; - # join with the next line - $desc .= <IN>; - # eliminate consecutive quotes, being careful to ignore - # preceding slashes. XXX FIXME XXX what about \\" ? - $desc =~ s/([^\\])\"\s*\"/$1/; - } - $desc = "" if $desc =~ /^\"/; # chop everything if it was "" - $desc =~ s/\\n/\n/g; # insert fake line ends - $desc =~ s/([^\"])\".*$/$1/; # chop everything after final '"' - $desc =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\" - $desc =~ s/$//g; # chop trailing ... - - if (!($desc =~ /^\s*-[*]- texinfo -[*]-/)) { - my $err = sprintf("Function %s, does not contain texinfo help\n", - $function); - print STDERR "$err"; - } - my $entry = sprintf("\037%s\n%s", $function, $desc); - print "$entry", "\n"; - } - close (IN); - } else { - print STDERR "Could not open file ($f): $!\n"; - } -} - -# grab help from m-files -foreach my $f ( @m_files ) { - my $desc = extract_description($f); - my $function = basename($f, ('.m')); - die "Null function?? [$f]\n" unless $function; - if (!($desc =~ /^\s*-[*]- texinfo -[*]-/)) { - my $err = sprintf("Function %s, does not contain texinfo help\n", - $function); - print STDERR "$err"; - } - my $entry = sprintf("\037%s\n%s", $function, $desc); - print "$entry", "\n"; -} - -sub extract_description { # {{{1 -# grab the entire documentation comment from an m-file - my ($file) = @_; - my $retval = ''; - - if( open( IN, "$file")) { - # skip leading blank lines - while (<IN>) { - last if /\S/; - } - if( m/\s*[%\#][\s\#%]* Copyright/) { - # next block is copyright statement, skip it - while (<IN>) { - last unless /^\s*[%\#]/; - } - } - # Skip everything until the next comment block - while ( !/^\s*[\#%]/ ) { - $_ = <IN>; - last if not defined $_; - } - # Return the next comment block as the documentation - while (/^\s*[\#%]/) { - s/^[\s%\#]*//; # strip leading comment characters - s/[\cM\s]*$//; # strip trailing spaces. - s/[\.*]$//; - $retval .= "$_\n"; - $_ = <IN>; - last if not defined $_; - } - close(IN); - return $retval; - } - else { - print STDERR "Could not open file ($file): $!\n"; - } -} # 1}}}
--- a/main/gsl/src/admin/mkpkgadd Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -#! /bin/sh - -if test $# -eq 1; then - dir="$1" -else - echo "usage: mkpkgadd directory" 1>&2 - exit 1 -fi - -cd $dir - -m_files=`echo *.m` -cxx_files=`echo *.cc` -ln_files=`echo *.octlink` - -if test "$m_files" != "*.m"; then - sed -n 's/^[#%][#%]* *PKG_ADD: *//p' $m_files -fi - -if test "$cxx_files" != "*.cc"; then - sed -n -e 's,^//* *PKG_ADD: *,,p' \ - -e 's,^/\** *PKG_ADD: *\(.*\) \*/$,\1,p' $cxx_files -fi - -if test "$ln_files" != "*.octlink" ; then - cat $ln_files -fi
--- a/main/gsl/src/admin/mktests.sh Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -#! /bin/sh - -# Where to find mkpkgadd -MKPKGADD=$1 - -# Create a new fntests.m file -echo "fid=fopen('fntests.log','wt');" > fntests.m -echo "if fid<0,error('could not open fntests.log for writing');end" >>fntests.m -echo "test('','explain',fid);" >> fntests.m -echo "passes=0; tests=0;" >>fntests.m - -# Find all toplevel non-cvs directories -DIRS="`find FIXES main/* extra/* nonfree/* -type d ! -name CVS -prune`" - -# Find the tests in that directory -for dir in $DIRS; do - dir=`echo $dir | sed -e "s-^\./--" ` - - # skip the NOINSTALL directories - if test -f "$dir/NOINSTALL"; then continue; fi - - # Create local copy of PKG_ADD for in place testing - if test -e "$dir/PKG_ADD" ; then rm -f $dir/PKG_ADD; fi - $MKPKGADD $dir > $dir/PKG_ADD - if test -z "`cat $dir/PKG_ADD`" ; then rm -f $dir/PKG_ADD; fi - - # Build a list of possible test files - FILES="" - - # Find all successfully compiled .cc files - cxx_files=`echo $dir/*.cc` - if test "$cxx_files" != "$dir/*.cc"; then - for file in $cxx_files; do - obj=`echo "$file" | sed -e 's-\.cc$-.o-'` - if test -f "$obj" ; then FILES="$FILES $file"; fi - done - fi - - # Find all m-files - m_files=`echo $dir/*.m` - if test "$m_files" != "$dir/*.m"; then FILES="$FILES $m_files"; fi - - # No C++ of m-files, so no testing - if test -z "$FILES" ; then continue; fi - - # Find all files with %!test or %!assert in them - # XXX FIXME XXX is there a system independent way of doing (test|assert) - TESTS=`grep -l -E '^%![ta][es]s' $FILES` - - NUMFILES=`echo $FILES | wc -w` - NUMTESTS=`echo $TESTS | wc -w` - prompt="$dir [tests $NUMTESTS of $NUMFILES files]" - - # if no files have tests in them, skip - echo "printf('%s','$prompt'); disp('');" >>fntests.m - if test -z "$TESTS" ; then - echo "printf('%-40s ---> success','');disp('');" >>fntests.m - else - echo "dp=dn=0;" >>fntests.m - for file in $TESTS ; do - echo "[p,n] = test('$file','quiet',fid);" >>fntests.m - echo "dp += p; dn += n;" >>fntests.m - done - echo "if dp==dn, printf('%-40s ---> success',''); else" >>fntests.m - echo "printf('%-40s ---> passes %d out of %d tests','',dp,dn); end" >>fntests.m - echo "disp(''); passes += dp; tests += dn;" >>fntests.m - fi - -done - -echo "printf('passes %d out of %d tests',passes,tests);disp('');" >> fntests.m -echo "printf('see fntests.log for details');disp('');" >> fntests.m -echo "fclose(fid);" >> fntests.m
--- a/main/gsl/src/admin/mktexi Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,433 +0,0 @@ -#!/usr/bin/env perl -# -# David Bateman Feb 02 2003 -# -# Extracts the help in texinfo format for particular function for use -# in documentation. Based on make_index script from octave_forge. - -use strict; -use File::Find; -use File::Basename; -use Text::Wrap; -use FileHandle; -use IPC::Open3; -use POSIX ":sys_wait_h"; - -my $file = shift @ARGV; -my $docfile = shift @ARGV; -my $indexfile = shift @ARGV; -my $line; - -if ( open(IN,$file) ) { - $line = <IN>; - my $tex = 0; - while ($line) { - if ($line =~ /^\@DOCSTRING/) { - my $found = 0; - my $func = $line; - $func =~ s/\@DOCSTRING\(//; - $func =~ s/\)[\n\r]+//; - my $func0 = $func; - my $func1 = $func; - $func0 =~ s/,.*$//; - $func1 =~ s/^.*,//; - if ( open(DOC,$docfile) ) { - while (<DOC>) { - next unless /\037/; - my $function = $_; - $function =~ s/\037//; - $function =~ s/[\n\r]+//; - if ($function =~ /^$func0$/) { - my $desc = ""; - my $docline; - my $doctex = 0; - while (($docline = <DOC>) && ($docline !~ /^\037/)) { - $docline =~ s/^\s*-[*]- texinfo -[*]-\s*//; - if ($docline =~ /\@tex/) { - $doctex = 1; - } - if ($doctex) { - $docline =~ s/\\\\/\\/g; - } - if ($docline =~ /\@end tex/) { - $doctex = 0; - } - $desc .= $docline; - } - $desc =~ s/$func0/$func1/g; - $desc =~ s/\@seealso\{(.*[^}])\}/See also: \1/g; - print "$desc", "\n"; - $found = 1; - last; - } - } - close (DOC); - if (! $found) { - print "\@emph{Not implemented}\n"; - } - } else { - print STDERR "Could not open file $docfile\n"; - exit 1; - } - } elsif ($line =~ /^\@REFERENCE_SECTION/) { - my $secfound = 0; - my $sec = $line; - $sec =~ s/\@REFERENCE_SECTION\(//; - $sec =~ s/\)[\n\r]+//; - my @listfunc = (); - my $nfunc = 0; - my $seccat = 0; - - if ( open(IND,$indexfile) ) { - while (<IND>) { - next unless /^[^ ]/; - my $section = $_; - $section =~ s/[\n\r]+//; - if ($section =~ /^(.*?)\s*>>\s*(.*?)$/) { - $section =~ s/.*>>(.*)/\1/; - $seccat = 1; - } - $section =~ s/^ *//; - $section =~ s/ *$//; - if ($section =~ /^$sec$/) { - if ($seccat) { - print "\@iftex\n"; - print "\@section Functions by Category\n"; - # Get the list of categories to index - my $firstcat = 1; - my $category; - while (<IND>) { - last if />>/; - if (/^[^ ]/) { - if (! $firstcat) { - print "\@end table\n"; - } else { - $firstcat = 0; - } - $category = $_; - $category =~ s/[\n\r]+//; - print "\@subsection $category\n"; - print "\@table \@asis\n"; - } elsif (/^\s+(\S.*\S)\s*=\s*(\S.*\S)\s*$/) { - my $func = $1; - my $desc = $2; - print "\@item $func\n"; - print "$desc\n"; - print "\n"; - } else { - if ($firstcat) { - print STDERR "Error parsing index file\n"; - exit 1; - } - s/^\s+//; - my @funcs = split /\s+/; - while ($#funcs >= 0) { - my $func = shift @funcs; - $func =~ s/^ *//; - $func =~ s/[\n\r]+//; - push @listfunc, $func; - $nfunc = $nfunc + 1; - print "\@item $func\n"; - print func_summary($func, $docfile); - print "\n"; - } - } - } - if (! $firstcat) { - print "\@end table\n"; - } - print "\n\@section Functions Alphabetically\n"; - print "\@end iftex\n\n"; - } else { - # Get the list of functions to index - my $indline; - while (($indline = <IND>) && ($indline =~ /^ /)) { - if ($indline =~ /^\s+(\S.*\S)\s*=\s*(\S.*\S)\s*$/) { - next; - } - $indline =~ s/^\s+//; - my @funcs = split(/\s+/,$indline); - while ($#funcs >= 0) { - my $func = shift @funcs; - $func =~ s/^ *//; - $func =~ s/[\n\r]+//; - push @listfunc, $func; - $nfunc = $nfunc + 1; - } - } - } - $secfound = 1; - last; - } - } - close (IND); - if (! $secfound) { - print STDERR "Did not find section $sec\n"; - } - } else { - print STDERR "Could not open file $indexfile\n"; - exit 1; - } - - @listfunc = sort(@listfunc); - my @listfunc2 = (); - my $indent = 16 - 3; - print "\@menu\n"; - foreach my $func (@listfunc) { - if ( open(DOC,$docfile) ) { - my $found = 0; - while (<DOC>) { - next unless /\037/; - my $function = $_; - $function =~ s/\037//; - $function =~ s/[\n\r]+//; - if ($function =~ /^$func$/) { - $found = 1; - last; - } - } - close (DOC); - if ($found) { - push @listfunc2, $func; - my $func0 = "${func}::"; - my $entry = sprintf("* %-*s %s",$indent,$func0,func_summary($func,$docfile)); - print wrap("","\t\t","$entry"), "\n"; - } - } else { - print STDERR "Could not open file $indexfile\n"; - exit 1; - } - } - print "\@end menu\n"; - - my $up = "Function Reference"; - my $next; - my $prev; - my $mfunc = 1; - foreach my $func (@listfunc2) { - if ($mfunc == $nfunc) { - $next = ""; - } else { - $next = @listfunc2[$mfunc]; - $mfunc = $mfunc + 1; - } - print "\n\@node $func, $next, $prev, $up\n"; - if ($seccat) { - print "\@subsection $func\n\n"; - } else { - print "\@section $func\n\n"; - } - $prev = $func; - my $found = 0; - my $desc = ""; - if ( open(DOC,$docfile) ) { - while (<DOC>) { - next unless /\037/; - my $function = $_; - $function =~ s/\037//; - $function =~ s/[\n\r]+//; - if ($function =~ /^$func$/) { - my $docline; - my $doctex = 0; - while (($docline = <DOC>) && ($docline !~ /^\037/)) { - $docline =~ s/^\s*-[*]- texinfo -[*]-\s*//; - if ($docline =~ /\@tex/) { - $doctex = 1; - } - if ($doctex) { - $docline =~ s/\\\\/\\/g; - } - if ($docline =~ /\@end tex/) { - $doctex = 0; - } - $desc .= $docline; - } - $desc =~ s/\@seealso\{(.*[^}])\}/See also: \1/g; - print "$desc", "\n"; - $found = 1; - last; - } - } - close (DOC); - if (! $found) { - print "\@emph{Not implemented}\n"; - } - } else { - print STDERR "Could not open file $docfile\n"; - exit 1; - } - } - } else { - if ($line =~ /\@tex/) { - $tex = 1; - } - if ($tex) { - $line =~ s/\\\\/\\/g; - } - print "$line"; - if ($line =~ /\@end tex/) { - $tex = 0; - } - } - $line = <IN>; - } -} else { - print STDERR "Could not open file $file\n"; - exit 1; -} - -sub func_summary { # {{{1 - my ($func, # in function name - $docfile # in DOCSTRINGS - ) = @_; - - my $desc = ""; - my $found = 0; - if ( open(DOC,$docfile) ) { - while (<DOC>) { - next unless /\037/; - my $function = $_; - $function =~ s/\037//; - $function =~ s/[\n\r]+//; - if ($function =~ /^$func$/) { - my $docline; - my $doctex = 0; - while (($docline = <DOC>) && ($docline !~ /^\037/)) { - if ($docline =~ /\@tex/) { - $doctex = 1; - } - if ($doctex) { - $docline =~ s/\\\\/\\/g; - } - if ($docline =~ /\@end tex/) { - $doctex = 0; - } - $desc .= $docline; - } - $desc =~ s/\@seealso\{(.*[^}])\}/See also: \1/g; - $found = 1; - last; - } - } - close (DOC); - if (! $found) { - $desc = "\@emph{Not implemented}"; - } - } else { - print STDERR "Could not open file $docfile\n"; - exit 1; - } - return first_sentence($desc); -} # 1}}} - - -sub first_sentence { # {{{1 -# grab the first real sentence from the function documentation - my ($desc) = @_; - my $retval = ''; - my $line; - my $next; - my @lines; - - my $trace = 0; - # $trace = 1 if $desc =~ /Levenberg/; - return "" unless defined $desc; - if ($desc =~ /^\s*-[*]- texinfo -[*]-/) { - # help text contains texinfo. Strip the indicator and run it - # through makeinfo. (XXX FIXME XXX this needs to be a function) - $desc =~ s/^\s*-[*]- texinfo -[*]-\s*//; - my $cmd = "makeinfo --fill-column 1600 --no-warn --no-validate --no-headers --force --ifinfo"; - open3(*Writer, *Reader, *Errer, $cmd) or die "Could not run info"; - print Writer "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n"; - print Writer "$desc"; close(Writer); - @lines = <Reader>; close(Reader); - my @err = <Errer>; close(Errer); - waitpid(-1,&WNOHANG); - - # Display source and errors, if any - if (@err) { - my $n = 1; - foreach $line ( split(/\n/,$desc) ) { - printf "%2d: %s\n",$n++,$line; - } - print ">>> @err"; - } - - # Print trace showing formatted output -# print "<texinfo--------------------------------\n"; -# print @lines; -# print "--------------------------------texinfo>\n"; - - # Skip prototype and blank lines - while (1) { - return "" unless @lines; - $line = shift @lines; - next if $line =~ /^\s*-/; - next if $line =~ /^\s*$/; - last; - } - - } else { - -# print "<plain--------------------------------\n"; -# print $desc; -# print "--------------------------------plain>\n"; - - # Skip prototype and blank lines - @lines = split(/\n/,$desc); - while (1) { - return "" if ($#lines < 0); - $line = shift @lines; - next if $line =~ /^\s*[Uu][Ss][Aa][Gg][Ee]/; # skip " usage " - - $line =~ s/^\s*\w+\s*://; # chop " blah : " - print "strip blah: $line\n" if $trace; - $line =~ s/^\s*[Ff]unction\s+//; # chop " function " - print "strip function $line\n" if $trace; - $line =~ s/^\s*\[.*\]\s*=\s*//; # chop " [a,b] = " - print "strip []= $line\n" if $trace; - $line =~ s/^\s*\w+\s*=\s*//; # chop " a = " - print "strip a= $line\n" if $trace; - $line =~ s/^\s*\w+\s*\([^\)]*\)\s*//; # chop " f(x) " - print "strip f(x) $line\n" if $trace; - $line =~ s/^\s*[;:]\s*//; # chop " ; " - print "strip ; $line\n" if $trace; - - $line =~ s/^\s*[[:upper:]][[:upper:]0-9_]+//; # chop " BLAH" - print "strip BLAH $line\n" if $trace; - $line =~ s/^\s*\w*\s*[-]+\s+//; # chop " blah --- " - print "strip blah --- $line\n" if $trace; - $line =~ s/^\s*\w+ *\t\s*//; # chop " blah <TAB> " - print "strip blah <TAB> $line\n" if $trace; - $line =~ s/^\s*\w+\s\s+//; # chop " blah " - print "strip blah <NL> $line\n" if $trace; - -# next if $line =~ /^\s*\[/; # skip [a,b] = f(x) -# next if $line =~ /^\s*\w+\s*(=|\()/; # skip a = f(x) OR f(x) - next if $line =~ /^\s*or\s*$/; # skip blah \n or \n blah - next if $line =~ /^\s*$/; # skip blank line - next if $line =~ /^\s?!\//; # skip # !/usr/bin/octave - # XXX FIXME XXX should be testing for unmatched () in proto - # before going to the next line! - last; - } - } - - # Try to make a complete sentence, including the '.' - if ( "$line " !~ /[^.][.]\s/ && $#lines >= 0) { - my $next = $lines[0]; - $line =~ s/\s*$//; # trim trailing blanks on last - $next =~ s/^\s*//; # trim leading blanks on next - $line .= " $next" if "$next " =~ /[^.][.]\s/; # ends the sentence - } - - # Tidy up the sentence. - chomp $line; # trim trailing newline, if there is one - $line =~ s/^\s*//; # trim leading blanks on line - $line =~ s/([^.][.])\s.*$/$1/; # trim everything after the sentence - print "Skipping:\n$desc---\n" if $line eq ""; - - # And return it. - return $line; - -} # 1}}}
--- a/main/gsl/src/admin/no_vr_val.pm Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -#!/usr/bin/perl -w -n - -## Catches vr_val (x) transforms it into varargout(i++) = x; -## - -use OctRe; - -BEGIN { - $first = "vr_val_cnt = 1; "; - -} - -## Does necessary changes inplace on $_[0]. -sub change_line { - - if ($_[0] !~ /^\s*\#/) { # Don't do obvious comment lines - - # Change function declaration - if ($_[0] =~ /$defun_rx/) { - $_[0] =~ s/\.\.\.(\s*\]\s*\=)/varargout$1/g; - } - # Change vr_val() - - # BTW, if 1st vr_val() occurs in a loop, - # this will NOT WORK! - - if ($_[0] =~ - s{vr_val\s*\(([^;]*)\)(\s*;)} - {"$first" . "varargout\{vr_val_cnt++\} = $1$2"}eg) { - - $first = ""; - } - # Did I miss anything? - if ($_[0] =~ /vr_val\s*\(/) { - $_[0] .= "## TODO : Remove this vr_val\n"; - } - - } - $first = "vr_val_cnt = 1; " if $. == 1; -} - -sub comment_line { - "" -} -1;
--- a/main/gsl/src/admin/octlink.sh Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -#! /bin/sh - -FN2=`echo $2 | sed -e's/.octlink//'` -FN1=`echo $1 | sed -e's/.oct//'` -if test -e $2 ; then /bin/rm $2; fi -echo "autoload (\"$FN2\", which (\"$FN1\"));" > $2
--- a/main/gsl/src/admin/run_forge Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -#! /bin/sh - -# Walk the octave-forge tree (starting in the root) searching for -# all the directories that are supposed to be installed. -# Add each directory and any data subdirectories to the LOADPATH for octave. -# Add any bin directories to the EXEC_PATH. -# Add any DLL directories to the system PATH. -# Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH for any .so and .dylib files found. -# -# You must call this from the root of the octave-forge tree, using, e.g., -# admin/run_forge octave --norc -q -# -# Normally this is called for you, using the run target from make: -# make run - -ROOT=`pwd` -BINPATH="$PATH" -LDPATH="$LD_LIBRARY_PATH" -DYLDPATH="$DYLD_LIBRARY_PATH" -OCTPATH="$OCTAVE_PATH" -# XXX FIXME XXX strictly speaking, the default octave bin directories -# should be in the middle of EXECPATH and PATH, but it should be safe -# to put them at the end since octave probably isn't overriding anything -# on the system. We may also want to pick up the OCTAVE_EXEC_PATH if -# there is one. -EXECPATH="$PATH:" -for f in FIXES main/* extra/* nonfree/*; do - # exclude CVS directories, only include directories, skip NOINSTALL - case "$f" in - */CVS) ;; - *) - if test -d $f -a ! -f $f/NOINSTALL; then - OCTPATH="$ROOT/$f:$OCTPATH" - - # if there is install data, include in on the path - if test -d "$f/data"; then OCTPATH="$ROOT/$f/data:$OCTPATH"; fi - - # make sure we can find supporting binaries - if test -d "$f/bin"; then EXECPATH="$ROOT/$f/bin:$EXECPATH"; fi - if test -d "$f/scripts"; then EXECPATH="$ROOT/$f/scripts:$EXECPATH"; fi - - # supporting libraries need to be available as well - check=`echo $f/*.dll` - if test "$check" != "$f/*.dll"; then BINPATH="$ROOT/$f:$BINPATH"; fi - check=`echo $f/*.so` - if test "$check" != "$f/*.so"; then LDPATH="$ROOT/$f:$LDPATH"; fi - check=`echo $f/*.dylib` - if test "$check" != "$f/*.dylib"; then DYLDPATH="$ROOT/$f:$DYLDPATH"; fi - fi - esac -done -LD_LIBRARY_PATH="$LDPATH" -DYLD_LIBRARY_PATH="$DYLDPATH" -PATH="$BINPATH" -OCTAVE_PATH="$OCTPATH" -OCTAVE_EXEC_PATH="$EXECPATH" -export LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH OCTAVE_PATH OCTAVE_EXEC_PATH -$*
--- a/main/gsl/src/admin/template.ndev Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,405 +0,0 @@ --> Note: this file is a template used by the Perl script 'get_contents'. --> get_contents reads this file and the CONTENTS files in each --> subdirectory then creates the new_developer.html file by --> populating the "Where does your code belong" section. --> Albert Danial Jan 2 2002 - -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<!-- - The file new_developer.html is generated dynamically by the Perl - program 'get_contents'. Edit admin/template.ndev to make permanent - changes to new_developer.html. - Albert Danial Jan 2 2002 - --> -<html> -<head> -<title>Octave-Forge Developer's Notes</title> - <meta name="keywords" content="instruction,octave,developer,contribute"> -</head> -<body bgcolor="#FFFFFF"> - -<!-- top table {{{1 --> -<table align="center" BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="95%" BGCOLOR="#444444" > -<tr> -<td> -<table BORDER=0 cellspacing=1 CELLPADDING=3 WIDTH="100%" > -<tr> -<td ALIGN=CENTER VALIGN=CENTER BGCOLOR="#FFFFFF"> - <font face="Arial, Helvetica, Sans Serif" size=+2 color="#0000CC"> - GNU Octave Repository - </font> -</td> -</tr> -</table> -</td> -</tr> -</table> -<p align="center"> -<font size="-1"> -<A href="http://octave.sourceforge.net">Home</A> | -<A href="http://sourceforge.net/projects/octave/">Summary</A> | -<A href="http://sourceforge.net/forum/?group_id=2888">Forums</A> | -<A href="http://sourceforge.net/bugs/?group_id=2888">Bugs</A> | -<A href="http://sourceforge.net/support/?group_id=2888">Support</A> | -<A href="http://sourceforge.net/patch/?group_id=2888">Patches</A> | -<A href="http://sourceforge.net/mail/?group_id=2888">Lists</A> | -<A href="http://sourceforge.net/pm/?group_id=2888">Tasks</A> | -<A href="http://sourceforge.net/docman/?group_id=2888">Docs</A> | -<A href="http://sourceforge.net/survey/?group_id=2888">Surveys</A> | -<A href="http://sourceforge.net/news/?group_id=2888">News</A> | -<A href="http://sourceforge.net/cvs/?group_id=2888">CVS</A> | -<A href="http://sourceforge.net/project/showfiles.php?group_id=2888">Files</A> -</font> -</p> - - -<!-- 1}}} end top table --> - -<p> -<center> -<h2>Contributing Code to the Gnu Octave Repository</h2> -</center> - - -<h3>Requirements</h3> -To contribute your .m files, C++, C, or Fortran code to the GNU Octave -Repository (octave-forge) you need to -<ul> - <li> have an account on SourceForge, - <li> be registered as an octave-forge developer, - <li> have <a href="http://www.cvshome.org/">CVS</a> - installed on the computer from which you - will submit contributions, and - <li> have the secure shell, - <a href="http://www.openssh.com/"><tt>ssh</tt></a>, installed - on your computer. -</ul> -The first two requirements are easy but may take a few days. -If you don't already have one, request a SourceForge (SF) account -<a href="http://sourceforge.net/account/register.php"> here</a>. -To register as a developer send a request -to the octave-forge mailing list -<a href="mailto:octave-dev@lists.sf.net">octave-dev@lists.sf.net</a>. -Include a bit of information about the code -you plan to submit. -Finally, if your computer runs linux or -FreeBSD, chances are good that both <tt>ssh</tt> and CVS are already -installed on your system. -If they aren't, -you will need to find prebuilt packages for them or download their -source codes and build them. - -<h3>Create a SF home directory</h3> -<p> -If you've never submitted code to a SourceForge project before, -create your home directory by -logging onto the octave-forge account with <tt>ssh</tt>: -<pre> - $ ssh -l <FONT COLOR="#800000"><i>sflogin</i></FONT> octave.cvs.sourceforge.net - Password: <FONT COLOR="#800000"><i>your SF password</i></FONT> -</pre> -Although SF will only show you a message-of-the-day screen then log -you out, this process has the useful side effect of creating a home -directory for you if one doesn't already exist. Some CVS commands will fail -if you do not have a home directory on SF. - -<h3>Download the latest octave-forge distribution</h3> -CVS expects the -code you plan to submit to reside in a directory within the existing -octave-forge directory structure. -You will therefore need to download a copy of the latest octave-forge -distribution to work in. Change directories to a place you want -to put the code, then issue the CVS <i>checkout</i> -(abreviated as 'co') command: -<pre> - $ cd <FONT COLOR="#800000"><i>working_directory</i></FONT> - $ export CVS_RSH=ssh - $ cvs -d:ext:<FONT COLOR="#800000"><i>sflogin</i></FONT>@octave.cvs.sourceforge.net:/cvsroot/octave co octave-forge -</pre> - -<h3>Where does your code belong?</h3> - -Put your file(s) in a subdirectory under the <tt>octave-forge/</tt> -directory. Here are some guidelines to help you decide where your -code belongs: -<ul> ->>>INSERT CONTENTS HERE<<< -</ul> - -<h3>Add a copyright notice</h3> -<p> -Each file in octave-forge must contain a copyright notice. -If you wish to release your -code under the -GNU <a href="http://www.gnu.org/licenses/gpl.html">GPL</a> -, insert the following text at the top of your file: -<pre> -## Copyright (C) <FONT COLOR="#800000"><i>year</i></FONT> <FONT COLOR="#800000"><i>Your Name</i></FONT> <<FONT COLOR="#800000"><i>your@preferred.email</i></FONT>> -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -</pre> - -Here are other popular open source licenses: -<ul> - <li> <a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser GPL</a> - <li> <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License</a> - <li> <a href="http://www.opensource.org/licenses/artistic-license.html">Artistic License</a> - <li> <a href="http://www.opensource.org/licenses/bsd-license.html">BSD License</a> -</ul> -Consult -<a href="http://www.opensource.org/licenses/index.html">opensource.org</a>. -for a comprehensive list of Open Source licenses. - -<h3>Package structure</h3> -<dl> -<dt>package/NOINSTALL -<dd> don't install this package; the user can rename or delete this - file if they want the package installed anyway. -<dt>package/*.m -<dd> m-files for the package; these will be installed in - site/mfiles/octave-forge/package -<dt>package/data/* -<dd> datafiles to be installed with the mfiles. You can accesses - them from your m-files with x = file_in_load_path("a"). -<dt>package/Makefile -<dd> Makefile with a default target to build anything that needs - building, an optional "install" target in case you need to - install something other than m-files, oct-files, data files or - octave binaries, and a "clean" target to remove everything that - has been built. See below for details. -<dt>package/configure.add, package/Makeconf.add -<dd> Additional configuration-time commands to run in order to - find all the components that your package requires. You - can look for anything you want in configure.add and note - what you need in Makeconf.add. The definitions in - Makeconf.add will be available when you include ../../Makeconf - in your Makefile. See main/symbolic for an example. -<dt>package/*.oct -<dd> oct-files built by Makefile. These will be installed all - together in site-oct-files/octave-forge. You may assume that - HAVE_OCTAVE_20 is defined for 2.0.x series mkoctfile, and - HAVE_OCTAVE_21 is defined for 2.1.x series mkoctfile. -<dt>package/bin/* -<dd> executable files built by Makefile. These will be - installed in Octave's EXEC_PATH, so they will be available - from Octave but not from the shell. You have two options - regarding this directory. The better one would be to make - sure that the directory exists before you try building the - binary. The other option is to have a hidden bin/.keepdir - so that CVS won't delete it for you automatically. -</dl> - -<h3>Adding a Makefile</h3> - -If your package has something other than m-files you will need a -Makefile in your directory. This could be as short as three lines: -<pre> -include ../../Makeconf -all: f1.oct -clean: ; -$(RM) *.o core octave-core *.oct *~ -</pre><p> - -If you define multiple DEFUN_DLD's in a file, you may need to -use symbolic links in order for Octave to find them: -<pre> -include ../../Makeconf - -# extra functions defined in fn.oct -fn_LINKS=fn2.oct fn3.oct - -# all compiled functions -PROGS=fn.oct $(fn_LINKS) gn.oct - -all: $(PROGS) - -$(PROGS): Makefile - -$(fn_LINKS): - -$(RM) $@ - $(LN_S) fn.oct $@ - -clean: ; -$(RM) *.o core octave-core *.oct *~ -</pre><p> - -The "include ../../Makeconf" line above includes all of the definitions -that were created during configuration. This includes things like MKOCTFILE, -as well as implicit rules for compiling oct-files. See Makeconf.base -for a list of predefined variables and rules. Sometimes you will see -"sinclude ../../Makeconf". This is for packages which can be compiled -independently of Octave-forge. If Octave-forge is configured, then the -variable OCTAVE_FORGE will be defined.<p> - -Even more complicated makefiles are sometimes necessary, particularly when -the package depends on external libraries. See main/symbolic/Makefile -for an example. The external libraries must be found during configure -so main/symbolic/configure.add provides detection rules. The results -are posted in main/symbolic/Makeconf.add, and will be available during make.<p> - -Please try to keep compatibility with older versions of Octave. The main -configure script tests for features that have changed since octave-2.1.36. -The tests are done in such a way that conditions are only defined if you -are using an older version of octave. That way if the tests are not performed -and the conditions are not defined, support defaults to the newer version -of octave. The following conditions are defined in configure.base: -<dl> -<dt>HAVE_SLLIST_H -<dd>subsref changed from using SLList to using std::list. -To support older versions of octave, use:<pre><code> -#ifdef HAVE_SLLIST_H -#define LIST SLList -#define LISTSIZE length -#define SUBSREF_STRREF -#else -#include <list> -#define LIST std::list -#define LISTSIZE size -#define SUBSREF_STRREF & -#endif -... - octave_value subsref (const std::string SUBSREF_STRREF type, - const LIST<octave_value_list>& idx) { - ... - } - octave_value_list subsref (const std::string SUBSREF_STRREF type, - const LIST<octave_value_list>& idx, - int nargout) { - ... - - if (idx.LISTSIZE () > 1) - ... - } -</code></pre> -<dt>NEED_OCTAVE_QUIT -<dd>signal handling changed from longjump to C++ exceptions. To support -older versions of octave, use:<pre><code> -#ifdef NEED_OCTAVE_QUIT -#define OCTAVE_QUIT do {} while (0) -#define BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE -#define END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE -#define octave_throw_bad_alloc() \ - do { jump_to_top_level(); panic_impossible(); } while (0) -#else -#include <octave/quit.h> -#endif -</code></pre> -<dt>USE_OCTAVE_NAN -<dd>octave_NaN and octave_Inf constants were converted to functions. -To support older versions of octave, use:<pre><code> -#ifdef USE_OCTAVE_NAN -#define lo_ieee_nan_value() octave_NaN -#define lo_ieee_inf_value() octave_Inf -#endif -</code></pre> -</dl> -<p>m-file support across multiple versions -is tricky. Sometimes try/catch will help, but for syntax -changes you will need some sort of preprocessor, such as -awk or sed. -</p> - -<h3>Submit your code!</h3> -You are now ready to upload your code to the Gnu Octave Repository. -Do this with two CVS commands--one to add a new -entry for your file in the octave-forge catalog, and a second command -to actually upload the file: -<pre> - $ cvs add <FONT COLOR="#800000"><i>files</i></FONT> - $ cvs commit <FONT COLOR="#800000"><i>files</i></FONT> -</pre> - -After hitting the carriage return at the end of the commit command, -CVS will open your default editor so that you can enter comments about -the commit. The first time you commit a file the comment might be -something as simple as `Initial commit into CVS.' However, for all -subsequent commits please add meaningful comments that explain why -changes were made to the file since all comments will appear in the -changelog. Try to gather related changes into one commit command. -<p> -Aside: the default editor can be defined like so: -<pre> - $ export EDITOR=<FONT COLOR="#800000">vim</FONT> -</pre> -<p> - -If you are uploading an entire package, then put your directory into the -octave-forge tree and do the following: -<pre> - $ cd octave-forge/main - $ cvs add <FONT COLOR="#800000"><i>package</i></FONT> - $ cvs commit <FONT COLOR="#800000"><i>package</i></FONT> - $ cd <FONT COLOR="#800000"><i>package</i></FONT> - $ cvs add * - $ cvs commit * -</pre> - -You may find it easier to use the import command, especially if your -package contains subdirectories. In this case, you should not put -your directory into the octave-forge tree. Instead, change to the -root of your package tree and enter the following: -<pre> - $ cd <FONT COLOR="#800000"><i>package</i></FONT> - $ cvs -d:ext:<FONT COLOR="#800000"><i>sflogin</i></FONT>@octave.cvs.sourceforge.net:/cvsroot/octave import -m "<FONT COLOR="#800000"><i>package name</i></FONT>" octave-forge/<FONT COLOR="#800000"><i>main/package</i></FONT> <FONT COLOR="#800000"><i>sflogin</i></FONT> start -</pre> - -You can then fetch the new package from octave-forge as follows: -<pre> - $ cd octave-forge - $ cvs -q update -d -</pre> - -<p> -From time to time, you will need to synchronize with CVS: -<pre> - $ cd octave-forge - $ cvs -q update -d -</pre> -Each file will be listed with one of the following codes: -<ul> -<li> `?' for files you created didn't add and commit. -<li> `M' for files you modified but didn't commit. -<li> `C' for files which have unresolvable conflicts. Look inside the file to -see what it was that couldn't be resolved. It will be clearly marked, or you -can do a cvs diff on the file to highlight the conflict. -<li> `U' for files you haven't touched but are modified on the server. -<li> `P' for files you have modified in a way consistent with the modifications -on the server (?), e.g., because you submitted a patch for someone else to apply. -</ul> - -<h3>Learn more about CVS</h3> -The few CVS commands shown here just scratch the surface of this -powerful versioning package. If you become an active contributor -you will benefit from learning more CVS commands and understanding -how CVS works. -The -<a href="http://cvsbook.red-bean.com/cvsbook.html"> -CVS Book</a> is a great place to begin your exploration. - -<h3>Join the developers' mailing list</h3> -Finally, consider joining the octave-forge developer's -<a href="http://lists.sourceforge.net/lists/listinfo/octave-dev"> -mailing list</a>. It is very low traffic. It is used to announce -pending releases of octave-forge and discuss issues related to -working with octave-forge. Discussion of the functions in -octave-forge mostly occurs on the primary octave mailing lists. - -<hr noshade size=1> - -<center> -<p> -<small>Hosted by</small> -<br><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=2888&type=4" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a> - -</body> -</html>
--- a/main/gsl/src/admin/template.readme Wed Aug 23 22:15:50 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ --> Note: this is not the true README file. Create the correct top-level --> README by running the Perl script 'get_contents'. get_contents --> reads this file and the CONTENTS files in each subdirectory then --> creates the README by populating the "Project organization" --> section below with the information found in the CONTENTS files. --> Albert Danial Jan 2 2002 - -*** README is automatically generated from admin/template.readme *** - -The octave-forge project contains functions for Octave which are not in -the main distribution. While the main Octave distribution is -conservative about accepting new functions and changes, octave-forge is -very open. As a result, be prepared for some lower quality code and -more rapidly changing interfaces to the functions in octave-forge. - -The collection is in the public domain, but the individual functions -vary. See COPYING for details. See INSTALL for installation -instructions. - -Octave needs your support! Please donate to the University of -Wisconsin Foundation: - - http://www.uwfoundation.wisc.edu/index.html - -designated as follows: - - I/we wish to support ongoing development of the Octave modelling - language, under the supervision of Professor James B. Rawlings and - Dr. John W. Eaton of the Department of Chemical and Biological - Engineering at the University of Wisconsin-Madison. - -Donations are tax deductible in the United States. A donation of $10/user -per year at current estimates of the user base would support two developers. -Adjust as appropriate for the percentage of users that you think will donate. - - -===================================================================== -Project organization -====================================================================== -Package organization - -package/NOINSTALL - don't install this package; rename or delete this - file if you want the package installed anyway. -package/INDEX - a functions in the directory organized into categories. See - octave-forge/INDEX for a description of the format. -package/*.m - m-files for the package. These will be installed in - site/mfiles/octave-forge/package -package/data/* - datafiles to be installed with the mfiles. You can accesses - them from your m-files with x = file_in_load_path("a"). -package/Makefile - Makefile with a default target to build anything that needs - building, an "install" target to install anything that needs - installing (other than oct-files and m-files---they are handled - automatically), and a "clean" target to delete everything that - was built. -package/configure.add -package/Makeconf.add - Additional configuration-time commands to run in order to - find all the components that the package requires. -package/*.oct - oct-files built by Makefile. These will be installed all - together in site-oct-files/octave-forge. -package/bin/* - executable files built by Makefile. These will be - installed in Octave's EXEC_PATH, so they will be available - from Octave but not from the shell. - -========================================================================== -Administrative files - -autogen.sh - Generates ./configure and Makeconf.in - -configure.base -Makeconf.base - Basic configuration checks, such as locating the install paths, - and the associated variables to be put into Makeconf. Each - package can append checks by including configure.add in the - package directory. - -octinst.sh.in - Install program for packages, with pieces to be filed in by - ./configure - -install-sh - intall program to use if /usr/bin/install does not work - -COPYING - License for the collection, plus an out-of-date list of functions - in the collection and their licenses. - -COPYING.GPL - The text of the GPL license - -cvs-tree - Generate web listing of m-files in the tree - -README - This file - -TODO - Things that could/should be done - -INSTALL - Installation instructions - -Makefile - Top level makefile - -release.sh - Generates release tarball - -cvsdir.sh - Save/restore CVS adminstration files. You need this to install - directly from the CVS tree rather than an exported tarball. E.g., - $ cvsdir.sh save - $ make install - $ cvsdir.sh restore - -========================================================================== -Compatibility Issues - -Issue the following command: - $ grep -d skip "XXX COMPATIBILITY XXX" */* */*/* -for a list of compatibility issues in various functions. As of this -writing, mu2lin is a likely cause of problems when porting audio -packages. - - -========================================================================== -Paul Kienzle -pkienzle@users.sf.net -March 17, 2002