Mercurial > hg > octave-nkf
annotate src/mkbuiltins @ 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 | 0d4613a736e9 |
rev | line source |
---|---|
6218 | 1 #! /bin/sh |
7019 | 2 # |
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, | |
8920 | 4 # 2006, 2007, 2008, 2009 John W. Eaton |
7019 | 5 # |
6 # This file is part of Octave. | |
7 # | |
8 # Octave is free software; you can redistribute it and/or modify it | |
9 # under the terms of the GNU General Public License as published by the | |
10 # Free Software Foundation; either version 3 of the License, or (at | |
11 # your option) any later version. | |
12 # | |
13 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 # for more details. | |
17 # | |
18 # You should have received a copy of the GNU General Public License | |
19 # along with Octave; see the file COPYING. If not, see | |
20 # <http://www.gnu.org/licenses/>. | |
2335 | 21 |
5794 | 22 if test $# -ne 1; then |
23 echo "usage: mkbuiltins f1" 1>&2 | |
2907 | 24 exit 1 |
25 fi | |
26 | |
4299 | 27 SED=${SED:-'sed'} |
28 | |
2907 | 29 DEF_FILES=`cat $1` |
30 | |
31 if test -z "$DEF_FILES"; then | |
32 echo "mkbuiltins: DEF_FILES is empty!" 1>&2 | |
33 exit 1 | |
34 fi | |
35 | |
2335 | 36 cat << \EOF |
37 // DO NOT EDIT! Generated automatically by mkbuiltins. | |
38 | |
39 #ifdef HAVE_CONFIG_H | |
40 #include "config.h" | |
41 #endif | |
42 | |
2968 | 43 #include "defun.h" |
2335 | 44 #include "oct-obj.h" |
45 #include "variables.h" | |
7210 | 46 #include "builtins.h" |
2335 | 47 |
3399 | 48 #if defined (quad) |
49 #undef quad | |
50 #endif | |
51 | |
4128 | 52 #if defined (ENABLE_DYNAMIC_LINKING) |
5796 | 53 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
54 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 55 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
56 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 57 |
3364 | 58 #else |
5796 | 59 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
60 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) \ |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
61 XDEFUN_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 62 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
63 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) \ |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
64 XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 65 |
3364 | 66 #endif |
67 | |
9014
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
68 #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
|
69 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
70 #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
3295 | 71 extern DECLARE_FUN (name, args_name, nargout_name); \ |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
72 install_builtin_function (F ## name, #name, doc); \ |
4234 | 73 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
74 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
4234 | 75 extern DECLARE_FUN (name, args_name, nargout_name); \ |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
76 install_builtin_function (F ## name, #name, doc, false); \ |
3295 | 77 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
78 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \ |
3744 | 79 extern DECLARE_FUNX (fname, args_name, nargout_name); \ |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
80 install_builtin_function (fname, name, doc); \ |
3744 | 81 |
3295 | 82 #define XDEFALIAS_INTERNAL(alias, name) \ |
83 alias_builtin (#alias, #name); | |
84 | |
3321 | 85 #define XDEFCONST_INTERNAL(name, defn, doc) |
3295 | 86 |
2373 | 87 EOF |
88 | |
2907 | 89 for file in $DEF_FILES; do |
4299 | 90 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373 | 91 echo "static void" |
92 echo "install_${fcn}_fcns (void)" | |
93 echo "{" | |
94 cat $file | |
95 echo "}" | |
2907 | 96 echo "" |
97 done | |
98 | |
2373 | 99 cat << \EOF |
2907 | 100 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
101 void |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
102 install_builtins (void) |
2335 | 103 { |
104 EOF | |
105 | |
2907 | 106 for file in $DEF_FILES; do |
4299 | 107 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373 | 108 echo " install_${fcn}_fcns ();" |
109 done | |
2335 | 110 |
111 cat << \EOF | |
112 } | |
113 | |
114 EOF | |
115 | |
116 exit 0 |