Commit 383da68c authored by Alexandre Julliard's avatar Alexandre Julliard

Optimized debugging API to reduce code size.

parent fc296da4
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include "winbase.h" #include "winbase.h"
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
#include "server.h" #include "server.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(reg) DEFAULT_DEBUG_CHANNEL(reg);
/* Ansi->Unicode conversion without string delimiters */ /* Ansi->Unicode conversion without string delimiters */
......
...@@ -11,16 +11,17 @@ ...@@ -11,16 +11,17 @@
* *
*/ */
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "winbase.h" #include "winbase.h"
#include "commctrl.h" #include "commctrl.h"
#include "datetime.h" #include "datetime.h"
#include "monthcal.h" #include "monthcal.h"
#include "debugtools.h" #include "debugtools.h"
#include <math.h> DEFAULT_DEBUG_CHANNEL(datetime);
#include <string.h>
DEFAULT_DEBUG_CHANNEL(datetime)
#define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0)) #define DATETIME_GetInfoPtr(hwnd) ((DATETIME_INFO *)GetWindowLongA (hwnd, 0))
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include "winbase.h" #include "winbase.h"
#include "commctrl.h" #include "commctrl.h"
...@@ -30,7 +31,7 @@ ...@@ -30,7 +31,7 @@
#include "heap.h" #include "heap.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ipaddress) DEFAULT_DEBUG_CHANNEL(ipaddress);
#define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongA (hwnd, 0)) #define IPADDRESS_GetInfoPtr(hwnd) ((IPADDRESS_INFO *)GetWindowLongA (hwnd, 0))
......
...@@ -23,13 +23,14 @@ ...@@ -23,13 +23,14 @@
*/ */
#include <stdio.h>
#include "winbase.h" #include "winbase.h"
#include "commctrl.h" #include "commctrl.h"
#include "trackbar.h" #include "trackbar.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(trackbar) DEFAULT_DEBUG_CHANNEL(trackbar);
#define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)GetWindowLongA (hwnd,0)) #define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)GetWindowLongA (hwnd,0))
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "winbase.h" #include "winbase.h"
#include "ldt.h" #include "ldt.h"
...@@ -20,7 +21,7 @@ ...@@ -20,7 +21,7 @@
#include "filedlgbrowser.h" #include "filedlgbrowser.h"
#include "wine/obj_contextmenu.h" #include "wine/obj_contextmenu.h"
DEFAULT_DEBUG_CHANNEL(commdlg) DEFAULT_DEBUG_CHANNEL(commdlg);
/*********************************************************************** /***********************************************************************
* Data structure and global variables * Data structure and global variables
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* dplayx.dll data which is accessible from all processes. * dplayx.dll data which is accessible from all processes.
*/ */
#include <stdio.h>
#include "debugtools.h" #include "debugtools.h"
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
#include "dplayx_global.h" #include "dplayx_global.h"
DEFAULT_DEBUG_CHANNEL(dplay) DEFAULT_DEBUG_CHANNEL(dplay);
/* FIXME: Need to do all that fun other dll referencing type of stuff */ /* FIXME: Need to do all that fun other dll referencing type of stuff */
/* FIXME: Need to allocate a giant static area */ /* FIXME: Need to allocate a giant static area */
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/fcntl.h> #include <sys/fcntl.h>
...@@ -70,7 +71,7 @@ ...@@ -70,7 +71,7 @@
#include "thread.h" #include "thread.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(dsound) DEFAULT_DEBUG_CHANNEL(dsound);
/***************************************************************************** /*****************************************************************************
...@@ -1197,7 +1198,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Initialize( ...@@ -1197,7 +1198,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Initialize(
) { ) {
ICOM_THIS(IDirectSoundBufferImpl,iface); ICOM_THIS(IDirectSoundBufferImpl,iface);
FIXME("(%p,%p,%p):stub\n",This,dsound,dbsd); FIXME("(%p,%p,%p):stub\n",This,dsound,dbsd);
printf("Re-Init!!!\n"); DPRINTF("Re-Init!!!\n");
return DSERR_ALREADYINITIALIZED; return DSERR_ALREADYINITIALIZED;
} }
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
...@@ -18,7 +20,7 @@ ...@@ -18,7 +20,7 @@
#include "lzexpand.h" #include "lzexpand.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(file) DEFAULT_DEBUG_CHANNEL(file);
/* The readahead length of the decompressor. Reading single bytes /* The readahead length of the decompressor. Reading single bytes
......
...@@ -40,13 +40,13 @@ void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring) ...@@ -40,13 +40,13 @@ void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring)
} }
} }
LPSTR debugstr_as (PANSI_STRING us) LPCSTR debugstr_as (PANSI_STRING us)
{ {
if (!us) return NULL; if (!us) return NULL;
return debugstr_an(us->Buffer, us->Length); return debugstr_an(us->Buffer, us->Length);
} }
LPSTR debugstr_us (PUNICODE_STRING us) LPCSTR debugstr_us (PUNICODE_STRING us)
{ {
if (!us) return NULL; if (!us) return NULL;
return debugstr_wn(us->Buffer, us->Length); return debugstr_wn(us->Buffer, us->Length);
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include "winnt.h" #include "winnt.h"
/* debug helper */ /* debug helper */
extern LPSTR debugstr_as (PANSI_STRING us); extern LPCSTR debugstr_as (PANSI_STRING us);
extern LPSTR debugstr_us (PUNICODE_STRING us); extern LPCSTR debugstr_us (PUNICODE_STRING us);
extern void dump_ObjectAttributes (POBJECT_ATTRIBUTES ObjectAttributes); extern void dump_ObjectAttributes (POBJECT_ATTRIBUTES ObjectAttributes);
extern void dump_AnsiString(PANSI_STRING as, BOOLEAN showstring); extern void dump_AnsiString(PANSI_STRING as, BOOLEAN showstring);
extern void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring); extern void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
# include <netinet/in.h> # include <netinet/in.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
...@@ -56,7 +57,8 @@ ...@@ -56,7 +57,8 @@
#include "ifs.h" #include "ifs.h"
#include "compobj.h" #include "compobj.h"
DEFAULT_DEBUG_CHANNEL(ole) DEFAULT_DEBUG_CHANNEL(ole);
/**************************************************************************** /****************************************************************************
* COM External Lock structures and methods declaration * COM External Lock structures and methods declaration
* *
...@@ -1958,13 +1960,11 @@ void COM_ExternalLockDump() ...@@ -1958,13 +1960,11 @@ void COM_ExternalLockDump()
{ {
COM_ExternalLock *current = elList.head; COM_ExternalLock *current = elList.head;
printf("\nExternal lock list contains:\n"); DPRINTF("\nExternal lock list contains:\n");
while ( current != EL_END_OF_LIST ) while ( current != EL_END_OF_LIST )
{ {
printf( "\t%p with %lu references count.\n", DPRINTF( "\t%p with %lu references count.\n", current->pUnk, current->uRefCount);
current->pUnk,
current->uRefCount);
/* Skip to the next item */ /* Skip to the next item */
current = current->next; current = current->next;
......
...@@ -303,7 +303,7 @@ HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm) ...@@ -303,7 +303,7 @@ HRESULT WINAPI CompositeMonikerImpl_Load(IMoniker* iface,IStream* pStm)
res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]); res=OleLoadFromStream(pStm,&IID_IMoniker,(void**)&This->tabMoniker[This->tabLastIndex]);
#endif #endif
res=ReadClassStm(pStm,&clsid); res=ReadClassStm(pStm,&clsid);
printf("res=%ld",res); DPRINTF("res=%ld",res);
if (FAILED(res)) if (FAILED(res))
break; break;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <assert.h> #include <assert.h>
#include "winerror.h" #include "winerror.h"
#include "winreg.h" /* for HKEY_LOCAL_MACHINE */ #include "winreg.h" /* for HKEY_LOCAL_MACHINE */
...@@ -40,8 +41,8 @@ typedef struct ITypeInfoVtbl ITypeLib_VTable, *LPTYPEINFO_VTABLE ; ...@@ -40,8 +41,8 @@ typedef struct ITypeInfoVtbl ITypeLib_VTable, *LPTYPEINFO_VTABLE ;
typedef struct ITypeLibVtbl *LPTYPELIB_VTABLE ; typedef struct ITypeLibVtbl *LPTYPELIB_VTABLE ;
#include "typelib.h" #include "typelib.h"
DEFAULT_DEBUG_CHANNEL(ole) DEFAULT_DEBUG_CHANNEL(ole);
DECLARE_DEBUG_CHANNEL(typelib) DECLARE_DEBUG_CHANNEL(typelib);
/**************************************************************************** /****************************************************************************
* QueryPathOfRegTypeLib16 [TYPELIB.14] * QueryPathOfRegTypeLib16 [TYPELIB.14]
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include "debugtools.h" #include "debugtools.h"
#include "winerror.h" #include "winerror.h"
#include "winreg.h" #include "winreg.h"
...@@ -15,7 +16,7 @@ ...@@ -15,7 +16,7 @@
#include "shlguid.h" #include "shlguid.h"
#include "shresdef.h" #include "shresdef.h"
DEFAULT_DEBUG_CHANNEL(shell) DEFAULT_DEBUG_CHANNEL(shell);
#define MAX_EXTENSION_LENGTH 20 #define MAX_EXTENSION_LENGTH 20
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* 1998 Jrgen Schmied * 1998 Jrgen Schmied
*/ */
#include <string.h> #include <string.h>
#include <stdio.h>
#include "winerror.h" #include "winerror.h"
#include "winreg.h" #include "winreg.h"
#include "debugtools.h" #include "debugtools.h"
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
#include "wine/undocshell.h" #include "wine/undocshell.h"
#include "shpolicy.h" #include "shpolicy.h"
DEFAULT_DEBUG_CHANNEL(shell) DEFAULT_DEBUG_CHANNEL(shell);
/************************************************************************* /*************************************************************************
* SHChangeNotifyRegister [SHELL32.2] * SHChangeNotifyRegister [SHELL32.2]
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "windef.h" #include "windef.h"
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
#include "xmalloc.h" #include "xmalloc.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ver) DEFAULT_DEBUG_CHANNEL(ver);
/****************************************************************************** /******************************************************************************
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "neexe.h" #include "neexe.h"
#include "module.h" #include "module.h"
...@@ -15,7 +17,7 @@ ...@@ -15,7 +17,7 @@
#include "lzexpand.h" #include "lzexpand.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ver) DEFAULT_DEBUG_CHANNEL(ver);
/*********************************************************************** /***********************************************************************
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <memory.h> #include <memory.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include "winbase.h" #include "winbase.h"
#include "aspi.h" #include "aspi.h"
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#include "config.h" #include "config.h"
#include <stdio.h>
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include "windef.h" #include "windef.h"
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
#include "heap.h" #include "heap.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(mcimidi) DEFAULT_DEBUG_CHANNEL(mcimidi);
#define MIDI_NOTEOFF 0x80 #define MIDI_NOTEOFF 0x80
#define MIDI_NOTEON 0x90 #define MIDI_NOTEON 0x90
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "mmsystem.h" #include "mmsystem.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(mmio) DEFAULT_DEBUG_CHANNEL(mmio);
LPMMIOPROC16 MMIO_InstallIOProc(FOURCC, LPMMIOPROC16, DWORD, BOOL); LPMMIOPROC16 MMIO_InstallIOProc(FOURCC, LPMMIOPROC16, DWORD, BOOL);
...@@ -1114,11 +1114,12 @@ LRESULT WINAPI mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage, ...@@ -1114,11 +1114,12 @@ LRESULT WINAPI mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage,
{ {
LPMMIOINFO16 lpmminfo; LPMMIOINFO16 lpmminfo;
LRESULT result; LRESULT result;
const char *msg = NULL;
struct IOProcList *pListNode; struct IOProcList *pListNode;
#ifdef DEBUG_RUNTIME if (TRACE_ON(mmio))
switch (uMessage) { {
const char *msg = NULL;
switch (uMessage) {
#define msgname(x) case x: msg = #x; break; #define msgname(x) case x: msg = #x; break;
msgname(MMIOM_OPEN); msgname(MMIOM_OPEN);
msgname(MMIOM_CLOSE); msgname(MMIOM_CLOSE);
...@@ -1128,15 +1129,14 @@ LRESULT WINAPI mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage, ...@@ -1128,15 +1129,14 @@ LRESULT WINAPI mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage,
msgname(MMIOM_SEEK); msgname(MMIOM_SEEK);
msgname(MMIOM_RENAME); msgname(MMIOM_RENAME);
#undef msgname #undef msgname
} }
#endif if (msg)
if (msg)
TRACE("(%04X, %s, %ld, %ld)\n", TRACE("(%04X, %s, %ld, %ld)\n",
hmmio, msg, lParam1, lParam2); hmmio, msg, lParam1, lParam2);
else else
TRACE("(%04X, %u, %ld, %ld)\n", TRACE("(%04X, %u, %ld, %ld)\n",
hmmio, uMessage, lParam1, lParam2); hmmio, uMessage, lParam1, lParam2);
}
lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio); lpmminfo = (LPMMIOINFO16)GlobalLock16(hmmio);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
#include "oss.h" #include "oss.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(mmaux) DEFAULT_DEBUG_CHANNEL(mmaux);
#ifdef HAVE_OSS #ifdef HAVE_OSS
......
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
...@@ -17,7 +18,7 @@ ...@@ -17,7 +18,7 @@
#include "ldt.h" #include "ldt.h"
#include "callback.h" #include "callback.h"
DEFAULT_DEBUG_CHANNEL(aspi) DEFAULT_DEBUG_CHANNEL(aspi);
/* FIXME! /* FIXME!
* 1) Residual byte length reporting not handled * 1) Residual byte length reporting not handled
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_ERRNO_H #ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h> #include <sys/errno.h>
...@@ -50,7 +51,7 @@ ...@@ -50,7 +51,7 @@
#include "server.h" #include "server.h"
DEFAULT_DEBUG_CHANNEL(file) DEFAULT_DEBUG_CHANNEL(file);
#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON) #if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
#define MAP_ANON MAP_ANONYMOUS #define MAP_ANON MAP_ANONYMOUS
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include "gdi.h" #include "gdi.h"
#include "heap.h" #include "heap.h"
...@@ -75,7 +76,7 @@ static char *ddProp = "WINE_DDRAW_Property"; ...@@ -75,7 +76,7 @@ static char *ddProp = "WINE_DDRAW_Property";
#include "ddraw_private.h" #include "ddraw_private.h"
#include "d3d_private.h" #include "d3d_private.h"
DEFAULT_DEBUG_CHANNEL(ddraw) DEFAULT_DEBUG_CHANNEL(ddraw);
/* Restore signal handlers overwritten by XF86DGA /* Restore signal handlers overwritten by XF86DGA
*/ */
......
...@@ -7,13 +7,14 @@ ...@@ -7,13 +7,14 @@
*/ */
#include <string.h> #include <string.h>
#include <stdio.h>
#include "winnt.h" /* HEAP_ZERO_MEMORY */ #include "winnt.h" /* HEAP_ZERO_MEMORY */
#include "psdrv.h" #include "psdrv.h"
#include "options.h" #include "options.h"
#include "debugtools.h" #include "debugtools.h"
#include "heap.h" #include "heap.h"
DEFAULT_DEBUG_CHANNEL(psdrv) DEFAULT_DEBUG_CHANNEL(psdrv);
#include <ctype.h> #include <ctype.h>
/* ptr to fonts for which we have afm files */ /* ptr to fonts for which we have afm files */
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <string.h> #include <string.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "winnt.h" /* HEAP_ZERO_MEMORY */ #include "winnt.h" /* HEAP_ZERO_MEMORY */
#include "heap.h" #include "heap.h"
...@@ -13,7 +14,7 @@ ...@@ -13,7 +14,7 @@
#include "psdrv.h" #include "psdrv.h"
#include "winspool.h" #include "winspool.h"
DEFAULT_DEBUG_CHANNEL(psdrv) DEFAULT_DEBUG_CHANNEL(psdrv);
typedef struct { typedef struct {
char *key; char *key;
......
...@@ -6,12 +6,13 @@ ...@@ -6,12 +6,13 @@
*/ */
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "psdrv.h" #include "psdrv.h"
#include "winspool.h" #include "winspool.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(psdrv) DEFAULT_DEBUG_CHANNEL(psdrv);
static char psheader[] = /* title llx lly urx ury orientation */ static char psheader[] = /* title llx lly urx ury orientation */
"%%!PS-Adobe-3.0\n" "%%!PS-Adobe-3.0\n"
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winestring.h" #include "wine/winestring.h"
......
...@@ -4,505 +4,354 @@ ...@@ -4,505 +4,354 @@
#define DEBUG_CLASS_COUNT __DBCL_COUNT #define DEBUG_CLASS_COUNT __DBCL_COUNT
#ifdef DEBUG_RUNTIME static const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" }; char dbch_accel[] = "\003accel";
char dbch_advapi[] = "\003advapi";
const int dbch_accel = 0; char dbch_animate[] = "\003animate";
const int dbch_advapi = 1; char dbch_aspi[] = "\003aspi";
const int dbch_animate = 2; char dbch_atom[] = "\003atom";
const int dbch_aspi = 3; char dbch_avifile[] = "\003avifile";
const int dbch_atom = 4; char dbch_bitblt[] = "\003bitblt";
const int dbch_avifile = 5; char dbch_bitmap[] = "\003bitmap";
const int dbch_bitblt = 6; char dbch_caret[] = "\003caret";
const int dbch_bitmap = 7; char dbch_cdrom[] = "\003cdrom";
const int dbch_caret = 8; char dbch_class[] = "\003class";
const int dbch_cdrom = 9; char dbch_clipboard[] = "\003clipboard";
const int dbch_class = 10; char dbch_clipping[] = "\003clipping";
const int dbch_clipboard = 11; char dbch_combo[] = "\003combo";
const int dbch_clipping = 12; char dbch_comboex[] = "\003comboex";
const int dbch_combo = 13; char dbch_comm[] = "\003comm";
const int dbch_comboex = 14; char dbch_commctrl[] = "\003commctrl";
const int dbch_comm = 15; char dbch_commdlg[] = "\003commdlg";
const int dbch_commctrl = 16; char dbch_console[] = "\003console";
const int dbch_commdlg = 17; char dbch_crtdll[] = "\003crtdll";
const int dbch_console = 18; char dbch_cursor[] = "\003cursor";
const int dbch_crtdll = 19; char dbch_datetime[] = "\003datetime";
const int dbch_cursor = 20; char dbch_dc[] = "\003dc";
const int dbch_datetime = 21; char dbch_ddeml[] = "\003ddeml";
const int dbch_dc = 22; char dbch_ddraw[] = "\003ddraw";
const int dbch_ddeml = 23; char dbch_debug[] = "\003debug";
const int dbch_ddraw = 24; char dbch_debugstr[] = "\003debugstr";
const int dbch_debug = 25; char dbch_delayhlp[] = "\003delayhlp";
const int dbch_debugstr = 26; char dbch_dialog[] = "\003dialog";
const int dbch_delayhlp = 27; char dbch_dinput[] = "\003dinput";
const int dbch_dialog = 28; char dbch_dll[] = "\003dll";
const int dbch_dinput = 29; char dbch_dosfs[] = "\003dosfs";
const int dbch_dll = 30; char dbch_dosmem[] = "\003dosmem";
const int dbch_dosfs = 31; char dbch_dplay[] = "\003dplay";
const int dbch_dosmem = 32; char dbch_driver[] = "\003driver";
const int dbch_dplay = 33; char dbch_dsound[] = "\003dsound";
const int dbch_driver = 34; char dbch_edit[] = "\003edit";
const int dbch_dsound = 35; char dbch_elfdll[] = "\003elfdll";
const int dbch_edit = 36; char dbch_enhmetafile[] = "\003enhmetafile";
const int dbch_elfdll = 37; char dbch_event[] = "\003event";
const int dbch_enhmetafile = 38; char dbch_exec[] = "\003exec";
const int dbch_event = 39; char dbch_file[] = "\003file";
const int dbch_exec = 40; char dbch_fixup[] = "\003fixup";
const int dbch_file = 41; char dbch_font[] = "\003font";
const int dbch_fixup = 42; char dbch_gdi[] = "\003gdi";
const int dbch_font = 43; char dbch_global[] = "\003global";
const int dbch_gdi = 44; char dbch_graphics[] = "\003graphics";
const int dbch_global = 45; char dbch_header[] = "\003header";
const int dbch_graphics = 46; char dbch_heap[] = "\003heap";
const int dbch_header = 47; char dbch_hook[] = "\003hook";
const int dbch_heap = 48; char dbch_hotkey[] = "\003hotkey";
const int dbch_hook = 49; char dbch_icmp[] = "\003icmp";
const int dbch_hotkey = 50; char dbch_icon[] = "\003icon";
const int dbch_icmp = 51; char dbch_imagehlp[] = "\003imagehlp";
const int dbch_icon = 52; char dbch_imagelist[] = "\003imagelist";
const int dbch_imagehlp = 53; char dbch_imm[] = "\003imm";
const int dbch_imagelist = 54; char dbch_int[] = "\003int";
const int dbch_imm = 55; char dbch_int10[] = "\003int10";
const int dbch_int = 56; char dbch_int16[] = "\003int16";
const int dbch_int10 = 57; char dbch_int17[] = "\003int17";
const int dbch_int16 = 58; char dbch_int19[] = "\003int19";
const int dbch_int17 = 59; char dbch_int21[] = "\003int21";
const int dbch_int19 = 60; char dbch_int31[] = "\003int31";
const int dbch_int21 = 61; char dbch_io[] = "\003io";
const int dbch_int31 = 62; char dbch_ipaddress[] = "\003ipaddress";
const int dbch_io = 63; char dbch_key[] = "\003key";
const int dbch_ipaddress = 64; char dbch_keyboard[] = "\003keyboard";
const int dbch_key = 65; char dbch_ldt[] = "\003ldt";
const int dbch_keyboard = 66; char dbch_listbox[] = "\003listbox";
const int dbch_ldt = 67; char dbch_listview[] = "\003listview";
const int dbch_listbox = 68; char dbch_local[] = "\003local";
const int dbch_listview = 69; char dbch_mci[] = "\003mci";
const int dbch_local = 70; char dbch_mcianim[] = "\003mcianim";
const int dbch_mci = 71; char dbch_mciavi[] = "\003mciavi";
const int dbch_mcianim = 72; char dbch_mcicda[] = "\003mcicda";
const int dbch_mciavi = 73; char dbch_mcimidi[] = "\003mcimidi";
const int dbch_mcicda = 74; char dbch_mciwave[] = "\003mciwave";
const int dbch_mcimidi = 75; char dbch_mdi[] = "\003mdi";
const int dbch_mciwave = 76; char dbch_menu[] = "\003menu";
const int dbch_mdi = 77; char dbch_message[] = "\003message";
const int dbch_menu = 78; char dbch_metafile[] = "\003metafile";
const int dbch_message = 79; char dbch_midi[] = "\003midi";
const int dbch_metafile = 80; char dbch_mmaux[] = "\003mmaux";
const int dbch_midi = 81; char dbch_mmio[] = "\003mmio";
const int dbch_mmaux = 82; char dbch_mmsys[] = "\003mmsys";
const int dbch_mmio = 83; char dbch_mmtime[] = "\003mmtime";
const int dbch_mmsys = 84; char dbch_module[] = "\003module";
const int dbch_mmtime = 85; char dbch_monthcal[] = "\003monthcal";
const int dbch_module = 86; char dbch_mpr[] = "\003mpr";
const int dbch_monthcal = 87; char dbch_msacm[] = "\003msacm";
const int dbch_mpr = 88; char dbch_msg[] = "\003msg";
const int dbch_msacm = 89; char dbch_msvideo[] = "\003msvideo";
const int dbch_msg = 90; char dbch_nativefont[] = "\003nativefont";
const int dbch_msvideo = 91; char dbch_nonclient[] = "\003nonclient";
const int dbch_nativefont = 92; char dbch_ntdll[] = "\003ntdll";
const int dbch_nonclient = 93; char dbch_odbc[] = "\003odbc";
const int dbch_ntdll = 94; char dbch_ole[] = "\003ole";
const int dbch_odbc = 95; char dbch_pager[] = "\003pager";
const int dbch_ole = 96; char dbch_palette[] = "\003palette";
const int dbch_pager = 97; char dbch_pidl[] = "\003pidl";
const int dbch_palette = 98; char dbch_print[] = "\003print";
const int dbch_pidl = 99; char dbch_process[] = "\003process";
const int dbch_print = 100; char dbch_profile[] = "\003profile";
const int dbch_process = 101; char dbch_progress[] = "\003progress";
const int dbch_profile = 102; char dbch_prop[] = "\003prop";
const int dbch_progress = 103; char dbch_propsheet[] = "\003propsheet";
const int dbch_prop = 104; char dbch_psapi[] = "\003psapi";
const int dbch_propsheet = 105; char dbch_psdrv[] = "\003psdrv";
const int dbch_psapi = 106; char dbch_ras[] = "\003ras";
const int dbch_psdrv = 107; char dbch_rebar[] = "\003rebar";
const int dbch_ras = 108; char dbch_reg[] = "\003reg";
const int dbch_rebar = 109; char dbch_region[] = "\003region";
const int dbch_reg = 110; char dbch_relay[] = "\003relay";
const int dbch_region = 111; char dbch_resource[] = "\003resource";
const int dbch_relay = 112; char dbch_scroll[] = "\003scroll";
const int dbch_resource = 113; char dbch_security[] = "\003security";
const int dbch_scroll = 114; char dbch_segment[] = "\003segment";
const int dbch_security = 115; char dbch_seh[] = "\003seh";
const int dbch_segment = 116; char dbch_selector[] = "\003selector";
const int dbch_seh = 117; char dbch_sendmsg[] = "\003sendmsg";
const int dbch_selector = 118; char dbch_server[] = "\003server";
const int dbch_sendmsg = 119; char dbch_setupx[] = "\003setupx";
const int dbch_server = 120; char dbch_shell[] = "\003shell";
const int dbch_setupx = 121; char dbch_snoop[] = "\003snoop";
const int dbch_shell = 122; char dbch_sound[] = "\003sound";
const int dbch_snoop = 123; char dbch_static[] = "\003static";
const int dbch_sound = 124; char dbch_statusbar[] = "\003statusbar";
const int dbch_static = 125; char dbch_storage[] = "\003storage";
const int dbch_statusbar = 126; char dbch_stress[] = "\003stress";
const int dbch_storage = 127; char dbch_string[] = "\003string";
const int dbch_stress = 128; char dbch_syscolor[] = "\003syscolor";
const int dbch_string = 129; char dbch_system[] = "\003system";
const int dbch_syscolor = 130; char dbch_tab[] = "\003tab";
const int dbch_system = 131; char dbch_tape[] = "\003tape";
const int dbch_tab = 132; char dbch_tapi[] = "\003tapi";
const int dbch_tape = 133; char dbch_task[] = "\003task";
const int dbch_tapi = 134; char dbch_text[] = "\003text";
const int dbch_task = 135; char dbch_thread[] = "\003thread";
const int dbch_text = 136; char dbch_thunk[] = "\003thunk";
const int dbch_thread = 137; char dbch_timer[] = "\003timer";
const int dbch_thunk = 138; char dbch_toolbar[] = "\003toolbar";
const int dbch_timer = 139; char dbch_toolhelp[] = "\003toolhelp";
const int dbch_toolbar = 140; char dbch_tooltips[] = "\003tooltips";
const int dbch_toolhelp = 141; char dbch_trackbar[] = "\003trackbar";
const int dbch_tooltips = 142; char dbch_treeview[] = "\003treeview";
const int dbch_trackbar = 143; char dbch_ttydrv[] = "\003ttydrv";
const int dbch_treeview = 144; char dbch_tweak[] = "\003tweak";
const int dbch_ttydrv = 145; char dbch_typelib[] = "\003typelib";
const int dbch_tweak = 146; char dbch_updown[] = "\003updown";
const int dbch_typelib = 147; char dbch_ver[] = "\003ver";
const int dbch_updown = 148; char dbch_virtual[] = "\003virtual";
const int dbch_ver = 149; char dbch_vxd[] = "\003vxd";
const int dbch_virtual = 150; char dbch_wave[] = "\003wave";
const int dbch_vxd = 151; char dbch_win[] = "\003win";
const int dbch_wave = 152; char dbch_win16drv[] = "\003win16drv";
const int dbch_win = 153; char dbch_win32[] = "\003win32";
const int dbch_win16drv = 154; char dbch_wing[] = "\003wing";
const int dbch_win32 = 155; char dbch_winsock[] = "\003winsock";
const int dbch_wing = 156; char dbch_winspool[] = "\003winspool";
const int dbch_winsock = 157; char dbch_wnet[] = "\003wnet";
const int dbch_winspool = 158; char dbch_x11[] = "\003x11";
const int dbch_wnet = 159; char dbch_x11drv[] = "\003x11drv";
const int dbch_x11 = 160;
const int dbch_x11drv = 161;
#define DEBUG_CHANNEL_COUNT 162 #define DEBUG_CHANNEL_COUNT 162
char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = { static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {
{1, 1, 0, 0}, dbch_accel,
{1, 1, 0, 0}, dbch_advapi,
{1, 1, 0, 0}, dbch_animate,
{1, 1, 0, 0}, dbch_aspi,
{1, 1, 0, 0}, dbch_atom,
{1, 1, 0, 0}, dbch_avifile,
{1, 1, 0, 0}, dbch_bitblt,
{1, 1, 0, 0}, dbch_bitmap,
{1, 1, 0, 0}, dbch_caret,
{1, 1, 0, 0}, dbch_cdrom,
{1, 1, 0, 0}, dbch_class,
{1, 1, 0, 0}, dbch_clipboard,
{1, 1, 0, 0}, dbch_clipping,
{1, 1, 0, 0}, dbch_combo,
{1, 1, 0, 0}, dbch_comboex,
{1, 1, 0, 0}, dbch_comm,
{1, 1, 0, 0}, dbch_commctrl,
{1, 1, 0, 0}, dbch_commdlg,
{1, 1, 0, 0}, dbch_console,
{1, 1, 0, 0}, dbch_crtdll,
{1, 1, 0, 0}, dbch_cursor,
{1, 1, 0, 0}, dbch_datetime,
{1, 1, 0, 0}, dbch_dc,
{1, 1, 0, 0}, dbch_ddeml,
{1, 1, 0, 0}, dbch_ddraw,
{1, 1, 0, 0}, dbch_debug,
{1, 1, 0, 0}, dbch_debugstr,
{1, 1, 0, 0}, dbch_delayhlp,
{1, 1, 0, 0}, dbch_dialog,
{1, 1, 0, 0}, dbch_dinput,
{1, 1, 0, 0}, dbch_dll,
{1, 1, 0, 0}, dbch_dosfs,
{1, 1, 0, 0}, dbch_dosmem,
{1, 1, 0, 0}, dbch_dplay,
{1, 1, 0, 0}, dbch_driver,
{1, 1, 0, 0}, dbch_dsound,
{1, 1, 0, 0}, dbch_edit,
{1, 1, 0, 0}, dbch_elfdll,
{1, 1, 0, 0}, dbch_enhmetafile,
{1, 1, 0, 0}, dbch_event,
{1, 1, 0, 0}, dbch_exec,
{1, 1, 0, 0}, dbch_file,
{1, 1, 0, 0}, dbch_fixup,
{1, 1, 0, 0}, dbch_font,
{1, 1, 0, 0}, dbch_gdi,
{1, 1, 0, 0}, dbch_global,
{1, 1, 0, 0}, dbch_graphics,
{1, 1, 0, 0}, dbch_header,
{1, 1, 0, 0}, dbch_heap,
{1, 1, 0, 0}, dbch_hook,
{1, 1, 0, 0}, dbch_hotkey,
{1, 1, 0, 0}, dbch_icmp,
{1, 1, 0, 0}, dbch_icon,
{1, 1, 0, 0}, dbch_imagehlp,
{1, 1, 0, 0}, dbch_imagelist,
{1, 1, 0, 0}, dbch_imm,
{1, 1, 0, 0}, dbch_int,
{1, 1, 0, 0}, dbch_int10,
{1, 1, 0, 0}, dbch_int16,
{1, 1, 0, 0}, dbch_int17,
{1, 1, 0, 0}, dbch_int19,
{1, 1, 0, 0}, dbch_int21,
{1, 1, 0, 0}, dbch_int31,
{1, 1, 0, 0}, dbch_io,
{1, 1, 0, 0}, dbch_ipaddress,
{1, 1, 0, 0}, dbch_key,
{1, 1, 0, 0}, dbch_keyboard,
{1, 1, 0, 0}, dbch_ldt,
{1, 1, 0, 0}, dbch_listbox,
{1, 1, 0, 0}, dbch_listview,
{1, 1, 0, 0}, dbch_local,
{1, 1, 0, 0}, dbch_mci,
{1, 1, 0, 0}, dbch_mcianim,
{1, 1, 0, 0}, dbch_mciavi,
{1, 1, 0, 0}, dbch_mcicda,
{1, 1, 0, 0}, dbch_mcimidi,
{1, 1, 0, 0}, dbch_mciwave,
{1, 1, 0, 0}, dbch_mdi,
{1, 1, 0, 0}, dbch_menu,
{1, 1, 0, 0}, dbch_message,
{1, 1, 0, 0}, dbch_metafile,
{1, 1, 0, 0}, dbch_midi,
{1, 1, 0, 0}, dbch_mmaux,
{1, 1, 0, 0}, dbch_mmio,
{1, 1, 0, 0}, dbch_mmsys,
{1, 1, 0, 0}, dbch_mmtime,
{1, 1, 0, 0}, dbch_module,
{1, 1, 0, 0}, dbch_monthcal,
{1, 1, 0, 0}, dbch_mpr,
{1, 1, 0, 0}, dbch_msacm,
{1, 1, 0, 0}, dbch_msg,
{1, 1, 0, 0}, dbch_msvideo,
{1, 1, 0, 0}, dbch_nativefont,
{1, 1, 0, 0}, dbch_nonclient,
{1, 1, 0, 0}, dbch_ntdll,
{1, 1, 0, 0}, dbch_odbc,
{1, 1, 0, 0}, dbch_ole,
{1, 1, 0, 0}, dbch_pager,
{1, 1, 0, 0}, dbch_palette,
{1, 1, 0, 0}, dbch_pidl,
{1, 1, 0, 0}, dbch_print,
{1, 1, 0, 0}, dbch_process,
{1, 1, 0, 0}, dbch_profile,
{1, 1, 0, 0}, dbch_progress,
{1, 1, 0, 0}, dbch_prop,
{1, 1, 0, 0}, dbch_propsheet,
{1, 1, 0, 0}, dbch_psapi,
{1, 1, 0, 0}, dbch_psdrv,
{1, 1, 0, 0}, dbch_ras,
{1, 1, 0, 0}, dbch_rebar,
{1, 1, 0, 0}, dbch_reg,
{1, 1, 0, 0}, dbch_region,
{1, 1, 0, 0}, dbch_relay,
{1, 1, 0, 0}, dbch_resource,
{1, 1, 0, 0}, dbch_scroll,
{1, 1, 0, 0}, dbch_security,
{1, 1, 0, 0}, dbch_segment,
{1, 1, 0, 0}, dbch_seh,
{1, 1, 0, 0}, dbch_selector,
{1, 1, 0, 0}, dbch_sendmsg,
{1, 1, 0, 0}, dbch_server,
{1, 1, 0, 0}, dbch_setupx,
{1, 1, 0, 0}, dbch_shell,
{1, 1, 0, 0}, dbch_snoop,
{1, 1, 0, 0}, dbch_sound,
{1, 1, 0, 0}, dbch_static,
{1, 1, 0, 0}, dbch_statusbar,
{1, 1, 0, 0}, dbch_storage,
{1, 1, 0, 0}, dbch_stress,
{1, 1, 0, 0}, dbch_string,
{1, 1, 0, 0}, dbch_syscolor,
{1, 1, 0, 0}, dbch_system,
{1, 1, 0, 0}, dbch_tab,
{1, 1, 0, 0}, dbch_tape,
{1, 1, 0, 0}, dbch_tapi,
{1, 1, 0, 0}, dbch_task,
{1, 1, 0, 0}, dbch_text,
{1, 1, 0, 0}, dbch_thread,
{1, 1, 0, 0}, dbch_thunk,
{1, 1, 0, 0}, dbch_timer,
{1, 1, 0, 0}, dbch_toolbar,
{1, 1, 0, 0}, dbch_toolhelp,
{1, 1, 0, 0}, dbch_tooltips,
{1, 1, 0, 0}, dbch_trackbar,
{1, 1, 0, 0}, dbch_treeview,
{1, 1, 0, 0}, dbch_ttydrv,
{1, 1, 0, 0}, dbch_tweak,
{1, 1, 0, 0}, dbch_typelib,
{1, 1, 0, 0}, dbch_updown,
{1, 1, 0, 0}, dbch_ver,
{1, 1, 0, 0}, dbch_virtual,
{1, 1, 0, 0}, dbch_vxd,
{1, 1, 0, 0}, dbch_wave,
{1, 1, 0, 0}, dbch_win,
{1, 1, 0, 0}, dbch_win16drv,
{1, 1, 0, 0}, dbch_win32,
{1, 1, 0, 0}, dbch_wing,
{1, 1, 0, 0}, dbch_winsock,
{1, 1, 0, 0}, dbch_winspool,
{1, 1, 0, 0}, dbch_wnet,
{1, 1, 0, 0}, dbch_x11,
{1, 1, 0, 0} dbch_x11drv
}; };
const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = { int dbg_header_err( const char *dbg_channel, const char *func )
"accel", {
"advapi", return dbg_printf( "err:%s:%s ", dbg_channel + 1, func );
"animate", }
"aspi",
"atom", int dbg_header_fixme( const char *dbg_channel, const char *func )
"avifile", {
"bitblt", return dbg_printf( "fixme:%s:%s ", dbg_channel + 1, func );
"bitmap", }
"caret",
"cdrom",
"class",
"clipboard",
"clipping",
"combo",
"comboex",
"comm",
"commctrl",
"commdlg",
"console",
"crtdll",
"cursor",
"datetime",
"dc",
"ddeml",
"ddraw",
"debug",
"debugstr",
"delayhlp",
"dialog",
"dinput",
"dll",
"dosfs",
"dosmem",
"dplay",
"driver",
"dsound",
"edit",
"elfdll",
"enhmetafile",
"event",
"exec",
"file",
"fixup",
"font",
"gdi",
"global",
"graphics",
"header",
"heap",
"hook",
"hotkey",
"icmp",
"icon",
"imagehlp",
"imagelist",
"imm",
"int",
"int10",
"int16",
"int17",
"int19",
"int21",
"int31",
"io",
"ipaddress",
"key",
"keyboard",
"ldt",
"listbox",
"listview",
"local",
"mci",
"mcianim",
"mciavi",
"mcicda",
"mcimidi",
"mciwave",
"mdi",
"menu",
"message",
"metafile",
"midi",
"mmaux",
"mmio",
"mmsys",
"mmtime",
"module",
"monthcal",
"mpr",
"msacm",
"msg",
"msvideo",
"nativefont",
"nonclient",
"ntdll",
"odbc",
"ole",
"pager",
"palette",
"pidl",
"print",
"process",
"profile",
"progress",
"prop",
"propsheet",
"psapi",
"psdrv",
"ras",
"rebar",
"reg",
"region",
"relay",
"resource",
"scroll",
"security",
"segment",
"seh",
"selector",
"sendmsg",
"server",
"setupx",
"shell",
"snoop",
"sound",
"static",
"statusbar",
"storage",
"stress",
"string",
"syscolor",
"system",
"tab",
"tape",
"tapi",
"task",
"text",
"thread",
"thunk",
"timer",
"toolbar",
"toolhelp",
"tooltips",
"trackbar",
"treeview",
"ttydrv",
"tweak",
"typelib",
"updown",
"ver",
"virtual",
"vxd",
"wave",
"win",
"win16drv",
"win32",
"wing",
"winsock",
"winspool",
"wnet",
"x11",
"x11drv"
};
#endif /*DEBUG_RUNTIME*/ int dbg_header_warn( const char *dbg_channel, const char *func )
{
return dbg_printf( "warn:%s:%s ", dbg_channel + 1, func );
}
/* end of automatically generated debug.h */ int dbg_header_trace( const char *dbg_channel, const char *func )
{
return dbg_printf( "trace:%s:%s ", dbg_channel + 1, func );
}
...@@ -5,97 +5,91 @@ ...@@ -5,97 +5,91 @@
#ifdef __WINE__ /* Debugging interface is internal to Wine */ #ifdef __WINE__ /* Debugging interface is internal to Wine */
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include "config.h" #include "config.h"
#include "windef.h" #include "windef.h"
#define DEBUG_RUNTIME
struct _GUID; struct _GUID;
/* Internal definitions (do not use these directly) */ /* Internal definitions (do not use these directly) */
enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT }; enum __DEBUG_CLASS { __DBCL_FIXME, __DBCL_ERR, __DBCL_WARN, __DBCL_TRACE, __DBCL_COUNT };
extern char __debug_msg_enabled[][__DBCL_COUNT]; #ifndef NO_TRACE_MSGS
# define __GET_DEBUGGING_trace(dbch) ((dbch)[0] & (1 << __DBCL_TRACE))
#else
# define __GET_DEBUGGING_trace(dbch) 0
#endif
extern const char * const debug_cl_name[__DBCL_COUNT]; #ifndef NO_DEBUG_MSGS
extern const char * const debug_ch_name[]; # define __GET_DEBUGGING_warn(dbch) ((dbch)[0] & (1 << __DBCL_WARN))
# define __GET_DEBUGGING_fixme(dbch) ((dbch)[0] & (1 << __DBCL_FIXME))
#else
# define __GET_DEBUGGING_warn(dbch) 0
# define __GET_DEBUGGING_fixme(dbch) 0
#endif
/* define error macro regardless of what is configured */
#define __GET_DEBUGGING_err(dbch) ((dbch)[0] & (1 << __DBCL_ERR))
#define __GET_DEBUGGING(dbcl,dbch) (__debug_msg_enabled[(dbch)][(dbcl)]) #define __GET_DEBUGGING(dbcl,dbch) __GET_DEBUGGING_##dbcl(dbch)
#define __SET_DEBUGGING(dbcl,dbch,on) (__debug_msg_enabled[(dbch)][(dbcl)] = (on)) #define __SET_DEBUGGING(dbcl,dbch,on) \
((on) ? ((dbch)[0] |= 1 << (dbcl)) : ((dbch)[0] &= ~(1 << (dbcl))))
#ifndef __GNUC__ #ifndef __GNUC__
#define __FUNCTION__ "" #define __FUNCTION__ ""
#endif #endif
#define __DPRINTF(dbcl,dbch) \ #define __DPRINTF(dbcl,dbch) \
(!__GET_DEBUGGING(dbcl,dbch) || \ (!__GET_DEBUGGING(dbcl,(dbch)) || (dbg_header_##dbcl((dbch),__FUNCTION__),0)) ? \
(dbg_printf("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __FUNCTION__),0)) \ (void)0 : (void)dbg_printf
? 0 : dbg_printf
#define __DUMMY_DPRINTF 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
/* Exported definitions and macros */ /* Exported definitions and macros */
/* These function return a printable version of a string, including /* These function return a printable version of a string, including
quotes. The string will be valid for some time, but not indefinitely quotes. The string will be valid for some time, but not indefinitely
as strings are re-used. */ as strings are re-used. */
extern LPSTR debugstr_an (LPCSTR s, int n); extern LPCSTR debugstr_an (LPCSTR s, int n);
extern LPSTR debugstr_a (LPCSTR s); extern LPCSTR debugstr_wn (LPCWSTR s, int n);
extern LPSTR debugstr_wn (LPCWSTR s, int n); extern LPCSTR debugres_a (LPCSTR res);
extern LPSTR debugstr_w (LPCWSTR s); extern LPCSTR debugres_w (LPCWSTR res);
extern LPSTR debugres_a (LPCSTR res); extern LPCSTR debugstr_guid( const struct _GUID *id );
extern LPSTR debugres_w (LPCWSTR res); extern LPCSTR debugstr_hex_dump (const void *ptr, int len);
extern LPSTR debugstr_guid( const struct _GUID *id ); extern int dbg_header_err( const char *dbg_channel, const char *func );
extern LPSTR debugstr_hex_dump (const void *ptr, int len); extern int dbg_header_warn( const char *dbg_channel, const char *func );
extern int dbg_header_fixme( const char *dbg_channel, const char *func );
extern int dbg_header_trace( const char *dbg_channel, const char *func );
extern int dbg_vprintf( const char *format, va_list args ); extern int dbg_vprintf( const char *format, va_list args );
static inline LPCSTR debugstr_a( LPCSTR s ) { return debugstr_an( s, 80 ); }
static inline LPCSTR debugstr_w( LPCWSTR s ) { return debugstr_wn( s, 80 ); }
#ifdef __GNUC__ #ifdef __GNUC__
extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2))); extern int dbg_printf(const char *format, ...) __attribute__((format (printf,1,2)));
#else #else
extern int dbg_printf(const char *format, ...); extern int dbg_printf(const char *format, ...);
#endif #endif
/* use configure to allow user to compile out debugging messages */ #define TRACE __DPRINTF(trace,__dbch_default)
#ifndef NO_TRACE_MSGS #define TRACE_(ch) __DPRINTF(trace,dbch_##ch)
#define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT) #define TRACE_ON(ch) __GET_DEBUGGING(trace,dbch_##ch)
#define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
#define TRACE_ON(ch) __GET_DEBUGGING(__DBCL_TRACE,dbch_##ch)
#else
#define TRACE __DUMMY_DPRINTF
#define TRACE_(ch) __DUMMY_DPRINTF
#define TRACE_ON(ch) 0
#endif /* NO_TRACE_MSGS */
#ifndef NO_DEBUG_MSGS #define WARN __DPRINTF(warn,__dbch_default)
#define WARN __DPRINTF(__DBCL_WARN,*DBCH_DEFAULT) #define WARN_(ch) __DPRINTF(warn,dbch_##ch)
#define WARN_(ch) __DPRINTF(__DBCL_WARN,dbch_##ch) #define WARN_ON(ch) __GET_DEBUGGING(warn,dbch_##ch)
#define WARN_ON(ch) __GET_DEBUGGING(__DBCL_WARN,dbch_##ch)
#define FIXME __DPRINTF(__DBCL_FIXME,*DBCH_DEFAULT)
#define FIXME_(ch) __DPRINTF(__DBCL_FIXME,dbch_##ch)
#define FIXME_ON(ch) __GET_DEBUGGING(__DBCL_FIXME,dbch_##ch)
#else
#define WARN __DUMMY_DPRINTF
#define WARN_(ch) __DUMMY_DPRINTF
#define WARN_ON(ch) 0
#define FIXME __DUMMY_DPRINTF
#define FIXME_(ch) __DUMMY_DPRINTF
#define FIXME_ON(ch) 0
#endif /* NO_DEBUG_MSGS */
/* define error macro regardless of what is configured */ #define FIXME __DPRINTF(fixme,__dbch_default)
/* Solaris got an 'ERR' define in <sys/reg.h> */ #define FIXME_(ch) __DPRINTF(fixme,dbch_##ch)
#undef ERR #define FIXME_ON(ch) __GET_DEBUGGING(fixme,dbch_##ch)
#define ERR __DPRINTF(__DBCL_ERR,*DBCH_DEFAULT)
#define ERR_(ch) __DPRINTF(__DBCL_ERR,dbch_##ch) #undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
#define ERR_ON(ch) __GET_DEBUGGING(__DBCL_ERR,dbch_##ch) #define ERR __DPRINTF(err,__dbch_default)
#define ERR_(ch) __DPRINTF(err,dbch_##ch)
#define ERR_ON(ch) __GET_DEBUGGING(err,dbch_##ch)
#define DECLARE_DEBUG_CHANNEL(ch) \ #define DECLARE_DEBUG_CHANNEL(ch) \
extern const int dbch_##ch; extern char dbch_##ch[];
#define DEFAULT_DEBUG_CHANNEL(ch) \ #define DEFAULT_DEBUG_CHANNEL(ch) \
extern const int dbch_##ch; static const int *const DBCH_DEFAULT = &dbch_##ch; extern char dbch_##ch[]; static char * const __dbch_default = dbch_##ch;
#define DPRINTF dbg_printf #define DPRINTF dbg_printf
#define MESSAGE dbg_printf #define MESSAGE dbg_printf
......
...@@ -218,7 +218,7 @@ extern void ASPI_DOS_HandleInt(CONTEXT86 *context); ...@@ -218,7 +218,7 @@ extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
(!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff)) (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
#define INT_BARF(context,num) \ #define INT_BARF(context,num) \
fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \ ERR( "int%x: unknown/not implemented parameters:\n" \
"int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \ "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
"SI %04x, DI %04x, DS %04x, ES %04x\n", \ "SI %04x, DI %04x, DS %04x, ES %04x\n", \
(num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \ (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
#include "debugtools.h" #include "debugtools.h"
#include "winerror.h" #include "winerror.h"
DEFAULT_DEBUG_CHANNEL(global) DEFAULT_DEBUG_CHANNEL(global);
/* Global arena block */ /* Global arena block */
typedef struct typedef struct
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winestring.h" #include "wine/winestring.h"
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
#include "toolhelp.h" #include "toolhelp.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(heap) DEFAULT_DEBUG_CHANNEL(heap);
/* Note: the heap data structures are based on what Pietrek describes in his /* Note: the heap data structures are based on what Pietrek describes in his
* book 'Windows 95 System Programming Secrets'. The layout is not exactly * book 'Windows 95 System Programming Secrets'. The layout is not exactly
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
#include "config.h" #include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "ldt.h" #include "ldt.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ldt) DEFAULT_DEBUG_CHANNEL(ldt);
#ifdef __i386__ #ifdef __i386__
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
#include "server.h" #include "server.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(virtual) DEFAULT_DEBUG_CHANNEL(virtual);
#ifndef MS_SYNC #ifndef MS_SYNC
#define MS_SYNC 0 #define MS_SYNC 0
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include "winbase.h" #include "winbase.h"
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "wine/winestring.h" #include "wine/winestring.h"
...@@ -16,7 +17,7 @@ ...@@ -16,7 +17,7 @@
#include "winerror.h" #include "winerror.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(reg) DEFAULT_DEBUG_CHANNEL(reg);
static BYTE PF[64] = {0,}; static BYTE PF[64] = {0,};
......
...@@ -52,8 +52,7 @@ gimme1 (int n) ...@@ -52,8 +52,7 @@ gimme1 (int n)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
LPSTR LPCSTR debugstr_an (LPCSTR src, int n)
debugstr_an (LPCSTR src, int n)
{ {
LPSTR dst, res; LPSTR dst, res;
...@@ -96,16 +95,7 @@ debugstr_an (LPCSTR src, int n) ...@@ -96,16 +95,7 @@ debugstr_an (LPCSTR src, int n)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
LPSTR LPCSTR debugstr_wn (LPCWSTR src, int n)
debugstr_a (LPCSTR s)
{
return debugstr_an (s, 80);
}
/* ---------------------------------------------------------------------- */
LPSTR
debugstr_wn (LPCWSTR src, int n)
{ {
LPSTR dst, res; LPSTR dst, res;
...@@ -147,36 +137,30 @@ debugstr_wn (LPCWSTR src, int n) ...@@ -147,36 +137,30 @@ debugstr_wn (LPCWSTR src, int n)
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
LPSTR
debugstr_w (LPCWSTR s)
{
return debugstr_wn (s, 80);
}
/* ---------------------------------------------------------------------- */
/* This routine returns a nicely formated name of the resource res /* This routine returns a nicely formated name of the resource res
If the resource name is a string, it will return '<res-name>' If the resource name is a string, it will return '<res-name>'
If it is a number, it will return #<4-digit-hex-number> */ If it is a number, it will return #<4-digit-hex-number> */
LPSTR debugres_a( LPCSTR res ) LPCSTR debugres_a( LPCSTR res )
{ {
char resname[10]; char *resname;
if (HIWORD(res)) return debugstr_a(res); if (HIWORD(res)) return debugstr_a(res);
sprintf(resname, "#%04x", LOWORD(res)); resname = gimme1(6);
return debugstr_a (resname); sprintf(resname, "#%04x", LOWORD(res) );
return resname;
} }
LPSTR debugres_w( LPCWSTR res ) LPCSTR debugres_w( LPCWSTR res )
{ {
char resname[10]; char *resname;
if (HIWORD(res)) return debugstr_w(res); if (HIWORD(res)) return debugstr_w(res);
sprintf(resname, "#%04x", LOWORD(res)); resname = gimme1(6);
return debugstr_a (resname); sprintf( resname, "#%04x", LOWORD(res) );
return resname;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
LPSTR debugstr_guid( const GUID *id ) LPCSTR debugstr_guid( const GUID *id )
{ {
LPSTR str; LPSTR str;
...@@ -232,7 +216,6 @@ int dbg_printf(const char *format, ...) ...@@ -232,7 +216,6 @@ int dbg_printf(const char *format, ...)
} }
/*--< Function >--------------------------------------------------------- /*--< Function >---------------------------------------------------------
** **
** debugstr_hex_dump ** debugstr_hex_dump
...@@ -252,8 +235,7 @@ int dbg_printf(const char *format, ...) ...@@ -252,8 +235,7 @@ int dbg_printf(const char *format, ...)
** TRACE("struct dump is \n%s", debugstr_hex_dump(&x, sizeof(x))); ** TRACE("struct dump is \n%s", debugstr_hex_dump(&x, sizeof(x)));
** **
**-------------------------------------------------------------------------*/ **-------------------------------------------------------------------------*/
LPSTR LPCSTR debugstr_hex_dump (const void *ptr, int len)
debugstr_hex_dump (const void *ptr, int len)
{ {
/* Locals */ /* Locals */
char dumpbuf[59]; char dumpbuf[59];
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "windef.h" #include "windef.h"
......
...@@ -104,6 +104,7 @@ struct options Options = ...@@ -104,6 +104,7 @@ struct options Options =
FALSE, /* Perfect graphics */ FALSE, /* Perfect graphics */
FALSE, /* No DGA */ FALSE, /* No DGA */
FALSE, /* No XSHM */ FALSE, /* No XSHM */
FALSE, /* DXGrab */
NULL, /* Alternate config file name */ NULL, /* Alternate config file name */
0 /* screenDepth */ 0 /* screenDepth */
}; };
...@@ -194,7 +195,7 @@ BOOL MAIN_ParseDebugOptions(char *options) ...@@ -194,7 +195,7 @@ BOOL MAIN_ParseDebugOptions(char *options)
int l, cls, dotracerelay = TRACE_ON(relay); int l, cls, dotracerelay = TRACE_ON(relay);
l = strlen(options); l = strlen(options);
if (l<3) if (l<2)
return FALSE; return FALSE;
if (options[l-1]=='\n') options[l-1]='\0'; if (options[l-1]=='\n') options[l-1]='\0';
do do
...@@ -226,7 +227,7 @@ BOOL MAIN_ParseDebugOptions(char *options) ...@@ -226,7 +227,7 @@ BOOL MAIN_ParseDebugOptions(char *options)
for (i=0; i<DEBUG_CHANNEL_COUNT; i++) for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
for(j=0; j<DEBUG_CLASS_COUNT; j++) for(j=0; j<DEBUG_CLASS_COUNT; j++)
if(cls == -1 || cls == j) if(cls == -1 || cls == j)
__SET_DEBUGGING( j, i, (*options=='+') ); __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
} }
else if (!lstrncmpiA(options+1, "relay=", 6) || else if (!lstrncmpiA(options+1, "relay=", 6) ||
!lstrncmpiA(options+1, "snoop=", 6)) !lstrncmpiA(options+1, "snoop=", 6))
...@@ -235,10 +236,11 @@ BOOL MAIN_ParseDebugOptions(char *options) ...@@ -235,10 +236,11 @@ BOOL MAIN_ParseDebugOptions(char *options)
char *s, *s2, ***output, c; char *s, *s2, ***output, c;
for (i=0; i<DEBUG_CHANNEL_COUNT; i++) for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
if (debug_ch_name && (!lstrncmpiA(debug_ch_name[i],options+1,5))){ if (!strncasecmp( debug_channels[i] + 1, options + 1, 5))
{
for(j=0; j<DEBUG_CLASS_COUNT; j++) for(j=0; j<DEBUG_CLASS_COUNT; j++)
if(cls == -1 || cls == j) if(cls == -1 || cls == j)
__SET_DEBUGGING( j, i, 1 ); __SET_DEBUGGING( j, debug_channels[i], 1 );
break; break;
} }
/* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */ /* should never happen, maybe assert(i!=DEBUG_CHANNEL_COUNT)? */
...@@ -277,10 +279,11 @@ BOOL MAIN_ParseDebugOptions(char *options) ...@@ -277,10 +279,11 @@ BOOL MAIN_ParseDebugOptions(char *options)
{ {
int i, j; int i, j;
for (i=0; i<DEBUG_CHANNEL_COUNT; i++) for (i=0; i<DEBUG_CHANNEL_COUNT; i++)
if (debug_ch_name && (!lstrncmpiA(options+1,debug_ch_name[i],l-1))){ if (!strncasecmp( debug_channels[i] + 1, options + 1, l - 1) && !debug_channels[i][l])
{
for(j=0; j<DEBUG_CLASS_COUNT; j++) for(j=0; j<DEBUG_CLASS_COUNT; j++)
if(cls == -1 || cls == j) if(cls == -1 || cls == j)
__SET_DEBUGGING( j, i, (*options=='+') ); __SET_DEBUGGING( j, debug_channels[i], (*options=='+') );
break; break;
} }
if (i==DEBUG_CHANNEL_COUNT) if (i==DEBUG_CHANNEL_COUNT)
...@@ -316,8 +319,7 @@ BOOL MAIN_ParseDebugOptions(char *options) ...@@ -316,8 +319,7 @@ BOOL MAIN_ParseDebugOptions(char *options)
MESSAGE("Available message types:\n"); MESSAGE("Available message types:\n");
MESSAGE("%-9s ","all"); MESSAGE("%-9s ","all");
for(i=0;i<DEBUG_CHANNEL_COUNT;i++) for(i=0;i<DEBUG_CHANNEL_COUNT;i++)
if(debug_ch_name[i]) MESSAGE("%-9s%c",debug_channels[i] + 1,
MESSAGE("%-9s%c",debug_ch_name[i],
(((i+2)%8==0)?'\n':' ')); (((i+2)%8==0)?'\n':' '));
MESSAGE("\n\n"); MESSAGE("\n\n");
ExitProcess(1); ExitProcess(1);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
#include "server.h" #include "server.h"
#include "services.h" #include "services.h"
DEFAULT_DEBUG_CHANNEL(reg) DEFAULT_DEBUG_CHANNEL(reg);
static void REGISTRY_Init(void); static void REGISTRY_Init(void);
/* FIXME: following defines should be configured global ... */ /* FIXME: following defines should be configured global ... */
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "callback.h" #include "callback.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int31) DEFAULT_DEBUG_CHANNEL(int31);
#define DOS_GET_DRIVE(reg) ((reg) ? (reg) - 1 : DRIVE_GetCurrentDrive()) #define DOS_GET_DRIVE(reg) ((reg) ? (reg) - 1 : DRIVE_GetCurrentDrive())
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "miscemu.h" #include "miscemu.h"
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int);
/********************************************************************** /**********************************************************************
* INT_Int2aHandler * INT_Int2aHandler
* *
......
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "msdos.h"
#include "miscemu.h" #include "miscemu.h"
/* #define DEBUG_INT */
#include "debugtools.h" #include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int);
/********************************************************************** /**********************************************************************
* INT_Int3dHandler * INT_Int3dHandler
* *
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
#include <stdio.h> #include <stdio.h>
#include "miscemu.h" #include "miscemu.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int);
/*********************************************************************** /***********************************************************************
* INT_Int41Handler * INT_Int41Handler
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include <stdio.h> #include <stdio.h>
#include "miscemu.h" #include "miscemu.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int);
/*********************************************************************** /***********************************************************************
* INT_Int4bHandler * INT_Int4bHandler
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include "winbase.h" #include "winbase.h"
#include "winnt.h" #include "winnt.h"
......
...@@ -21,16 +21,14 @@ cat <<EOF ...@@ -21,16 +21,14 @@ cat <<EOF
#define DEBUG_CLASS_COUNT __DBCL_COUNT #define DEBUG_CLASS_COUNT __DBCL_COUNT
#ifdef DEBUG_RUNTIME static const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
const char * const debug_cl_name[] = { "fixme", "err", "warn", "trace" };
EOF EOF
chno=0 chno=0
for ch in $DEBUG_CHANNELS for ch in $DEBUG_CHANNELS
do do
echo "const int dbch_$ch = $chno;" echo "char dbch_$ch[] = \"\\003$ch\";"
chno=`expr $chno + 1` chno=`expr $chno + 1`
done done
echo echo
...@@ -38,35 +36,25 @@ echo "#define DEBUG_CHANNEL_COUNT $chno" ...@@ -38,35 +36,25 @@ echo "#define DEBUG_CHANNEL_COUNT $chno"
count=1 count=1
echo echo
echo 'char __debug_msg_enabled[DEBUG_CHANNEL_COUNT][DEBUG_CLASS_COUNT] = {' echo 'static char * const debug_channels[DEBUG_CHANNEL_COUNT] = {'
for ch in $DEBUG_CHANNELS for ch in $DEBUG_CHANNELS
do do
if [ "${count}" != "${chno}" ]; then if [ "${count}" != "${chno}" ]; then
echo "{1, 1, 0, 0}," echo " dbch_${ch},"
else else
echo "{1, 1, 0, 0}" echo " dbch_${ch}"
fi fi
count=`expr $count + 1` count=`expr $count + 1`
done done
echo '};' echo '};'
count=1 for cls in err fixme warn trace
echo
echo 'const char * const debug_ch_name[DEBUG_CHANNEL_COUNT] = {'
for ch in $DEBUG_CHANNELS
do do
if [ "${count}" != "${chno}" ]; then cat <<EOF
echo "\"${ch}\",";
else
echo "\"${ch}\"";
fi
count=`expr $count + 1`
done
echo '};'
cat <<EOF int dbg_header_$cls( const char *dbg_channel, const char *func )
{
#endif /*DEBUG_RUNTIME*/ return dbg_printf( "$cls:%s:%s ", dbg_channel + 1, func );
}
/* end of automatically generated debug.h */
EOF EOF
done
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
*/ */
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -26,9 +28,8 @@ ...@@ -26,9 +28,8 @@
#include "syslevel.h" #include "syslevel.h"
#include "winerror.h" #include "winerror.h"
DECLARE_DEBUG_CHANNEL(thunk) DEFAULT_DEBUG_CHANNEL(thunk);
DECLARE_DEBUG_CHANNEL(dosmem) DECLARE_DEBUG_CHANNEL(win32);
DECLARE_DEBUG_CHANNEL(win32)
/*********************************************************************** /***********************************************************************
...@@ -42,7 +43,7 @@ DECLARE_DEBUG_CHANNEL(win32) ...@@ -42,7 +43,7 @@ DECLARE_DEBUG_CHANNEL(win32)
*/ */
void WINAPI LogApiThk( LPSTR func ) void WINAPI LogApiThk( LPSTR func )
{ {
TRACE_(thunk)( "%s\n", debugstr_a(func) ); TRACE( "%s\n", debugstr_a(func) );
} }
/*********************************************************************** /***********************************************************************
...@@ -52,7 +53,7 @@ void WINAPI LogApiThk( LPSTR func ) ...@@ -52,7 +53,7 @@ void WINAPI LogApiThk( LPSTR func )
*/ */
void WINAPI LogApiThkLSF( LPSTR func, CONTEXT86 *context ) void WINAPI LogApiThkLSF( LPSTR func, CONTEXT86 *context )
{ {
TRACE_(thunk)( "%s\n", debugstr_a(func) ); TRACE( "%s\n", debugstr_a(func) );
} }
/*********************************************************************** /***********************************************************************
...@@ -62,7 +63,7 @@ void WINAPI LogApiThkLSF( LPSTR func, CONTEXT86 *context ) ...@@ -62,7 +63,7 @@ void WINAPI LogApiThkLSF( LPSTR func, CONTEXT86 *context )
*/ */
void WINAPI LogApiThkSL( LPSTR func, CONTEXT86 *context ) void WINAPI LogApiThkSL( LPSTR func, CONTEXT86 *context )
{ {
TRACE_(thunk)( "%s\n", debugstr_a(func) ); TRACE( "%s\n", debugstr_a(func) );
} }
/*********************************************************************** /***********************************************************************
...@@ -72,7 +73,7 @@ void WINAPI LogApiThkSL( LPSTR func, CONTEXT86 *context ) ...@@ -72,7 +73,7 @@ void WINAPI LogApiThkSL( LPSTR func, CONTEXT86 *context )
*/ */
void WINAPI LogCBThkSL( LPSTR func, CONTEXT86 *context ) void WINAPI LogCBThkSL( LPSTR func, CONTEXT86 *context )
{ {
TRACE_(thunk)( "%s\n", debugstr_a(func) ); TRACE( "%s\n", debugstr_a(func) );
} }
/*********************************************************************** /***********************************************************************
...@@ -135,7 +136,7 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32, ...@@ -135,7 +136,7 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32,
if ((hmod = LoadLibrary16(module)) <= 32) if ((hmod = LoadLibrary16(module)) <= 32)
{ {
ERR_(thunk)("(%s, %s, %s): Unable to load '%s', error %d\n", ERR("(%s, %s, %s): Unable to load '%s', error %d\n",
module, func, module32, module, hmod); module, func, module32, module, hmod);
return 0; return 0;
} }
...@@ -143,14 +144,14 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32, ...@@ -143,14 +144,14 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32,
if ( !(ordinal = NE_GetOrdinal(hmod, func)) if ( !(ordinal = NE_GetOrdinal(hmod, func))
|| !(TD16 = PTR_SEG_TO_LIN(NE_GetEntryPointEx(hmod, ordinal, FALSE)))) || !(TD16 = PTR_SEG_TO_LIN(NE_GetEntryPointEx(hmod, ordinal, FALSE))))
{ {
ERR_(thunk)("(%s, %s, %s): Unable to find '%s'\n", ERR("(%s, %s, %s): Unable to find '%s'\n",
module, func, module32, func); module, func, module32, func);
return 0; return 0;
} }
if (TD32 && memcmp(TD16->magic, TD32->magic, 4)) if (TD32 && memcmp(TD16->magic, TD32->magic, 4))
{ {
ERR_(thunk)("(%s, %s, %s): Bad magic %c%c%c%c (should be %c%c%c%c)\n", ERR("(%s, %s, %s): Bad magic %c%c%c%c (should be %c%c%c%c)\n",
module, func, module32, module, func, module32,
TD16->magic[0], TD16->magic[1], TD16->magic[2], TD16->magic[3], TD16->magic[0], TD16->magic[1], TD16->magic[2], TD16->magic[3],
TD32->magic[0], TD32->magic[1], TD32->magic[2], TD32->magic[3]); TD32->magic[0], TD32->magic[1], TD32->magic[2], TD32->magic[3]);
...@@ -159,14 +160,14 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32, ...@@ -159,14 +160,14 @@ static LPVOID _loadthunk(LPCSTR module, LPCSTR func, LPCSTR module32,
if (TD32 && TD16->checksum != TD32->checksum) if (TD32 && TD16->checksum != TD32->checksum)
{ {
ERR_(thunk)("(%s, %s, %s): Wrong checksum %08lx (should be %08lx)\n", ERR("(%s, %s, %s): Wrong checksum %08lx (should be %08lx)\n",
module, func, module32, TD16->checksum, TD32->checksum); module, func, module32, TD16->checksum, TD32->checksum);
return 0; return 0;
} }
if (!TD32 && checksum && checksum != *(LPDWORD)TD16) if (!TD32 && checksum && checksum != *(LPDWORD)TD16)
{ {
ERR_(thunk)("(%s, %s, %s): Wrong checksum %08lx (should be %08lx)\n", ERR("(%s, %s, %s): Wrong checksum %08lx (should be %08lx)\n",
module, func, module32, *(LPDWORD)TD16, checksum); module, func, module32, *(LPDWORD)TD16, checksum);
return 0; return 0;
} }
...@@ -209,19 +210,19 @@ UINT WINAPI ThunkConnect32( ...@@ -209,19 +210,19 @@ UINT WINAPI ThunkConnect32(
{ {
directionSL = TRUE; directionSL = TRUE;
TRACE_(thunk)("SL01 thunk %s (%lx) <- %s (%s), Reason: %ld\n", TRACE("SL01 thunk %s (%lx) <- %s (%s), Reason: %ld\n",
module32, (DWORD)TD, module16, thunkfun16, dwReason); module32, (DWORD)TD, module16, thunkfun16, dwReason);
} }
else if (!strncmp(TD->magic, "LS01", 4)) else if (!strncmp(TD->magic, "LS01", 4))
{ {
directionSL = FALSE; directionSL = FALSE;
TRACE_(thunk)("LS01 thunk %s (%lx) -> %s (%s), Reason: %ld\n", TRACE("LS01 thunk %s (%lx) -> %s (%s), Reason: %ld\n",
module32, (DWORD)TD, module16, thunkfun16, dwReason); module32, (DWORD)TD, module16, thunkfun16, dwReason);
} }
else else
{ {
ERR_(thunk)("Invalid magic %c%c%c%c\n", ERR("Invalid magic %c%c%c%c\n",
TD->magic[0], TD->magic[1], TD->magic[2], TD->magic[3]); TD->magic[0], TD->magic[1], TD->magic[2], TD->magic[3]);
return 0; return 0;
} }
...@@ -242,7 +243,7 @@ UINT WINAPI ThunkConnect32( ...@@ -242,7 +243,7 @@ UINT WINAPI ThunkConnect32(
if (SL16->fpData == NULL) if (SL16->fpData == NULL)
{ {
ERR_(thunk)("ThunkConnect16 was not called!\n"); ERR("ThunkConnect16 was not called!\n");
return 0; return 0;
} }
...@@ -255,7 +256,7 @@ UINT WINAPI ThunkConnect32( ...@@ -255,7 +256,7 @@ UINT WINAPI ThunkConnect32(
tdb->next = SL32->data->targetDB; /* FIXME: not thread-safe! */ tdb->next = SL32->data->targetDB; /* FIXME: not thread-safe! */
SL32->data->targetDB = tdb; SL32->data->targetDB = tdb;
TRACE_(thunk)("Process %08lx allocated TargetDB entry for ThunkDataSL %08lx\n", TRACE("Process %08lx allocated TargetDB entry for ThunkDataSL %08lx\n",
(DWORD)PROCESS_Current(), (DWORD)SL32->data); (DWORD)PROCESS_Current(), (DWORD)SL32->data);
} }
else else
...@@ -806,7 +807,7 @@ BOOL WINAPI SSInit16() ...@@ -806,7 +807,7 @@ BOOL WINAPI SSInit16()
*/ */
BOOL WINAPI SSOnBigStack() BOOL WINAPI SSOnBigStack()
{ {
TRACE_(thunk)("Yes, thunking is initialized\n"); TRACE("Yes, thunking is initialized\n");
return TRUE; return TRUE;
} }
...@@ -874,12 +875,12 @@ DWORD WINAPIV SSCall( ...@@ -874,12 +875,12 @@ DWORD WINAPIV SSCall(
case 48: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11]); case 48: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11]);
break; break;
default: default:
WARN_(thunk)("Unsupported nr of arguments, %ld\n",nr); WARN("Unsupported nr of arguments, %ld\n",nr);
ret = 0; ret = 0;
break; break;
} }
TRACE_(thunk)(" returning %ld ...\n",ret); TRACE(" returning %ld ...\n",ret);
return ret; return ret;
} }
...@@ -998,7 +999,7 @@ BOOL16 WINAPI IsPeFormat16( ...@@ -998,7 +999,7 @@ BOOL16 WINAPI IsPeFormat16(
return FALSE; return FALSE;
} }
if (mzh.e_magic!=IMAGE_DOS_SIGNATURE) { if (mzh.e_magic!=IMAGE_DOS_SIGNATURE) {
WARN_(dosmem)("File has not got dos signature!\n"); WARN("File has not got dos signature!\n");
_lclose(hf); _lclose(hf);
return FALSE; return FALSE;
} }
...@@ -1051,7 +1052,7 @@ void WINAPI K32Thk1632Prolog( CONTEXT86 *context ) ...@@ -1051,7 +1052,7 @@ void WINAPI K32Thk1632Prolog( CONTEXT86 *context )
char *stack32 = (char *)NtCurrentTeb()->cur_stack - argSize; char *stack32 = (char *)NtCurrentTeb()->cur_stack - argSize;
STACK16FRAME *frame16 = (STACK16FRAME *)stack16 - 1; STACK16FRAME *frame16 = (STACK16FRAME *)stack16 - 1;
TRACE_(thunk)("before SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n", TRACE("before SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack); EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack);
memset(frame16, '\0', sizeof(STACK16FRAME)); memset(frame16, '\0', sizeof(STACK16FRAME));
...@@ -1064,7 +1065,7 @@ void WINAPI K32Thk1632Prolog( CONTEXT86 *context ) ...@@ -1064,7 +1065,7 @@ void WINAPI K32Thk1632Prolog( CONTEXT86 *context )
ESP_reg(context) = (DWORD)stack32 + 4; ESP_reg(context) = (DWORD)stack32 + 4;
EBP_reg(context) = ESP_reg(context) + argSize; EBP_reg(context) = ESP_reg(context) + argSize;
TRACE_(thunk)("after SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n", TRACE("after SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack); EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack);
} }
...@@ -1092,7 +1093,7 @@ void WINAPI K32Thk1632Epilog( CONTEXT86 *context ) ...@@ -1092,7 +1093,7 @@ void WINAPI K32Thk1632Epilog( CONTEXT86 *context )
DWORD nArgsPopped = ESP_reg(context) - (DWORD)stack32; DWORD nArgsPopped = ESP_reg(context) - (DWORD)stack32;
TRACE_(thunk)("before SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n", TRACE("before SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack); EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack);
NtCurrentTeb()->cur_stack = (DWORD)frame16->frame32; NtCurrentTeb()->cur_stack = (DWORD)frame16->frame32;
...@@ -1100,7 +1101,7 @@ void WINAPI K32Thk1632Epilog( CONTEXT86 *context ) ...@@ -1100,7 +1101,7 @@ void WINAPI K32Thk1632Epilog( CONTEXT86 *context )
ESP_reg(context) = (DWORD)stack16 + nArgsPopped; ESP_reg(context) = (DWORD)stack16 + nArgsPopped;
EBP_reg(context) = frame16->ebp; EBP_reg(context) = frame16->ebp;
TRACE_(thunk)("after SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n", TRACE("after SYSTHUNK hack: EBP: %08lx ESP: %08lx cur_stack: %08lx\n",
EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack); EBP_reg(context), ESP_reg(context), NtCurrentTeb()->cur_stack);
} }
} }
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
#include "windef.h" #include "windef.h"
#include "x11drv.h" #include "x11drv.h"
DEFAULT_DEBUG_CHANNEL(event) DEFAULT_DEBUG_CHANNEL(event);
DECLARE_DEBUG_CHANNEL(win) DECLARE_DEBUG_CHANNEL(win);
/* X context to associate a hwnd to an X window */ /* X context to associate a hwnd to an X window */
extern XContext winContext; extern XContext winContext;
...@@ -1005,20 +1005,19 @@ static Atom EVENT_SelectionRequest_TARGETS( Window requestor, Atom target, Atom ...@@ -1005,20 +1005,19 @@ static Atom EVENT_SelectionRequest_TARGETS( Window requestor, Atom target, Atom
} }
} }
#ifdef DEBUG_RUNTIME if (TRACE_ON(event))
{
int i;
for ( i = 0; i < cTargets; i++)
{ {
if (targets[i]) int i;
for ( i = 0; i < cTargets; i++)
{ {
char *itemFmtName = TSXGetAtomName(display, targets[i]); if (targets[i])
TRACE("\tAtom# %d: Type %s\n", i, itemFmtName); {
TSXFree(itemFmtName); char *itemFmtName = TSXGetAtomName(display, targets[i]);
TRACE("\tAtom# %d: Type %s\n", i, itemFmtName);
TSXFree(itemFmtName);
}
} }
} }
}
#endif
/* Update the X property */ /* Update the X property */
TRACE("\tUpdating property %s...", TSXGetAtomName(display, rprop)); TRACE("\tUpdating property %s...", TSXGetAtomName(display, rprop));
......
...@@ -258,16 +258,7 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[]) ...@@ -258,16 +258,7 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[])
if (X11DRV_USER_GetResource( db, ".debugoptions", &value)) if (X11DRV_USER_GetResource( db, ".debugoptions", &value))
MAIN_ParseDebugOptions((char*)value.addr); MAIN_ParseDebugOptions((char*)value.addr);
if (X11DRV_USER_GetResource( db, ".debugmsg", &value)) if (X11DRV_USER_GetResource( db, ".debugmsg", &value))
{ MAIN_ParseDebugOptions((char*)value.addr);
#ifndef DEBUG_RUNTIME
MESSAGE("%s: Option \"-debugmsg\" not implemented.\n" \
" Recompile with DEBUG_RUNTIME in include/debugtools.h defined.\n",
argv[0]);
exit(1);
#else
MAIN_ParseDebugOptions((char*)value.addr);
#endif
}
if (X11DRV_USER_GetResource( db, ".dll", &value)) if (X11DRV_USER_GetResource( db, ".dll", &value))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment