1 |
#!/bin/sh |
2 |
############################################################################### |
3 |
# |
4 |
# Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
5 |
# |
6 |
# Redistribution and use in source and binary forms, with or without |
7 |
# modification, are permitted provided that the following conditions are met: |
8 |
# |
9 |
# 1. Redistributions of source code must retain the above copyright |
10 |
# notice, this list of conditions and the following disclaimer. |
11 |
# 2. Redistributions in binary form must reproduce the above copyright |
12 |
# notice, this list of conditions and the following disclaimer in the |
13 |
# documentation and/or other materials provided with the distribution. |
14 |
# 3. The name of the author may not be used to endorse or promote products |
15 |
# derived from this software without specific prior written permission. |
16 |
# |
17 |
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
18 |
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
19 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
20 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
21 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
22 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
23 |
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 |
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
25 |
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
26 |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 |
# SUCH DAMAGE. |
28 |
# |
29 |
# |
30 |
# $Id: makeautomachine.sh,v 1.3 2005/12/31 15:47:38 debug Exp $ |
31 |
|
32 |
|
33 |
printf "Generating automachine.c... " |
34 |
|
35 |
rm -f automachine.c |
36 |
|
37 |
printf "/*\n * DO NOT EDIT. AUTOMATICALLY CREATED\n */\n\n" >> automachine.c |
38 |
|
39 |
cat automachine_head.c >> automachine.c |
40 |
|
41 |
printf "2" |
42 |
for a in machine_*.c; do |
43 |
B=`grep MACHINE_REGISTER $a` |
44 |
if [ z"$B" != z ]; then |
45 |
C=`grep MACHINE_REGISTER $a | cut -d \( -f 2|cut -d \) -f 1` |
46 |
for B in $C; do |
47 |
printf "void machine_register_$B(void);\n" >> automachine.c |
48 |
done |
49 |
fi |
50 |
done |
51 |
|
52 |
cat automachine_middle.c >> automachine.c |
53 |
|
54 |
printf "1" |
55 |
for a in machine_*.c; do |
56 |
B=`grep MACHINE_REGISTER $a` |
57 |
if [ z"$B" != z ]; then |
58 |
C=`grep MACHINE_REGISTER $a | cut -d \( -f 2|cut -d \) -f 1` |
59 |
for B in $C; do |
60 |
printf "\tmachine_register_$B();\n" >> automachine.c |
61 |
done |
62 |
fi |
63 |
done |
64 |
|
65 |
cat automachine_tail.c >> automachine.c |
66 |
|
67 |
printf " done\n" |