xen/mapcache: add an ability to create dummy mappings
[qemu.git] / scripts / hxtool
blob1e2c97c5e69db8a64ee0822f5ed76abe0fefcafd
1 #!/bin/sh
3 hxtoh()
5 flag=1
6 while read -r str; do
7 case $str in
8 HXCOMM*)
9 ;;
10 STEXI*|ETEXI*) 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 printf "@subsection %s\n" "$*"
26 hxtotexi()
28 flag=0
29 line=1
30 while read -r str; do
31 case "$str" in
32 HXCOMM*)
34 STEXI*)
35 if test $flag -eq 1 ; then
36 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
37 exit 1
39 flag=1
41 ETEXI*)
42 if test $flag -ne 1 ; then
43 printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
44 exit 1
46 flag=0
48 DEFHEADING*)
49 print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
51 ARCHHEADING*)
52 print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
55 test $flag -eq 1 && printf '%s\n' "$str"
57 esac
58 line=$((line+1))
59 done
62 case "$1" in
63 "-h") hxtoh ;;
64 "-t") hxtotexi ;;
65 *) exit 1 ;;
66 esac
68 exit 0