Treat XIDs the same as other cardinal values.
authorPeter Harris <peter.harris@hummingbird.com>
Wed, 12 Nov 2008 19:45:04 +0000 (14:45 -0500)
committerPeter Harris <peter.harris@hummingbird.com>
Wed, 19 Nov 2008 16:06:01 +0000 (11:06 -0500)
This fixes a bug where c_client.py wasn't generating *_end functions,
but expected them to exist in order to find the subsequent list's start.

Signed-off-by: Peter Harris <peter.harris@hummingbird.com>
src/c_client.py

index 99fe114..73bd064 100755 (executable)
@@ -17,18 +17,6 @@ _cplusplus_annoyances = {'class' : '_class',
                          'new'   : '_new',
                          'delete': '_delete'}
 
-_cardinal_types = ['CARD8', 'uint8_t',
-                   'CARD16','uint16_t',
-                   'CARD32','uint32_t',
-                   'INT8', 'int8_t',
-                   'INT16', 'int16_t',
-                   'INT32', 'int32_t',
-                   'BYTE',
-                   'BOOL',
-                   'char',
-                   'void',
-                   'float',
-                   'double']
 _hlines = []
 _hlevel = 0
 _clines = []
@@ -319,7 +307,7 @@ def _c_iterator_get_end(field, accum):
         return _c_iterator_get_end(field.type.last_varsized_field, accum)
     if field.type.is_list:
         # XXX we can always use the first way
-        if field.type.c_type in _cardinal_types:
+        if field.type.member.is_simple:
             return field.c_end_name + '(' + accum + ')'
         else:
             return field.type.member.c_end_name + '(' + field.c_iterator_name + '(' + accum + '))'
@@ -455,7 +443,7 @@ def _c_accessors_field(self, field):
     '''
     Declares the accessor functions for a non-list field that follows a variable-length field.
     '''
-    if field.field_type[0] in _cardinal_types:
+    if field.type.is_simple:
         _hc('')
         _hc('')
         _hc('/*****************************************************************************')
@@ -547,7 +535,7 @@ def _c_accessors_list(self, field):
     _c('    return %s;', _c_accessor_get_expr(field.type.expr, 'R'))
     _c('}')
 
-    if field.field_type[0] in _cardinal_types:
+    if field.type.member.is_simple:
         _hc('')
         _hc('')
         _hc('/*****************************************************************************')