From nobody Wed May 1 08:29:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15007984139251022.0775451381704; Sun, 23 Jul 2017 01:26:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C18E80462; Sun, 23 Jul 2017 08:26:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A7A260BEB; Sun, 23 Jul 2017 08:26:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 19CEC14B20; Sun, 23 Jul 2017 08:26:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6M94iBc010929 for ; Sat, 22 Jul 2017 05:04:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 71B8E60F88; Sat, 22 Jul 2017 09:04:44 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id A865177DFF; Sat, 22 Jul 2017 09:04:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9C18E80462 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9C18E80462 From: Michal Privoznik To: libvir-list@redhat.com Date: Sat, 22 Jul 2017 11:04:33 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: tgolembi@redhat.com Subject: [libvirt] [PATCH 1/2] apibuild.py: Handle enum comments properly X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sun, 23 Jul 2017 08:26:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" After f4cb85c6aff7c1d90 we only have two options for placing enum values descriptions. It's either: typedef enum { /* Some long description. Therefore it's placed before * the value. */ VIR_ENUM_A_VAL =3D 1, } virEnumA; or: typedef enum { VIR_ENUM_B_VAL =3D 1, /* Some short description */ } virEnumB; However, our apibuild.py script is not able to deal with the former one. It messes up comments. To fix this couple of things needs to be done: a) DO NOT reset self.comment in parseEnumBlock(). This is a result from our tokenizer. Upon calling token() if it finds a comment block it stores it in self.comment and returns the next token (which is not comment). Therefore, if we reset self.comment we might lose the first comment in the enum block. b) we need a variable to track if the current enum block uses value descriptions before or after values. That is if it's type virEnumA or virEnumB. Depending on that, it we're dealing with virEnumA type and the current token is a comma ',' we can add the value into the list as we already have everything needed: comment, name and value. Signed-off-by: Michal Privoznik --- docs/apibuild.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 47f340c7d..3a8f5d449 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -1365,9 +1365,9 @@ class CParser: def parseEnumBlock(self, token): self.enums =3D [] name =3D None - self.comment =3D None comment =3D "" value =3D "-1" + commentsBeforeVal =3D self.comment is not None while token is not None: if token[0] =3D=3D "sep" and token[1] =3D=3D "{": token =3D self.token() @@ -1408,6 +1408,10 @@ class CParser: self.warning("Failed to compute value of enum %s" = % (name)) value=3D"" if token[0] =3D=3D "sep" and token[1] =3D=3D ",": + if commentsBeforeVal and self.comment is not None: + self.cleanupComment() + self.enums.append((name, value, self.comment)) + name =3D comment =3D self.comment =3D None token =3D self.token() else: token =3D self.token() @@ -1652,6 +1656,8 @@ class CParser: self.enums =3D [] token =3D self.token() if token is not None and token[0] =3D=3D "sep" and token[1] = =3D=3D "{": + # drop comments before the enum block + self.comment =3D None token =3D self.token() token =3D self.parseEnumBlock(token) else: --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 1 08:29:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500798438225515.1746318112677; Sun, 23 Jul 2017 01:27:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46610883C5; Sun, 23 Jul 2017 08:27:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A8535D6A6; Sun, 23 Jul 2017 08:27:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 132BB180BA88; Sun, 23 Jul 2017 08:27:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6M94kNU010935 for ; Sat, 22 Jul 2017 05:04:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4082560F90; Sat, 22 Jul 2017 09:04:46 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7600A60F88; Sat, 22 Jul 2017 09:04:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 46610883C5 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 46610883C5 From: Michal Privoznik To: libvir-list@redhat.com Date: Sat, 22 Jul 2017 11:04:34 +0200 Message-Id: <59c55ece487d1bb704d90a71c5a018987d1a1788.1500714065.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: tgolembi@redhat.com Subject: [libvirt] [PATCH 2/2] docs: Span cells if there's not doc text for enum val X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 23 Jul 2017 08:27:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When generating HTML documentation we put enum values into a table so that we can display the value's name, numerical value and description (if it has one). Now the last part is problem. If the value doesn't have description the table row has just two cells and if it has one the row counts three cells. This makes HTML engines render the description into very little space - for instance see: html/libvirt-libvirt-domain.html#virDomainMemoryStatTags We can avoid this problem if we let the cell that corresponds to numerical value span over two cells if there's no description. Signed-off-by: Michal Privoznik --- docs/newapi.xsl | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/newapi.xsl b/docs/newapi.xsl index 815c1b9d7..9dd961507 100644 --- a/docs/newapi.xsl +++ b/docs/newapi.xsl @@ -307,16 +307,21 @@ =3D - - - -
- - - -
- -
+ + + + +
+ + + +
+ +
+ + + +
--=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list