Mercurial > octave-nkf
annotate scripts/mkdoc.pl @ 20633:ffc6cdcd02c5 stable
Fix segfault when complex double matrix calls ZGETRF (bug #45577).
* CMatrix.cc (finverse, determinant, rcond, fsolve): Calculate norm of matrix
and if it is NaN, skip calling ZGETRF in LAPACK and set info to non-zero value
to signal an error.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 10 Oct 2015 16:46:00 -0700 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
1 #! /usr/bin/perl |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
2 use utf8; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
3 |
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19630
diff
changeset
|
4 # Copyright (C) 2012-2015 Rik Wehbring |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
5 # |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
6 # This file is part of Octave. |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
7 # |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
8 # Octave is free software; you can redistribute it and/or modify it |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
9 # under the terms of the GNU General Public License as published by the |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
10 # Free Software Foundation; either version 3 of the License, or (at |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
11 # your option) any later version. |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
12 # |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
13 # Octave is distributed in the hope that it will be useful, but WITHOUT |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
16 # for more details. |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
17 # |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
18 # You should have received a copy of the GNU General Public License |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
19 # along with Octave; see the file COPYING. If not, see |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
20 # <http://www.gnu.org/licenses/>. |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
21 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
22 use strict; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
23 use warnings; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
24 use File::Spec; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
25 use Cwd; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
26 |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
27 ## Expecting arguments in this order: |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
28 ## |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
29 ## SRCDIR SRCDIR-FILES ... -- LOCAL-FILES ... |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
30 |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
31 unless (@ARGV >= 2) { die "Usage: $0 srcdir m_filename1 ..." ; } |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
32 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
33 my $srcdir = shift (@ARGV); |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
34 |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
35 print <<__END_OF_MSG__; |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
36 ### DO NOT EDIT! |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
37 ### |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
38 ### This file is generated automatically from Octave source files. |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
39 ### Edit source files directly and run make to update this file. |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
40 |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
41 __END_OF_MSG__ |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
42 |
18977
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
43 MFILE: foreach my $m_fname (@ARGV) |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
44 { |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
45 if ($m_fname eq "--") |
18977
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
46 { |
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
47 $srcdir = getcwd (); |
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
48 next MFILE; |
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
49 } |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
50 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
51 my $full_fname = File::Spec->catfile ($srcdir, $m_fname); |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
52 my @paths = File::Spec->splitdir ($full_fname); |
18977
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
53 if (@paths < 3 |
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
54 || $paths[-2] eq "private" # skip private directories |
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
55 || $paths[-1] !~ s/\.m$//i) # skip non m-files, and remove extension |
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
56 { next MFILE; } |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
57 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
58 ## @classes will have @class/method as their function name |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
59 my $fcn = $paths[-2] =~ m/^@/ ? File::Spec->catfile (@paths[-2, -1]) |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
60 : $paths[-1]; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
61 |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
62 my @help_txt = gethelp ($fcn, $full_fname); |
18977
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
63 next MFILE unless @help_txt; |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
64 |
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
|
65 print "\x{1d}$fcn\n"; |
18977
714ce8ca71ea
mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents:
18974
diff
changeset
|
66 print "\@c $fcn ", File::Spec->catfile ("scripts", $m_fname), "\n"; |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
67 |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
68 foreach $_ (@help_txt) |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
69 { |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
70 my $in_example = (m/\s*\@example\b/ .. m/\s*\@end\s+example\b/); |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
71 s/^\s+\@/\@/ unless $in_example; |
18974
29fc1736a6be
scripts/mkdoc.pl: remove '@(end )?example' leading spaces from DOCSTRING.
Carnë Draug <carandraug@octave.org>
parents:
18973
diff
changeset
|
72 s/^\s+(\@(?:end)\s+(group|example))/$1/; |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
73 print $_; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
74 } |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
75 } |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
76 |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
77 ################################################################################ |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
78 # Subroutines |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
79 ################################################################################ |
14644
f49e47ab83ca
maint: Rename mygethelp function to gethelp in scripts/mkdoc.pl
Rik <octave@nomad.inbox5.com>
parents:
14617
diff
changeset
|
80 sub gethelp |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
81 { |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
82 my $fcn = shift; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
83 my $fname = shift; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
84 open (my $fh, "<", $fname) or return; |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
85 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
86 my @help_txt; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
87 while (my $line = <$fh>) |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
88 { |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
89 next if $line =~ m/^\s*$/; # skip empty lines |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
90 last if $line !~ m/^\s*(#|%)/; # out of here once code starts |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
91 |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
92 my $reading_block = sub {defined ($line = <$fh>) && $line !~ m/^\s*$/}; |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
93 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
94 ## Skip this block |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
95 if ($line =~ /(Copyright|Author)/) |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
96 { while (&$reading_block ()) {} } |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
97 else |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
98 { |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
99 do |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
100 { |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
101 $line =~ s/^\s*(%|#)+ ?//; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
102 push (@help_txt, $line); |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
103 } while (&$reading_block ()); |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
104 last; |
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
105 } |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
106 } |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
107 |
18973
b0960d4afe5f
scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents:
18972
diff
changeset
|
108 close ($fh); |
14617
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
109 return @help_txt; |
8ffb01c3a27a
doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff
changeset
|
110 } |