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 |
|
28 #include "builtins.h" |
|
29 #include "mappers.h" |
2890
|
30 #include "oct-builtin.h" |
2335
|
31 #include "oct-obj.h" |
|
32 #include "variables.h" |
|
33 |
2373
|
34 EOF |
|
35 |
2907
|
36 for file in $DEF_FILES; do |
|
37 fcn=`echo $file | sed 's/\.df//; s/-/_/g'` |
2373
|
38 echo "static void" |
|
39 echo "install_${fcn}_fcns (void)" |
|
40 echo "{" |
|
41 cat $file |
|
42 echo "}" |
2907
|
43 echo "" |
|
44 done |
|
45 |
|
46 for file in $VAR_FILES; do |
2909
|
47 f=`echo $file | sed 's/-/_/g'` |
|
48 echo "extern void symbols_of_${f} (void);" |
2373
|
49 done |
|
50 |
|
51 cat << \EOF |
2907
|
52 |
|
53 static void |
|
54 install_builtin_variables (void) |
|
55 { |
|
56 EOF |
|
57 |
|
58 for file in $VAR_FILES; do |
2909
|
59 f=`echo $file | sed 's/-/_/g'` |
|
60 echo " symbols_of_${f} ();" |
2907
|
61 done |
|
62 |
|
63 cat << \EOF |
|
64 } |
|
65 |
2335
|
66 static void |
|
67 install_builtin_functions (void) |
|
68 { |
|
69 EOF |
|
70 |
2907
|
71 for file in $DEF_FILES; do |
|
72 fcn=`echo $file | sed 's/\.df//; s/-/_/g'` |
2373
|
73 echo " install_${fcn}_fcns ();" |
|
74 done |
2335
|
75 |
|
76 cat << \EOF |
|
77 } |
|
78 |
|
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 |