]> git.proxmox.com Git - qemu.git/blame - hxtool
tcg-i386: Merge 64-bit generation.
[qemu.git] / hxtool
CommitLineData
5824d651
BS
1#!/bin/sh
2
3hxtoh()
4{
5 flag=1
fb21ced7 6 while read -r str; do
5824d651
BS
7 case $str in
8 HXCOMM*)
9 ;;
b40292e7 10 STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
5824d651
BS
11 ;;
12 *)
004efc96 13 test $flag -eq 1 && printf "%s\n" "$str"
5824d651
BS
14 ;;
15 esac
16 done
17}
18
19hxtotexi()
20{
21 flag=0
6c913ba5 22 line=1
fb21ced7 23 while read -r str; do
5824d651
BS
24 case "$str" in
25 HXCOMM*)
26 ;;
6c913ba5
JK
27 STEXI*)
28 if test $flag -eq 1 ; then
29 echo "line $line: syntax error: expected ETEXI, found $str" >&2
30 exit 1
31 fi
32 flag=1
33 ;;
34 ETEXI*)
35 if test $flag -ne 1 ; then
36 echo "line $line: syntax error: expected STEXI, found $str" >&2
37 exit 1
38 fi
39 flag=0
5824d651 40 ;;
b40292e7
JK
41 SQMP*|EQMP*)
42 if test $flag -eq 1 ; then
43 echo "line $line: syntax error: expected ETEXI, found $str" >&2
44 exit 1
45 fi
46 ;;
5824d651 47 DEFHEADING*)
7d69c52e 48 echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
5824d651
BS
49 ;;
50 *)
7d69c52e 51 test $flag -eq 1 && echo "$str"
5824d651
BS
52 ;;
53 esac
6c913ba5 54 line=$((line+1))
5824d651
BS
55 done
56}
57
b40292e7
JK
58hxtoqmp()
59{
60 IFS=
61 flag=0
62 while read -r str; do
63 case "$str" in
64 HXCOMM*)
65 ;;
66 SQMP*)
67 if test $flag -eq 1 ; then
68 echo "line $line: syntax error: expected EQMP, found $str" >&2
69 exit 1
70 fi
71 flag=1
72 ;;
73 EQMP*)
74 if test $flag -ne 1 ; then
75 echo "line $line: syntax error: expected SQMP, found $str" >&2
76 exit 1
77 fi
78 flag=0
79 ;;
80 STEXI*|ETEXI*)
81 if test $flag -eq 1 ; then
82 echo "line $line: syntax error: expected EQMP, found $str" >&2
83 exit 1
84 fi
85 ;;
86 *)
87 test $flag -eq 1 && echo "$str"
88 ;;
89 esac
90 done
91}
92
5824d651
BS
93case "$1" in
94"-h") hxtoh ;;
95"-t") hxtotexi ;;
b40292e7 96"-q") hxtoqmp ;;
5824d651
BS
97*) exit 1 ;;
98esac
5c2f8d2d
BS
99
100exit 0