From patchwork Wed Oct 31 22:35:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 196054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1A5822C0223 for ; Thu, 1 Nov 2012 10:27:03 +1100 (EST) Received: from localhost ([::1]:48830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTgup-0002ds-Ew for incoming@patchwork.ozlabs.org; Wed, 31 Oct 2012 18:37:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTgtv-0000cO-Rb for qemu-devel@nongnu.org; Wed, 31 Oct 2012 18:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTgtu-0005n8-No for qemu-devel@nongnu.org; Wed, 31 Oct 2012 18:36:43 -0400 Received: from mail-ie0-f173.google.com ([209.85.223.173]:33189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTgtu-0005k6-JV for qemu-devel@nongnu.org; Wed, 31 Oct 2012 18:36:42 -0400 Received: by mail-ie0-f173.google.com with SMTP id 17so2893446iea.4 for ; Wed, 31 Oct 2012 15:36:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=hH/BLrsI6cKSlf+e5LC97OydFAZz7MC7SidUW4TT4g0=; b=wSb2j3+V0TgQaXXT76+GnpoCQ34fWWBb9YfDBilGYXGZKdR+5BUdidkpE/Is5d8E6F pinm48cUOZguxI21uKtmDJBB868R31Neicyohp1J7Xh3UNI/KXExUY+2zO3b+8m3drAm xZ9TzfuExCg56GfWmx9rm/ZEEpCMpXpJpHMzqHjBLCRnTjTN2tsBrLrwON/DVDvZoKIN E3wlKzffUoZQYjjWImvzZBexVsIZx/m9NvqrU2Pc7D060jNT9Bi9NjbQmK/e7YkUWNC3 rG1BRxTW2T/RytA611flkhX4azRqssgRwTqrDfSjq38VgBSw7rYrO8DaHpQoollSe4JC 3Gmw== Received: by 10.50.217.200 with SMTP id pa8mr3105483igc.26.1351723002334; Wed, 31 Oct 2012 15:36:42 -0700 (PDT) Received: from loki.morrigu.org (cpe-72-179-62-111.austin.res.rr.com. [72.179.62.111]) by mx.google.com with ESMTPS id hg2sm11556858igc.3.2012.10.31.15.36.41 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 31 Oct 2012 15:36:41 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 31 Oct 2012 17:35:52 -0500 Message-Id: <1351722972-17801-9-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1351722972-17801-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1351722972-17801-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.173 Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, blauwirbel@gmail.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH 08/28] qapi: qapi_visit.py, support for q_string annotations 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 Signed-off-by: Michael Roth --- scripts/qapi_visit.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/qapi_visit.py b/scripts/qapi_visit.py index c531a5a..b3c6bfe 100644 --- a/scripts/qapi_visit.py +++ b/scripts/qapi_visit.py @@ -18,6 +18,14 @@ import getopt import errno import types +def generate_visit_carray_as_string(name, info): + return mcgen(''' +char *%(name)s_ptr = (char *)&(*obj)->%(name)s; +visit_type_str(m, &%(name)s_ptr, "%(name)s", errp); +''', + name=name) + + def generate_visit_carray_body(name, info): if info['array_size'][0].isdigit(): array_size = info['array_size'] @@ -144,7 +152,10 @@ if (obj && (*obj)->%(prefix)shas_%(c_name)s) { else: if annotated: if isinstance(argentry['type'], types.ListType): - ret += generate_visit_carray_body(argname, argentry) + if argentry.has_key('is_string') and argentry['is_string'] == 'true': + ret += generate_visit_carray_as_string(argname, argentry) + else: + ret += generate_visit_carray_body(argname, argentry) elif argentry.has_key('embedded') and argentry['embedded'] == 'true': tmp_ptr_name = "%s_%s_ptr" % (c_var(field_prefix).replace(".", ""), c_var(argname)) ret += mcgen('''