2335
|
1 #!/bin/sh |
|
2 |
2907
|
3 if test $# -ne 2; then |
|
4 echo "usage: mkbuiltins f1 f2" 1>&2 |
|
5 exit 1 |
|
6 fi |
|
7 |
4299
|
8 SED=${SED:-'sed'} |
|
9 |
2907
|
10 DEF_FILES=`cat $1` |
|
11 VAR_FILES=`cat $2` |
|
12 |
|
13 if test -z "$DEF_FILES"; then |
|
14 echo "mkbuiltins: DEF_FILES is empty!" 1>&2 |
|
15 exit 1 |
|
16 fi |
|
17 |
|
18 if test -z "$VAR_FILES"; then |
|
19 echo "mkbuiltins: VAR_FILES is empty!" 1>&2 |
|
20 exit 1 |
|
21 fi |
|
22 |
2335
|
23 cat << \EOF |
|
24 // DO NOT EDIT! Generated automatically by mkbuiltins. |
|
25 |
|
26 #ifdef HAVE_CONFIG_H |
|
27 #include "config.h" |
|
28 #endif |
|
29 |
2968
|
30 #include "defun.h" |
2335
|
31 #include "oct-obj.h" |
|
32 #include "variables.h" |
|
33 |
3399
|
34 #if defined (quad) |
|
35 #undef quad |
|
36 #endif |
|
37 |
4128
|
38 #if defined (ENABLE_DYNAMIC_LINKING) |
3364
|
39 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) |
|
40 #else |
|
41 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
|
42 XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) |
|
43 #endif |
|
44 |
3295
|
45 #define XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ |
|
46 extern DECLARE_FUN (name, args_name, nargout_name); \ |
4234
|
47 install_builtin_function (F ## name, #name, doc, is_text_fcn); \ |
|
48 |
|
49 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, \ |
|
50 is_text_fcn, doc) \ |
|
51 extern DECLARE_FUN (name, args_name, nargout_name); \ |
|
52 install_builtin_function (F ## name, #name, doc, is_text_fcn, false); \ |
3295
|
53 |
3744
|
54 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, \ |
|
55 is_text_fcn, doc) \ |
|
56 extern DECLARE_FUNX (fname, args_name, nargout_name); \ |
4234
|
57 install_builtin_function (fname, name, doc, is_text_fcn); \ |
3744
|
58 |
3295
|
59 #define XDEFALIAS_INTERNAL(alias, name) \ |
|
60 alias_builtin (#alias, #name); |
|
61 |
|
62 #define XDEFVAR_INTERNAL(name, sname, defn, protect, chg_fcn, doc) |
|
63 |
3321
|
64 #define XDEFCONST_INTERNAL(name, defn, doc) |
3295
|
65 |
|
66 #define XDEFUN_MAPPER_INTERNAL(name, ch_map, d_b_map, c_b_map, d_d_map, \ |
|
67 d_c_map, c_c_map, lo, hi, \ |
4100
|
68 ch_map_flag, can_ret_cmplx_for_real, doc) |
3295
|
69 |
2373
|
70 EOF |
|
71 |
2907
|
72 for file in $DEF_FILES; do |
4299
|
73 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373
|
74 echo "static void" |
|
75 echo "install_${fcn}_fcns (void)" |
|
76 echo "{" |
|
77 cat $file |
|
78 echo "}" |
2907
|
79 echo "" |
|
80 done |
|
81 |
|
82 for file in $VAR_FILES; do |
4299
|
83 f=`echo $file | $SED 's,^\./,,; s/-/_/g'` |
2909
|
84 echo "extern void symbols_of_${f} (void);" |
2373
|
85 done |
|
86 |
|
87 cat << \EOF |
2907
|
88 |
|
89 static void |
|
90 install_builtin_variables (void) |
|
91 { |
|
92 EOF |
|
93 |
|
94 for file in $VAR_FILES; do |
4299
|
95 f=`echo $file | $SED 's,^\./,,; s/-/_/g'` |
2909
|
96 echo " symbols_of_${f} ();" |
2907
|
97 done |
|
98 |
|
99 cat << \EOF |
|
100 } |
|
101 |
2335
|
102 static void |
|
103 install_builtin_functions (void) |
|
104 { |
|
105 EOF |
|
106 |
2907
|
107 for file in $DEF_FILES; do |
4299
|
108 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373
|
109 echo " install_${fcn}_fcns ();" |
|
110 done |
2335
|
111 |
|
112 cat << \EOF |
|
113 } |
|
114 |
2910
|
115 extern void install_mapper_functions (void); |
|
116 |
2335
|
117 void |
|
118 install_builtins (void) |
|
119 { |
|
120 install_builtin_variables (); |
|
121 install_mapper_functions (); |
|
122 install_builtin_functions (); |
|
123 } |
|
124 EOF |
|
125 |
|
126 exit 0 |