]> git.tdb.fi Git - gldbg.git/blob - source/glprint.funcs.t
Enhance the object-orientedness of genwrap.py
[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         else:
18                 w("%%p")
19         first = False
20 w(')')
21 if ret.ctype!="void":
22         w(' = %s', ret.io[1])
23 w('"')
24 for p in params+[ret]:
25         if p.ctype!="void":
26                 if p.io and len(p.io)>=3 and p.io[2]:
27                         f = p.io[2].split(':')
28                         w(', %s(%s)', f[0], ", ".join(eval(x) for x in f[1:]))
29                 else:
30                         w(', %s', p.name)
31 wl(');')
32 wl('}')
33 :static void init_print(GlDecoder *dec)
34 :{
35 wl('    dec->%s = print_%s;', func.name, func.name)
36 :}