wine/tools/make_X11wrappers
Alexandre Julliard 829fe323e4 Release 980726
Sat Jul 25 19:45:45 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [include/shlobj.h][misc/shell.c][misc/shellord.c][ole/folders.c]
	[shell32.spec]
	Added SHFILEOPSTRUCT32[A|W] and constants, prototypes.
	Implemented SHGetSpecialFolderLocation, SHGetPathFromIDList32[A].
	Many IShellFolder, pidl, shell -related changes.

	SHChangeNotifyRegister, SHChangeNotifyDeregister,
	SHShellFolderView_Message, SHMapPIDLToSystemImageListIndex,
	SHAddToRecentDocs32, SHFileOperation, SHChangeNotify, 
	SHCreateShellFolderViewEx stubs.

Sat Jul 25 17:16:25 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [files/profile.c]
	Fix return value of PROFILE_GetSection().

Fri Jul 24 22:45:19 1998  Ove Kaaven <ovek@isflak.arcticnet.no>

	* [controls/edit.c]
	Killed the modified flag on WM_SETTEXT. Eudora should no longer
	bother asking whether you want to save an unchanged message.

Fri Jul 24 21:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [controls/menu.c]
	Fixed bug in GetMenuState32.
	Doesn't fix Free Agent 32 :((

	* [documentation/debugging]
	Hints added.

	* [files/dos_fs.c] [include/msdos.h] [msdos/int21.c]
	Enhanced DOS device support.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/rasapi16.spec]
	  [relay32/Makefile.in] [relay32/builtin32.c] [relay32/rasapi32.spec]
	Added RASAPI16/32.DLL.

	* [misc/aspi.c] [relay32/wnaspi32.spec]
	Implemented GetASPI32SupportInfo.

	* [multimedia/mmsystem.c]
	Implemented mmTaskCreate.

Fri Jul 24 20:55:31 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/toolbar.c]
	Fixed some bugs and added new features.

	* [controls/tooltips.c][include/tooltips.h]
	Added more messages and started display code.

	* [misc/shell.c][misc/shellord.c][relay32/shell.spec]
	Fixed StrToOleStrN (SHELL32_79) and added OleStrToStrN (SHELL32_78).
	Added some new stubs.

	* [objects/cursoricon.c][misc/imagelist.c][include/windows.h]
	Fixed GetIconInfo and removed the GetIconInfo hack from the
	image list code.

	* [controls/pager.c][include/pager.h][controls/treeview.c]
	  [include/treeview.h]
	Added some messages.

	* [misc/tweak.c][winows/nonclient.c][documentation/win95look]
	Removed unused tweak variables.

	* [documentation/common_controls]
	Updated.

Fri Jul 24 18:36:32 1998  James Moody <013263m@dragon.acadiau.ca>

	* [objects/font.c]
	Fixed a bug in GetTextFace.

Fri Jul 24 17:09:33 1998  Marcus Meissner <marcus@jet.franken.de>

	* [misc/commdlg.c]
	Fixed stacksmashing bug due to invalid specified function
	pointers.

	* [files/dos_fs.c]
	Small change in case handling... be able to create files with
	uppercase in them (like Program Files/).

	* [graphics/ddraw.c]
	XF86DGA support made threadsafe, added more Xlib dependent stuff
	(create Window using CreateWindow(), draw into it). xlib support
	is not satisfying.

	* [scheduler/critsection.c]
	Don't recurse on HeapLock with semaphore id 0.

	* [win32/user32.c][windows/message.c][windows/event.c]
	Moved win32 *Message functions where they belong.
	Removed some potential races between XPending and XNextEvent by
	a bit more locking.

Fri Jul 24 13:58:19 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/pe_image.c] [loader/ne/segment.c]
	Use bogus pointer value instead of NULL for unresolved externals.

	* [memory/selector.c]
	Clear saved_fs on selector free.

	* [msdos/cdrom.c] [configure.in]
	Added check for linux/ucdrom.h.

	* [scheduler/client.c] [server/socket.c]
	Fix for missing struct cmsghdr.
	Attempt to support msg_accrights fd passing (completely untested).

	* [windows/event.c]
	Do not grab the pointer in SetCapture (Win32 behavior).

Tue Jul 21 22:28:13 1998  James Juran  <jrj120@psu.edu>

	* [Make.rules.in]
	Changed $(MKDIR) macro to use -p option (make parent directories
	if they don't already exist.  This fixes an error in 'make install'
	if /usr/local/include doesn't already exist.

Tue Jul 21 13:37:04 Rein Klazes <rklazes@casema.net>

	* [include/heap.h]
	Replaced macro SEGPTR_GET by inline function to avoid *lots*
	of wrong use of this macro.

	* [relay32/comdlg32.spec]
	Corrected GetSaveFileNameW entry.

	* [relay32/advapi32.spec] [win32/advapi.c]
	  [relay32/ole32.spec] [ ole/moniker.c]
	Added stubs for SetFileSecurity[AW] and CreateFileMoniker32

	* [graphics/x11drv/graphics.c]
	Finished implementation of bezier drawing code.

Tue Jul 21 11:00:51 1998  Claus Fischer <cfischer@td2cad.intel.com>

	* [files/drive.c]
	Remove label trailing blanks in GetVolumeInformation32A.

	* [documentation/cdrom-labels]
	Added documentation on how to find out a CD-ROM label.

Sun Jul 19 23:16:41 1998  Pascal Cuoq <pcuoq@ens-lyon.fr>

	* [include/windows.h]
	Added some DM_* and DISP_CHANGE_* flags.

	* [relay32/user32.spec] [windows/user.c]
	Added stub for ChangeDisplaySettingA.

	* [ole/ole2nls.c]
	is_punctuation: reuse information from another table.

Sun Jul 19 22:04:46 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [Make.rules.in]
	Updated automatic documentation rules.

	* [graphics/path.c] [misc/aspi.c] [misc/ntdll.c] [misc/winsock_dns.c]
	[ole/ole2dsp.c] [relay32/user32.spec]
	Comment format futzing to keep c2man happy.

	* [documentation/README.documentation]
	Updated description of automatic documentation.

Wed Jul 15 19:10:09 1998   Andrew M. Bishop <amb@gedanken.demon.co.uk>

	* [files/profile.c]
	Cache the 10 most recently used .ini files.

Tue May 20 19:20:23 1997  Pablo Saratxaga <srtxg@chanae.alphanet.ch>

	* [misc/commdlg.c]
	Makes PrintDlg32A() return TRUE even if it is an empty
	stub, so most programs are happy and run anyway instead of
	aborting at startup.

	* [graphics/x11drv/xfont.c]
	Increased the maximum font families as (X11) font aliases
	eated up a lot of families causing wine to stop reading fonts.
1998-07-26 14:27:39 +00:00

288 lines
8.4 KiB
Perl
Executable file

#!/usr/bin/perl -w
# Create threads safe wrappers around X11 calls.
#
# Copyright 1998 Kristian Nielsen.
#
# FIXME: This does not do full C prototype parsing, but relies on
# knowledge on how the X11 include files are formatted. It will
# probably need to be modified for new include files. It also fails
# for certain prototypes (notably those with function pointer
# arguments or results), so these must be added manually. And it
# relies on a fixed location of X11 includes (/usr/X11R6/include/).
#
# This program expects to be run from Wine's main directory.
$X11_include_dir = "/usr/X11R6/include";
$outdir = "tsx11";
$wantfile = "$outdir/X11_calls";
@dolist = ("Xlib", "Xresource", "Xutil", "xpm", "XShm", "xf86dga");
# First read list of wanted function names.
open(WANT, $wantfile) || die "open";
while(<WANT>) {
next if /^\s*\#/; # Skip comment lines.
next if /^\s*$/; # Skip empty lines.
if(/^\s*([a-zA-Z0-9_]+)\s*$/) {
$want{$1} = 1;
} else {
die "syntax error in file '$wantfile', in line '$_'";
}
}
close(WANT);
foreach $name (@dolist) {
$ucname = uc $name;
$lcname = lc $name;
$outfile = "/ts_$lcname";
open(OUTC, ">$outdir/$outfile.c") || die "open";
open(OUTH, ">include/$outfile.h") || die "open";
$x11_incl = "";
$extensions_dir = "";
$pre_file = "";
$post_file = "";
if($name eq "Xutil" || $name eq "Xresource" || $name eq "XShm") {
$x11_incl = "#include <X11/Xlib.h>\n";
# For Xutil, we need X11/Xresource.h for XUniqueContext().
$x11_incl .= "#include <X11/Xresource.h>\n" if $name eq "Xutil";
}
if($name eq "xf86dga") {
$x11_incl = "#include <X11/Xlib.h>\n";
$extensions_dir = "extensions/";
$pre_file = "#include \"config.h\"\n#ifdef HAVE_LIBXXF86DGA\n";
$post_file = "#endif";
}
if($name eq "XShm") {
$extensions_dir = "extensions/";
}
print OUTH <<END;
/*
* Thread safe wrappers around $name calls.
* Always include this file instead of <X11/$name.h>.
* This file was generated automatically by tools/make_X11wrappers
*
* Copyright 1998 Kristian Nielsen
*/
#ifndef __WINE_TS$ucname\_H
#define __WINE_TS$ucname\_H
$x11_incl#include <X11/$extensions_dir$name.h>
END
print OUTC <<END;
/*
* Thread safe wrappers around $name calls.
* This file was generated automatically by tools/make_X11wrappers
* DO NOT EDIT!
*/
$pre_file
$x11_incl#include <X11/$extensions_dir$name.h>
#include "x11drv.h"
#include "debug.h"
END
if($name eq "xpm") { # Handle as special case.
output_fn("XpmCreatePixmapFromData", "int",
"Display *, Drawable, char **, Pixmap *, Pixmap *, XpmAttributes *",
"Display *a0, Drawable a1, char **a2, Pixmap *a3, Pixmap *a4, XpmAttributes *a5",
"a0, a1, a2, a3, a4, a5");
output_fn("XpmAttributesSize", "int", "void", "void", "");
} elsif($name eq "XShm") {
output_fn("XShmQueryExtension", "Bool",
"Display *", "Display *a0", "a0");
output_fn("XShmPixmapFormat", "int",
"Display *", "Display *a0", "a0");
output_fn("XShmDetach", Status,
"Display *, XShmSegmentInfo *",
"Display *a0, XShmSegmentInfo *a1", "a0, a1");
output_fn("XShmAttach", Status,
"Display *, XShmSegmentInfo *",
"Display *a0, XShmSegmentInfo *a1", "a0, a1");
output_fn("XShmPutImage", Status,
"Display *, Drawable, GC, XImage *, int, int, int, int, unsigned int, unsigned int, Bool",
"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");
} elsif($name eq "xf86dga") {
output_fn("XF86DGAQueryVersion",Bool,
"Display*,int*,int*",
"Display*a0,int*a1,int*a2",
"a0,a1,a2"
);
output_fn("XF86DGAQueryExtension",Bool,
"Display*,int*,int*",
"Display*a0,int*a1,int*a2",
"a0,a1,a2"
);
output_fn("XF86DGAGetVideo",Status,
"Display*,int,char**,int*,int*,int*",
"Display*a0,int a1,char**a2,int*a3,int*a4,int*a5",
"a0,a1,a2,a3,a4,a5"
);
output_fn("XF86DGADirectVideo",Status,
"Display*,int,int",
"Display*a0,int a1,int a2",
"a0,a1,a2"
);
output_fn("XF86DGAGetViewPortSize",Status,
"Display*,int,int*,int*",
"Display*a0,int a1,int *a2,int *a3",
"a0,a1,a2,a3"
);
output_fn("XF86DGASetViewPort",Status,
"Display*,int,int,int",
"Display*a0,int a1,int a2,int a3",
"a0,a1,a2,a3"
);
output_fn("XF86DGAInstallColormap",Status,
"Display*,int,Colormap",
"Display*a0,int a1,Colormap a2",
"a0,a1,a2"
);
output_fn("XF86DGAQueryDirectVideo",Status,
"Display*,int,int*",
"Display*a0,int a1,int *a2",
"a0,a1,a2"
);
output_fn("XF86DGAViewPortChanged",Status,
"Display*,int,int",
"Display*a0,int a1,int a2",
"a0,a1,a2"
);
} else {
open(IN, "echo \"$x11_incl#include <X11/$extensions_dir$name.h>\" | gcc -L$X11_include_dir -E - | grep -v '^[ \t]*\$'|") || die "open";
PROTO: while(<IN>) {
if(m'extern\s+([^()]*)\b([a-zA-Z0-9_]+)\s*\(') {
$result_type = $1;
$fn_name = $2;
$result_type = "int" if $result_type =~ /^\s*$/;
@args = ();
while(<IN>) {
last if m'\)\s*;';
# Give up on vararg functions and function pointer args.
if(m'\.\.\.|\(\*\)') {
undef $fn_name;
last;
}
if(m'\s*([^,]*[^, \t])\s*(,?\n)') {
$args[$#args+1] = $1;
}
}
# Skip if vararg, function pointer arg, or not needed.
next unless $fn_name;
next unless $want{$fn_name} && $want{$fn_name} == 1;
# Special case for no arguments (which is specified as "void").
if($#args == 0 && $args[0] eq "void") {
@args = ();
}
$proto = "";
$formals = "";
$actuals = "";
for($i = 0; $i <= $#args; $i++) {
$comma = $i < $#args ? ", " : "";
$proto .= "$args[$i]$comma";
$formals .= "$args[$i] a$i$comma";
$actuals .= "a$i$comma";
}
$proto = $formals = "void" if $#args == -1;
output_fn($fn_name, $result_type, $proto, $formals, $actuals);
}
}
}
if($name eq "Xlib") {
raw_output_fn("XSynchronize", "int (*r)(Display *)",
"int (*TSXSynchronize(Display *, Bool))(Display *)",
"int (*TSXSynchronize(Display *a0, Bool a1))(Display *)",
"a0, a1");
print OUTC "\nextern void _XInitImageFuncPtrs(XImage *);\n";
output_fn("_XInitImageFuncPtrs", "void", "XImage *", "XImage *a0", "a0");
} elsif($name eq "Xutil") {
output_fn("XDestroyImage", "int",
"struct _XImage *", "struct _XImage *a0", "a0");
output_fn("XGetPixel", "unsigned long",
"struct _XImage *, int, int",
"struct _XImage *a0, int a1, int a2",
"a0, a1, a2");
output_fn("XPutPixel", "int",
"struct _XImage *, int, int, unsigned long",
"struct _XImage *a0, int a1, int a2, unsigned long a3",
"a0, a1, a2, a3");
output_fn("XSubImage", "struct _XImage *",
"struct _XImage *, int, int, unsigned int, unsigned int",
"struct _XImage *a0, int a1, int a2, unsigned int a3, unsigned int a4",
"a0, a1, a2, a3, a4");
output_fn("XAddPixel", "int",
"struct _XImage *, long",
"struct _XImage *a0, long a1", "a0, a1");
output_fn("XUniqueContext", "XContext", "void", "void", "");
}
print OUTH <<END;
#endif /* __WINE_TS$ucname\_H */
END
print OUTC <<END;
$post_file
END
}
foreach $i (keys %want) {
if($want{$i} == 1) {
print "Unresolved: $i\n";
}
}
sub output_fn {
# Example call:
# output_fn("main", "int", "int, char **", "int a0, char **a1", "a0, a1")
#
my ($fn_name, $result_type, $protos, $formals, $actuals) = @_;
return raw_output_fn($fn_name,
$result_type =~ /^\s*void\s*$/ ? "" : "$result_type r",
"$result_type TS$fn_name($protos)",
"$result_type TS$fn_name($formals)",
$actuals);
}
sub raw_output_fn {
# Example call:
# output_fn("main", "int r", "int main(int, char **)", "int main(int a0, char **a1)", "a0, a1")
#
my ($fn_name, $resultdecl, $protodecl, $defdecl, $actuals) = @_;
return undef unless $want{$fn_name} && $want{$fn_name} == 1;
print OUTC "\n$defdecl\n";
print OUTH "extern $protodecl;\n";
# print OUTH "#define $fn_name TS$fn_name\n";
print OUTC "{\n";
print OUTC " $resultdecl;\n" if $resultdecl;
print OUTC " TRACE(x11, \"Call $fn_name\\n\");\n";
print OUTC " EnterCriticalSection( &X11DRV_CritSection );\n";
print OUTC " ";
print OUTC "r = " if $resultdecl;
print OUTC "$fn_name($actuals);\n";
print OUTC " LeaveCriticalSection( &X11DRV_CritSection );\n";
print OUTC " TRACE(x11, \"Ret $fn_name\\n\");\n";
print OUTC " return r;\n" if $resultdecl;
print OUTC "}\n";
$want{$fn_name} = 2;
return 1;
}