6218
|
1 #! /bin/sh |
7019
|
2 # |
|
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, |
|
4 # 2006, 2007 John W. Eaton |
|
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 |
3364
|
54 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) |
5796
|
55 |
|
56 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, \ |
|
57 is_text_fcn, doc) |
|
58 |
3364
|
59 #else |
5796
|
60 |
3364
|
61 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
|
62 XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) |
5796
|
63 |
|
64 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, \ |
|
65 is_text_fcn, doc) \ |
|
66 XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, is_text_fcn, doc) |
|
67 |
3364
|
68 #endif |
|
69 |
3295
|
70 #define XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
|
71 extern DECLARE_FUN (name, args_name, nargout_name); \ |
4234
|
72 install_builtin_function (F ## name, #name, doc, is_text_fcn); \ |
|
73 |
|
74 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, \ |
|
75 is_text_fcn, doc) \ |
|
76 extern DECLARE_FUN (name, args_name, nargout_name); \ |
|
77 install_builtin_function (F ## name, #name, doc, is_text_fcn, false); \ |
3295
|
78 |
3744
|
79 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, \ |
|
80 is_text_fcn, doc) \ |
|
81 extern DECLARE_FUNX (fname, args_name, nargout_name); \ |
4234
|
82 install_builtin_function (fname, name, doc, is_text_fcn); \ |
3744
|
83 |
3295
|
84 #define XDEFALIAS_INTERNAL(alias, name) \ |
|
85 alias_builtin (#alias, #name); |
|
86 |
3321
|
87 #define XDEFCONST_INTERNAL(name, defn, doc) |
3295
|
88 |
|
89 #define XDEFUN_MAPPER_INTERNAL(name, ch_map, d_b_map, c_b_map, d_d_map, \ |
|
90 d_c_map, c_c_map, lo, hi, \ |
4100
|
91 ch_map_flag, can_ret_cmplx_for_real, doc) |
3295
|
92 |
2373
|
93 EOF |
|
94 |
2907
|
95 for file in $DEF_FILES; do |
4299
|
96 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373
|
97 echo "static void" |
|
98 echo "install_${fcn}_fcns (void)" |
|
99 echo "{" |
|
100 cat $file |
|
101 echo "}" |
2907
|
102 echo "" |
|
103 done |
|
104 |
2373
|
105 cat << \EOF |
2907
|
106 |
|
107 static void |
2335
|
108 install_builtin_functions (void) |
|
109 { |
|
110 EOF |
|
111 |
2907
|
112 for file in $DEF_FILES; do |
4299
|
113 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373
|
114 echo " install_${fcn}_fcns ();" |
|
115 done |
2335
|
116 |
|
117 cat << \EOF |
|
118 } |
|
119 |
2910
|
120 extern void install_mapper_functions (void); |
|
121 |
2335
|
122 void |
|
123 install_builtins (void) |
|
124 { |
|
125 install_mapper_functions (); |
|
126 install_builtin_functions (); |
|
127 } |
|
128 EOF |
|
129 |
|
130 exit 0 |