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

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