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 |
|
8 DEF_FILES=`cat $1` |
|
9 VAR_FILES=`cat $2` |
|
10 |
|
11 if test -z "$DEF_FILES"; then |
|
12 echo "mkbuiltins: DEF_FILES is empty!" 1>&2 |
|
13 exit 1 |
|
14 fi |
|
15 |
|
16 if test -z "$VAR_FILES"; then |
|
17 echo "mkbuiltins: VAR_FILES is empty!" 1>&2 |
|
18 exit 1 |
|
19 fi |
|
20 |
2335
|
21 cat << \EOF |
|
22 // DO NOT EDIT! Generated automatically by mkbuiltins. |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include "config.h" |
|
26 #endif |
|
27 |
2968
|
28 #include "defun.h" |
2335
|
29 #include "oct-obj.h" |
|
30 #include "variables.h" |
|
31 |
2373
|
32 EOF |
|
33 |
2907
|
34 for file in $DEF_FILES; do |
|
35 fcn=`echo $file | sed 's/\.df//; s/-/_/g'` |
2373
|
36 echo "static void" |
|
37 echo "install_${fcn}_fcns (void)" |
|
38 echo "{" |
|
39 cat $file |
|
40 echo "}" |
2907
|
41 echo "" |
|
42 done |
|
43 |
|
44 for file in $VAR_FILES; do |
2909
|
45 f=`echo $file | sed 's/-/_/g'` |
|
46 echo "extern void symbols_of_${f} (void);" |
2373
|
47 done |
|
48 |
|
49 cat << \EOF |
2907
|
50 |
|
51 static void |
|
52 install_builtin_variables (void) |
|
53 { |
|
54 EOF |
|
55 |
|
56 for file in $VAR_FILES; do |
2909
|
57 f=`echo $file | sed 's/-/_/g'` |
|
58 echo " symbols_of_${f} ();" |
2907
|
59 done |
|
60 |
|
61 cat << \EOF |
|
62 } |
|
63 |
2335
|
64 static void |
|
65 install_builtin_functions (void) |
|
66 { |
|
67 EOF |
|
68 |
2907
|
69 for file in $DEF_FILES; do |
|
70 fcn=`echo $file | sed 's/\.df//; s/-/_/g'` |
2373
|
71 echo " install_${fcn}_fcns ();" |
|
72 done |
2335
|
73 |
|
74 cat << \EOF |
|
75 } |
|
76 |
2910
|
77 extern void install_mapper_functions (void); |
|
78 |
2335
|
79 void |
|
80 install_builtins (void) |
|
81 { |
|
82 install_builtin_variables (); |
|
83 install_mapper_functions (); |
|
84 install_builtin_functions (); |
|
85 } |
|
86 EOF |
|
87 |
|
88 exit 0 |