Release 980301

Sun Mar  1 10:45:23 1998  Andreas Mohr <100.30936@germany.net>

	* [loader/ne_image.c]
	Fixed problem with weird DLLs (NE_FFLAGS_SINGLEDATA && DGROUP = 0).

	* [msdos/dosmem.c]
	Export address for __0000H, too.

	* [msdos/dpmi.c]
	Changed MemAlloc functions to return less fragmented addresses.

Sat Feb 28 18:50:12 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [scheduler/process.c] [scheduler/sysdeps.c]
	Don't use %fs register before threading initialization.

Sat Feb 28 14:04:56 1998  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [configure.in] [include/acconfig.h]
	Autoconf macro to check for non-reentrant X libraries.

	* [windows/winpos.c]
	In SetWindowPos32(), do not cause WM_SIZE messages when the
	SWP_NOSIZE flag is specified. This fixes the division-by-zero in
	Borland C++ 4.0 "Open Project" menu item.

Sat Feb 28 13:11:26 1998  James Moody  <013263m@dragon.acadiau.ca>

	* [ole/ole2nls.c]
	Changed "English" values from German to English.

	* [files/dos_fs.c]
	Fixed off-by-one month bug.

Fri Feb 27 22:12:01 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [windows/win.c]
	Fix winelib class menu loading bug.

	* [include/module.h] [loader/module.c]
	LoadModule32 should be implemented in terms of CreateProcess.

	* [programs/view/*]
	Metafile viewer sample program.

	* [documentation/wine.texinfo] [documentation/Makefile.in]
	Improvements and additions, HTML target.

Fri Feb 27 04:27:48 1998  Dimitrie O. Paun <dimi@cs.toronto.edu>

	* [*/*]
	Switched to the new debug messages interface. For more information
	please refer to documentation/debug-msgs. Because the new scheme
	introduces a new semantic level, I had to manually do through
	about 530 dprintf_xxx!  The rest of about 2400 where transformed
	via a script.  Because of the large number of changes that I had
	to do, some may have not come out as nicely as I wanted them.  If
	this is the case, please let me know. There is a lot of work left
	to do: -- a few hundred printf's to be converted -- about 2300
	fprintf's to be converted -- about 600 FIXME's to be transformed
	The problem is that in the above mentioned cases, a lot of manual
	intervention is required because a lot of the information is
	missing.  There are also a lot of other things to be done to the
	interface and so forth. I have now ideas for a at least a month
	worth of full time work :) I will proceed with many changes in the
	next few releases, so please do not start modifing things because
	there will be a hell of a lot of conflicts. If you have ideas that
	you want to integrate or you want to work on different things,
	please coordinate with me.

Thu Feb 26 13:04:29 1998  David Lee Lambert <lamber45@egr.msu.edu>

	* [ole/ole2nls.c] [include/windows.h]
	First try at OLE date- and time-formatting functions.

Wed Feb 25 11:20:35 1998 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/*.c]
	Changed dos device handling, added 'CON' devicehandling.

	* [graphics/ddraw.c]
	Bug fixes, some additions.

	* [if1632/builtin.c][loader/module.c][library/winestub.c]
	Small hack so we don't need a dummy BUILTIN_LoadModule
	in winestub.c.

	* [ole/*][relay32/ole32.spec][if1632/storage.spec]
	storage.dll started. winword loads documents (saving
	doesn't work yet, dunno why).
	Several ole additions, some cleanups and bugfixes.
	IMalloc16 implemented.

	* [loader/pe_image.c]
	Added some comments, fixed circular dll references,
	fixed modref ordering, fixed tls allocation.

	* [memory/global.c]
	Added validity checks before every GET_ARENA_PTR.
	(several functions rely on Global* return values
	 on invalid handles, like IsTask).
	Implemented GlobalUnlockFree16.

	* [memory/virtual.c]
	Replaced dprintf_virtual by fprintf, so we can
	do 'info map' again in the debugger. Increase read
	linesize for Linux2.1 cases.

	* [misc/cpu.c][misc/registry.c]
	Moved cpu registry initialization to misc/cpu.c.

	* [multimedia/dsound.c]
	Enhanced, replaced GETOSPACE bufferingcheck by SETFRAGMENT.

	* [relay32/crtdll.spec][relay32/ntdll.spec]
	Replaced some ptr by respective 'str' and 'wstr' arguments
	for libc functions.

	* [scheduler/thread.c]
	Added some sanity checks to stackallocation, tlshandling fixed.

	* [tools/build.c]
	Fixed cdecl argumenttype order (was reversed).

	* [win32/ordinals.c]
	Implemented KERNEL_449.

	* [windows/dinput.c]
	Some fixes, needs much more work. Tomb Raider2 works with keyboard ;)

Tue Feb 24 20:46:37 1998  James Juran   <jrj120@psu.edu>

	* [windows/win.c]
	Fixed USER32 ordinal numbers in documentation.

Sat Feb 21 12:30:38 1998  John Richardson <jrichard@zko.dec.com>

	* [files/file.c] [include/k32obj.h] [memory/virtual.c]
	[scheduler/critsection.c] [scheduler/event.c] [scheduler/handle.c]
	[scheduler/k32obj.c] [scheduler/mutex.c] [scheduler/process.c]
	[scheduler/semaphore.c] [scheduler/thread.c]
	Added generic k32obj read and write routines for k32objs that
	support I/O.

	* [documentation/console]
	Updated console docs.

	* [win32/console.c]
	Make console work like a k32obj that supports I/O.

	* [include/windows.h]
	Make WriteFile and ReadFile take HANDLE32 for handle.

Sun Feb 15 14:07:07 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>

	* [controls/menu.c] [misc/ver.c] [multimedia/dsound.c]
	  [multimedia/joystick.c] [windows/dialog.c]
	Modified some dprintf_xxx's to prepare them for a new
	dprintf_ scheme. Basically, I changed the dprintf's that
	outputed a line with many dprintf calls to do just one
	dprintf call.
diff --git a/tools/build.c b/tools/build.c
index 34995d2..154f679 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -1308,16 +1308,21 @@
 static int TransferArgs16To32( FILE *outfile, char *args, int usecdecl )
 {
     int i, pos16, pos32;
+    char *xargs;
 
     /* Copy the arguments */
 
     pos16 = 6;  /* skip bp and return address */
     pos32 = usecdecl ? -(strlen(args) * 4) : 0;
+    xargs = usecdecl ? args:args+strlen(args);
 
     for (i = strlen(args); i > 0; i--)
     {
-        if (!usecdecl) pos32 -= 4;
-        switch(args[i-1])
+        if (!usecdecl) {
+            pos32 -= 4;
+            xargs--;
+        }
+        switch(*xargs)
         {
         case 'w':  /* word */
             fprintf( outfile, "\tmovzwl %d(%%ebp),%%eax\n", pos16 );
@@ -1353,9 +1358,12 @@
             break;
 
         default:
-            fprintf( stderr, "Unknown arg type '%c'\n", args[i-1] );
+            fprintf( stderr, "Unknown arg type '%c'\n", *xargs );
         }
-        if (usecdecl) pos32 += 4;
+        if (usecdecl) {
+            pos32 += 4;
+            xargs++;
+        }
     }
 
     return pos16 - 6;  /* Return the size of the 16-bit args */
@@ -2087,7 +2095,7 @@
  *
  * Stack layout:
  *   ...     ...
- * (esp+208) ret addr (or relay addr when debugging_relay is on)
+ * (esp+208) ret addr (or relay addr when debugging(relay) is on)
  * (esp+204) entry point
  * (esp+0)   CONTEXT struct
  */
diff --git a/tools/find_debug_channels b/tools/find_debug_channels
new file mode 100644
index 0000000..39c5666
--- /dev/null
+++ b/tools/find_debug_channels
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# This script scans the whole source code for symbols of the form 
+# 'dprintf_xxx(yyy' where yyy is a C identifier and outputs, on the
+# standard output a sorted list of the identifiers found in the .c 
+# files. Each identifier is reported once. Header files are not
+# scanned.
+#
+# The script can be given an argument that specify the files to be
+# searched according to the following scheme:
+#    - if the argument does not contain a slash (/), the script
+#      will search the tree rooted in the current directory for
+#      files that match that description. You can also pass
+#      wildcard arguments, but remember to quote them to prevent
+#      expansion by the shell
+#    - if the argument does contain a slash, only that file is
+#      searched
+#    - if no argument is given, the argument defaults to "*.c"
+#      that is, all C files are searched.
+#    - if more than a argument is given, only the listed files are
+#      searched. Note that in this case, the script will not
+#      attempt to find them in some subdirectories, but rather
+#      it will try to open them in the current directory.
+# Thus, if you want to disable the automatic searching when the file
+# name does not contain a /, either prefix the filename with ./
+# or add /dev/null as another argument.
+#
+# Dimitrie O. Paun <dimi@cs.toronto.edu>
+#
+
+case "$#" in
+    0 | 1)  files=${1:-'*.c'}
+	    if [ ${files#*/} = "$files" ]; then
+		files=$(find . -name "$files" -print)
+	    fi;;
+    *    )  files="$@";;
+esac
+
+grep -h dprintf_ $files /dev/null | \
+    sed 's/.*dprintf_[A-Za-z0-9_]\+ *( *\([A-Za-z0-9_]*\).*/\1/g' | \
+    sort | uniq
diff --git a/tools/fnt2bdf.c b/tools/fnt2bdf.c
index 80537be..f678e85 100644
--- a/tools/fnt2bdf.c
+++ b/tools/fnt2bdf.c
@@ -81,7 +81,8 @@
                 }
             break;
             }
-	case(dfString):
+		case(dfString):
+			break;
         } 
     return ret_val;
 }
diff --git a/tools/make_X11wrappers b/tools/make_X11wrappers
index 0f2db0b..08b470c 100755
--- a/tools/make_X11wrappers
+++ b/tools/make_X11wrappers
@@ -78,7 +78,6 @@
 
 $x11_incl#include <X11/$extensions_dir$name.h>
 #include "x11drv.h"
-#include "stddebug.h"
 #include "debug.h"
 END
 
@@ -212,13 +211,13 @@
 #    print OUTH "#define $fn_name TS$fn_name\n";
     print OUTC "{\n";
     print OUTC "  $resultdecl;\n" if $resultdecl;
-    print OUTC "  dprintf_x11(stddeb, \"Call $fn_name\\n\");\n";
+    print OUTC "  dprintf_info(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 "  dprintf_x11(stddeb, \"Ret $fn_name\\n\");\n";
+    print OUTC "  dprintf_info(x11, \"Ret $fn_name\\n\");\n";
     print OUTC "  return r;\n" if $resultdecl;
     print OUTC "}\n";
     $want{$fn_name} = 2;
diff --git a/tools/make_debug b/tools/make_debug
index d836f3b..67451f6 100755
--- a/tools/make_debug
+++ b/tools/make_debug
@@ -1,164 +1,75 @@
-#!/bin/sh
+#!/bin/bash
 #
-# This script scans the whole source code for symbols of the form dprintf_xxx,
-# generates the necessary macro definitions and puts them into the files
-# include/stddebug.h and include/debug.h . This script must be started with 
-# cwd = rootdir of the Wine-distribution.
+# This script generates the required files for supporting the debug
+# channels used throught the code.
+# The generated files are 
+#   include/debugdefs.h
+#   include/debug.h
+# The script must be run in the root directory of the project.
 #
-# Michael Patra  <micky@marie.physik.tu-berlin.de>
+# Dimitrie O. Paun <dimi@cs.toronto.edu>
 #
-DEBUG_H=include/debug.h
-STDDEBUG_H=include/stddebug.h
+DEBUG_H="include/debug.h"
+DEBUG_DEFS_H="include/debugdefs.h"
 
-mv $DEBUG_H $DEBUG_H.old
-mv $STDDEBUG_H $STDDEBUG_H.old
+DEBUG_CHANNELS="$( tools/find_debug_channels )"
 
-# Build the list of debug identifiers
-grep -h dprintf_ `find . -name '*.c' -print` | \
-    sed 's/.*dprintf_\([A-Za-z0-9_]*\).*/\1/g' | sort | uniq > temp.$$
-
-# Build debug.h
-
-sed '/^\/\* Do not remove this line or change anything below this line \*\//q'\
-      <$DEBUG_H.old >$DEBUG_H
-cat <<++EOF++ >> $DEBUG_H
-
-#ifdef DEBUG_NONE_EXT
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
 {
-while read x
-do
-	echo "#undef DEBUG_$x" >> $DEBUG_H
-done
-}
+    cat <<EOF
+/* Do not modify this file -- it is automatically generated! */
 
-cat <<++EOF++ >>$DEBUG_H
+#ifndef __DEBUGTOOLS_H
+#include "debugtools.h"
 #endif
 
-#ifdef DEBUG_ALL_EXT
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	echo "#define DEBUG_$x" >> $DEBUG_H
-done
-}
-
-cat <<++EOF++ >>$DEBUG_H
-#endif
-
-#ifdef DEBUG_RUNTIME
-#ifdef DEBUG_DEFINE_VARIABLES
-short debug_msg_enabled[]={
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	cat <<++EOF++ >>$DEBUG_H
-#ifdef DEBUG_$x
-    1,
-#else
-    0,
-#endif
-++EOF++
-
-done
-}
-
-cat <<++EOF++ >>$DEBUG_H
-    0
-};
-#else
-extern short debug_msg_enabled[];
-#endif
-#endif
-
-++EOF++
-
-i=0
-cat temp.$$ |
-{
-while read x 
-do
-	y=`echo $x | tr a-z A-Z`
-	cat <<++EOF++ >>$DEBUG_H
-#ifdef DEBUG_RUNTIME
-#define dprintf_$x if(!debug_msg_enabled[$i]) ; else fprintf
-#define debugging_$x debug_msg_enabled[$i]
-#else
-#ifdef DEBUG_$y
-#define dprintf_$x fprintf
-#define debugging_$x 1
-#else
-#define dprintf_$x while(0) fprintf
-#define debugging_$x 0
-#endif
-#endif
-
-++EOF++
+EOF
+    i=0
+    for ch in $DEBUG_CHANNELS
+    do
+	echo "#define dbch_${ch} $i"
 	let i=$i+1
-done
-}
+    done
+} > $DEBUG_H
 
-cat <<++EOF++ >>$DEBUG_H
+# Now, on the last step, we proceed to construct
+# the definitions to be used by the main function.
+# These will be stored in include/debugdefs.h
+{
+    cat <<EOF
+/* Do not modify this file -- it is automatically generated! */
 
+#ifndef __DEBUGTOOLS_H
+#include "debugtools.h"
+#endif
+
+#define DEBUG_CHANNEL_COUNT $i
 #ifdef DEBUG_RUNTIME
-#ifdef DEBUG_DEFINE_VARIABLES
-static char *debug_msg_name[] = {
-++EOF++
+short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
+EOF
 
-cat temp.$$ | 
-{
-while read x
-do
-	echo "    \"$x\"," >> $DEBUG_H
-done
-}
+    for ch in $DEBUG_CHANNELS
+    do
+	echo "{1, 1, 0, 0},"
+    done
+    echo '};'
 
-cat <<++EOF++ >>$DEBUG_H
-    ""
-};
-#endif
-#endif
-++EOF++
+    echo 'const char* debug_ch_name[] = {'
+    for ch in $DEBUG_CHANNELS
+    do
+	echo "\"${ch}\","
+    done
+    echo '};'
+    
+    cat <<EOF
 
-# Build stddebug.h
+const char* debug_cl_name[] =
+{ "fixme", "err", "warn", "info" };
 
-sed '/^\/\* Do not remove this line or change anything below this line \*\//q'\
-      <$STDDEBUG_H.old >$STDDEBUG_H
+#endif /*DEBUG_RUNTIME*/
 
-cat <<++EOF++ >>$STDDEBUG_H
+/* end of automatically generated debug.h */
+EOF
 
-#ifdef DEBUG_NONE
-++EOF++
+} > $DEBUG_DEFS_H
 
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	echo "#undef DEBUG_$x" >> $STDDEBUG_H
-done
-}
 
-cat <<++EOF++ >>$STDDEBUG_H
-#endif
-
-#ifdef DEBUG_ALL
-++EOF++
-
-cat temp.$$ | tr a-z A-Z |
-{
-while read x
-do
-	echo "#define DEBUG_$x" >> $STDDEBUG_H
-done
-}
-echo "#endif" >> $STDDEBUG_H
-
-rm temp.$$ $DEBUG_H.old $STDDEBUG_H.old