Mercurial > octave
annotate libinterp/mk-doc.pl @ 23709:3b68aeeabc40
rename some build scripts for consistency and move them to where they are used
* libgui/mk-default-qt-settings.in.sh: Rename from
build-aux/mk-default-qt-settings.in.sh.
* libinterp/mk-doc.pl: Rename from libinterp/gendoc.pl.
* libinterp/operators/mk-ops.sh: Rename from libinterp/mkops.
* scripts/mk-doc.pl: Rename from scripts/mkdoc.pl.
* libinterp/mk-builtins.pl: Rename from build-aux/mk-builtins.pl.
* liboctave/external/mk-f77-def.in.sh: Rename from
build-aux/mk-f77-def.in.sh.
* libinterp/corefcn/mk-mxarray-h.in.sh: Rename from
build-aux/mk-mxarray-h.in.sh.
* libinterp/mk-version-h.in.sh: Rename from
build-aux/mk-version-h.in.sh.
* libinterp/corefcn/genprops.awk: Rename from libinterp/genprops.awk.
* libinterp/corefcn/mk-errno-list.sh: Rename from
libinterp/mk-errno-list.
* libinterp/mk-pkg-add.sh: Rename from libinterp/mk-pkg-add.
* scripts/mk-pkg-add.sh: Rename from scripts/mk-pkg-add.
* Makefile.am, build-aux/module.mk, configure.ac, libgui/module.mk,
libinterp/corefcn/module.mk, libinterp/dldfcn/config-module.awk,
libinterp/module.mk, libinterp/operators/module.mk,
liboctave/external/module.mk, liboctave/external/ranlib/module.mk,
scripts/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 27 Jun 2017 15:10:58 -0400 |
parents | libinterp/gendoc.pl@8744d4ed8fb4 |
children | 194eb4bd202b |
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 # |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 # Copyright (C) 2012-2017 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 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
8 # under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
9 # the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
10 # (at your option) any later version. |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
11 # |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 # Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 # WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
15 # GNU General Public License for more details. |
14649
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 |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
21 unless (@ARGV > 1) { die "Usage: $0 SRCDIR src-file1 ..." } |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
22 |
21967
17457503ba95
gendoc.pl: Minor changes for readability and speed.
Rik <rik@octave.org>
parents:
21966
diff
changeset
|
23 $srcdir = shift (@ARGV); |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
24 |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
25 print <<__END_OF_MSG__; |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
26 ### DO NOT EDIT! |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
27 ### |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
28 ### 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
|
29 ### 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
|
30 |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
31 __END_OF_MSG__ |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
32 |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
33 FILE: foreach $fname (@ARGV) |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
34 { |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
35 if (-f "$fname") |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
36 { |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
37 $src_fname = "$fname"; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
38 } |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
39 else |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
40 { |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
41 $src_fname = "$srcdir/$fname"; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
42 } |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
43 |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
44 open (SRC_FH, $src_fname) or die "Unable to open $src_fname"; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
45 |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
46 @func_list = (); |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
47 @docstr = (); |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
48 |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
49 LINE: while (my $line = <SRC_FH>) |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
50 { |
23518 | 51 if ($line =~ /^\s*DEF(?:CONSTFUN|CONSTMETHOD|METHOD|METHOD_DLD|METHODX|METHODX_DLD|UN|UN_DLD|UNX|UNX_DLD)\s*\(/) |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
52 { |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
53 ($func) = $line =~ /\("?(\w+)"?,/; |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
54 unless ($func) { die "Unable to parse $src_fname at line $.\n" } |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
55 push (@func_list, $func); |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
56 |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
57 ## Skip optional line that declares list of classes that this |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
58 ## function accepts. |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
59 $line = <SRC_FH>; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
60 if ($line =~ m#\s*classes:#) |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
61 { |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
62 $line = <SRC_FH>; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
63 } |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
64 |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
65 if ($line =~ m#\s*doc:\s+\Q/*\E\s+\Q-*- texinfo -*-\E\s*$#) |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
66 { |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
67 $str = "-*- texinfo -*-\n"; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
68 $reading_docstring = 1; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
69 } |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
70 else |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
71 { |
23709
3b68aeeabc40
rename some build scripts for consistency and move them to where they are used
John W. Eaton <jwe@octave.org>
parents:
23518
diff
changeset
|
72 print STDERR "mk-doc.pl: undocumented function $func from $fname\n"; |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
73 push (@docstr, "Undocumented."); |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
74 } |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
75 } |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
76 elsif ($reading_docstring) |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
77 { |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
78 if ($line =~ /^.*\s+\*\/\s*\)\s*$/) |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
79 { |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
80 $line =~ s#\s+\*/\s*\)\s*$##; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
81 push (@docstr, $str . $line); |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
82 $reading_docstring = 0; |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
83 } |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
84 else |
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
85 { |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
86 $str .= $line; |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
87 } |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
88 } |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
89 } |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
90 close (SRC_FH); |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
91 |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
92 ## Print results in DOCSTRING format |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
93 foreach $i (0 .. $#func_list) |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
94 { |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
95 $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
|
96 print "\x{1d}$func\n"; |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
97 print "\@c $func $fname\n"; |
14649
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
98 print $docstr[$i],"\n"; |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
99 } |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
100 |
5fa6a41d4fbe
build: Use Perl to create DOCSTRINGS in src/ directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
101 } |