]> git.tdb.fi Git - gldbg.git/blob - source/glprint.funcs.t
5f703e1be510ff81272d0765d53530308930923c
[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 for p in params:
13         if not first:
14                 w(', ')
15         if p.kind=="value":
16                 w('%s', p.io[1])
17         elif p.kind=="reference" and not p.io:
18                 w('<ref:%s %%p>', p.type)
19         else:
20                 w('%%s')
21         first = False
22 w(')')
23 if ret.ctype!="void":
24         w(' = %s', ret.io[1])
25 w('"')
26 for p in params+[ret]:
27         if p.ctype!="void":
28                 if p.kind=="value":
29                         if len(p.io)>=3 and p.io[2]:
30                                 w(', %s(%s, "%s")', p.io[2], p.name, p.type)
31                         else:
32                                 w(', %s', p.name)
33                 elif p.kind=="reference" and not p.io:
34                         w(', %s', p.name)
35                 elif not p.csize:
36                         w(', print_data(%s, 0)', p.name)
37                 elif p.base_ctype=="GLvoid" or p.base_ctype=="void":
38                         w(', print_data(%s, %s)', p.name, p.csize)
39                 elif len(p.io)>=3 and p.io[2]:
40                         w(', print_array_described(%s, "%s", %s, sizeof(%s), %s)', p.io[2], p.type, p.name, p.base_ctype, p.csize)
41                 else:
42                         w(', print_array("%s", %s, sizeof(%s), %s)', p.io[1], p.name, p.base_ctype, p.csize)
43 wl(');')
44 wl('}')
45 :static void init_print(GlDecoder *dec)
46 :{
47 wl('    dec->%s = print_%s;', func.name, func.name)
48 :}