]> git.tdb.fi Git - gldbg.git/blobdiff - source/glprint.funcs.t
Unify array and reference print generation
[gldbg.git] / source / glprint.funcs.t
index d98f6e72102389bd6cac9a78a5fb79af8fdde7da..5f703e1be510ff81272d0765d53530308930923c 100644 (file)
@@ -14,12 +14,9 @@ for p in params:
                w(', ')
        if p.kind=="value":
                w('%s', p.io[1])
-       elif p.kind=="reference":
-               if p.io:
-                       w('{%s}', p.io[1])
-               else:
-                       w('<ref:%s %%p>', p.type)
-       elif p.kind=="array":
+       elif p.kind=="reference" and not p.io:
+               w('<ref:%s %%p>', p.type)
+       else:
                w('%%s')
        first = False
 w(')')
@@ -30,25 +27,19 @@ for p in params+[ret]:
        if p.ctype!="void":
                if p.kind=="value":
                        if len(p.io)>=3 and p.io[2]:
-                               f = p.io[2].split(':')
-                               w(', %s(%s)', f[0], ", ".join(eval(x) for x in f[1:]))
-                       else:
-                               w(', %s', p.name)
-               elif p.kind=="reference":
-                       if p.io:
-                               w(', *%s', p.name)
+                               w(', %s(%s, "%s")', p.io[2], p.name, p.type)
                        else:
                                w(', %s', p.name)
-               elif p.kind=="array":
-                       if not p.csize:
-                               w(', print_data(%s, 0)', p.name)
-                       elif p.base_ctype=="GLvoid" or p.base_ctype=="void":
-                               w(', print_data(%s, %s)', p.name, p.csize)
-                       else:
-                               f = p.io[1]
-                               if len(p.io)>=3 and p.io[2]:
-                                       f = "%x"
-                               w(', print_array("%s", %s, sizeof(%s), %s)', f, p.name, p.base_ctype, p.csize)
+               elif p.kind=="reference" and not p.io:
+                       w(', %s', p.name)
+               elif not p.csize:
+                       w(', print_data(%s, 0)', p.name)
+               elif p.base_ctype=="GLvoid" or p.base_ctype=="void":
+                       w(', print_data(%s, %s)', p.name, p.csize)
+               elif len(p.io)>=3 and p.io[2]:
+                       w(', print_array_described(%s, "%s", %s, sizeof(%s), %s)', p.io[2], p.type, p.name, p.base_ctype, p.csize)
+               else:
+                       w(', print_array("%s", %s, sizeof(%s), %s)', p.io[1], p.name, p.base_ctype, p.csize)
 wl(');')
 wl('}')
 :static void init_print(GlDecoder *dec)