[Xcb-commit] 3 commits - src xcbgen

Jeremy Kolb jkolb at brandeis.edu
Thu May 22 05:27:32 PDT 2008


On Wed, 2008-05-21 at 19:50 -0700, Eamon Walsh wrote:
> src/sync.xml    |    6 +++---
>  xcbgen/types.py |    4 +++-
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> New commits:
> commit 3e8dbef32e691150ca1c86a2bccfd4458ef16190
> Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
> Date:   Wed May 21 22:49:14 2008 -0400
> 
>     Avoid using enum types as structure fields.
> 
> diff --git a/src/sync.xml b/src/sync.xml
> index a60a81f..386d233 100644
> --- a/src/sync.xml
> +++ b/src/sync.xml
> @@ -55,9 +55,9 @@ for licensing information.
>  
>    <struct name="TRIGGER">
>      <field type="COUNTER" name="counter" />
> -    <field type="VALUETYPE" name="wait_type" />
> +    <field type="CARD32" name="wait_type" />
>      <field type="INT64" name="wait_value" />
> -    <field type="TESTTYPE" name="test_type" />
> +    <field type="CARD32" name="test_type" />
>    </struct>
>  
>    <struct name="WAITCONDITION">
> @@ -154,7 +154,7 @@ for licensing information.
>        <field type="TRIGGER" name="trigger" />
>        <field type="INT64" name="delta" />
>        <field type="BOOL" name="events" />
> -      <field type="ALARMSTATE" name="state" />
> +      <field type="CARD8" name="state" />
>      </reply>
>    </request>
>  
> commit 9ae5448fc231a008fa02eb704fd034de099cf2bb
> Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
> Date:   Wed May 21 22:25:50 2008 -0400
> 
>     Fix a type size calculation.
> 
> diff --git a/xcbgen/types.py b/xcbgen/types.py
> index ce2842f..d4b16e2 100644
> --- a/xcbgen/types.py
> +++ b/xcbgen/types.py
> @@ -318,7 +318,7 @@ class ComplexType(Type):
>              if not m.wire:
>                  continue
>              if m.type.fixed_size():
> -                self.size = self.size + m.type.size
> +                self.size = self.size + (m.type.size * m.type.nmemb)
>              else:
>                  self.size = None
>                  break
> commit 0212c5ea88f4387a1a200ef80b2e844d01ace470
> Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
> Date:   Fri May 16 14:53:49 2008 -0400
> 
>     Add is_simple boolean attribute for plain integer types.
> 
> diff --git a/xcbgen/types.py b/xcbgen/types.py
> index a84420f..ce2842f 100644
> --- a/xcbgen/types.py
> +++ b/xcbgen/types.py
> @@ -25,6 +25,7 @@ class Type(object):
>          self.resolved = False
>  
>          # Screw isinstance().
> +        self.is_simple = False
>          self.is_list = False
>          self.is_expr = False
>          self.is_container = False
> @@ -82,6 +83,7 @@ class SimpleType(Type):
>      '''
>      def __init__(self, name, size):
>          Type.__init__(self, name)
> +        self.is_simple = True
>          self.size = size
>          self.nmemb = 1
>  
> _______________________________________________
> xcb-commit mailing list
> xcb-commit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb-commit

Wouldn't it be better to use enum fields?  That way other language
bindings can do cool things while the c bindings use the appropriate
CARD.  It would also make documentation clearer.

Jeremy



More information about the xcb-commit mailing list