]> Git Repo - qemu.git/blob - scripts/hxtool
dump-guest-memory.py: fix "You can't do that without a process to debug"
[qemu.git] / scripts / hxtool
1 #!/bin/sh
2
3 hxtoh()
4 {
5     flag=1
6     while read -r str; do
7         case $str in
8             HXCOMM*)
9             ;;
10             STEXI*|ETEXI*) flag=$(($flag^1))
11             ;;
12             *)
13             test $flag -eq 1 && printf "%s\n" "$str"
14             ;;
15         esac
16     done
17 }
18
19 print_texi_heading()
20 {
21     if test "$*" != ""; then
22         title="$*"
23         printf "@subsection %s\n" "${title%:}"
24     fi
25 }
26
27 hxtotexi()
28 {
29     flag=0
30     line=1
31     while read -r str; do
32         case "$str" in
33             HXCOMM*)
34             ;;
35             STEXI*)
36             if test $flag -eq 1 ; then
37                 printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
38                 exit 1
39             fi
40             flag=1
41             ;;
42             ETEXI*)
43             if test $flag -ne 1 ; then
44                 printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
45                 exit 1
46             fi
47             flag=0
48             ;;
49             DEFHEADING*)
50             print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
51             ;;
52             ARCHHEADING*)
53             print_texi_heading "$(expr "$str" : "ARCHHEADING(\(.*\),.*)")"
54             ;;
55             *)
56             test $flag -eq 1 && printf '%s\n' "$str"
57             ;;
58         esac
59         line=$((line+1))
60     done
61 }
62
63 case "$1" in
64 "-h") hxtoh ;;
65 "-t") hxtotexi ;;
66 *) exit 1 ;;
67 esac
68
69 exit 0
This page took 0.024367 seconds and 4 git commands to generate.