]> git.tdb.fi Git - gldbg.git/blob - source/glwrap.funcs.t
eb77b0a7a3e0e5ce15e19101bffcb18ad73e8928
[gldbg.git] / source / glwrap.funcs.t
1 # $Id$
2 !handcode glBegin
3 !handcode glEnd
4 !handcode glGetError
5 !handcode glXGetProcAddress
6 !handcode glXGetProcAddressARB
7 wl('%s APIENTRY %s(%s)', ret.ctype, func.name, ", ".join([p.ctype+" "+p.name for p in params]))
8 wl('{')
9 wl('    static %s (*orig)(%s);', ret.ctype, ", ".join([p.ctype for p in params]))
10 if ret.ctype!='void':
11         wl('    %s ret;', ret.ctype)
12 wl('    if(!orig)')
13 wl('            orig = glsym("%s");', func.name)
14 w('     ')
15 if ret.ctype!='void':
16         w('ret = ')
17 wl('orig(%s);', ", ".join([p.name for p in params]))
18 wl('    begin_packet(FUNC_%s);', func.name.upper())
19 if ret.ctype!='void':
20         wl('    write_%s(ret);', ret.io[0].replace(' ', '_'))
21 for p in params:
22         if p.kind=="value":
23                 wl('    write_%s(%s);', p.io[0].replace(' ', '_'), p.name)
24         elif p.kind=="array" and p.io and p.io[0]=="string":
25                 wl('  write_string_array(%s, %s);', p.name, p.csize)
26         elif p.csize:
27                 wl('    write_data(%s, %s);', p.name, p.csize)
28         else:
29                 wl('    write_pointer(%s);', p.name)
30 wl('    send_packet();')
31 if not func.name.startswith("glX"):
32         wl('    check_error();')
33 if ret.ctype!='void':
34         wl('    return ret;')
35 wl('}')