From nobody Tue Apr 16 12:39:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589893330; cv=none; d=zohomail.com; s=zohoarc; b=SmKaqECycAYKsd/sSgjaY2PecD3G+VcgFX6i3pH6RtaKcOu+zkdr7xXyCtR+q61y0bSPIPRuvyVDtconAATEeI5FLP8RoEoJGkR695fm0bnwE4Nn8glT90q+lR/1kvBkOPpFzP7CI2RR5ChmHm1wK24e8EAIOENAjOteuZzawu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589893330; h=Content-Type:Content-Transfer-Encoding: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=94G+zP7kClWF+hv+Ipgzlyi0toQ1bOHkSOvT73xXi+M=; b=NzqyMtQBYrhvF8o57jqnh2Q9fEp1R6WvQF396bUn1bfDl1zGnvX0qQxFYerlmwoFN1Vq9IQ4VL6+0zvadO3q3nvxQUvnkWdDBll4tbh8743B3l6lXGBNFrAAIUcxSZ3AqoLWDNflHUdltKL0AzDFea5EmjxeZLCPIzZiE52PvLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1589893330029358.2350715477694; Tue, 19 May 2020 06:02:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-o0NclYKjNs6xv2s-Nzvc2A-1; Tue, 19 May 2020 09:02:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 99CDF193F75B; Tue, 19 May 2020 13:01:32 +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 71BD71001925; Tue, 19 May 2020 13:01:32 +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 3747A1809554; Tue, 19 May 2020 13:01:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04JD1UP6023981 for ; Tue, 19 May 2020 09:01:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 493885D9E4; Tue, 19 May 2020 13:01:30 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01CDD5D9C5; Tue, 19 May 2020 13:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589893328; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=94G+zP7kClWF+hv+Ipgzlyi0toQ1bOHkSOvT73xXi+M=; b=TrajPJEBxStVv8Tn0PiHDPFow2M2AbtA+ObOG8gX/R4truessE1oH4/mTr5ObQx0owt4oH kfL8N6i1J8nkn6cTMxjSt7P1POE45lAnvaf6AaKcyXCFp0HQ3lBtKLF/XRI58T+YMO/xAF 2/oqBuINTxaEiJtCa8sG6oUYYhwKmxM= X-MC-Unique: o0NclYKjNs6xv2s-Nzvc2A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] scripts: use UTF-8 for API XML files Date: Tue, 19 May 2020 14:01:16 +0100 Message-Id: <20200519130119.2149052-2-berrange@redhat.com> In-Reply-To: <20200519130119.2149052-1-berrange@redhat.com> References: <20200519130119.2149052-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The build system will be running in UTF-8 locale, so any content in the API XML files will also end up being UTF-8, not ISO-8859-1. Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/apibuild.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 05a169c30d..b13b5db644 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -2333,7 +2333,7 @@ class docBuilder: if not quiet: print("Saving XML description %s" % (filename)) output =3D open(filename, "w") - output.write('\n') + output.write('\n') output.write("\n" % self.name) output.write(" \n") headers =3D sorted(self.headers.keys()) --=20 2.26.2 From nobody Tue Apr 16 12:39:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589893336; cv=none; d=zohomail.com; s=zohoarc; b=jpsMkE2IKfwbf/MWXP1p0BBiZNBWMqugjR3iNX0apfMhmLaMJ7QuD6kXiLbl2wndWsXr9WMhzid2QdO4yKZV0VoJ2L7DjC8WZIlsF9DGh8GRJni9y1TJxtAF+IIYK13SmhrgojhCy65Y++4pfTzIMH61OrawUGCyKGxQNq1Uwck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589893336; h=Content-Type:Content-Transfer-Encoding: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=CsQdxnUxdZpMZKF8dT3GhYzl8D2BdTzkGKQgUd6ZDm0=; b=ncq+RCmed5Ln/vCQWTwVPpH8KO+SNI/whYnzHD/1Fxxe8uX9JQfC9TtYuNsx8bD3AFljrqleiZc/YAYdxMpM48bMzLBgiydz/LU3Ubkd52WEotcGdgTbw+nJSRCcZYBuK1VZVwPPUc/MvqC2on0oM9I8p328nbkrULI3uTjFBJQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1589893336657599.0282306043121; Tue, 19 May 2020 06:02:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-dwxfAHtzNVusaz2DA3wLOQ-1; Tue, 19 May 2020 09:02:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2F4E805C28; Tue, 19 May 2020 13:01:35 +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 93EB35C1C5; Tue, 19 May 2020 13:01:35 +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 640374ED69; Tue, 19 May 2020 13:01:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04JD1V8r023991 for ; Tue, 19 May 2020 09:01:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FCD95D9DD; Tue, 19 May 2020 13:01:31 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C5DD5D9C5; Tue, 19 May 2020 13:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589893332; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CsQdxnUxdZpMZKF8dT3GhYzl8D2BdTzkGKQgUd6ZDm0=; b=hMd/9nQH1oejJINpmw1NXR+N8LZSIRjNPOayNKeXgW8YF6gXbhOWMuKu5kcxgWs8aXS7qO vhCvjcIz5xKKqBuVBkNf2L46sCoJ4q17SeZf74uBFwAeRENgOeFesM7i6TLPsrxoOwdCws K439DIgz8lGhvOu3+xW2Mt2zD5J7wZk= X-MC-Unique: dwxfAHtzNVusaz2DA3wLOQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] scripts: fix tokenizing of enum parameters in API builder Date: Tue, 19 May 2020 14:01:17 +0100 Message-Id: <20200519130119.2149052-3-berrange@redhat.com> In-Reply-To: <20200519130119.2149052-1-berrange@redhat.com> References: <20200519130119.2149052-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The API build script tokenizes enums declarations by first splitting on whitespace. This is unhelpful as it means an enum # define VIR_USE_CPU(cpumap, cpu) ((cpumap)[(cpu) / 8] |=3D (1 << ((cpu) %= 8))) Gets tokenized as #define VIR_USE_CPU(cpumap, cpu) ((cpumap)[(cpu) / 8] |=3D (1 << ((cpu) % 8))) With this change, the set of parameters are all merged into the first token: #define VIR_USE_CPU(cpumap,cpu) ((cpumap)[(cpu) / 8] |=3D (1 << ((cpu) % 8))) which is more convenient to process later on in the script. Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/apibuild.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index b13b5db644..68c588d8b6 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -494,6 +494,28 @@ class CLexer: if self.tokens[0][1] =3D=3D "#": self.tokens[0] =3D ('preproc', "#" + self.tokens[1][1]) del self.tokens[1] + + if self.tokens[0][1] =3D=3D "#define" and "(" in self.toke= ns[1][1]: + newtokens =3D [self.tokens[0]] + + endArg =3D self.tokens[1][1].find(")") + if endArg !=3D -1: + extra =3D self.tokens[1][1][endArg+1:] + name =3D self.tokens[1][1][0:endArg+1] + newtokens.append(('preproc', name)) + if extra !=3D "": + newtokens.append(('preproc', extra)) + else: + name =3D self.tokens[1][1] + for token in self.tokens[2:]: + if name is not None: + name =3D name + token[1] + if ")" in token[1]: + newtokens.append(('preproc', name)) + name =3D None + else: + newtokens.append(token) + self.tokens =3D newtokens break nline =3D len(line) if line[0] =3D=3D '"' or line[0] =3D=3D "'": --=20 2.26.2 From nobody Tue Apr 16 12:39:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589893334; cv=none; d=zohomail.com; s=zohoarc; b=IJPFzG+NVo//iTzXAlt0hmFP1QHzSa1f4DMzgjs29NCwLyECUxzm27gnnMEu3o6zRlhNJVsFWTmvLVN9p5IJrGsGoltZMBXihiDCtg5cJl9K6Z+UQuo5uuxmKXb9uJ0GdJQ3G6U9Hc+IXkFkb1TroGOppQhPf37khp8RM2DfGyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589893334; h=Content-Type:Content-Transfer-Encoding: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=flL2iBcmWGI7kdXuTODOw9pymTmHgRLyuFjE70E2Eew=; b=nmwuDFuWqas8HT7YBS/fo/0lMIaE4T7EMmQX6d1u2yk4vvtp4TnT9HN5teV7iElyt17ZEf76aZiz94YKeU9cdESgRcyHIapX9HMhBIDSbpXxaovssVn6Y2cygJO/yNNRU+u9gwEF/6X+iAwwdRmHw9WgnBK/Pxtz86j84CSRkoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1589893334244620.436797832321; Tue, 19 May 2020 06:02:14 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-OcibW0xvOnmSjbf6wcNJZQ-1; Tue, 19 May 2020 09:02:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D1A0805C24; Tue, 19 May 2020 13:01:35 +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 EDC4B3A1; Tue, 19 May 2020 13:01:34 +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 BE7CC4ED62; Tue, 19 May 2020 13:01:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04JD1WDl023999 for ; Tue, 19 May 2020 09:01:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id B22BA5D9DD; Tue, 19 May 2020 13:01:32 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2ABC5D9C5; Tue, 19 May 2020 13:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589893331; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=flL2iBcmWGI7kdXuTODOw9pymTmHgRLyuFjE70E2Eew=; b=dbQtz85XpyrXODZKuoTn7p7qUT0ulDH89WS/KNBn0cfhHbLu0uE4CjC7fsXK8D8jMgkKGp 3wG0r4qfe/xI1e3Tf1CTHPjFFygj7Iui4V2WdXAhrtjo3S9Z+H27vciW88plYterUQfbJU xB1C8iUbGobduhWZLzVH92rCwIhrhLY= X-MC-Unique: OcibW0xvOnmSjbf6wcNJZQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] scripts: emit enum parameters in API build description Date: Tue, 19 May 2020 14:01:18 +0100 Message-Id: <20200519130119.2149052-4-berrange@redhat.com> In-Reply-To: <20200519130119.2149052-1-berrange@redhat.com> References: <20200519130119.2149052-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Currently the information about enums in the API document lacks any mention of parameters, so it is impossible to tell what kind of enum declaration is present in the libvirt API header. With this change ...snip... becomes ...snip... Signed-off-by: Daniel P. Berrang=C3=A9 --- scripts/apibuild.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 68c588d8b6..9faf15a75e 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -1013,10 +1013,12 @@ class CParser: token[1][0] !=3D '#'): lst.append(token[1]) token =3D self.lexer.token() - try: - name =3D name.split('(')[0] - except Exception: - pass + + paramStart =3D name.find("(") + params =3D None + if paramStart !=3D -1: + params =3D name[paramStart+1:-1] + name =3D name[0:paramStart] =20 # skip hidden macros if name in hidden_macros: @@ -1029,7 +1031,7 @@ class CParser: strValue =3D lst[0][1:-1] (args, desc) =3D self.parseMacroComment(name, not self.is_= header) self.index_add(name, self.filename, not self.is_header, - "macro", (args, desc, strValue)) + "macro", (args, desc, params, strValue)) return token =20 # @@ -2174,10 +2176,13 @@ class docBuilder: if id.info is None: args =3D [] desc =3D None + params =3D None strValue =3D None else: - (args, desc, strValue) =3D id.info + (args, desc, params, strValue) =3D id.info =20 + if params is not None: + output.write(" params=3D'%s'" % params) if strValue is not None: output.write(" string=3D'%s'" % strValue) output.write(">\n") --=20 2.26.2 From nobody Tue Apr 16 12:39:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1589893324; cv=none; d=zohomail.com; s=zohoarc; b=FMwS1EN+B0a8haQyiOEvHO9Rd0UOYwbXkukibYhCkvGARfFiTRf4uvxMimcyBSb8vh9xsNpPkah9qiwY1HwI9w4mr0lveVm+CaxBMrwBZVcn6J6ZpbeHeXA7/mvOn3/HU1Xu2AjvvfA71vDc0PJagdfaqajJg19NXGYGgaruZBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589893324; h=Content-Type:Content-Transfer-Encoding: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=MrBLL4IGPxA97c47827pJZyoYRWQyxiQeUZJxHHLLwE=; b=I98M8UoN09HLOi0w/FFEEwaH91TCKqwKW0VfxUN2UbVAoiiuXkKdMT6YEf+A0Y5pEzD2d53cEMJyLG5m9+AWcoELm++hIVCK+Jw3cEflqg+tKTzWCRnBimaraSrShUY5Ngpg1kIClq+T4alGPPjgm0nWwmZVkRodc6EYhRxrBYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1589893324141981.0110984499718; Tue, 19 May 2020 06:02:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-298-JDr3AqtlMemigaYjYre27A-1; Tue, 19 May 2020 09:01:56 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 53EFD15C4E; Tue, 19 May 2020 13:01:41 +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 BF7D66EA26; Tue, 19 May 2020 13:01:37 +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 89DB51800429; Tue, 19 May 2020 13:01:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04JD1Yvw024007 for ; Tue, 19 May 2020 09:01:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCD965D9E2; Tue, 19 May 2020 13:01:34 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id A59D95D9C5; Tue, 19 May 2020 13:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589893322; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MrBLL4IGPxA97c47827pJZyoYRWQyxiQeUZJxHHLLwE=; b=Blgt60yU2HSETyfcKiv2GJHL3nh50gqwGj0zf1rpuO8k998GH5+oktM4L5evj1W7uKr72n NttQ/lcfa1jceg2HAIk0AV/HsXTQuTu+dXGDXWSEvp08I/5l/H18A0OvX7FU4fp7lw8BzZ d+Ul+aTVIO+jppWYrP4yZs080sSbTwE= X-MC-Unique: JDr3AqtlMemigaYjYre27A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] scripts: emit raw enum value in API build description Date: Tue, 19 May 2020 14:01:19 +0100 Message-Id: <20200519130119.2149052-5-berrange@redhat.com> In-Reply-To: <20200519130119.2149052-1-berrange@redhat.com> References: <20200519130119.2149052-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Currently the value for an enum is only emitted if it is a plain string. If the enum is an integer or hex value, or a complex code block, it is omitted from the API build. This fixes that by emitting the raw value if no string value is present. With this change: ...snip... ...snip... Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- scripts/apibuild.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/apibuild.py b/scripts/apibuild.py index 9faf15a75e..d63489ba62 100755 --- a/scripts/apibuild.py +++ b/scripts/apibuild.py @@ -1027,11 +1027,14 @@ class CParser: return token =20 strValue =3D None + rawValue =3D None if len(lst) =3D=3D 1 and lst[0][0] =3D=3D '"' and lst[0][-= 1] =3D=3D '"': strValue =3D lst[0][1:-1] + else: + rawValue =3D " ".join(lst) (args, desc) =3D self.parseMacroComment(name, not self.is_= header) self.index_add(name, self.filename, not self.is_header, - "macro", (args, desc, params, strValue)) + "macro", (args, desc, params, strValue, raw= Value)) return token =20 # @@ -2178,13 +2181,16 @@ class docBuilder: desc =3D None params =3D None strValue =3D None + rawValue =3D None else: - (args, desc, params, strValue) =3D id.info + (args, desc, params, strValue, rawValue) =3D id.info =20 if params is not None: output.write(" params=3D'%s'" % params) if strValue is not None: output.write(" string=3D'%s'" % strValue) + else: + output.write(" raw=3D'%s'" % rawValue) output.write(">\n") =20 if desc is not None and desc !=3D "": --=20 2.26.2