]> git.tdb.fi Git - gldbg.git/blob - source/glprint.funcs.t
Describe some texture parameters when printing
[gldbg.git] / source / glprint.funcs.t
1 # $Id$
2 w('static void print_%s(void *user_data', func.name)
3 if ret.ctype!="void":
4         w(', %s ret', ret.ctype)
5 for p in params:
6         w(', %s %s', p.ctype, p.name)
7 wl(')')
8 wl('{')
9 wl('    GlPrintData *gpd = (GlPrintData *)user_data;')
10 w('     snprintf(gpd->buffer, gpd->bufsize, "%s(', func.name)
11 first = True
12 pname = None
13 for p in params:
14         if not first:
15                 w(', ')
16         if p.name=="pname":
17                 pname = p
18         if p.kind=="value":
19                 if pname and p.name=="param" and p.base_ctype=="GLint":
20                         w('%%s')
21                 elif p.type=="TextureComponentCount":
22                         w('%%s')
23                 else:
24                         w('%s', p.io[1])
25         elif p.kind=="reference" and not p.io:
26                 w('<ref:%s %%p>', p.type)
27         else:
28                 w('%%s')
29         first = False
30 w(')')
31 if ret.ctype!="void":
32         w(' = %s', ret.io[1])
33 w('"')
34 for p in params+[ret]:
35         if p.ctype!="void":
36                 if p.kind=="value":
37                         if pname and p.name=="param" and p.base_ctype=="GLint":
38                                 w(', print_parameter(%s, %s)', pname.name, p.name)
39                         elif p.type=="TextureComponentCount":
40                                 w(', print_internal_format(%s)', p.name)
41                         elif len(p.io)>=3 and p.io[2]:
42                                 w(', %s(%s, "%s")', p.io[2], p.name, p.type)
43                         else:
44                                 w(', %s', p.name)
45                 elif p.kind=="reference" and not p.io:
46                         w(', %s', p.name)
47                 elif not p.csize:
48                         w(', print_data(%s, 0)', p.name)
49                 elif p.base_ctype=="GLvoid" or p.base_ctype=="void":
50                         w(', print_data(%s, %s)', p.name, p.csize)
51                 elif len(p.io)>=3 and p.io[2]:
52                         w(', print_array_described(%s, "%s", %s, sizeof(%s), %s)', p.io[2], p.type, p.name, p.base_ctype, p.csize)
53                 else:
54                         w(', print_array("%s", %s, sizeof(%s), %s)', p.io[1], p.name, p.base_ctype, p.csize)
55 wl(');')
56 wl('}')
57 :static void init_print(GlDecoder *dec)
58 :{
59 wl('    dec->%s = print_%s;', func.name, func.name)
60 :}