annotate admin/make_index @ 2676:019a7290e0fd octave-forge

Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
author adb014
date Sat, 14 Oct 2006 05:10:07 +0000
parents 6548c639892b
children 9da47715addc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1 #!/usr/bin/env perl
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
2 #
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
3 # Albert Danial Mar 21 2002
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
4 #
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
5 # Creates .html files documenting all the functions in octave and
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
6 # octave-forge.
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
7
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
8 use strict;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
9 use File::Find;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
10 use File::Basename;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
11 use Text::Wrap;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
12 use FileHandle;
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
13 use IPC::Open3;
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
14 use POSIX ":sys_wait_h";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
15
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
16 ## Local configuration; the OCTAVE directory should contain
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
17 # src/DOCSTRINGS (which is a build product) and scripts/.
2497
f68cd4dab747 Just minor changes
hauberg
parents: 2496
diff changeset
18 my $OCTAVE = "../octave";
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
19 my $tmpdir = "/tmp"; # temp directory
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
20 my $catdir = "www/doc"; # output directory
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
21
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
22 ## Commands to grab the last few defs from octave
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
23 ## Use the first def if you want to extract from
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
24 ## a locally compiled version, or the second if you
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
25 ## want to use the installed version.
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
26 #my $OCTAVECMD = "LD_LIBRARY_PATH=$OCTAVE/src/:$OCTAVE/liboctave:$OCTAVE/libcruft $OCTAVE/src/octave -q";
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
27 #my $OCTAVEINIT = "path='.:$OCTAVE/src//:$OCTAVE/scripts//'; suppress_verbose_help_message = 1;";
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
28 my $OCTAVECMD = "octave -q";
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
29 my $OCTAVEINIT = "suppress_verbose_help_message = 1;";
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
30
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
31 # Links to octave/octave-forge web CVS
1545
f6a4d072a146 [for David Bateman] use viewcvs rather than cvsweb
pkienzle
parents: 1475
diff changeset
32 my $OCTAVECVS = "http://www.octave.org/cgi-bin/viewcvs.cgi/~checkout~/octave";
2615
d48a2accb8d8 Fix the octave-forge CVS address so the checkout link actually works
adb014
parents: 2607
diff changeset
33 my $FORGECVS = "http://octave.cvs.sourceforge.net/octave/octave-forge/";
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
34
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
35 #my $script = basename($0);
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
36
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
37 my $forgebar = qq~<center>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
38 <A href="http://octave.sourceforge.net">Home</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
39 <A href="http://sourceforge.net/projects/octave/">Summary</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
40 <A href="http://sourceforge.net/forum/?group_id=2888">Forums</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
41 <A href="http://sourceforge.net/bugs/?group_id=2888">Bugs</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
42 <A href="http://sourceforge.net/support/?group_id=2888">Support</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
43 <A href="http://sourceforge.net/patch/?group_id=2888">Patches</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
44 <A href="http://sourceforge.net/mail/?group_id=2888">Lists</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
45 <A href="http://sourceforge.net/pm/?group_id=2888">Tasks</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
46 <A href="http://sourceforge.net/docman/?group_id=2888">Docs</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
47 <A href="http://sourceforge.net/survey/?group_id=2888">Surveys</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
48 <A href="http://sourceforge.net/news/?group_id=2888">News</A> |
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
49 <A href="http://sourceforge.net/cvs/?group_id=2888">CVS</A> |
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
50 <A href="http://sourceforge.net/project/showfiles.php?group_id=2888">Files</A>
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
51 </center>
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
52 ~;
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
53
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
54 my $forgelink = qq~
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
55 <hr><center>
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
56 <small>Hosted by</small> <a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=2888&amp;type=4" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a>
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
57 </center>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
58 ~;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
59
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
60 # initialize the indexing variables
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
61 my %index_by_TB_cat = (); # i_TB_cat{toolbox}{category} = list of functions
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
62 my %index_by_function = (); # i_function{function} =[ [toolbox_1,category_1],
225
eb54c3d23e13 2nd pass --- still a work in progress
pkienzle
parents: 224
diff changeset
63 # [toolbox_2,category_2],..]
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
64 my %TB_description = ();
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
65 my %index_notes = (); # index_notes{function} = comment
2666
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
66 my %index_by_package = (); # i_package{package} = list of functions
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
67
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
68 # find and load all indices
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
69 my @index_files = ();
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
70 find(\&index_files, ".");
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
71 sub index_files { # {{{1 populates global array @files
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
72 return unless -f and /INDEX$/; # INDEX files
2607
fd60101db45d Ignore INDEX files in packages directory
adb014
parents: 2606
diff changeset
73 return if ($File::Find::dir =~ /packages$/);
280
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
74 my $path = "$File::Find::dir/$_";
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
75 $path =~ s|^[.]/||;
2676
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
76 my $noinstall = sprintf("%s/NOINSTALL", $path);
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
77 if (! -e $noinstall) {
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
78 push @index_files, $path;
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
79 }
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
80 } # 1}}}
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
81 foreach my $f ( @index_files ) {
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
82 load_index($f,
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
83 \%index_by_TB_cat,
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
84 \%TB_description,
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
85 \%index_by_function);
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
86 }
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
87
1475
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
88 # XXX FIXME XXX should die if the index is empty
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
89 # die "No INDEX in current directory" if !-e "INDEX";
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
90 my $summary = !-e "admin/make_index"; # if not in the root, just summarize
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
91 my $include_octave = !$summary; # only include octave if not summarizing
225
eb54c3d23e13 2nd pass --- still a work in progress
pkienzle
parents: 224
diff changeset
92
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
93 # locate all C++ and m-files in octave-forge, and all m-files in octave
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
94 # don't need C++ files from octave because we have DOCSTRINGS
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
95 my @m_files = ();
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
96 my @C_files = ();
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
97 find(\&cc_and_m_files, "$OCTAVE/scripts") if $include_octave;
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
98 find(\&cc_and_m_files, "$OCTAVE/src") if $include_octave;
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
99 # or just use $OCTAVE/{src,scripts}/DOCSTRINGS ....
2140
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
100 find(\&cc_and_m_files, ".");
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
101 sub cc_and_m_files { # {{{1 populates global array @files
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
102 return unless -f and /\.(m|cc|l|y)$/; # .m and .cc files (lex & yacc too!)
280
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
103 my $path = "$File::Find::dir/$_";
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
104 $path =~ s|^[.]/||;
2676
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
105 my $noinstall = sprintf("%s/NOINSTALL", $path);
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
106 if (! -e $noinstall) {
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
107 if (/\.m$/) {
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
108 push @m_files, $path;
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
109 } else {
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
110 push @C_files, $path;
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
111 }
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
112 }
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
113 } # 1}}}
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
114
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
115 my %function_description = ();
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
116 my %octave_forge_function = ();
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
117 my @uncategorized = ();
282
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
118 my @skipped = ();
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
119 my %n_appearances = ();
225
eb54c3d23e13 2nd pass --- still a work in progress
pkienzle
parents: 224
diff changeset
120 my $n_functions = 0;
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
121 my @shadow_paths = ('FIXES', 'extra/NaN', 'extra/Windows', 'extra/ver20');
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
122 my @shadowed = ();
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
123
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
124 # grab help from C++ files
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
125 foreach my $f ( @C_files ) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
126 if ( open(IN,$f) ) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
127 while (<IN>) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
128 # skip to the next function
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
129 next unless /^\s*DEF(UN[ (]|UN_MAPPER|UN_DLD|CMD|VAR|CONST)/;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
130
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
131 # print "looking at $_";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
132 # extract function name to pattern space
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
133 /\((\w*)\s*,/;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
134 # remember function name
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
135 my $function = $1;
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
136 # print " found function $function\n";
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
137
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
138 # skip to second , to skip default string options of DEFVAR
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
139 # comment if third or higher arg
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
140 # XXX FIXME XXX What about if the string arg includes ,
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
141 # XXX FIXME XXX What if second , is not on first line!!
2140
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
142 # Special cases
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
143 # * for DEFCONST (I, Complex (0., 1.),
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
144 s/\(\w*\s*,\s*Complex\s*\(\s*[0-9.]*\s*,\s*[0-9.]*\s*\),//;
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
145 # * for macro containing DEFUN_DLD
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
146 s/\w*\s*\(\w*\s*,\s*"/"/;
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
147 # Main case
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
148 s/\(\w*\s*,.*?,//;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
149
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
150 # If we have nothing but a newline, skip
2140
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
151 $_ = <IN> if /^\s*DEF(UN[ (]|UN_MAPPER|UN_DLD|CMD|VAR|CONST)\s*,*\s*\n/;
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
152
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
153 # if line contains \w+_DOC_STRING we have a macro for the
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
154 # help text
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
155 my $desc;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
156 if (/\w+_DOC_STRING/) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
157 my $macro = $_;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
158 $macro =~ s/^.*?\s*(\w*_DOC_STRING).*$/$1/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
159 $macro =~ s/\n//;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
160
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
161 my $line;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
162 if ( open(IN2, $f) ) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
163 while ($line = <IN2>) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
164 next unless $line =~ /^\#\s*define\s+$macro\s+\"/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
165 $desc = $line;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
166 $desc =~ s/^\#\s*define\s+$macro\s+\"(.*\n)$/$1/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
167 while ($desc !~ /[^\\]\"/ && $desc !~ /^\"/) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
168 $desc =~ s/\\\s*\n//;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
169 # join with the next line
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
170 $desc .= <IN2>;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
171 }
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
172 $desc = "" if $desc =~ /^\"/; # chop everything if it was ""
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
173 $desc =~ s/\\n/\n/g; # insert fake line ends
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
174 $desc =~ s/([^\"])\".*$/$1/; # chop everything after final '"'
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
175 $desc =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\"
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
176 last;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
177 }
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
178 close (IN2);
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
179 } else {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
180 print STDERR "Could not open file ($f): $!\n";
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
181 }
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
182 } else {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
183 # skip to next line if comment doesn't start on this line
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
184 # XXX FIXME XXX maybe we want a loop here?
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
185 $_ = <IN> unless /\"/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
186 # skip to the beginning of the comment string by
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
187 # chopping everything up to opening "
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
188 $desc = $_;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
189 $desc =~ s/^[^\"]*\"//;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
190
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
191 # join lines until you get the end of the comment string
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
192 # plus a bit more. You need the "plus a bit more" because
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
193 # C compilers allow implicitly concatenated string constants
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
194 # "A" "B" ==> "AB".
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
195 while ($desc !~ /[^\\]\"\s*[\,\)]/ && $desc !~ /^\"/) {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
196 # if line ends in '\', chop it and the following '\n'
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
197 $desc =~ s/\\\s*\n//;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
198 # join with the next line
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
199 $desc .= <IN>;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
200 # eliminate consecutive quotes, being careful to ignore
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
201 # preceding slashes. XXX FIXME XXX what about \\" ?
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
202 $desc =~ s/([^\\])\"\s*\"/$1/;
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
203 }
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
204 $desc = "" if $desc =~ /^\"/; # chop everything if it was ""
1430
8aabe04712c8 make_index fix for help strings with macros like load or fft
adb014
parents: 1112
diff changeset
205
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
206 # Now check for text included in help messages as macros
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
207 # XXX FIXME XXX These macros are often compile dependent, so
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
208 # how to we get the correct version of the macro in this case
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
209 # without actually compiling the code???
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
210 while ($desc =~ /[^\\]\"\s*\S+\s*[^\\]\"/) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
211 my $macro = $desc;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
212 # Deal with issues of multiple macros...
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
213 # $macro =~ s/^.*[^\\]\"\s*(\S+?)\s*[^\\]\".*$/$1/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
214 ($macro) = ($macro =~ /[^\\]\"\s*(\S+?)\s*\".*$/);
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
215 $macro =~ s/\n//;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
216 my $macro_defn;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
217 my $line;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
218 if ( open(IN2, $f) ) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
219 while ($line = <IN2>) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
220 next unless $line =~ /^\#\s*define\s+$macro\s+\"/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
221 $macro_defn = $line;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
222 $macro_defn =~ s/^\#\s*define\s+$macro\s+\"(.*)\n$/$1/;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
223 while ($macro_defn !~ /[^\\]\"/ && $macro_defn !~ /^\"/) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
224 $macro_defn =~ s/\\\s*\n//;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
225 # join with the next line
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
226 $macro_defn .= <IN2>;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
227 }
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
228 $macro_defn = "" if $macro_defn =~ /^\"/; # chop everything if it was ""
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
229 $macro_defn =~ s/\\n/\n/g; # insert fake line ends
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
230 $macro_defn =~ s/([^\"])\".*$/$1/; # chop everything after final '"'
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
231 $macro_defn =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\"
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
232 last;
1430
8aabe04712c8 make_index fix for help strings with macros like load or fft
adb014
parents: 1112
diff changeset
233 }
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
234 close (IN2);
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
235 } else {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
236 print STDERR "Could not open file ($f): $!\n";
1430
8aabe04712c8 make_index fix for help strings with macros like load or fft
adb014
parents: 1112
diff changeset
237 }
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
238 $desc =~ s/\"\s*$macro\s*\"/$macro_defn/;
1430
8aabe04712c8 make_index fix for help strings with macros like load or fft
adb014
parents: 1112
diff changeset
239 }
8aabe04712c8 make_index fix for help strings with macros like load or fft
adb014
parents: 1112
diff changeset
240 }
8aabe04712c8 make_index fix for help strings with macros like load or fft
adb014
parents: 1112
diff changeset
241
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
242 $desc =~ s/\\n/\n/g; # insert fake line ends
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
243 $desc =~ s/([^\"])\".*$/$1/; # chop everything after final '"'
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
244 $desc =~ s/\\\"/\"/; # convert \"; XXX FIXME XXX \\"
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
245 # print " description: $desc";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
246
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
247 # register the function with a brief description
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
248 register_function($function,$desc,$f,0);
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
249 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
250 close (IN);
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
251 } else {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
252 print STDERR "Could not open file ($f): $!\n";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
253 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
254 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
255
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
256 # grab help from m-files (octave-forge and octave)
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
257 foreach my $f ( @m_files ) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
258 my $desc = extract_description($f);
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
259 my $function = basename($f, ('.m'));
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
260 die "Null function?? [$f]\n" unless $function;
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
261 register_function($function,$desc,$f,0);
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
262 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
263
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
264 # grab help from octave's DOCSTRINGS
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
265 if ( !$include_octave ) {
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
266 # skip DOCSTRINGS if just summary
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
267 }
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
268 else {
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
269
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
270 if (open (IN,"$OCTAVE/src/DOCSTRINGS")) {
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
271 process_docstrings();
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
272 } else {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
273 print STDERR "could not open $OCTAVE/src/DOCSTRINGS !\n";
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
274 }
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
275 if (open (IN,"$OCTAVE/scripts/DOCSTRINGS")) {
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
276 process_docstrings();
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
277 } else {
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
278 print STDERR "could not open $OCTAVE/scripts/DOCSTRINGS !\n";
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
279 }
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
280 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
281
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
282 # Desperate last measure. Try help <func> within octave. Good for getting
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
283 # keyword and operator descriptions
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
284 print "Perl hacker: please make the following faster\n";
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
285 # XXX FIXME XXX, we shouldn't respawn a new octave process each time !!!
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
286 foreach my $TB ( toolbox_list()) {
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
287 foreach my $cat ( cat_list($TB) ) {
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
288 foreach my $func ( cat_funcs($TB,$cat) ) {
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
289 if (! defined $function_description{$func}[1] && ! defined $index_notes{$func} ) {
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
290 open3(*Writer, *Reader, *Errer, $OCTAVECMD) or die "Could not run octave";
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
291 print Writer $OCTAVEINIT;
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
292 print Writer "help $func; 1"; close(Writer);
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
293 my @lines = <Reader>; close(Reader);
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
294 my @err = <Errer>; close(Errer);
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
295 waitpid(-1,&WNOHANG);
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
296
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
297 # Display errors, if any
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
298 if (@err) {
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
299 print "help $func\n>>> @err";
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
300 } else {
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
301 my $body = join("",@lines);
2140
63b242a71651 make octave versions of function precede octave-forge versions. Some fixes to indexing
adb014
parents: 2000
diff changeset
302 if ($body =~ /help: `(.*)' not found/ || $body =~ /help: sorry,/) {
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
303 # do nothing
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
304 } else {
1776
c96e26aa8fd0 Allow preinstalled octave to fill in missing function definitions.
pkienzle
parents: 1770
diff changeset
305 print "help $func\n";
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
306
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
307 my $start;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
308 if ($body =~ /^\n\*\*\*/) {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
309 # clipping assuming ops/keywords only
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
310 $start = index($body,"$func") + 1 + length($func);
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
311 } else {
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
312 # first lines till \n\n will be octave tell us the type
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
313 # of variable/funtion and where it is found
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
314 $start = index($body,"\n\n") + 2;
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
315 }
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
316 my $stop = index($body,"ans =");
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
317 $body = substr($body,$start,$stop-$start);
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
318 register_function($func,$body,$OCTAVE,0);
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
319 }
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
320 }
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
321 }
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
322 }
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
323 }
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
324 }
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
325
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
326 # print a summary table rather than generating the html
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
327 if ( $summary ) {
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
328 write_ascii("% ");
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
329 }
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
330 else {
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
331 write_html();
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
332 }
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
333
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
334
282
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
335 if (@skipped) {
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
336 print "skipped ", scalar(@skipped), " functions ";
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
337 my $rs = $,; $, = "\n ";
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
338 print " ", sort(@skipped); $, = $rs;
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
339 print "\n";
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
340 }
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
341
710
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
342 print_missing();
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
343
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
344 if (@uncategorized) {
280
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
345 print scalar(@uncategorized), " uncategorized functions ";
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
346 print "(out of ", $n_functions, " total)";
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
347 my $rs = $,; $, = "\n ";
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
348 print " ", sort(@uncategorized); $, = $rs;
225
eb54c3d23e13 2nd pass --- still a work in progress
pkienzle
parents: 224
diff changeset
349 print "\n";
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
350 # print wrap("\t", "\t", join(" ", sort @uncategorized)), "\n";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
351 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
352
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
353 if (@shadowed) {
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
354 print "unexpected shadowing of ", scalar(@shadowed), " Octave functions";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
355 my $rs = $,; $, = "\n ";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
356 print " ", sort(@shadowed); $, = $rs;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
357 print "\n";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
358 # print wrap("\t", "\t", join(" ", sort @shadowed)), "\n";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
359 }
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
360
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
361 sub process_docstrings {
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
362 my $function = "";
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
363 my $desc = "";
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
364 while (<IN>) {
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
365 if (/^\037/) {
2606
54054a31a45e Only treat DOCSTRING entry if we haven't already found the function
adb014
parents: 2599
diff changeset
366 if ($n_appearances{$function} == 0) {
54054a31a45e Only treat DOCSTRING entry if we haven't already found the function
adb014
parents: 2599
diff changeset
367 register_function($function,$desc,$OCTAVE,1) unless $function eq "";
54054a31a45e Only treat DOCSTRING entry if we haven't already found the function
adb014
parents: 2599
diff changeset
368 }
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
369 $function = $_;
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
370 $function =~ s/^\037//;
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
371 $function =~ s/\n$//;
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
372 $desc = "";
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
373 } else {
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
374 $desc .= $_;
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
375 }
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
376 }
2606
54054a31a45e Only treat DOCSTRING entry if we haven't already found the function
adb014
parents: 2599
diff changeset
377 if ($n_appearances{$function} == 0) {
54054a31a45e Only treat DOCSTRING entry if we haven't already found the function
adb014
parents: 2599
diff changeset
378 register_function($function,$desc,$OCTAVE,1) unless $function eq "";
54054a31a45e Only treat DOCSTRING entry if we haven't already found the function
adb014
parents: 2599
diff changeset
379 }
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
380 close(IN);
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
381 }
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
382
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
383 sub first_sentence { # {{{1
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
384 # grab the first real sentence from the function documentation
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
385 my ($desc) = @_;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
386 my $retval = '';
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
387 my $line;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
388 my $next;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
389 my @lines;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
390
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
391 my $trace = 0;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
392 # $trace = 1 if $desc =~ /Levenberg/;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
393 return "" unless defined $desc;
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
394 if ($desc =~ /^\s*-[*]- texinfo -[*]-/) {
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
395
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
396 # help text contains texinfo. Strip the indicator and run it
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
397 # through makeinfo. (XXX FIXME XXX this needs to be a function)
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
398 $desc =~ s/^\s*-[*]- texinfo -[*]-\s*//;
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
399 my $cmd = "makeinfo --fill-column 1600 --no-warn --no-validate --no-headers --force --ifinfo";
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
400 open3(*Writer, *Reader, *Errer, $cmd) or die "Could not run info";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
401 print Writer "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
402 print Writer "$desc"; close(Writer);
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
403 @lines = <Reader>; close(Reader);
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
404 my @err = <Errer>; close(Errer);
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
405 waitpid(-1,&WNOHANG);
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
406
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
407 # Display source and errors, if any
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
408 if (@err) {
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
409 my $n = 1;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
410 foreach $line ( split(/\n/,$desc) ) {
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
411 printf "%2d: %s\n",$n++,$line;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
412 }
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
413 print ">>> @err";
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
414 }
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
415
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
416 # Print trace showing formatted output
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
417 # print "<texinfo--------------------------------\n";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
418 # print @lines;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
419 # print "--------------------------------texinfo>\n";
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
420
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
421 # Skip prototype and blank lines
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
422 while (1) {
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
423 return "" unless @lines;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
424 $line = shift @lines;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
425 next if $line =~ /^\s*-/;
237
436268e5fe9c Category refinement
pkienzle
parents: 234
diff changeset
426 next if $line =~ /^\s*$/;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
427 last;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
428 }
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
429
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
430 } else {
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
431
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
432 # print "<plain--------------------------------\n";
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
433 # print $desc;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
434 # print "--------------------------------plain>\n";
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
435
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
436 # Skip prototype and blank lines
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
437 @lines = split(/\n/,$desc);
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
438 while (1) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
439 return "" if ($#lines < 0);
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
440 $line = shift @lines;
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
441 next if $line =~ /^\s*[Uu][Ss][Aa][Gg][Ee]/; # skip " usage "
2000
1ce8e644c3a9 allow help as only a macro. ignore first lines when calling octave help
adb014
parents: 1985
diff changeset
442 next if $line =~ /^\s*-/; # skip " -- blah"
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
443
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
444 $line =~ s/^\s*\w+\s*://; # chop " blah : "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
445 print "strip blah: $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
446 $line =~ s/^\s*[Ff]unction\s+//; # chop " function "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
447 print "strip function $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
448 $line =~ s/^\s*\[.*\]\s*=\s*//; # chop " [a,b] = "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
449 print "strip []= $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
450 $line =~ s/^\s*\w+\s*=\s*//; # chop " a = "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
451 print "strip a= $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
452 $line =~ s/^\s*\w+\s*\([^\)]*\)\s*//; # chop " f(x) "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
453 print "strip f(x) $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
454 $line =~ s/^\s*[;:]\s*//; # chop " ; "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
455 print "strip ; $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
456
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
457 $line =~ s/^\s*[[:upper:]][[:upper:]0-9_]+//; # chop " BLAH"
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
458 print "strip BLAH $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
459 $line =~ s/^\s*\w*\s*[-]+\s+//; # chop " blah --- "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
460 print "strip blah --- $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
461 $line =~ s/^\s*\w+ *\t\s*//; # chop " blah <TAB> "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
462 print "strip blah <TAB> $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
463 $line =~ s/^\s*\w+\s\s+//; # chop " blah "
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
464 print "strip blah <NL> $line\n" if $trace;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
465
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
466 # next if $line =~ /^\s*\[/; # skip [a,b] = f(x)
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
467 # next if $line =~ /^\s*\w+\s*(=|\()/; # skip a = f(x) OR f(x)
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
468 next if $line =~ /^\s*or\s*$/; # skip blah \n or \n blah
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
469 next if $line =~ /^\s*$/; # skip blank line
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
470 next if $line =~ /^\s?!\//; # skip # !/usr/bin/octave
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
471 # XXX FIXME XXX should be testing for unmatched () in proto
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
472 # before going to the next line!
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
473 last;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
474 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
475 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
476
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
477 # Try to make a complete sentence, including the '.'
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
478 if ( "$line " !~ /[^.][.]\s/ && $#lines >= 0) {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
479 my $next = $lines[0];
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
480 $line =~ s/\s*$//; # trim trailing blanks on last
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
481 $next =~ s/^\s*//; # trim leading blanks on next
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
482 $line .= " $next" if "$next " =~ /[^.][.]\s/; # ends the sentence
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
483 }
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
484
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
485 # Tidy up the sentence.
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
486 chomp $line; # trim trailing newline, if there is one
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
487 $line =~ s/^\s*//; # trim leading blanks on line
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
488 $line =~ s/([^.][.])\s.*$/$1/; # trim everything after the sentence
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
489 print "Skipping:\n$desc---\n" if $line eq "";
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
490
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
491 # And return it.
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
492 return $line;
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
493
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
494 } # 1}}}
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
495 sub shadow_path { # {{{1
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
496 # shadow_path($f) returns true if $f is on a known Octave shadow path
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
497 my ($file) = @_;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
498 $file =~ s|/[^/]*$||;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
499 my @matches = grep(/^$file$/,@shadow_paths);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
500 # print "looking for $file in @shadow_paths\n";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
501 # print "returns ",@matches,"\n";
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
502 return scalar(@matches) > 0 || $file =~ /alternatives$/;
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
503
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
504 } # 1}}}
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
505 sub register_function { # {{{1
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
506 # register the function and its one-line description
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
507 my ($function, # in $index{toolbox}{category} = [functions]
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
508 $desc, # in $toolbox_desc{toolbox} = description
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
509 $file,
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
510 $replace_shadow,
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
511 ) = @_;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
512 ++$n_appearances{$function};
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
513 if ($n_appearances{$function} > 1) {
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
514 if ($replace_shadow != 0) {
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
515 push @shadowed, "$file:$function" if $file =~ /^$OCTAVE/
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
516 and !shadow_path($function_description{$function}[0]);
2168
9e2e3714b627 Better reporting of shadowed functions; better support for DOCSTRINGS
pkienzle
parents: 2140
diff changeset
517 # print "$file:$function appeared previously\n";
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
518 }
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
519 } else {
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
520 ++$n_functions;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
521 }
2666
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
522 if (! ($file =~ /^$OCTAVE/)) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
523 $octave_forge_function{$function} = 1;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
524 my $package = $file;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
525 $package =~ s|^\s*([^/]+/[^/]+/).*$|$1|;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
526 if ($package =~ /^\s*$/) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
527 printf("%-12s %-20s %s\n", $function, $file, $package);
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
528 }
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
529 push @{$index_by_package{$package}}, $function;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
530 }
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
531 if (!defined $index_by_function{$function}) {
282
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
532 my $entry = $file;
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
533 $entry = "$file: $function" if $file !~ /[.]m$/;
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
534 if ($function =~ /__/ || $file =~ /test/
2580
211c0aebba29 Start fixing the main INDEX file and making a clearer split with the octave core functions
adb014
parents: 2512
diff changeset
535 || $function =~ /^[Cc]ontents?$/
211c0aebba29 Start fixing the main INDEX file and making a clearer split with the octave core functions
adb014
parents: 2512
diff changeset
536 || $function =~ /pre_install/ || $function =~ /post_install/) {
282
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
537 push @skipped, $entry;
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
538 } else {
19aaed89e997 More categorization --- mostly complete now
pkienzle
parents: 280
diff changeset
539 push @uncategorized, $entry;
280
d635ce91ccaf still more tidying of summary output
pkienzle
parents: 279
diff changeset
540 }
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
541 }
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
542
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
543 my $oneline = first_sentence($desc);
278
042ee9410f80 Summary of the current directory if not run from the root
pkienzle
parents: 267
diff changeset
544 #printf "%30s %s\n", $function, $oneline;
1759
ffb76ce36061 Don't replace help text for existing functions. That is help of *.cc versions preferred to *.m versions (cf dispatch)
adb014
parents: 1756
diff changeset
545 if ($replace_shadow == 0 && defined @function_description{$function}) {
ffb76ce36061 Don't replace help text for existing functions. That is help of *.cc versions preferred to *.m versions (cf dispatch)
adb014
parents: 1756
diff changeset
546 @function_description{$function} = [ $function_description{$function}[0], $oneline, $desc ];
ffb76ce36061 Don't replace help text for existing functions. That is help of *.cc versions preferred to *.m versions (cf dispatch)
adb014
parents: 1756
diff changeset
547 } elsif (!defined @function_description{$function}) {
1756
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
548 @function_description{$function} = [ $file, $oneline, $desc ];
10090d51b02a Update make_index to check for DEFCONST, also use DOCSTRINGS for text of help even if function is found elsewhere to allow for help string defined as macros, and call help in octave to find operators and keywords
adb014
parents: 1755
diff changeset
549 }
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
550 # push @function_description{$function}}, "$file\n$oneline\n$desc";
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
551 #printf "%-12s %-20s %s\n", $function,
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
552 # $index_by_function{$function}[0],
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
553 # $index_by_function{$function}[1];
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
554 } # 1}}}
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
555 sub extract_description { # {{{1
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
556 # grab the entire documentation comment from an m-file
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
557 my ($file) = @_;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
558 my $retval = '';
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
559
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
560 if( open( IN, "$file")) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
561 # skip leading blank lines
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
562 while (<IN>) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
563 last if /\S/;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
564 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
565 if( m/\s*[%\#][\s\#%]* Copyright/) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
566 # next block is copyright statement, skip it
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
567 while (<IN>) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
568 last unless /^\s*[%\#]/;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
569 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
570 }
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
571 # Skip everything until the next comment block
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
572 while ( !/^\s*[\#%]/ ) {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
573 $_ = <IN>;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
574 last if not defined $_;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
575 }
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
576 # Return the next comment block as the documentation
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
577 while (/^\s*[\#%]/) {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
578 s/^[\s%\#]*//; # strip leading comment characters
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
579 s/[\cM\s]*$//; # strip trailing spaces.
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
580 $retval .= "$_\n";
267
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
581 $_ = <IN>;
94a282214dc7 Tune the first sentence heuristic
pkienzle
parents: 265
diff changeset
582 last if not defined $_;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
583 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
584 close(IN);
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
585 return $retval;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
586 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
587 else {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
588 print STDERR "Could not open file ($file): $!\n";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
589 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
590 } # 1}}}
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
591 sub load_index { # {{{1
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
592 my ($file) = @_; # in
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
593 my $toolbox = "extra";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
594 my $category = "";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
595 my $description = "";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
596 my $function = "";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
597 open(IN, $file) or die "Cannot read $file: $!\n";
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
598 my %map; # simple macros for use in notes
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
599 while (<IN>) {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
600 next if /^\s*$/; # skip blank lines
225
eb54c3d23e13 2nd pass --- still a work in progress
pkienzle
parents: 224
diff changeset
601 next if /^\s*\#/; # skip comment lines
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
602 chomp;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
603 if (/^(.*?)\s*>>\s*(.*?)$/) {
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
604 # toolbox lines contain "word >> description"
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
605 $toolbox = $1;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
606 $description = $2;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
607 $category = "";
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
608 $TB_description{$toolbox} = $description;
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
609 } elsif (/^\s*\$(\w+)\s*=\s*(\S.*\S)\s*$/) {
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
610 # define a variable as "$var = expansion"
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
611 $map{$1} = $2;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
612 } elsif (/^(\w.*?)\s*$/) {
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
613 # category lines start in the left most column
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
614 $category = $1;
1755
89aab854c966 Allow '== = <text>' syntax in INDEX
adb014
parents: 1545
diff changeset
615 } elsif (/^\s+(\S.*[^=~!><])=\s*(\S.*\S)\s*$/) {
880
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
616 # Process "function = notes" explicit descriptions
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
617 $function = $1;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
618 $description = $2;
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
619
880
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
620 # We used ...(\S.*)=... rather than (\S.*\S)\s*= to allow for
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
621 # single character function names, but that means we may have
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
622 # to trim some extra spaces of the function name. Single
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
623 # character descriptions get the treatment they deserve.
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
624 $function =~ s/\s+$//;
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
625
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
626 # expand all $var in the description
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
627 my @parts = split('\$', $description);
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
628 foreach my $i ( 1 .. $#parts ) {
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
629 $parts[$i] =~ /^(\w+)(\W.*)$/ or $parts[$i] =~ /^(\w+)()$/;
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
630 $parts[$i] = "$map{$1}$2";
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
631 }
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
632 $description = join("",@parts);
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
633
880
391d6cb29a47 fix single character " x = description" INDEX entries
pkienzle
parents: 876
diff changeset
634 # record the function->description mapping
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
635 $index_notes{$function} = $description;
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
636 die "Function $function (line $.) has no category" unless $category;
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
637 push @{$index_by_TB_cat{$toolbox}{$category}}, $function;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
638 push @{$index_by_function{$function}}, [$toolbox, $category];
234
e331450e76fd pass 3: allows function descirptions in the index file.
pkienzle
parents: 225
diff changeset
639 } else {
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
640 s/^\s+//;
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
641 my @list = split /\s+/;
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
642 while ($#list >= 0) {
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
643 $function = shift @list;
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
644 die "Function $function (line $.) has no category" unless $category;
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
645 push @{$index_by_TB_cat{$toolbox}{$category}}, $function;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
646 push @{$index_by_function{$function}}, [$toolbox, $category];
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
647
224
9a03ed867bd3 First pass at complete index.
pkienzle
parents: 213
diff changeset
648 }
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
649 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
650 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
651 close(IN);
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
652 } # 1}}}
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
653 sub write_html { # {{{1
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
654 # make empty html directories
1475
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
655 unlink <$catdir/*.html>;
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
656 unlink <$catdir/f/*.html>;
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
657 mkdir "$catdir";
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
658 mkdir "$catdir/f";
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
659
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
660 #write_main();
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
661 #write_forgebar();
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
662 write_index();
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
663 write_alphabetic_navbar();
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
664 write_TBnavbar();
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
665 foreach ( toolbox_list() ) {
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
666 #write_TBnavbar($_);
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
667 write_TBdetails($_);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
668 }
2666
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
669 foreach ( package_list() ) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
670 write_package_details($_);
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
671 }
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
672
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
673 # Write one file for each letter.
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
674 #
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
675
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
676 my $Letter = chr(0);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
677 foreach my $func ( indexed_funcs() ) {
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
678 # The source file
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
679
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
680 my $body = long_desc($func);
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
681 if ($body ne "") {
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
682 # XXX FIXME XXX this will die if the punctuation is too wild
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
683 open FUNC, ">$catdir/f/$func.in" or die "Could not open $func.in";
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
684 print FUNC "__DOC_HEADER__([[[Function Reference: $func]]])";
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
685 print FUNC "<table width=100%><tr><td align=left><b>$func</b>\n";
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
686 # The toolboxes to which it belongs
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
687 foreach my $pair ( @{$index_by_function{$func}} ) {
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
688 my ( $TB, $cat ) = @{$pair};
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
689 print FUNC " ", cat_ref_up($TB, $cat, "[$TB]"), "\n";
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
690 }
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
691 print FUNC " <td align=right>", download_ref($func), "</table>\n";
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
692 print FUNC "$body\n";
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
693 print FUNC "__TRAILER__";
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
694 close FUNC;
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
695 }
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
696
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
697 # Check if need to go to the next letter
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
698 # This is particularly complicated because we
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
699 # want to include all punctuation in the
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
700 my $next = uc(substr($func, 0, 1));
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
701 if ($next ne $Letter) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
702 if ($Letter =~ /[A-Y]/) {
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
703 print OUT "</dl>\n__TRAILER__\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
704 close OUT;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
705 } else {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
706 print OUT "</dl>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
707 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
708 if ($Letter =~ /[\0A-Y]/) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
709 my $head = "";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
710 if ( $next =~ /[A-Z]/ ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
711 $head = $next;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
712 } elsif ( $next lt "A" ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
713 $head = "A";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
714 } else {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
715 $head = "Z";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
716 }
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
717 my $file = ">$catdir/$head.in";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
718 open(OUT, $file) or die "Cannot write $file";
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
719 print OUT "__DOC_HEADER__([[[Function Reference: $head]]])";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
720 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
721 $Letter = $next;
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
722 print OUT "<h2><a name=\"$Letter\">$Letter</a></h2>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
723 print OUT "<dl>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
724 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
725
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
726 # Function reference
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
727 print OUT "<dt><table width=100%><tr><td align=left><b>",func_ref($func,$func),"</b>\n";
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
728 # The toolboxes to which it belongs
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
729 foreach my $pair ( @{$index_by_function{$func}} ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
730 my ( $TB, $cat ) = @{$pair};
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
731 print OUT " ", cat_ref($TB, $cat, "[$TB]"), "\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
732 }
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
733 print OUT " <td align=right>", download_ref($func), "</table>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
734
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
735
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
736 # column 3: the function description
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
737 # XXX FIXME XXX multiple functions???
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
738 print OUT " <dd>",html_desc($func),"\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
739 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
740
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
741 print OUT "</dl>\n__TRAILER__\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
742 close(OUT);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
743 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
744 sub writenav { # 1{{{
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
745 my ($cat) = @_;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
746
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
747 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
748 sub write_main { # {{{1
1475
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
749 open(OUT,">$catdir/index.html") or die "Could not open $catdir/index.html";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
750 print OUT <<EOF;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
751 <HTML><HEAD>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
752 <TITLE>Octave-forge combined index</TITLE>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
753 </HEAD>
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
754 <FRAMESET rows="50, *">
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
755 <FRAME src="forgebar.html" noresize frameborder="0">
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
756 <FRAMESET cols="33%, 67%">
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
757 <FRAME name=navbar src="categorical.html">
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
758 <FRAMESET rows="50, *">
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
759 <FRAME src="alphabetic.html">
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
760 <FRAME name=content src="intro.html">
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
761 </FRAMESET>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
762 </FRAMESET>
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
763 <NOFRAMES>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
764 $forgebar
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
765 <H1>Octave-Forge Combined Index</H1>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
766 <ul>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
767 <li><A HREF="categorical.html">Categorical index</a>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
768 <li><A HREF="alphabetic.html">Alphabetic index</a>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
769 </ul>
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
770 </NOFRAMES>
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
771 </FRAMESET>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
772 </HTML>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
773 EOF
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
774 close OUT;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
775 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
776 sub write_forgebar {
1475
4602d2d9b1f8 Windows/OS X have case-insensitive file names, so move INDEX out of the
pkienzle
parents: 1430
diff changeset
777 open(OUT,">$catdir/forgebar.html") or die "Could not open index/forgebar.html";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
778 print OUT <<EOF;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
779 <html><title>Octave Forge site navigator</title>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
780 <base target=_top>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
781 <body>
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
782 $forgebar
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
783 </body></html>
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
784 EOF
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
785 }
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
786 sub download_ref {
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
787 # download_ref($func,$desc) returns a link to download $func described by $desc
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
788 my ($func) = @_;
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
789
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
790 my $path = $function_description{$func}[0];
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
791 if ($path ne "" && $path !~ /^$OCTAVE/) {
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
792 return "[<a href=\"$FORGECVS$path\?rev=HEAD\&content-type=text/plain\">octave-forge/$path</a>]";
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
793 } elsif ($path =~ /^$OCTAVE/) {
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
794 $path =~ s/^$OCTAVE//;
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
795 return "[<a href=\"$OCTAVECVS$path\?rev=HEAD\&content-type=text/plain\">octave$path</a>]";
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
796 } else {
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
797 return "";
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
798 }
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
799 }
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
800 sub write_index { # 1{{{
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
801 open(OUT,">$catdir/index.in") or die "Could not open $catdir/index.in";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
802 print OUT <<EOF;
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
803 __DOC_HEADER__([[[Function Reference]]])
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
804 <p>This page contains the documentation for individual functions provided by
2512
b517790ca56e The text on the function reference main page corresponds to the new drop-down menus
hauberg
parents: 2511
diff changeset
805 Octave and Octave-Forge. The documentation can either be accessed by category or alphabetically.
b517790ca56e The text on the function reference main page corresponds to the new drop-down menus
hauberg
parents: 2511
diff changeset
806 Simply use the drop-down menus at the top of the page.</p>
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
807 __TRAILER__
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
808 EOF
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
809 close OUT;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
810 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
811 sub write_TBnavbar { # 1{{{
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
812 my $openTB = shift;
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
813 my $file = "menu";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
814 $file = "nav$openTB" if $openTB ne "";
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
815 open(OUT,">$catdir/$file.include") or die "Could not open $catdir/$file.include";
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
816
2511
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
817 #print OUT "<a href=\"__BASE_ADDRESS__/index.html\">Home</a>\n";
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
818 print OUT "<select name=\"dropdowncat\" size=\"1\" onChange=\"javascript:goto_url(docform.dropdowncat.value)\">\n";
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
819 print OUT "<option value=\"-1\">Categories</option>\n";
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
820
2676
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
821 foreach my $TB (toolbox_list_sorted_by_desc()) {
2511
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
822 print OUT "<option value=\"__BASE_ADDRESS__/doc/$TB.html\">$TB_description{$TB}</option>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
823 }
2511
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
824 print OUT "</select>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
825 close OUT;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
826 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
827 sub write_TBdetails { # 1{{{
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
828 my $TB = shift;
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
829 my $file = "$catdir/$TB.in";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
830
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
831 open(OUT, ">$file") or die "Cannot write $file: $!\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
832 print OUT <<EOF;
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
833 __DOC_HEADER__([[[$TB]]])
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
834 <h2>$TB_description{$TB}</h2>
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
835 EOF
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
836
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
837 # summary list of categories
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
838 print OUT "<ul>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
839 foreach my $cat ( cat_list($TB) ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
840 my $anchor = cat_anchor($cat);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
841 print OUT " <li><a href=\"#$anchor\">$cat</a></li>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
842 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
843 print OUT "</ul>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
844
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
845 # Each category has a table of its functions and their descriptions.
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
846 foreach my $cat ( cat_list($TB) ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
847 my $anchor = cat_anchor($cat);
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
848 print OUT "<h3><a name=\"$anchor\">$cat</a></h3>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
849 print OUT "<dl>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
850 foreach my $func ( cat_funcs($TB,$cat) ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
851
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
852 # column 1: the function (x-ref to full description in
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
853 # cvs-tree's html file)
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
854 print OUT "<dt><table width=100%><tr><td align=left><b>",func_ref($func,$func),"</b>\n";
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
855 print OUT " <td align=right>", download_ref($func), "</table>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
856
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
857 # column 2: the description, if it exists
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
858 #
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
859 print OUT "<dd>",html_desc($func),"\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
860 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
861 print OUT "</dl>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
862 }
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
863 print OUT "__TRAILER__\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
864 close(OUT);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
865 } # 1}}}
2666
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
866 sub write_package_details { # 1{{{
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
867 my $packdir = shift;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
868 my $package;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
869 my $title;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
870 my $desc = sprintf("%s/DESCRIPTION", $packdir);
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
871 open(IN, $desc) or die "Cannot read $desc: $!\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
872 while(<IN>) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
873 if (/^[Nn]ame:/) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
874 chomp;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
875 s/^[Nn]ame:\s*//;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
876 s/\s*$//;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
877 $package = lc($_);
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
878 } elsif (/^[Tt]itle:/) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
879 chomp;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
880 s/^[Tt]itle:\s*//;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
881 s/\s*$//;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
882 $title = $_;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
883 }
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
884 }
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
885 close(IN);
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
886 my $file = "$catdir/funref_$package.in";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
887
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
888 open(OUT, ">$file") or die "Cannot write $file: $!\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
889 print OUT <<EOF;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
890 __HEADER__([[[$title]]])
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
891 EOF
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
892 print OUT "<dl>\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
893 foreach my $func ( pack_list($packdir) ) {
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
894
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
895 # column 1: the function (x-ref to full description in
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
896 # cvs-tree's html file)
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
897 print OUT "<dt><table width=100%><tr><td align=left><b>",func_ref($func,$func),"</b>\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
898 print OUT " <td align=right>", download_ref($func), "</table>\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
899
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
900 # column 2: the description, if it exists
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
901 #
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
902 print OUT "<dd>",html_desc($func),"\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
903 }
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
904 print OUT "</dl>\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
905 print OUT "__TRAILER__\n";
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
906 close(OUT);
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
907 } # 1}}}
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
908 sub write_alphabetic_navbar { # 1{{{
2487
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
909 open(OUT,">$catdir/alphabetic.include") or die "Could not open $catdir/alphabetic.include";
8243f1450195 Updated the webpage to include documentation
hauberg
parents: 2168
diff changeset
910
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
911 my $A_to_Z = "";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
912 foreach (first_letters (indexed_funcs())) {
2511
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
913 $A_to_Z .= letter_option($_) . "\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
914 }
2511
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
915 my $select = "<select name=\"dropdownalpha\" size=\"1\" onChange=\"javascript:goto_url(docform.dropdownalpha.value)\">";
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
916 $select .= "\n<option value=\"-1\">Alphabetical</option>\n";
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
917 print OUT $select . $A_to_Z . "\n</select>\n";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
918 close OUT;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
919 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
920 sub oldnavbar { # 1{{{
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
921 my $max_TB_across_top = 7;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
922 my $all_toolboxes = "<center>\n";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
923 my $n = 0;
265
e49d918cb803 Split main.idx into individual subdirectories to make it more manageable
pkienzle
parents: 264
diff changeset
924
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
925 foreach my $TB (toolbox_list()) {
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
926 ++$n;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
927 if ($n > $max_TB_across_top) {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
928 $n = 0;
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
929 $all_toolboxes .= "<a href=\"$TB.html\">$TB</a> <br> ";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
930 } else {
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
931 $all_toolboxes .= "<a href=\"$TB.html\">$TB</a> | ";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
932 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
933 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
934 $all_toolboxes =~ s/\s+\|\s*$//; # strip last pipe separator
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
935 $all_toolboxes .= "<br><br>";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
936 my $A_to_Z = "";
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
937 foreach (first_letters (indexed_funcs())) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
938 $A_to_Z .= letter_ref($_);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
939 $A_to_Z .= " | ";
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
940 }
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
941 $A_to_Z =~ s/\s+\|\s*$//; # strip last pipe separator
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
942 my $all_toolboxes_A_Z = $all_toolboxes . "$A_to_Z </center>\n";
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
943 $all_toolboxes .= "</center>\n";
264
aab3ba664fbe code tidying
pkienzle
parents: 237
diff changeset
944
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
945 } # 1}}}
710
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
946 sub print_missing {
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
947 my $printmissing = 1;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
948 foreach my $TB ( toolbox_list() ) {
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
949 my $printTB = 1;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
950 foreach my $cat ( cat_list($TB) ) {
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
951 my $printcat = 1;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
952 foreach my $func ( cat_funcs($TB,$cat) ) {
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
953 if (! defined $function_description{$func}[1] && ! defined $index_notes{$func} ) {
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
954 print "missing functions:" if $printmissing;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
955 print "\n [$TB]" if $printTB;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
956 print "\n $cat\n >" if $printcat;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
957 print " $func";
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
958 $printTB = 0;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
959 $printcat = 0;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
960 $printmissing = 0;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
961 }
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
962 }
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
963 }
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
964 }
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
965 print "\n" unless $printmissing;
208ab6af6cb3 List missing and unnoted functions so that INDEX can be checked for extra
pkienzle
parents: 654
diff changeset
966 }
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
967 sub write_ascii { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
968 # output all toolboxes as a contents.m file
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
969 my ($prefix) = @_;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
970 my $indent = 16 - 3 - length($prefix);
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
971
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
972 # XXX FIXME XXX add an option to spit out contents.m
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
973 # XXX FIXME XXX what if there is no toolbox?
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
974 # XXX FIXME XXX preserve category order
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
975 foreach my $TB ( toolbox_list() ) {
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
976 print wrap($prefix,$prefix,$TB_description{$TB}),"\n$prefix\n";
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
977 foreach my $cat ( cat_list($TB) ) {
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
978 print wrap($prefix,$prefix,$cat), "\n";
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
979 foreach my $func ( cat_funcs($TB,$cat) ) {
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
980 my $entry = sprintf("%-*s %s",$indent,$func,ascii_desc($func));
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
981 print wrap("$prefix","$prefix\t\t"," $entry"), "\n";
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
982 }
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
983 print "$prefix\n";
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
984 }
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
985 }
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
986 } # 1}}}
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
987 sub cat_ref { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
988 # cat_ref($TB,$cat,$ref) returns an html link to $cat described by $ref
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
989 my ($TB,$cat,$ref) = @_;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
990 my $anchor = cat_anchor($cat);
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
991 return "<a href=\"$TB.html#$anchor\">$ref</a>";
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
992 } # 1}}}
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
993 sub cat_ref_up { # 1{{{
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
994 # cat_ref($TB,$cat,$ref) returns an html link to $cat described by $ref
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
995 my ($TB,$cat,$ref) = @_;
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
996 my $anchor = cat_anchor($cat);
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
997 return "<a href=\"../$TB.html#$anchor\">$ref</a>";
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
998 } # 1}}}
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
999 sub cat_anchor { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1000 # cat_anchor($cat) returns the anchor word generated for category $cat
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1001 my ($cat) = @_;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1002 $cat =~ s/\W+//g;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1003 return $cat;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1004 } # 1}}}
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1005 sub func_ref { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1006 # func_ref($func) returns an html link to $func described by $ref
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1007 my ($func,$ref) = @_;
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1008 if ( defined $function_description{$func}[2] &&
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1009 $function_description{$func}[2] ne "") {
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1010 return "<a href=\"f/$func.html\">$ref</a>";
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1011 } elsif ( $ref ne $func ) {
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1012 # XXX FIXME XXX do we want "$ref ($func)"? Check how it is called.
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1013 return $ref;
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1014 } else {
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1015 return $ref;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1016 }
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1017 } # 1}}}
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1018 sub split_long_name { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1019 # html magic to break long variable/function names
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1020 # XXX FIXME XXX this function is probably not used
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1021 my ( $nicefunc ) = @_;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1022 # $nicefunc =~ s/([^_])_([^_])/$1_ $2/g;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1023 return $nicefunc;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1024 } # 1}}}
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1025 sub first_letters { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1026 # return a list of all first letters in the arguments
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1027 # The argument list must come sorted with a case-insensitive sort.
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1028 my $Letter = chr(0);
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1029 my @ret = ();
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1030 foreach my $name ( @_ ) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1031 # Check if need to go to the next letter
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1032 if (uc(substr($name, 0, 1)) ne $Letter) {
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1033 $Letter = uc(substr($name, 0, 1));
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1034 push @ret, $Letter;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1035 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1036 }
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1037 return @ret;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1038 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1039 sub letter_file { # 1{{{
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1040 return "$_.html" if /[A-Z]/;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1041 return "A.html" if $_ lt "A";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1042 return "Z.html";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1043 } # 1}}}
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1044 sub letter_ref { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1045 # letter_ref($letter) returns a link to the letter
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1046 return "<a href=\"" . letter_file($_) . "#$_\">$_</a>";
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1047 } # 1}}}
2511
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
1048 sub letter_option { # 1{{{
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
1049 # letter_option($letter) returns a link to the letter
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
1050 return "<option value=\"__BASE_ADDRESS__/doc/" . letter_file($_) . "#$_\">$_</option>";
b0b8a45dc50e Added a new navigation bar for the function reference
hauberg
parents: 2497
diff changeset
1051 } # 1}}}
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1052 sub ascii_desc { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1053 # ascii_desc($func) returns a decription of $func using ascii markup
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1054 my ( $func ) = @_;
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1055 if (! defined $function_description{$func}[1] ) {
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1056 my $notes = $index_notes{$func};
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1057 $notes = "<missing>" if $notes eq "";
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1058 # convert "<a link>desc</a>" to "desc (link)"
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1059 $notes =~ s|<a href=\"?([^>]*)\"?>([^<]*)</a>|$2 ($1)|g;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1060 # strip all remaining html formatting
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1061 $notes =~ s|<[^>]*>||g;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1062 return $notes;
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1063 } else {
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1064 my $desc = $function_description{$func}[1];
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1065 if ($desc eq "") {
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1066 return "<no description>";
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1067 } else {
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1068 return $desc;
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1069 }
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1070 }
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1071 } #}}}
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1072 sub html_desc { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1073 # html_desc($func) returns a description of $func using html markup
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1074 my ( $func ) = @_;
881
3f56c4a164d3 List the ignored notes
pkienzle
parents: 880
diff changeset
1075 my $notes = $index_notes{$func};
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1076 if (! defined $function_description{$func}[1] ) {
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1077 $notes = "not implemented" if $notes eq "";
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1078 # shut of the bold italics during "code" formatting
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1079 $notes =~ s|<code>|</i><code>|g;
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1080 $notes =~ s|</code>|</code><i>|g;
1112
8cae3cf4d756 Transform "use <code>fn</code>" to "use <f>fn</f>", and make it link to fn.
pkienzle
parents: 881
diff changeset
1081 $notes =~ s|<f>(\w+)</f>|</i><code><a href="f/$1.html">$1</a></code><i>|g;
296
b3208bf8490a Frames for easy navigation
pkienzle
parents: 295
diff changeset
1082 return "<i>$notes</i>";
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1083 } else {
881
3f56c4a164d3 List the ignored notes
pkienzle
parents: 880
diff changeset
1084 print "ignoring $func = $notes\n" if $notes ne "";
301
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1085 my $desc = $function_description{$func}[1];
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1086 if ($desc eq "") {
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1087 return "<i>no description</i>";
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1088 } else {
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1089 return $desc;
b31d50953186 fix "not implemented"; include full path to source; just include toolbox handle
pkienzle
parents: 299
diff changeset
1090 }
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1091 }
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1092 } # 1}}}
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1093 sub long_desc {
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1094 my ( $func ) = @_;
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1095 my $body = $function_description{$func}[2];
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1096 if ($body =~ /^\s*-[*]- texinfo -[*]-/) {
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1097 $body = info2html($func, $body);
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1098 } elsif ($body ne "") {
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1099 $body = "<pre>$body</pre>";
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1100 }
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1101 return $body
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1102 } # 1}}}
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1103 sub info2html_texi2html { # 1{{{
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1104 # run body through texi2html to produce html
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1105 my ( $func, $body ) = @_;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1106 $body =~ s/^\s*-[*]- texinfo -[*]-//;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1107 open(SRC, ">$func.texi");
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1108 print SRC "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1109 print SRC "BEGINCUT $body ENDCUT";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1110 close SRC;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1111 system ("texi2html -expand info $tmpdir/$func.texi");
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1112 open(SRC, "<$func.html");
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1113 my @lines = <SRC>;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1114 close SRC;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1115 $body = join("",@lines);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1116 my $start = index($body,"BEGINCUT") + 8;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1117 my $stop = index($body,"ENDCUT");
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1118 $body = substr($body,$start,$stop-$start);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1119 unlink "$func.texi", "$func.html";
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1120 } # 1}}}
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1121 sub info2html { # 1{{{
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1122 # run body through makeinfo to produce html
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1123 my ( $func, $body ) = @_;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1124 $body =~ s/^\s*-[*]- texinfo -[*]-//;
876
429ae5db0dcd Fix texinfo->html conversion.
pkienzle
parents: 874
diff changeset
1125 my $cmd = "makeinfo --fill-column 80 --no-warn --no-validate --force --html --ifinfo -o -";
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1126 open3(*Writer, *Reader, *Errer, $cmd) or die "Could not run info";
2599
e795ebd07acd www/developers.html now builds
hauberg
parents: 2580
diff changeset
1127 #SH# print Writer "\@macro seealso {args}\n\n\@noindent\nSee also: \\args\\.\n\@end macro\n";
e795ebd07acd www/developers.html now builds
hauberg
parents: 2580
diff changeset
1128 print Writer "\@macro seealso{args}\n m4_changequote(`, ')\n seealso(\\args\\)\n m4_changequote([[[, ]]])\n\@end macro\n";
329
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1129 # I have no idea why but makeinfo is introducing some weirdness with <p>
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1130 # at the front of the document. The following works for my particular
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1131 # version but I have little hope for it working in general
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1132 print Writer "-CUT HERE $body"; close(Writer);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1133 my @lines = <Reader>; close(Reader);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1134 my @err = <Errer>; close(Errer);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1135 waitpid(-1,&WNOHANG);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1136 # strip everything before <body> and after </body>
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1137 $body = join("",@lines);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1138 my $start = index($body,"CUT HERE") + 8;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1139 my $stop = index($body,"</body");
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1140 $body = substr($body,$start,$stop-$start);
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1141 $body =~ s|\@var\{([^\}]*)\}|<var>$1</var>|g;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1142 return $body;
a6f9e60ce251 report on shadowed octave functions
pkienzle
parents: 301
diff changeset
1143 } # 1}}}
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1144 sub toolbox_list { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1145 # toolbox_list() returns an ordered list of toolboxes.
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1146 return sort { uc($a) cmp uc($b) } keys %index_by_TB_cat;
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1147 } # 1}}}
2676
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
1148 sub toolbox_list_sorted_by_desc { # 1{{{
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
1149 # toolbox_list_sorted_by_desc() returns an ordered list of toolboxes.
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
1150 return sort { uc($TB_description{$a}) cmp uc($TB_description{$b}) } keys %index_by_TB_cat;
019a7290e0fd Respect NOINSTALL tags when indexing functions. Sort categories alphabetically
adb014
parents: 2666
diff changeset
1151 } # 1}}}
2666
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1152 sub package_list { # 1{{{
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1153 # package_list() returns an ordered list of package directories.
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1154 return sort { uc($a) cmp uc($b) } keys %index_by_package;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1155 } # 1}}}
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1156 sub cat_list { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1157 # cat_list($TB) returns an ordered list of categories in a toolbox $TB.
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1158 my ($TB) = @_;
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1159 return sort keys %{$index_by_TB_cat{$TB}};
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1160 } # 1}}}
2666
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1161 sub pack_list { # 1{{{
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1162 # pack_list($package) returns an ordered list of functions in a package directory.
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1163 my ($package) = @_;
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1164 return sort @{$index_by_package{$package}};
6548c639892b Create a seperate page list only the contents of a package alphabetically
adb014
parents: 2615
diff changeset
1165 } # 1}}}
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1166 sub cat_funcs { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1167 # cat_funcs($TB,$cat) returns an ordered list of functions in $TB,$cat
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1168 my ($TB,$cat) = @_;
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1169 return sort { uc($a) cmp uc($b) } @{$index_by_TB_cat{$TB}{$cat}}
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1170 } # 1}}}
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1171 sub indexed_funcs { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1172 # indexed_funcs() returns an ordered list of all functions in the index
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1173 return sort { uc($a) cmp uc($b) } keys %index_by_function;
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1174 } # 1}}}
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1175 sub forge_funcs { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1176 # forge_funcs() returns an ordered list of functions only found in octave forge
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1177 return sort { uc($a) cmp uc($b) } keys %octave_forge_function;
293
cc2526f5c33b start function interface to data structures rather than direct reference
pkienzle
parents: 282
diff changeset
1178 } # 1}}}
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1179 sub scanned_funcs { # 1{{{
299
343ca1be61fc generate extended descriptions; include download reference
pkienzle
parents: 296
diff changeset
1180 # scanned_funcs() returns an ordered list of all functions found in m-files and oct-files
295
3b264c1692ea more code cleanup
pkienzle
parents: 293
diff changeset
1181 return sort { uc($a) cmp uc($b) } %function_description;
213
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1182 } # 1}}}
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1183 __END__
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1184 This program is free software; you can redistribute it and/or modify
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1185 it under the terms of the GNU General Public License as published by
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1186 the Free Software Foundation; either version 2 of the License, or
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1187 (at your option) any later version.
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1188 This program is distributed in the hope that it will be useful,
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1189 but WITHOUT ANY WARRANTY; without even the implied warranty of
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1190 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1191 GNU General Public License for more details.
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1192 You should have received a copy of the GNU General Public License
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1193 along with this program; if not, write to the Free Software
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1194 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1195 This program is granted to the public domain.
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1196 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1197 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1198 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1199 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1200 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1201 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1202 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1203 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1204 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1205 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9281751ea60d Preliminary perl script to build the function index.
pkienzle
parents:
diff changeset
1206 SUCH DAMAGE.