From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8cdt-0005dp-Me for qemu-devel@nongnu.org; Fri, 16 Mar 2012 15:16:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8cds-0000yL-1n for qemu-devel@nongnu.org; Fri, 16 Mar 2012 15:16:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8cdr-0000yG-Pu for qemu-devel@nongnu.org; Fri, 16 Mar 2012 15:16:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2GJGjcM029505 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 16 Mar 2012 15:16:45 -0400 Date: Fri, 16 Mar 2012 16:16:48 -0300 From: Luiz Capitulino Message-ID: <20120316161648.22bb81d8@doriath.home> In-Reply-To: <1331826359-13398-1-git-send-email-fsimonce@redhat.com> References: <1331819618-12481-1-git-send-email-fsimonce@redhat.com> <1331826359-13398-1-git-send-email-fsimonce@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel_case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Federico Simoncelli Cc: pbonzini@redhat.com, qemu-devel@nongnu.org On Thu, 15 Mar 2012 15:45:59 +0000 Federico Simoncelli wrote: > This allows qapi commands and types with dots (downstream QMP extensions > containing fully qualified domain names). > > Signed-off-by: Federico Simoncelli > --- > scripts/qapi.py | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 6e05469..b1173bf 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -111,7 +111,7 @@ def de_camel_case(name): > for ch in name: > if ch.isupper() and new_name: > new_name += '_' > - if ch == '-': > + if ch == '-' or ch == '.': > new_name += '_' > else: > new_name += ch.lower() > @@ -131,7 +131,7 @@ def camel_case(name): > return new_name > > def c_var(name): > - return '_'.join(name.split('-')).lstrip("*") > + return name.replace('-', '_').replace('.', '_').lstrip('*') This changes a struct member access from 'foo.bar' to 'foo_bar' in the generated qapi-visit.c. Please, test build your patches against master before posting. > > def c_list_type(name): > return '%sList' % name