summaryrefslogtreecommitdiffstats
path: root/opcode-gen/opcode-gen
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2010-12-03 13:01:06 -0800
committerDan Bornstein <danfuzz@android.com>2010-12-03 13:05:53 -0800
commit973171bb01a052a302e8674b5f617383bac0647a (patch)
tree98bcc78ed5591fb26e019b49532c822926e25fc1 /opcode-gen/opcode-gen
parentc9cc157c98151966e1ddd3cc794416fd1efc39fd (diff)
downloadandroid_dalvik-973171bb01a052a302e8674b5f617383bac0647a.tar.gz
android_dalvik-973171bb01a052a302e8674b5f617383bac0647a.tar.bz2
android_dalvik-973171bb01a052a302e8674b5f617383bac0647a.zip
Clean up the opcode-gen script.
There was way too much string duplication, and it needed at least a bit more commenting. Change-Id: Id31ee1fd260db6f4afe301764c60de7c63b3f729
Diffstat (limited to 'opcode-gen/opcode-gen')
-rwxr-xr-xopcode-gen/opcode-gen16
1 files changed, 11 insertions, 5 deletions
diff --git a/opcode-gen/opcode-gen b/opcode-gen/opcode-gen
index 176ad3425..b8e4397db 100755
--- a/opcode-gen/opcode-gen
+++ b/opcode-gen/opcode-gen
@@ -20,15 +20,16 @@
# generate code inside the given <file>, based on the directives found
# in that file. Refer to those files to understand what's being
# generated. (Look for comments that say "BEGIN(name)" where "name" is
-# one of the directives defined below.
+# one of the "emission" directives defined in opcode-gen.awk in this
+# directory.)
file="$1"
tmpfile="/tmp/$$.txt"
-echo "processing `basename $1`"
+echo "processing `basename $1`" 1>&2
if [ "x$1" = "x" ]; then
- echo "must specify a file"
+ echo "must specify a file" 1>&2
exit 1
fi
@@ -57,5 +58,10 @@ bytecodeFile="$progdir/bytecode.txt"
awk -v "bytecodeFile=$bytecodeFile" -f "$progdir/opcode-gen.awk" \
"$file" > "$tmpfile"
-cp "$tmpfile" "$file"
-rm "$tmpfile"
+if [ "$?" = "0" ]; then
+ cp "$tmpfile" "$file"
+ rm "$tmpfile"
+else
+ echo "error running awk" 1>&2
+ exit 1
+fi