From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org,
Richard Henderson <richard.henderson@linaro.org>,
Markus Armbruster <armbru@redhat.com>,
Max Reitz <mreitz@redhat.com>, Greg Kurz <groug@kaod.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
John Snow <jsnow@redhat.com>
Subject: Re: [PATCH v2 2/8] hxtool: Support SRST/ERST directives
Date: Mon, 27 Jan 2020 09:23:00 +0100 [thread overview]
Message-ID: <1ff66395-d1c6-3d41-fabe-ab5094c789af@redhat.com> (raw)
In-Reply-To: <20200124162606.8787-3-peter.maydell@linaro.org>
On 1/24/20 5:26 PM, Peter Maydell wrote:
> We want to add support for including rST document fragments
> in our .hx files, in the same way we currently have texinfo
> fragments. These will be delimited by SRST and ERST directives,
> in the same way the texinfo is delimited by STEXI/ETEXI.
> The rST fragments will not be extracted by the hxtool
> script, but by a different mechanism, so all we need to
> do in hxtool is have it ignore all the text inside a
> SRST/ERST section, with suitable error-checking for
> mismatched rST-vs-texi fragment delimiters.
>
> The resulting effective state machine has only three states:
> * flag = 0, rstflag = 0 : reading section for C output
> * flag = 1, rstflag = 0 : reading texi fragment
> * flag = 0, rstflag = 1 : reading rST fragment
> and flag = 1, rstflag = 1 is not possible. Using two
> variables makes the parallel between the rST handling and
> the texi handling clearer; in any case all this code will
> be deleted once we've converted entirely to rST.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> scripts/hxtool | 33 ++++++++++++++++++++++++++++++++-
> 1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/hxtool b/scripts/hxtool
> index 7d7c4289e32..0003e7b673d 100644
> --- a/scripts/hxtool
> +++ b/scripts/hxtool
> @@ -7,7 +7,7 @@ hxtoh()
> case $str in
> HXCOMM*)
> ;;
> - STEXI*|ETEXI*) flag=$(($flag^1))
> + STEXI*|ETEXI*|SRST*|ERST*) flag=$(($flag^1))
> ;;
> *)
> test $flag -eq 1 && printf "%s\n" "$str"
> @@ -27,12 +27,17 @@ print_texi_heading()
> hxtotexi()
> {
> flag=0
> + rstflag=0
> line=1
> while read -r str; do
> case "$str" in
> HXCOMM*)
> ;;
> STEXI*)
> + if test $rstflag -eq 1 ; then
> + printf "line %d: syntax error: expected ERST, found '%s'\n" "$line" "$str" >&2
> + exit 1
> + fi
> if test $flag -eq 1 ; then
> printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
> exit 1
> @@ -40,12 +45,38 @@ hxtotexi()
> flag=1
> ;;
> ETEXI*)
> + if test $rstflag -eq 1 ; then
> + printf "line %d: syntax error: expected ERST, found '%s'\n" "$line" "$str" >&2
> + exit 1
> + fi
> if test $flag -ne 1 ; then
> printf "line %d: syntax error: expected STEXI, found '%s'\n" "$line" "$str" >&2
> exit 1
> fi
> flag=0
> ;;
> + SRST*)
> + if test $rstflag -eq 1 ; then
> + printf "line %d: syntax error: expected ERST, found '%s'\n" "$line" "$str" >&2
> + exit 1
> + fi
> + if test $flag -eq 1 ; then
> + printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
> + exit 1
> + fi
> + rstflag=1
> + ;;
> + ERST*)
> + if test $flag -eq 1 ; then
> + printf "line %d: syntax error: expected ETEXI, found '%s'\n" "$line" "$str" >&2
> + exit 1
> + fi
> + if test $rstflag -ne 1 ; then
> + printf "line %d: syntax error: expected SRST, found '%s'\n" "$line" "$str" >&2
> + exit 1
> + fi
> + rstflag=0
> + ;;
> DEFHEADING*)
> print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")"
> ;;
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2020-01-27 8:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-24 16:25 [PATCH v2 0/8] qemu-img, qemu-trace-stap, virtfs-proxy-helper: convert to rST Peter Maydell
2020-01-24 16:25 ` [PATCH v2 1/8] Makefile: Ensure we don't run Sphinx in parallel for manpages Peter Maydell
2020-01-31 15:20 ` Alex Bennée
2020-01-24 16:26 ` [PATCH v2 2/8] hxtool: Support SRST/ERST directives Peter Maydell
2020-01-24 18:10 ` Alex Bennée
2020-01-27 8:23 ` Philippe Mathieu-Daudé [this message]
2020-01-24 16:26 ` [PATCH v2 3/8] docs/sphinx: Add new hxtool Sphinx extension Peter Maydell
2020-01-24 18:24 ` Alex Bennée
2020-01-24 16:26 ` [PATCH v2 4/8] qemu-img-cmds.hx: Add rST documentation fragments Peter Maydell
2020-01-24 16:26 ` [PATCH v2 5/8] qemu-img: Convert invocation documentation to rST Peter Maydell
2020-01-31 15:14 ` Alex Bennée
2020-01-24 16:26 ` [PATCH v2 6/8] qemu-img-cmds.hx: Remove texinfo document fragments Peter Maydell
2020-01-31 15:14 ` Alex Bennée
2020-01-24 16:26 ` [PATCH v2 7/8] scripts/qemu-trace-stap: Convert documentation to rST Peter Maydell
2020-01-31 15:15 ` Alex Bennée
2020-01-24 16:26 ` [PATCH v2 8/8] virtfs-proxy-helper: " Peter Maydell
2020-01-24 16:47 ` Greg Kurz
2020-01-31 11:44 ` [PATCH v2 0/8] qemu-img, qemu-trace-stap, virtfs-proxy-helper: convert " Peter Maydell
2020-02-03 11:01 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ff66395-d1c6-3d41-fabe-ab5094c789af@redhat.com \
--to=philmd@redhat.com \
--cc=armbru@redhat.com \
--cc=groug@kaod.org \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).