Mercurial > hg > octave-nkf
annotate scripts/mkdoc @ 9014:71fca0fc2436
save source file names for functions as comments in .texi files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Mar 2009 12:54:17 -0400 |
parents | eb63fbe60fab |
children | acf9952463c3 |
rev | line source |
---|---|
3295 | 1 #! /bin/sh |
7019 | 2 # |
8920 | 3 # Copyright (C) 1999, 2002, 2005, 2007, 2009 John W. Eaton |
7019 | 4 # |
5 # This file is part of Octave. | |
6 # | |
7 # Octave is free software; you can redistribute it and/or modify it | |
8 # under the terms of the GNU General Public License as published by the | |
9 # Free Software Foundation; either version 3 of the License, or (at | |
10 # your option) any later version. | |
11 # | |
12 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 # for more details. | |
16 # | |
17 # You should have received a copy of the GNU General Public License | |
18 # along with Octave; see the file COPYING. If not, see | |
19 # <http://www.gnu.org/licenses/>. | |
3295 | 20 |
4098 | 21 set -e |
22 | |
8445
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
23 FIND=${FIND:-'find'} |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
24 |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
25 PERL=${PERL:-'perl'} |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
26 |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
27 if test $# -eq 1; then |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
28 d=$1 |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
29 elif test $# -eq 0; then |
3295 | 30 d=. |
31 else | |
8445
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
32 echo "usage: mkdoc [directory]" 1>&2 |
dd52e541418b
scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents:
8444
diff
changeset
|
33 exit 1 |
3295 | 34 fi |
35 | |
4098 | 36 if test -f gethelp; then |
5333 | 37 cat << EOF |
38 ### DO NOT EDIT! | |
39 ### | |
40 ### This file is generated automatically from the Octave sources. | |
41 ### Edit those files instead and run make to update this file. | |
42 | |
43 EOF | |
8444
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
44 $FIND $d -name '*.m' | \ |
9014
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
45 $PERL -n -e 'chop; |
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
46 $f = "$_"; |
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
47 m{(.*)/(.*)\.m}; |
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
48 for (qx{./gethelp $2 "$f" < "$f"}) { |
8444
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
49 s/^\s+\@/\@/ unless $i_am_in_example; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
50 s/^\s+\@group/\@group/; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
51 s/^\s+\@end\s+group/\@end\s+group/; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
52 $i_am_in_example = 1 if /\s*\@example/; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
53 $i_am_in_example = 0 if /\s*\@end\s+example/; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
54 print; |
9014
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
55 }' |
4098 | 56 else |
57 echo "gethelp program seems to be missing!" 1>&2 | |
58 exit 1 | |
59 fi |