annotate libinterp/gendoc.pl @ 20614:10ec79b47808

use new string_value method to handle value extraction errors * __voronoi__.cc, chol.cc, colamd.cc, fftw.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Oct 2015 18:15:56 -0400
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14649
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
1 #! /usr/bin/perl -w
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
2 #
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19627
diff changeset
3 # Copyright (C) 2012-2015 Rik Wehbring
14649
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
4 #
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
5 # This file is part of Octave.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
6 #
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
7 # Octave is free software; you can redistribute it and/or modify it
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
8 # under the terms of the GNU General Public License as published by the
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
9 # Free Software Foundation; either version 3 of the License, or (at
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
10 # your option) any later version.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
11 #
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
12 # Octave is distributed in the hope that it will be useful, but WITHOUT
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
15 # for more details.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
16 #
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
18 # along with Octave; see the file COPYING. If not, see
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
19 # <http://www.gnu.org/licenses/>.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
20
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
21 unless (@ARGV > 1) { die "Usage: $0 df-file1 ..." }
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
22
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
23 print <<__END_OF_MSG__;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
24 ### DO NOT EDIT!
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
25 ###
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
26 ### This file is generated automatically from Octave source files.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
27 ### Edit source files directly and run make to update this file.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
28
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
29 __END_OF_MSG__
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
30
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
31 DFFILE: foreach $df_fname (@ARGV)
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
32 {
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
33 open (DF_FH, $df_fname) or die "Unable to open $df_fname";
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
34
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
35 $src_fname = "";
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
36 @func_list = ();
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
37 @docstr = ();
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
38
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
39 LINE: while (<DF_FH>)
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
40 {
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
41 if (/XDEFUN_FILE_NAME \("([^"]+)"/)
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
42 {
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
43 $src_fname = $1;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
44 next LINE;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
45 }
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
46 if (/XDEF/ and ! /XDEFALIAS/)
14649
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
47 {
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
48 ## Decode 4 or 5 part macro definition.
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
49 ($func, $str) = /\("?(\w+)"?,[^,]+,[^,]+,(?:[^,]+,)?\s*"(.*)"\)\s*$/ ;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
50
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
51 unless ($func) { die "Unable to parse $df_fname at line $.\n" }
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
52
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
53 push (@func_list, $func);
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
54 ## Do escape sequence expansion
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
55 $str =~ s/(?<!\\)\\n/\n/g;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
56 $str =~ s/\\([^\\])/$1/g;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
57 $str =~ s/\\\\/\\/g;
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
58 push (@docstr, $str);
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
59 }
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
60 }
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
61 close (DF_FH);
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
62
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
63 ## Print results in DOCSTRING format
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
64 foreach $i (0 .. $#func_list)
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
65 {
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
66 $func = $func_list[$i];
17256
ee1d19174316 doc: Use 0x1d as record separator for joint compatibility with Texinfo 4.x and 5.x.
Rik <rik@octave.org>
parents: 17242
diff changeset
67 print "\x{1d}$func\n";
14649
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
68 print "\@c $func $src_fname\n";
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
69 print $docstr[$i],"\n";
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
70 }
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
71
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
72 }
5fa6a41d4fbe build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
73