From patchwork Tue Aug 4 15:58:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 503676 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 16E731402D4 for ; Wed, 5 Aug 2015 02:06:47 +1000 (AEST) Received: from localhost ([::1]:36065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMejk-0005te-W1 for incoming@patchwork.ozlabs.org; Tue, 04 Aug 2015 12:06:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMebm-0006tV-HM for qemu-devel@nongnu.org; Tue, 04 Aug 2015 11:58:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMebl-0005hj-Ad for qemu-devel@nongnu.org; Tue, 04 Aug 2015 11:58:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMebk-0005fG-L9 for qemu-devel@nongnu.org; Tue, 04 Aug 2015 11:58:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 307F7A10C6; Tue, 4 Aug 2015 15:58:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t74FwOXX032119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 4 Aug 2015 11:58:26 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3EC283011FB0; Tue, 4 Aug 2015 17:58:18 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 4 Aug 2015 17:58:09 +0200 Message-Id: <1438703896-12553-26-git-send-email-armbru@redhat.com> In-Reply-To: <1438703896-12553-1-git-send-email-armbru@redhat.com> References: <1438703896-12553-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH RFC v3 25/32] qapi: Improve built-in type documentation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Clarify how they map to JSON. Add how they map to C. Fix the reference to StringInputVisitor. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- docs/qapi-code-gen.txt | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/qapi-code-gen.txt b/docs/qapi-code-gen.txt index 5daa335..5fb35d2 100644 --- a/docs/qapi-code-gen.txt +++ b/docs/qapi-code-gen.txt @@ -140,17 +140,24 @@ must have a value that forms a struct name. === Built-in Types === -The following types are built-in to the parser: - 'str' - arbitrary UTF-8 string - 'int' - 64-bit signed integer (although the C code may place further - restrictions on acceptable range) - 'number' - floating point number - 'bool' - JSON value of true or false - 'int8', 'int16', 'int32', 'int64' - like 'int', but enforce maximum - bit size - 'uint8', 'uint16', 'uint32', 'uint64' - unsigned counterparts - 'size' - like 'uint64', but allows scaled suffix from command line - visitor +The following types are predefined, and map to C as follows: + + Schema C JSON + str char * any JSON string, UTF-8 + number double any JSON number + int int64_t a JSON number without fractional part + that fits into the C integer type + int8 int8_t likewise + int16 int16_t likewise + int32 int32_t likewise + int64 int64_t likewise + uint8 uint8_t likewise + uint16 uint16_t likewise + uint32 uint32_t likewise + uint64 uint64_t likewise + size uint64_t like uint64_t, except StringInputVisitor + accepts size suffixes + bool bool JSON true or false === Includes ===