]> git.tdb.fi Git - gldbg.git/blob - source/glwrap.funcs.t
Print the contents of arrays and references
[gldbg.git] / source / glwrap.funcs.t
1 # $Id$
2 !handcode glGetError
3 !handcode glXGetProcAddress
4 !handcode glXGetProcAddressARB
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.kind=="array" and p.io and p.io[0]=="string":
23                 wl('  write_string_array(%s, %s);', p.name, p.csize)
24         elif p.csize:
25                 wl('    write_data(%s, %s);', p.name, p.csize)
26         else:
27                 wl('    write_pointer(%s);', p.name)
28 wl('    send_packet();')
29 if not func.name.startswith("glX"):
30         wl('    check_error();')
31 if ret.ctype!='void':
32         wl('    return ret;')
33 wl('}')