annotate scripts/mk-doc.pl @ 33580:80346999b171 bytecode-interpreter tip

build: Fix typo in test/compile/module.mk (bug #65658). * test/compile/module.mk: Fix typo in path to file.
author A.R. Burgers <arburgers@gmail.com>
date Mon, 13 May 2024 11:33:36 +0200
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
1 #! /usr/bin/perl
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
2 use utf8;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
3
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 ########################################################################
29357
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
5 ##
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
6 ## Copyright (C) 2012-2024 The Octave Project Developers
29357
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
7 ##
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
8 ## See the file COPYRIGHT.md in the top-level directory of this
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
9 ## distribution or <https://octave.org/copyright/>.
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
10 ##
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
11 ## This file is part of Octave.
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
12 ##
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
13 ## Octave is free software: you can redistribute it and/or modify it
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
14 ## under the terms of the GNU General Public License as published by
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
15 ## the Free Software Foundation, either version 3 of the License, or
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
16 ## (at your option) any later version.
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
17 ##
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
18 ## Octave is distributed in the hope that it will be useful, but
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
19 ## WITHOUT ANY WARRANTY; without even the implied warranty of
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
20 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
21 ## GNU General Public License for more details.
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
22 ##
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
23 ## You should have received a copy of the GNU General Public License
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
24 ## along with Octave; see the file COPYING. If not, see
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
25 ## <https://www.gnu.org/licenses/>.
bbbe4dcc7200 use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents: 28377
diff changeset
26 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
27 ########################################################################
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
28
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
29 use strict;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
30 use warnings;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
31 use File::Spec;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
32 use Cwd;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
33
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
34 ## Expecting arguments in this order:
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
35 ##
21959
627f582edbe3 extract documentation from .in.m files instead of generated .m files
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
36 ## SRCDIR SRCDIR-FILES ...
14617
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 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
39
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
40 my $srcdir = shift (@ARGV);
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
41
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
42 print <<__END_OF_MSG__;
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
43 ### DO NOT EDIT!
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 ### 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
46 ### 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
47
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
48 __END_OF_MSG__
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
49
18943
714ce8ca71ea mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents: 18940
diff changeset
50 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
51 {
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
52 my $full_fname = File::Spec->catfile ($srcdir, $m_fname);
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
53 my @paths = File::Spec->splitdir ($full_fname);
18943
714ce8ca71ea mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents: 18940
diff changeset
54 if (@paths < 3
714ce8ca71ea mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents: 18940
diff changeset
55 || $paths[-2] eq "private" # skip private directories
21959
627f582edbe3 extract documentation from .in.m files instead of generated .m files
John W. Eaton <jwe@octave.org>
parents: 19697
diff changeset
56 || $paths[-1] !~ s/(\.in|)\.m$//i) # skip non m-files, and remove extension
18943
714ce8ca71ea mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents: 18940
diff changeset
57 { next MFILE; }
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
58
23393
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
59 my $fcn;
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
60 if ($paths[-2] =~ m/^@/)
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
61 {
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
62 ## @classes will have @class/method as their function name
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
63 $fcn = File::Spec->catfile (@paths[-2, -1]);
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
64 }
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
65 elsif ($paths[-2] =~ m/^\+/)
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
66 {
26215
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
67 $fcn = $paths[-1];
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
68 for (my $i = 2; $i < @paths; $i++)
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
69 {
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
70 if ($paths[-$i] =~ m/^\+/)
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
71 {
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
72 ## +package functions have package.name their function name
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
73 $fcn = substr ($paths[-$i], 1) . "." . $fcn;
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
74 }
39e84bf92d18 accept functions in nested +pkg directories in @DOCSTRING macros (bug #52596)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
75 }
23393
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
76 }
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
77 else
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
78 {
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
79 $fcn = $paths[-1];
675ad11b5c05 recognize docstrings for +package functions
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
80 }
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
81
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
82 my @help_txt = gethelp ($fcn, $full_fname);
18943
714ce8ca71ea mkdoc.pl: Tweaks to make code easier to understand for non-Perl experts.
Rik <rik@octave.org>
parents: 18940
diff changeset
83 next MFILE unless @help_txt;
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
84
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
85 print "\x{1d}$fcn\n";
22334
fed9aa2ed01d doc: Insert correct location of m-file into @c comment in .texi files.
Rik <rik@octave.org>
parents: 22323
diff changeset
86 print "\@c $fcn $m_fname\n";
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
87
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
88 foreach $_ (@help_txt)
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
89 {
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
90 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: 18938
diff changeset
91 s/^\s+\@/\@/ unless $in_example;
18940
29fc1736a6be scripts/mkdoc.pl: remove '@(end )?example' leading spaces from DOCSTRING.
Carnë Draug <carandraug@octave.org>
parents: 18939
diff changeset
92 s/^\s+(\@(?:end)\s+(group|example))/$1/;
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
93 print $_;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
94 }
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
95 }
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
96
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
97 ################################################################################
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
98 # Subroutines
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
99 ################################################################################
14644
f49e47ab83ca maint: Rename mygethelp function to gethelp in scripts/mkdoc.pl
Rik <octave@nomad.inbox5.com>
parents: 14617
diff changeset
100 sub gethelp
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
101 {
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
102 my $fcn = shift;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
103 my $fname = shift;
28377
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
104 my $have_cdef_file = 0;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
105 my $found_code = 0;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
106
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
107 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
108
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
109 my @help_txt;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
110 while (my $line = <$fh>)
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
111 {
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
112 next if $line =~ m/^[\s#%]*$/; # skip empty lines
28377
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
113
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
114 if ($line !~ m/^\s*(#|%)/)
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
115 {
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
116 if (! $found_code)
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
117 {
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
118 $found_code = 1;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
119 $have_cdef_file = ! $have_cdef_file && $line =~ m/^\s*classdef/;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
120 }
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
121
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
122 next if $have_cdef_file;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
123 last;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
124 }
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
125
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
126 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
127
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
128 ## Skip this block
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
129 if ($line =~ /(Copyright|Author)/)
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
130 { while (&$reading_block ()) {} }
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
131 else
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
132 {
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
133 do
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
134 {
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
135 $line =~ s/^\s*(%|#)+ ?//;
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
136 push (@help_txt, $line);
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
137 } while (&$reading_block ());
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
138 last;
28377
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
139
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
140 ## Instead of jumping out here unconditionally, should we
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
141 ## attempt to extract multiple help comment blocks in a
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
142 ## classdef file by searching forward for the next line that
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
143 ## begins with "function" and then saving the first comment
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
144 ## block after that? We will need a way to recognize the
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
145 ## method name to print the docstring separator line. Maybe
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
146 ## we should just be using Octave's parser and help system for
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
147 ## this job?
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
148
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
149 ## if ($have_cdef_file)
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
150 ## {
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
151 ## while (my $line = <$fh>)
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
152 ## {
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
153 ## last if $line =~ /^\s*function/;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
154 ## }
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
155 ## }
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
156 ## else
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
157 ## {
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
158 ## last;
3ed6fc50d8ae * mk-doc.pl: Find classdef docstrings inside classdef code block.
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
159 ## }
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
160 }
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
161 }
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
162
18939
b0960d4afe5f scripts/mkdoc.pl: improve perl code portability.
Carnë Draug <carandraug@octave.org>
parents: 18938
diff changeset
163 close ($fh);
14617
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
164 return @help_txt;
8ffb01c3a27a doc: Use Perl to create DOCSTRINGS in scripts directory.
Rik <octave@nomad.inbox5.com>
parents:
diff changeset
165 }