3 # Create threads safe wrappers around X11 calls.
5 # Copyright 1998 Kristian Nielsen.
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # FIXME: This does not do full C prototype parsing, but relies on
22 # knowledge on how the X11 include files are formatted. It will
23 # probably need to be modified for new include files. It also fails
24 # for certain prototypes (notably those with function pointer
25 # arguments or results), so these must be added manually. And it
26 # relies on a fixed location of X11 includes (/usr/X11R6/include/).
28 # This program expects to be run from Wine's main directory.
30 $X11_include_dir = "/usr/X11/include";
32 $wantfile = "$outdir/X11_calls";
33 @dolist = ("Xlib", "Xresource", "Xutil", "XShm", "xf86dga", "xf86dga2", "xf86vmode", "shape", "xvideo", "Xrender");
35 # First read list of wanted function names.
37 open(WANT
, $wantfile) || die "open";
39 next if /^\s*\#/; # Skip comment lines.
40 next if /^\s*$/; # Skip empty lines.
41 if(/^\s*([a-zA-Z0-9_]+)\s*$/) {
44 die "syntax error in file '$wantfile', in line '$_'";
49 foreach $name (@dolist) {
54 $outfile = "/ts_$lcname";
55 open(OUTC
, ">$outdir/$outfile.c") || die "open";
56 open(OUTH
, ">include/$outfile.h") || die "open";
63 if($name eq "Xutil" || $name eq "Xresource" || $name eq "XShm") {
64 $x11_incl = "#include <X11/Xlib.h>\n";
65 # For Xutil, we need X11/Xresource.h for XUniqueContext().
66 $x11_incl .= "#include <X11/Xresource.h>\n" if $name eq "Xutil";
68 if($name eq "xf86dga") {
69 $x11_incl = "#include <X11/Xlib.h>\n";
70 $extensions_dir = "extensions/";
71 $pre_file = "#ifdef HAVE_LIBXXF86DGA\n";
72 $post_file = "#endif /* defined(HAVE_LIBXXF86DGA) */\n";
74 if($name eq "xf86dga2") {
75 $x11_incl = "#include <X11/Xlib.h>\n";
76 $extensions_dir = "extensions/";
77 $pre_file = "#ifdef HAVE_LIBXXF86DGA2\n";
78 $post_file = "#endif /* defined(HAVE_LIBXXF86DGA2) */\n";
79 $inc_name = "xf86dga";
82 $extensions_dir = "extensions/";
83 $pre_file = "#ifdef HAVE_LIBXXSHM\n";
84 $post_file = "#endif /* defined(HAVE_LIBXXSHM) */\n";
86 if($name eq "xf86vmode") {
87 $x11_incl = "#include <X11/Xlib.h>\n";
88 $extensions_dir = "extensions/";
89 $pre_file = "#include \"windef.h\"\n#ifdef HAVE_LIBXXF86VM\n#define XMD_H\n#include \"basetsd.h\"\n";
90 $post_file = "#endif /* defined(HAVE_LIBXXF86VM) */\n";
92 if($name eq "shape") {
93 $extensions_dir = "extensions/";
94 $pre_file = "#ifdef HAVE_LIBXSHAPE\n#include <X11/IntrinsicP.h>\n";
95 $post_file = "#endif /* defined(HAVE_LIBXSHAPE) */\n";
98 if($name eq "xvideo") {
99 $x11_incl = "#include <X11/Xlib.h>\n#include <X11/extensions/Xv.h>\n#include <X11/extensions/XShm.h>\n";
100 $extensions_dir = "extensions/";
101 $pre_file = "#ifdef HAVE_XVIDEO\n";
102 $post_file = "#endif /* defined(HAVE_XVIDEO) */\n";
105 if($name eq "Xrender") {
106 $x11_incl = "#include <X11/Xlib.h>\n";
107 $extensions_dir = "extensions/";
108 $pre_file = "#ifdef HAVE_LIBXRENDER\n";
109 $post_file = "#endif /* defined(HAVE_LIBXRENDER) */\n";
115 * Thread safe wrappers around $name calls.
116 * Always include this file instead of <X11/$name.h>.
117 * This file was generated automatically by tools/make_X11wrappers
121 #ifndef __WINE_TS_$ucname\_H
122 #define __WINE_TS_$ucname\_H
124 #ifndef __WINE_CONFIG_H
125 # error You must include config.h to use this header
129 $x11_incl#include <X11/$extensions_dir$inc_name.h>
131 extern void (*wine_tsx11_lock)(void);
132 extern void (*wine_tsx11_unlock)(void);
138 * Thread safe wrappers around $name calls.
139 * This file was generated automatically by tools/make_X11wrappers
146 $x11_incl#include <X11/$extensions_dir$inc_name.h>
148 #include "ts_$lcname.h"
152 if ($name eq "XShm") {
153 output_fn
("XShmQueryExtension", "Bool",
154 "Display *", "Display *a0", "a0");
155 output_fn
("XShmQueryVersion", "Bool",
156 "Display *, int *, int *, Bool *",
157 "Display *a0, int *a1, int *a2, Bool *a3", "a0, a1, a2, a3");
158 output_fn
("XShmPixmapFormat", "int",
159 "Display *", "Display *a0", "a0");
160 output_fn
("XShmAttach", Status
,
161 "Display *, XShmSegmentInfo *",
162 "Display *a0, XShmSegmentInfo *a1", "a0, a1");
163 output_fn
("XShmDetach", Status
,
164 "Display *, XShmSegmentInfo *",
165 "Display *a0, XShmSegmentInfo *a1", "a0, a1");
166 output_fn
("XShmPutImage", Status
,
167 "Display *, Drawable, GC, XImage *, int, int, int, int, unsigned int, unsigned int, Bool",
168 "Display *a0, Drawable a1, GC a2, XImage *a3, int a4, int a5, int a6, int a7, unsigned int a8, unsigned int a9, Bool a10", "a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10");
169 output_fn
("XShmGetImage", Status
,
170 "Display *, Drawable, XImage *, int, int, unsigned long",
171 "Display *a0, Drawable a1, XImage *a2, int a3, int a4, unsigned long a5",
172 "a0, a1, a2, a3, a4, a5");
173 output_fn
("XShmCreateImage", "XImage *",
174 "Display *, Visual *, unsigned int, int, char *, XShmSegmentInfo *, unsigned int, unsigned int",
175 "Display *a0, Visual *a1, unsigned int a2, int a3, char *a4, XShmSegmentInfo *a5, unsigned int a6, unsigned int a7",
176 "a0, a1, a2, a3, a4, a5, a6, a7");
177 output_fn
("XShmCreatePixmap", "Pixmap",
178 "Display *, Drawable, char *, XShmSegmentInfo *, unsigned int, unsigned int, unsigned int",
179 "Display *a0, Drawable a1, char *a2, XShmSegmentInfo *a3, unsigned int a4, unsigned int a5, unsigned int a6",
180 "a0, a1, a2, a3, a4, a5, a6");
181 } elsif($name eq "xf86dga") {
182 output_fn
("XF86DGAQueryVersion",Bool
,
183 "Display*,int*,int*",
184 "Display*a0,int*a1,int*a2",
187 output_fn
("XF86DGAQueryExtension",Bool
,
188 "Display*,int*,int*",
189 "Display*a0,int*a1,int*a2",
192 output_fn
("XF86DGAGetVideo",Status
,
193 "Display*,int,char**,int*,int*,int*",
194 "Display*a0,int a1,char**a2,int*a3,int*a4,int*a5",
197 output_fn
("XF86DGADirectVideo",Status
,
199 "Display*a0,int a1,int a2",
202 output_fn
("XF86DGAGetViewPortSize",Status
,
203 "Display*,int,int*,int*",
204 "Display*a0,int a1,int *a2,int *a3",
207 output_fn
("XF86DGASetViewPort",Status
,
208 "Display*,int,int,int",
209 "Display*a0,int a1,int a2,int a3",
212 output_fn
("XF86DGAInstallColormap",Status
,
213 "Display*,int,Colormap",
214 "Display*a0,int a1,Colormap a2",
217 output_fn
("XF86DGAQueryDirectVideo",Status
,
219 "Display*a0,int a1,int *a2",
222 output_fn
("XF86DGAViewPortChanged",Status
,
224 "Display*a0,int a1,int a2",
227 } elsif($name eq "xf86dga2") {
228 output_fn_short
("Bool", "XDGAQueryVersion", "Display*" ,"int*","int*");
229 output_fn_short
("Bool", "XDGAQueryExtension", "Display*" ,"int*","int*");
230 output_fn_short
("XDGAMode*", "XDGAQueryModes", "Display*" ,"int", "int*");
231 output_fn_short
("XDGADevice*", "XDGASetMode", "Display*" ,"int","int");
232 output_fn_short
("Bool", "XDGAOpenFramebuffer", "Display*" ,"int");
233 output_fn_short
("void", "XDGACloseFramebuffer", "Display*" ,"int");
234 output_fn_short
("void", "XDGASetViewport", "Display*" ,"int", "int", "int", "int");
235 output_fn_short
("void", "XDGAInstallColormap", "Display*" , "int", "Colormap");
236 output_fn_short
("Colormap", "XDGACreateColormap", "Display*" ,"int", "XDGADevice*", "int");
237 output_fn_short
("void", "XDGASelectInput", "Display*" ,"int", "long");
238 output_fn_short
("void", "XDGAFillRectangle", "Display*" ,"int", "int", "int", "unsigned int", "unsigned int", "unsigned long");
239 output_fn_short
("void", "XDGACopyArea", "Display*" ,"int", "int", "int", "unsigned int", "unsigned int", "int", "int");
240 output_fn_short
("void", "XDGACopyTransparentArea", "Display*" ,"int", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned long");
241 output_fn_short
("int", "XDGAGetViewportStatus", "Display*" ,"int");
242 output_fn_short
("void", "XDGASync", "Display*" ,"int");
243 output_fn_short
("Bool", "XDGASetClientVersion", "Display*");
244 output_fn_short
("void", "XDGAChangePixmapMode", "Display*" ,"int", "int*", "int*", "int");
245 output_fn_short
("void", "XDGAKeyEventToXKeyEvent", "XDGAKeyEvent*" ,"XKeyEvent*");
246 } elsif ($name eq "xvideo") {
247 output_fn_short
("int", "XvQueryExtension", "Display*", "unsigned int*", "unsigned int*", "unsigned int*", "unsigned int*", "unsigned int*");
248 output_fn_short
("int", "XvQueryAdaptors", "Display*", "Window", "unsigned int*", "XvAdaptorInfo**");
249 output_fn_short
("int", "XvQueryEncodings", "Display*", "XvPortID", "unsigned int*", "XvEncodingInfo**");
250 output_fn_short
("int", "XvPutVideo", "Display*", "XvPortID", "Drawable", "GC", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned int", "unsigned int");
251 output_fn_short
("int", "XvPutStill", "Display*", "XvPortID", "Drawable", "GC", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned int", "unsigned int");
252 output_fn_short
("int", "XvGetVideo", "Display*", "XvPortID", "Drawable", "GC", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned int", "unsigned int");
253 output_fn_short
("int", "XvGetStill", "Display*", "XvPortID", "Drawable", "GC", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned int", "unsigned int");
254 output_fn_short
("int", "XvStopVideo", "Display*", "XvPortID", "Drawable");
255 output_fn_short
("int", "XvGrabPort", "Display*", "XvPortID", "Time");
256 output_fn_short
("int", "XvUngrabPort", "Display*", "XvPortID", "Time");
257 output_fn_short
("int", "XvSelectVideoNotify", "Display*", "Drawable", "Bool");
258 output_fn_short
("int", "XvSelectPortNotify", "Display*", "XvPortID", "Bool");
259 output_fn_short
("int", "XvSetPortAttribute", "Display*", "XvPortID", "Atom", "int");
260 output_fn_short
("int", "XvGetPortAttribute", "Display*", "XvPortID", "Atom", "int*");
261 output_fn_short
("int", "XvQueryBestSize", "Display*", "XvPortID", "Bool", "unsigned int", "unsigned int", "unsigned int", "unsigned int", "unsigned int*", "unsigned int*");
262 output_fn_short
("XvAttribute*", "XvQueryPortAttributes", "Display*", "XvPortID", "int*");
263 output_fn_short
("void", "XvFreeAdaptorInfo", "XvAdaptorInfo*");
264 output_fn_short
("void", "XvFreeEncodingInfo", "XvEncodingInfo*");
265 output_fn_short
("XvImageFormatValues *", "XvListImageFormats", "Display*", "XvPortID", "int*");
266 output_fn_short
("XvImage *", "XvCreateImage", "Display*", "XvPortID", "int", "char*", "int", "int");
267 output_fn_short
("int", "XvPutImage", "Display*", "XvPortID", "Drawable", "GC", "XvImage*", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned int", "unsigned int");
268 output_fn_short
("int", "XvShmPutImage", "Display*", "XvPortID", "Drawable", "GC", "XvImage*", "int", "int", "unsigned int", "unsigned int", "int", "int", "unsigned int", "unsigned int", "Bool");
269 output_fn_short
("XvImage *", "XvShmCreateImage", "Display*", "XvPortID", "int", "char*", "int", "int", "XShmSegmentInfo*");
270 } elsif($name eq "xf86vmode") {
271 output_fn
("XF86VidModeQueryVersion",Bool
,
272 "Display*,int*,int*",
273 "Display*a0,int*a1,int*a2",
276 output_fn
("XF86VidModeQueryExtension",Bool
,
277 "Display*,int*,int*",
278 "Display*a0,int*a1,int*a2",
281 output_fn
("XF86VidModeGetModeLine",Bool
,
282 "Display*,int,int*,XF86VidModeModeLine*",
283 "Display*a0,int a1,int*a2,XF86VidModeModeLine*a3",
286 output_fn
("XF86VidModeGetAllModeLines",Bool
,
287 "Display*,int,int*,XF86VidModeModeInfo***",
288 "Display*a0,int a1,int*a2,XF86VidModeModeInfo***a3",
291 output_fn
("XF86VidModeAddModeLine",Bool
,
292 "Display*,int,XF86VidModeModeInfo*,XF86VidModeModeInfo*",
293 "Display*a0,int a1,XF86VidModeModeInfo*a2,XF86VidModeModeInfo*a3",
296 output_fn
("XF86VidModeDeleteModeLine",Bool
,
297 "Display*,int,XF86VidModeModeInfo*",
298 "Display*a0,int a1,XF86VidModeModeInfo*a2",
301 output_fn
("XF86VidModeModModeLine",Bool
,
302 "Display*,int,XF86VidModeModeLine*",
303 "Display*a0,int a1,XF86VidModeModeLine*a2",
306 output_fn
("XF86VidModeValidateModeLine",Status
,
307 "Display*,int,XF86VidModeModeInfo*",
308 "Display*a0,int a1,XF86VidModeModeInfo*a2",
311 output_fn
("XF86VidModeSwitchMode",Bool
,
313 "Display*a0,int a1,int a2",
316 output_fn
("XF86VidModeSwitchToMode",Bool
,
317 "Display*,int,XF86VidModeModeInfo*",
318 "Display*a0,int a1,XF86VidModeModeInfo*a2",
321 output_fn
("XF86VidModeLockModeSwitch",Bool
,
323 "Display*a0,int a1,int a2",
326 output_fn
("XF86VidModeGetMonitor",Bool
,
327 "Display*,int,XF86VidModeMonitor*",
328 "Display*a0,int a1,XF86VidModeMonitor*a2",
331 output_fn
("XF86VidModeGetViewPort",Bool
,
332 "Display*,int,int*,int*",
333 "Display*a0,int a1,int*a2,int*a3",
336 output_fn
("XF86VidModeSetViewPort",Bool
,
337 "Display*,int,int,int",
338 "Display*a0,int a1,int a2,int a3",
341 } elsif($name eq "Xrender") {
342 output_fn
("XRenderAddGlyphs","void",
343 "Display*,GlyphSet,Glyph*,XGlyphInfo*,int,char*,int",
344 "Display*a0,GlyphSet a1,Glyph*a2,XGlyphInfo*a3,int a4,char*a5,int a6",
345 "a0,a1,a2,a3,a4,a5,a6"
347 output_fn
("XRenderCompositeString8","void",
348 "Display*,int,Picture,Picture,XRenderPictFormat*,GlyphSet,int,int,int,int,char*,int",
349 "Display*a0,int a1,Picture a2,Picture a3,XRenderPictFormat*a4,GlyphSet a5,int a6,int a7,int a8,int a9,char*a10,int a11",
350 "a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11"
352 output_fn
("XRenderCompositeString16","void",
353 "Display*,int,Picture,Picture,XRenderPictFormat*,GlyphSet,int,int,int,int,unsigned short*,int",
354 "Display*a0,int a1,Picture a2,Picture a3,XRenderPictFormat*a4,GlyphSet a5,int a6,int a7,int a8,int a9,unsigned short*a10,int a11",
355 "a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11"
357 output_fn
("XRenderCompositeString32","void",
358 "Display*,int,Picture,Picture,XRenderPictFormat*,GlyphSet,int,int,int,int,unsigned int*,int",
359 "Display*a0,int a1,Picture a2,Picture a3,XRenderPictFormat*a4,GlyphSet a5,int a6,int a7,int a8,int a9,unsigned int*a10,int a11",
360 "a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11"
362 output_fn
("XRenderCreateGlyphSet",GlyphSet
,
363 "Display*,XRenderPictFormat*",
364 "Display*a0,XRenderPictFormat*a1",
367 output_fn
("XRenderCreatePicture",Picture
,
368 "Display*,Drawable,XRenderPictFormat*,unsigned long,XRenderPictureAttributes*",
369 "Display*a0,Drawable a1,XRenderPictFormat*a2,unsigned long a3,XRenderPictureAttributes*a4",
372 output_fn
("XRenderFillRectangle","void",
373 "Display*,int,Picture,XRenderColor*,int,int,unsigned int, unsigned int",
374 "Display*a0,int a1,Picture a2,XRenderColor*a3,int a4,int a5,unsigned int a6,unsigned int a7",
375 "a0,a1,a2,a3,a4,a5,a6,a7"
377 output_fn
("XRenderFindFormat","XRenderPictFormat*",
378 "Display*,unsigned long,XRenderPictFormat*,int",
379 "Display*a0,unsigned long a1,XRenderPictFormat*a2,int a3",
382 output_fn
("XRenderFindVisualFormat","XRenderPictFormat*",
384 "Display*a0,Visual*a1",
387 output_fn
("XRenderFreeGlyphSet","void",
389 "Display*a0,GlyphSet a1",
392 output_fn
("XRenderFreePicture","void",
394 "Display*a0,Picture a1",
397 output_fn
("XRenderSetPictureClipRectangles","void",
398 "Display*,Picture,int,int,XRectangle*,int",
399 "Display*a0,Picture a1,int a2,int a3,XRectangle* a4,int a5",
402 output_fn
("XRenderQueryExtension",Bool
,
403 "Display*,int*,int*",
404 "Display*a0,int*a1,int*a2",
410 "echo \"$x11_incl#include <X11/$extensions_dir$name.h>\" | " .
411 "gcc -L$X11_include_dir -DNeedFunctionPrototypes -E - | " .
412 "grep -v '^[ \t]*\$)' |"
416 if(m
'extern\s+([^()]*)\b([a-zA-Z0-9_]+)\s*\(') {
419 $result_type = "int" if $result_type =~ /^\s*$/;
423 # Give up on vararg functions and function pointer args.
424 if(m
'\.\.\.|\(\*\)') {
428 if(m
'\s*([^,]*[^, \t])\s*(,?\n)') {
429 $args[$#args+1] = $1;
430 if ($1 =~ /char\s*\[/) { # small hack for XQueryKeymap
431 $args[$#args] = "char*";
435 # Skip if vararg, function pointer arg, or not needed.
436 next unless $fn_name;
437 next unless $want{$fn_name} && $want{$fn_name} == 1;
439 # Special case for no arguments (which is specified as "void").
440 if($#args == 0 && $args[0] eq "void") {
446 for($i = 0; $i <= $#args; $i++) {
447 $comma = $i < $#args ?
", " : "";
448 $proto .= "$args[$i]$comma";
449 $formals .= "$args[$i] a$i$comma";
450 $actuals .= "a$i$comma";
452 $proto = $formals = "void" if $#args == -1;
453 output_fn
($fn_name, $result_type, $proto, $formals, $actuals);
458 if($name eq "Xlib") {
459 raw_output_fn
("XSynchronize", "int (*r)(Display *)",
460 "int (*TSXSynchronize(Display *, Bool))(Display *)",
461 "int (*TSXSynchronize(Display *a0, Bool a1))(Display *)",
463 print OUTC
"\nextern void _XInitImageFuncPtrs(XImage *);\n";
464 output_fn
("_XInitImageFuncPtrs", "void", "XImage *", "XImage *a0", "a0");
465 } elsif($name eq "Xutil") {
466 output_fn
("XDestroyImage", "int",
467 "struct _XImage *", "struct _XImage *a0", "a0");
468 output_fn
("XGetPixel", "unsigned long",
469 "struct _XImage *, int, int",
470 "struct _XImage *a0, int a1, int a2",
472 output_fn
("XPutPixel", "int",
473 "struct _XImage *, int, int, unsigned long",
474 "struct _XImage *a0, int a1, int a2, unsigned long a3",
476 output_fn
("XSubImage", "struct _XImage *",
477 "struct _XImage *, int, int, unsigned int, unsigned int",
478 "struct _XImage *a0, int a1, int a2, unsigned int a3, unsigned int a4",
479 "a0, a1, a2, a3, a4");
480 output_fn
("XAddPixel", "int",
481 "struct _XImage *, long",
482 "struct _XImage *a0, long a1", "a0, a1");
483 output_fn
("XUniqueContext", "XContext", "void", "void", "");
484 output_fn
("XDeleteContext", "int",
485 "Display*,XID,XContext",
486 "Display*a0,XID a1,XContext a2",
493 #endif /* __WINE_TS_$ucname\_H */
504 foreach $i (keys %want) {
506 print "Unresolved: $i\n";
513 # output_fn("main", "int", "int, char **", "int a0, char **a1", "a0, a1")
516 my ($fn_name, $result_type, $protos, $formals, $actuals) = @_;
518 return raw_output_fn
($fn_name,
519 $result_type =~ /^\s*void\s*$/ ?
"" : "$result_type r",
520 "$result_type TS$fn_name($protos)",
521 "$result_type TS$fn_name($formals)",
525 sub output_fn_short
{
527 # output_fn_sort("Bool", "XDGAQueryExtension", "Display *", "int *", "int *");
529 my ($result_type, $fn_name, @args) = @_;
531 my ($i, $proto, $formals, $actuals) = (0,
532 "$result_type TS$fn_name(",
533 "$result_type TS$fn_name(",
535 while ($val = shift @args) {
536 $proto = $proto . $val;
537 $formals = $formals . $val . " a$i";
538 $actuals = $actuals . " a$i";
541 $proto = $proto . ", ";
542 $formals = $formals . ", ";
543 $actuals = $actuals . ", ";
546 $proto = $proto . ")";
547 $formals = $formals . ")";
550 raw_output_fn
($fn_name,
551 $result_type =~ /^\s*void\s*$/ ?
"" : "$result_type r",
559 # output_fn("main", "int r", "int main(int, char **)", "int main(int a0, char **a1)", "a0, a1")
562 my ($fn_name, $resultdecl, $protodecl, $defdecl, $actuals) = @_;
564 return undef unless $want{$fn_name} && $want{$fn_name} == 1;
566 print OUTC
"\n$defdecl\n";
567 print OUTH
"extern $protodecl;\n";
568 # print OUTH "#define $fn_name TS$fn_name\n";
570 print OUTC
" $resultdecl;\n" if $resultdecl;
571 print OUTC
" wine_tsx11_lock();\n";
573 print OUTC
"r = " if $resultdecl;
574 print OUTC
"$fn_name($actuals);\n";
575 print OUTC
" wine_tsx11_unlock();\n";
576 print OUTC
" return r;\n" if $resultdecl;