monitor/hmp: move hmp_snapshot_* to block-hmp-cmds.c
[qemu/ar7.git] / scripts / hxtool
blob0003e7b673db0da36e82d4f6b46511ae07f67065
1 #!/bin/sh
3 hxtoh()
5 flag=1
6 while read -r str; do
7 case $str in
8 HXCOMM*)
9 ;;
10 STEXI*|ETEXI*|SRST*|ERST*) flag=$(($flag^1))
13 test $flag -eq 1 && printf "%s\n" "$str"
15 esac
16 done
19 print_texi_heading()
21 if test "$*" != ""; then
22 title="$*"
23 printf "@subsection %s\n" "${title%:}"
27 hxtotexi()
29 flag=0
30 rstflag=0
31 line=1
32 while read -r str; do
33 case "$str" in
34 HXCOMM*)
36 STEXI*)
37 if test $rstflag -eq 1 ; then
38 printf "line %d: syntax error: expected ERST, found '%s'\n" "$line" "$str" >&2
39 exit 1
41 if test $flag -eq 1 ; then
42 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
43 exit 1
45 flag=1
47 ETEXI*)
48 if test $rstflag -eq 1 ; then
49 printf "line %d: syntax error: expected ERST, found '%s'\n" "$line" "$str" >&2
50 exit 1
52 if test $flag -ne 1 ; then
53 printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
54 exit 1
56 flag=0
58 SRST*)
59 if test $rstflag -eq 1 ; then
60 printf "line %d: syntax error: expected ERST, found '%s'\n" "$line" "$str" >&2
61 exit 1
63 if test $flag -eq 1 ; then
64 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
65 exit 1
67 rstflag=1
69 ERST*)
70 if test $flag -eq 1 ; then
71 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
72 exit 1
74 if test $rstflag -ne 1 ; then
75 printf "line %d: syntax error: expected SRST, found '%s'\n" "$line" "$str" >&2
76 exit 1
78 rstflag=0
80 DEFHEADING*)
81 print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
83 ARCHHEADING*)
84 print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
87 test $flag -eq 1 && printf '%s\n' "$str"
89 esac
90 line=$((line+1))
91 done
94 case "$1" in
95 "-h") hxtoh ;;
96 "-t") hxtotexi ;;
97 *) exit 1 ;;
98 esac
100 exit 0