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