Mercurial > octave-nkf
annotate src/gendoc.pl @ 16088:b29b10fbb744 stable release-3-6-4
Version 3.6.4 released.
* configure.ac (AC_INIT): Version is now 3.6.4.
(OCTAVE_RELEASE_DATE): Now 2013-02-21.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 21 Feb 2013 15:17:54 -0500 |
parents | 7c469bffc599 |
children |
rev | line source |
---|---|
15904
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
1 #! /usr/bin/perl -w |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
2 # |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
3 # Copyright (C) 2012 Rik Wehbring |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
4 # |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
5 # This file is part of Octave. |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
6 # |
7c469bffc599
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 |
7c469bffc599
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 |
7c469bffc599
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 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
10 # your option) any later version. |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
11 # |
7c469bffc599
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 |
7c469bffc599
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 |
7c469bffc599
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 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
15 # for more details. |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
16 # |
7c469bffc599
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 |
7c469bffc599
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 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
19 # <http://www.gnu.org/licenses/>. |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
20 |
7c469bffc599
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 ..." } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
22 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
23 print <<__END_OF_MSG__; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
24 ### DO NOT EDIT! |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
25 ### |
7c469bffc599
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. |
7c469bffc599
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. |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
28 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
29 __END_OF_MSG__ |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
30 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
31 DFFILE: foreach $df_fname (@ARGV) |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
32 { |
7c469bffc599
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"; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
34 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
35 $src_fname = ""; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
36 @func_list = (); |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
37 @docstr = (); |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
38 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
39 LINE: while (<DF_FH>) |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
40 { |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
41 if (/XDEFUN_FILE_NAME \("([^"]+)"/) |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
42 { |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
43 $src_fname = $1; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
44 next LINE; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
45 } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
46 if (/XDEF/ and ! /XDEFALIAS/) |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
47 { |
7c469bffc599
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. |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
49 ($func, $str) = /\("?(\w+)"?,[^,]+,[^,]+,(?:[^,]+,)?\s*"(.*)"\)\s*$/ ; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
50 |
7c469bffc599
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" } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
52 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
53 push (@func_list, $func); |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
54 ## Do escape sequence expansion |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
55 $str =~ s/(?<!\\)\\n/\n/g; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
56 $str =~ s/\\([^\\])/$1/g; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
57 $str =~ s/\\\\/\\/g; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
58 push (@docstr, $str); |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
59 } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
60 } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
61 close (DF_FH); |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
62 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
63 ## Print results in DOCSTRING format |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
64 foreach $i (0 .. $#func_list) |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
65 { |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
66 $func = $func_list[$i]; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
67 print "$func\n"; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
68 print "\@c $func $src_fname\n"; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
69 print $docstr[$i],"\n"; |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
70 } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
71 |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
72 } |
7c469bffc599
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
73 |