]> git.tdb.fi Git - gldbg.git/blob - source/glwrap.funcs.t
Enhance the object-orientedness of genwrap.py
[gldbg.git] / source / glwrap.funcs.t
1 # $Id$
2 wl('%s APIENTRY %s(%s)', ret.ctype, func.name, ", ".join([p.ctype+" "+p.name for p in params]))
3 wl('{')
4 wl('    static %s (*orig)(%s);', ret.ctype, ", ".join([p.ctype for p in params]))
5 if ret.ctype!='void':
6         wl('    %s ret;', ret.ctype)
7 wl('    if(!orig)')
8 wl('            orig = glsym("%s");', func.name)
9 w('     ')
10 if ret.ctype!='void':
11         w('ret = ')
12 wl('orig(%s);', ", ".join([p.name for p in params]))
13 wl('    begin_packet(FUNC_%s);', func.name.upper())
14 if ret.ctype!='void':
15         wl('    write_%s(ret);', ret.io[0])
16 for p in params:
17         if p.kind=="value":
18                 wl('    write_%s(%s);', p.io[0], p.name)
19         elif p.csize:
20                 wl('    write_data(%s, %s);', p.name, p.csize)
21         else:
22                 wl('    write_pointer(%s);', p.name)
23 wl('    send_packet();')
24 if ret.ctype!='void':
25         wl('    return ret;')
26 wl('}')