Added a possibility to let the internal debugger use a separate
[wine] / tools / make_X11wrappers
index 1a1c08b..a4d6df0 100755 (executable)
@@ -17,7 +17,7 @@
 $X11_include_dir = "/usr/X11R6/include";
 $outdir = "tsx11";
 $wantfile = "$outdir/X11_calls";
-@dolist = ("Xlib", "Xresource", "Xutil", "xpm", "XShm", "xf86dga");
+@dolist = ("Xlib", "Xresource", "Xutil", "xpm", "XShm", "xf86dga", "xf86vmode");
 
 # First read list of wanted function names.
 
@@ -54,11 +54,23 @@ foreach $name (@dolist) {
     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";
+       $pre_file = "#ifdef HAVE_LIBXXF86DGA\n";
+       $post_file = "#endif /* defined(HAVE_LIBXXF86DGA) */\n";
     }
     if($name eq "XShm") {
        $extensions_dir = "extensions/";
+       $pre_file = "#ifdef HAVE_LIBXXSHM\n";
+       $post_file = "#endif /* defined(HAVE_LIBXXSHM) */\n";
+    }
+    if($name eq "xpm") {
+       $pre_file = "#ifdef HAVE_LIBXXPM\n";
+       $post_file = "#endif /* defined(HAVE_LIBXXPM) */\n";
+    }
+    if($name eq "xf86vmode") {
+       $x11_incl = "#include <X11/Xlib.h>\n";
+       $extensions_dir = "extensions/";
+       $pre_file = "#include \"windef.h\"\n#ifdef HAVE_LIBXXF86VM\n#define XMD_H\n#define INT32 INT\n";
+       $post_file = "#endif /* defined(HAVE_LIBXXF86VM) */\n";
     }
 
     print OUTH <<END;
@@ -73,6 +85,11 @@ foreach $name (@dolist) {
 #ifndef __WINE_TS$ucname\_H
 #define __WINE_TS$ucname\_H
 
+#include "config.h"
+
+#ifndef X_DISPLAY_MISSING
+
+$pre_file
 $x11_incl#include <X11/$extensions_dir$name.h>
 
 END
@@ -83,10 +100,17 @@ END
  * This file was generated automatically by tools/make_X11wrappers
  * DO NOT EDIT!
  */
+
+#include "config.h"
+
+#ifndef X_DISPLAY_MISSING
+
 $pre_file
 $x11_incl#include <X11/$extensions_dir$name.h>
-#include "x11drv.h"
 #include "debug.h"
+#include "x11drv.h"
+
+DEFAULT_DEBUG_CHANNEL(x11)
 END
 
     if($name eq "xpm") {       # Handle as special case.
@@ -98,17 +122,32 @@ END
     } elsif($name eq "XShm") {
        output_fn("XShmQueryExtension", "Bool",
                  "Display *", "Display *a0", "a0");
+       output_fn("XShmQueryVersion", "Bool",
+                 "Display *, int *, int *, Bool *", 
+                 "Display *a0, int *a1, int *a2, Bool *a3", "a0, a1, a2, a3");
        output_fn("XShmPixmapFormat", "int",
                  "Display *", "Display *a0", "a0");
-       output_fn("XShmDetach", Status,
+       output_fn("XShmAttach", Status,
                  "Display *, XShmSegmentInfo *",
                  "Display *a0, XShmSegmentInfo *a1", "a0, a1");
-       output_fn("XShmAttach", Status,
+       output_fn("XShmDetach", 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");
+       output_fn("XShmGetImage", Status,
+                 "Display *, Drawable, XImage *, int, int, unsigned long",
+                 "Display *a0, Drawable a1, XImage *a2, int a3, int a4, unsigned long a5", 
+                 "a0, a1, a2, a3, a4, a5");
+       output_fn("XShmCreateImage", "XImage *",
+                 "Display *, Visual *, unsigned int, int, char *, XShmSegmentInfo *, unsigned int, unsigned int",
+                 "Display *a0, Visual *a1, unsigned int a2, int a3, char *a4, XShmSegmentInfo *a5, unsigned int a6, unsigned int a7",
+                 "a0, a1, a2, a3, a4, a5, a6, a7");
+       output_fn("XShmCreatePixmap", "Pixmap",
+                 "Display *, Drawable, char *, XShmSegmentInfo *, unsigned int, unsigned int, unsigned int",
+                 "Display *a0, Drawable a1, char *a2, XShmSegmentInfo *a3, unsigned int a4, unsigned int a5, unsigned int a6",
+                 "a0, a1, a2, a3, a4, a5, a6");
     } elsif($name eq "xf86dga") {
        output_fn("XF86DGAQueryVersion",Bool,
                "Display*,int*,int*",
@@ -155,6 +194,77 @@ END
                "Display*a0,int a1,int a2",
                "a0,a1,a2"
        );
+    } elsif($name eq "xf86vmode") {
+       output_fn("XF86VidModeQueryVersion",Bool,
+               "Display*,int*,int*",
+               "Display*a0,int*a1,int*a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeQueryExtension",Bool,
+               "Display*,int*,int*",
+               "Display*a0,int*a1,int*a2",
+               "a0,a2,a2"
+       );
+       output_fn("XF86VidModeGetModeLine",Bool,
+               "Display*,int,int*,XF86VidModeModeLine*",
+               "Display*a0,int a1,int*a2,XF86VidModeModeLine*a3",
+               "a0,a1,a2,a3"
+       );
+       output_fn("XF86VidModeGetAllModeLines",Bool,
+               "Display*,int,int*,XF86VidModeModeInfo***",
+               "Display*a0,int a1,int*a2,XF86VidModeModeInfo***a3",
+               "a0,a1,a2,a3"
+       );
+       output_fn("XF86VidModeAddModeLine",Bool,
+               "Display*,int,XF86VidModeModeInfo*,XF86VidModeModeInfo*",
+               "Display*a0,int a1,XF86VidModeModeInfo*a2,XF86VidModeModeInfo*a3",
+               "a0,a1,a2,a3"
+       );
+       output_fn("XF86VidModeDeleteModeLine",Bool,
+               "Display*,int,XF86VidModeModeInfo*",
+               "Display*a0,int a1,XF86VidModeModeInfo*a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeModModeLine",Bool,
+               "Display*,int,XF86VidModeModeLine*",
+               "Display*a0,int a1,XF86VidModeModeLine*a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeValidateModeLine",Status,
+               "Display*,int,XF86VidModeModeInfo*",
+               "Display*a0,int a1,XF86VidModeModeInfo*a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeSwitchMode",Bool,
+               "Display*,int,int",
+               "Display*a0,int a1,int a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeSwitchToMode",Bool,
+               "Display*,int,XF86VidModeModeInfo*",
+               "Display*a0,int a1,XF86VidModeModeInfo*a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeLockModeSwitch",Bool,
+               "Display*,int,int",
+               "Display*a0,int a1,int a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeGetMonitor",Bool,
+               "Display*,int,XF86VidModeMonitor*",
+               "Display*a0,int a1,XF86VidModeMonitor*a2",
+               "a0,a1,a2"
+       );
+       output_fn("XF86VidModeGetViewPort",Bool,
+               "Display*,int,int*,int*",
+               "Display*a0,int a1,int*a2,int*a3",
+               "a0,a1,a2,a3"
+       );
+       output_fn("XF86VidModeSetViewPort",Bool,
+               "Display*,int,int,int",
+               "Display*a0,int a1,int a2,int a3",
+               "a0,a1,a2,a3"
+       );      
     } else {
        open(IN, "echo \"$x11_incl#include <X11/$extensions_dir$name.h>\" | gcc -L$X11_include_dir -E - | grep -v '^[ \t]*\$'|") || die "open";
 
@@ -173,6 +283,9 @@ END
                  }
                  if(m'\s*([^,]*[^, \t])\s*(,?\n)') {
                      $args[$#args+1] = $1;
+                     if ($1 =~ /char\s*\[/) { # small hack for XQueryKeymap
+                       $args[$#args] = "char*";
+                     }
                  }
              }
              # Skip if vararg, function pointer arg, or not needed.
@@ -228,10 +341,15 @@ END
 
     print OUTH <<END;
 
+$post_file
+#endif /* !defined(X_DISPLAY_MISSING) */
+
 #endif /* __WINE_TS$ucname\_H */
 END
     print OUTC <<END;
+
 $post_file
+#endif /* !defined(X_DISPLAY_MISSING) */
 END