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