annotate src/mkgendoc @ 12312:b10ea6efdc58 release-3-4-x ss-3-3-91

version is now 3.3.91
author John W. Eaton <jwe@octave.org>
date Mon, 31 Jan 2011 08:36:58 -0500
parents a9be431c1595
children 72c96de7a403
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
1 #! /bin/sh
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
2 #
11523
fd0a3ac60b0e update copyright notices
John W. Eaton <jwe@octave.org>
parents: 10317
diff changeset
3 # Copyright (C) 1999-2011 John W. Eaton
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
4 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
5 # This file is part of Octave.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
6 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
7 # Octave is free software; you can redistribute it and/or modify it
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
8 # under the terms of the GNU General Public License as published by the
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
9 # Free Software Foundation; either version 3 of the License, or (at
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
10 # your option) any later version.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
11 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
12 # Octave is distributed in the hope that it will be useful, but WITHOUT
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
15 # for more details.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
16 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
17 # You should have received a copy of the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
18 # along with Octave; see the file COPYING. If not, see
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5796
diff changeset
19 # <http://www.gnu.org/licenses/>.
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
20
4299
02fcb550f20c [project @ 2003-01-16 20:15:14 by jwe]
jwe
parents: 4279
diff changeset
21 SED=${SED:-'sed'}
02fcb550f20c [project @ 2003-01-16 20:15:14 by jwe]
jwe
parents: 4279
diff changeset
22
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
23 if test $# -ne 1; then
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
24 echo "usage: mkgendoc f1" 1>&2
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
25 exit 1
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
26 fi
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
27
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
28 DOC_FILES=`cat $1`
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
29
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
30 if test -z "$DOC_FILES"; then
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
31 echo "mkgendoc: DOC_FILES is empty!" 1>&2
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
32 exit 1
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
33 fi
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
34
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
35 cat << \EOF
3364
fac05a83b4c5 [project @ 1999-11-20 03:05:42 by jwe]
jwe
parents: 3321
diff changeset
36 // DO NOT EDIT! Generated automatically by mkgendoc
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
37
4279
64c444ac1fee [project @ 2003-01-04 01:10:25 by jwe]
jwe
parents: 4234
diff changeset
38 #if defined (__DECCXX)
64c444ac1fee [project @ 2003-01-04 01:10:25 by jwe]
jwe
parents: 4234
diff changeset
39 #define __USE_STD_IOSTREAM
64c444ac1fee [project @ 2003-01-04 01:10:25 by jwe]
jwe
parents: 4234
diff changeset
40 #endif
64c444ac1fee [project @ 2003-01-04 01:10:25 by jwe]
jwe
parents: 4234
diff changeset
41
3543
c5b996022ef7 [project @ 2000-02-02 20:13:49 by jwe]
jwe
parents: 3364
diff changeset
42 #include <iostream>
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
43 #include <string>
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
44
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
45 #define XDEFUN_FILE_NAME(name) \
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
46 std::string file_name = name;
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
47
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
48 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
49 print_doc_string (#name, file_name, doc);
3364
fac05a83b4c5 [project @ 1999-11-20 03:05:42 by jwe]
jwe
parents: 3321
diff changeset
50
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
51 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
52 print_doc_string (name, file_name, doc);
5796
20f4bd627a74 [project @ 2006-05-09 02:04:54 by jwe]
jwe
parents: 5333
diff changeset
53
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
54 #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
55 print_doc_string (#name, file_name, doc);
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
56
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
57 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
58 print_doc_string (#name, file_name, doc);
4234
90e44267e8cf [project @ 2002-12-21 17:15:25 by jwe]
jwe
parents: 4100
diff changeset
59
8746
5dd06f19e9be handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents: 7503
diff changeset
60 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
61 print_doc_string (name, file_name, doc);
3746
c82ab37998aa [project @ 2000-11-30 01:11:42 by jwe]
jwe
parents: 3555
diff changeset
62
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
63 #define XDEFALIAS_INTERNAL(alias, name)
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
64
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
65 #define XDEFVAR_INTERNAL(name, sname, defn, protect, chg_fcn, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
66 print_doc_string (#name, file_name, doc);
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
67
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
68 #define XDEFCONST_INTERNAL(name, defn, doc) \
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
69 print_doc_string (#name, file_name, doc);
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
70
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
71 static void
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
72 print_doc_string (const std::string& name, const std::string& file_name,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9794
diff changeset
73 const std::string& doc)
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
74 {
3553
c5600b44bef9 [project @ 2000-02-03 03:22:37 by jwe]
jwe
parents: 3543
diff changeset
75 std::cout << "";
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
76
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
77 size_t len = name.length ();
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
78
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
79 if (name[0] == '"' && name[len-1] == '"')
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
80 std::cout << name.substr (1, len-2) << "\n";
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
81 else
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
82 std::cout << name << "\n";
3321
6923abb04e16 [project @ 1999-10-26 18:15:30 by jwe]
jwe
parents: 3295
diff changeset
83
11550
a9be431c1595 write function name along with filename in docstring comments
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
84 std::cout << "@c " << name << " " << file_name << "\n" << doc << "\n";
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
85 }
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
86
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
87 EOF
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
88
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
89 for file in $DOC_FILES; do
9794
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
90 fcn=`echo $file | $SED 's,.*/,,; s/\.df//; s/-/_/g;'`
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
91 echo "static void"
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
92 echo "print_${fcn}_doc_strings (void)"
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
93 echo "{"
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
94 cat $file
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
95 echo "}"
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
96 echo ""
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
97 done
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
98
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
99 cat << \EOF
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
100
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
101 int
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
102 main (void)
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
103 {
5333
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
104 std::cout
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
105 << "### DO NOT EDIT!\n"
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
106 << "###\n"
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
107 << "### This file is generated automatically from the Octave sources.\n"
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
108 << "### Edit those files instead and run make to update this file.\n"
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
109 << std::endl;
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4299
diff changeset
110
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
111 EOF
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
112
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
113 for file in $DOC_FILES; do
9794
0d4613a736e9 convert build system to use automake and libtool
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
114 fcn=`echo $file | $SED 's,.*/,,; s/\.df//; s/-/_/g;'`
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
115 echo " print_${fcn}_doc_strings ();"
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
116 done
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
117
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
118 cat << \EOF
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
119
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
120 return 0;
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
121 }
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
122 EOF
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
123
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
124 exit 0