From nobody Tue Feb 10 01:30:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1579883281; cv=none; d=zohomail.com; s=zohoarc; b=eDAm7Nr741Qjo8nVbziTIWhMFm39fmugMcc3OqahDFIBI+PI8L9Ws0t06S4CLW8K1gIXL5kjWbcc/rW9ncravKWAeNzLRF4PLhTBVWoGVDaxG94jLyfKooZZ3mPbqw8BFqzbfy7eFP1i4eDLiFazzovYSvVaBvOf8nQMEMjD1rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579883281; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Cxdjd0+/T8oWcuIOqxYHGy696lLjTHLlcETHinq7j3Y=; b=J0bs4644ZnlS8SpyCM8rcnoviCIRmarFibcRiP8Zrau505Hrsg/cqTP3ELOClclR+Df1vBs+KbLaLqURZVO8211/rLSy1wPYgM304gsPO41ZOdKBQDR52XnzLhbcng3GS4t61k85h8eXLWOBUnEePRTxQYgaBBiyH26+ejLgoz4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579883281389805.1146043480533; Fri, 24 Jan 2020 08:28:01 -0800 (PST) Received: from localhost ([::1]:44434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv1oO-0005U6-9g for importer@patchew.org; Fri, 24 Jan 2020 11:28:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37900) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv1mh-0002S3-8e for qemu-devel@nongnu.org; Fri, 24 Jan 2020 11:26:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iv1mg-0002oT-20 for qemu-devel@nongnu.org; Fri, 24 Jan 2020 11:26:15 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:36971) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iv1mf-0002my-Sh for qemu-devel@nongnu.org; Fri, 24 Jan 2020 11:26:14 -0500 Received: by mail-wr1-x42d.google.com with SMTP id w15so2707856wru.4 for ; Fri, 24 Jan 2020 08:26:13 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id q3sm7054998wmj.38.2020.01.24.08.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2020 08:26:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cxdjd0+/T8oWcuIOqxYHGy696lLjTHLlcETHinq7j3Y=; b=KaD7ITNJAWl9Ml02sjRO2XNqtomycY2eTMOaFAdCO3X9W72h/eNn/oUFpU8nWlJYW2 TrkhqZjeAgt4EwGKfQGvA3V2842Enrpeo0LVOftTfHibsxxr/cPVUTzta3Q2EQl33W3g HJSYhDOXFiGDSq7aLdkggqTYW1di7QpE+161KPWT8E1/Hb45QODXsgr7xROakudy/QvF vfgJmWhxk1BNGo2IkY5lOViWsOgO3Or1NU/+iszNwZ6AG4w82MLNKUPq7ozrNXE1x+Yl +moiS3SR1OCLLfoJbQYAA6XRxSO/9BkQKAmBWkXSqFfqmt8/AyeyiAovZax748ZKp1qJ 0qEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cxdjd0+/T8oWcuIOqxYHGy696lLjTHLlcETHinq7j3Y=; b=sX/qtiVTNnRfJdQ6+twVr8mFIY33O8tgxN1EEJITMED+a/toFR+pBGXIIztCagZ7fH gEwhayfaNzwJ+9j4iKt3RavPcc6zZdlymo2ydqD9tyDyD/Yvjg0omBh5ZoM+24sYDelR J/hPSdZfzVfGU15BHb7VY25HODLIlzWeDxzX3gvpcgbxowSdF8DkM9Ph01Bseqgk6qOp ZlejfsdYnEiQzASIyOOdfh7yzvHVIGWM7aprTbBsNXPwCqjuhaj1iJGJ6PTSw0bBwper QhM9NKqINK7EpuhwlO0V0OSRGzEL0hHnpzB+nP96sP0Q57I2ABB2vJoFfZbXUXwtK4sH AZ5A== X-Gm-Message-State: APjAAAVGKk00cpiikKpUNj+7MutcsGrwphSgvn1mOUGzJ/grJaAWnQmB eflPAfk3+yw+Tl7HEEWzQYeZJWCQunqrow== X-Google-Smtp-Source: APXvYqxKeY55agqWYrXeQtnbvp+s+MzPouCj7YH1zkzND+iuYmS8zjgxLyeRaGxDm751BAK8OgnlBw== X-Received: by 2002:adf:f288:: with SMTP id k8mr5496791wro.301.1579883172529; Fri, 24 Jan 2020 08:26:12 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH v2 2/8] hxtool: Support SRST/ERST directives Date: Fri, 24 Jan 2020 16:26:00 +0000 Message-Id: <20200124162606.8787-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200124162606.8787-1-peter.maydell@linaro.org> References: <20200124162606.8787-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Markus Armbruster , Richard Henderson , Greg Kurz , Max Reitz , Stefan Hajnoczi , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 =3D 0, rstflag =3D 0 : reading section for C output * flag =3D 1, rstflag =3D 0 : reading texi fragment * flag =3D 0, rstflag =3D 1 : reading rST fragment and flag =3D 1, rstflag =3D 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 Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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=3D$(($flag^1)) + STEXI*|ETEXI*|SRST*|ERST*) flag=3D$(($flag^1)) ;; *) test $flag -eq 1 && printf "%s\n" "$str" @@ -27,12 +27,17 @@ print_texi_heading() hxtotexi() { flag=3D0 + rstflag=3D0 line=3D1 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=3D1 ;; 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=3D0 ;; + 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=3D1 + ;; + 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=3D0 + ;; DEFHEADING*) print_texi_heading "$(expr "$str" : "DEFHEADING(\(.*\))")" ;; --=20 2.20.1