qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Federico Simoncelli <fsimonce@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel_case
Date: Fri, 16 Mar 2012 16:16:48 -0300	[thread overview]
Message-ID: <20120316161648.22bb81d8@doriath.home> (raw)
In-Reply-To: <1331826359-13398-1-git-send-email-fsimonce@redhat.com>

On Thu, 15 Mar 2012 15:45:59 +0000
Federico Simoncelli <fsimonce@redhat.com> wrote:

> This allows qapi commands and types with dots (downstream QMP extensions
> containing fully qualified domain names).
> 
> Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
> ---
>  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

  reply	other threads:[~2012-03-16 19:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15 13:53 [Qemu-devel] [PATCH] qapi: escaping the dots in c_var Federico Simoncelli
2012-03-15 14:51 ` Michael Roth
2012-03-15 15:03   ` Luiz Capitulino
2012-03-15 15:42     ` Michael Roth
2012-03-15 15:45 ` [Qemu-devel] [PATCH v2] qapi: escaping dots in c_var and in de_camel_case Federico Simoncelli
2012-03-16 19:16   ` Luiz Capitulino [this message]
2012-03-20 13:54     ` [Qemu-devel] [PATCH v3] qapi: add c_fun to escape function names Federico Simoncelli
2012-03-23 20:38       ` Luiz Capitulino
2012-03-26 20:07       ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120316161648.22bb81d8@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=fsimonce@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).