Got rid of dsprintf and related macros.

This commit is contained in:
Alexandre Julliard 1999-08-04 12:22:42 +00:00
parent dbab5e2666
commit 15de615276
11 changed files with 126 additions and 149 deletions

View file

@ -636,15 +636,13 @@ static BOOL LISTBOX_SetTabStops( WND *wnd, LB_DESCR *descr, INT count,
{
INT i;
LPINT16 p = (LPINT16)tabs;
dbg_decl_str(listbox, 256);
TRACE("[%04x]: settabstops ", wnd->hwndSelf );
for (i = 0; i < descr->nb_tabs; i++) {
descr->tabs[i] = *p++<<1; /* FIXME */
if(TRACE_ON(listbox))
dsprintf(listbox, "%hd ", descr->tabs[i]);
if (TRACE_ON(listbox)) DPRINTF("%hd ", descr->tabs[i]);
}
TRACE("[%04x]: settabstops %s\n",
wnd->hwndSelf, dbg_str(listbox));
if (TRACE_ON(listbox)) DPRINTF("\n");
}
else memcpy( descr->tabs, tabs, descr->nb_tabs * sizeof(INT) );
/* FIXME: repaint the window? */

View file

@ -182,7 +182,7 @@ static BOOL fEndMenu = FALSE;
if(!TRACE_ON(menu)) ; else do_debug_print_menuitem(pre, mp, post)
#define MENUOUT(text) \
dsprintf(menu, "%s%s", (count++ ? "," : ""), (text))
DPRINTF("%s%s", (count++ ? "," : ""), (text))
#define MENUFLAG(bit,text) \
do { \
@ -192,17 +192,16 @@ static BOOL fEndMenu = FALSE;
static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
const char *postfix)
{
dbg_decl_str(menu, 256);
TRACE("%s ", prefix);
if (mp) {
UINT flags = mp->fType;
int typ = MENU_ITEM_TYPE(flags);
dsprintf(menu, "{ ID=0x%x", mp->wID);
DPRINTF( "{ ID=0x%x", mp->wID);
if (flags & MF_POPUP)
dsprintf(menu, ", Sub=0x%x", mp->hSubMenu);
DPRINTF( ", Sub=0x%x", mp->hSubMenu);
if (flags) {
int count = 0;
dsprintf(menu, ", Typ=");
DPRINTF( ", Typ=");
if (typ == MFT_STRING)
/* Nothing */ ;
else if (typ == MFT_SEPARATOR)
@ -224,12 +223,12 @@ static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
MENUFLAG(MFT_RIGHTJUSTIFY, "right"); /* same as MF_HELP */
if (flags)
dsprintf(menu, "+0x%x", flags);
DPRINTF( "+0x%x", flags);
}
flags = mp->fState;
if (flags) {
int count = 0;
dsprintf(menu, ", State=");
DPRINTF( ", State=");
MENUFLAG(MFS_GRAYED, "grey");
MENUFLAG(MFS_DEFAULT, "default");
MENUFLAG(MFS_DISABLED, "dis");
@ -238,30 +237,30 @@ static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
MENUFLAG(MF_USECHECKBITMAPS, "usebit");
MENUFLAG(MF_MOUSESELECT, "mouse");
if (flags)
dsprintf(menu, "+0x%x", flags);
DPRINTF( "+0x%x", flags);
}
if (mp->hCheckBit)
dsprintf(menu, ", Chk=0x%x", mp->hCheckBit);
DPRINTF( ", Chk=0x%x", mp->hCheckBit);
if (mp->hUnCheckBit)
dsprintf(menu, ", Unc=0x%x", mp->hUnCheckBit);
DPRINTF( ", Unc=0x%x", mp->hUnCheckBit);
if (typ == MFT_STRING) {
if (mp->text)
dsprintf(menu, ", Text=\"%s\"", mp->text);
DPRINTF( ", Text=\"%s\"", mp->text);
else
dsprintf(menu, ", Text=Null");
DPRINTF( ", Text=Null");
} else if (mp->text == NULL)
/* Nothing */ ;
else
dsprintf(menu, ", Text=%p", mp->text);
DPRINTF( ", Text=%p", mp->text);
if (mp->dwItemData)
dsprintf(menu, ", ItemData=0x%08lx", mp->dwItemData);
dsprintf(menu, " }");
DPRINTF( ", ItemData=0x%08lx", mp->dwItemData);
DPRINTF( " }");
} else {
dsprintf(menu, "NULL");
DPRINTF( "NULL");
}
TRACE("%s %s %s\n", prefix, dbg_str(menu), postfix);
DPRINTF(" %s\n", postfix);
}
#undef MENUOUT

View file

@ -1277,8 +1277,6 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
SCROLLBAR_INFO *infoPtr;
UINT new_flags;
dbg_decl_str(scroll, 256);
*action = 0;
if (!(infoPtr = SCROLL_GetScrollInfo(hwnd, nBar))) return 0;
@ -1286,11 +1284,19 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
if ((info->cbSize != sizeof(*info)) &&
(info->cbSize != sizeof(*info)-sizeof(info->nTrackPos))) return 0;
if (TRACE_ON(scroll))
{
DPRINTF( "hwnd=%04x bar=%d", hwnd, nBar);
if (info->fMask & SIF_PAGE) DPRINTF( " page=%d", info->nPage );
if (info->fMask & SIF_POS) DPRINTF( " pos=%d", info->nPos );
if (info->fMask & SIF_RANGE) DPRINTF( " min=%d max=%d", info->nMin, info->nMax );
DPRINTF("\n");
}
/* Set the page size */
if (info->fMask & SIF_PAGE)
{
dsprintf(scroll, " page=%d", info->nPage );
if( infoPtr->Page != info->nPage )
{
infoPtr->Page = info->nPage;
@ -1302,7 +1308,6 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
if (info->fMask & SIF_POS)
{
dsprintf(scroll, " pos=%d", info->nPos );
if( infoPtr->CurVal != info->nPos )
{
infoPtr->CurVal = info->nPos;
@ -1314,8 +1319,6 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
if (info->fMask & SIF_RANGE)
{
dsprintf(scroll, " min=%d max=%d", info->nMin, info->nMax );
/* Invalid range -> range is set to (0,0) */
if ((info->nMin > info->nMax) ||
((UINT)(info->nMax - info->nMin) >= 0x80000000))
@ -1335,9 +1338,6 @@ INT SCROLL_SetScrollInfo( HWND hwnd, INT nBar,
}
}
TRACE("hwnd=%04x bar=%d %s\n",
hwnd, nBar, dbg_str(scroll));
/* Make sure the page size is valid */
if (infoPtr->Page < 0) infoPtr->Page = 0;

View file

@ -29,8 +29,6 @@ DEFAULT_DEBUG_CHANNEL(ver)
*****************************************************************************/
static void print_vffi_debug(VS_FIXEDFILEINFO *vffi)
{
dbg_decl_str(ver, 1024);
TRACE(" structversion=%u.%u, fileversion=%u.%u.%u.%u, productversion=%u.%u.%u.%u, flagmask=0x%lx, flags=%s%s%s%s%s%s\n",
HIWORD(vffi->dwStrucVersion),LOWORD(vffi->dwStrucVersion),
HIWORD(vffi->dwFileVersionMS),LOWORD(vffi->dwFileVersionMS),
@ -46,95 +44,94 @@ static void print_vffi_debug(VS_FIXEDFILEINFO *vffi)
(vffi->dwFileFlags & VS_FF_SPECIALBUILD) ? "SPECIALBUILD," : ""
);
dsprintf(ver," OS=0x%x.0x%x ",
TRACE("(");
DPRINTF(" OS=0x%x.0x%x ",
HIWORD(vffi->dwFileOS),
LOWORD(vffi->dwFileOS)
);
switch (vffi->dwFileOS&0xFFFF0000) {
case VOS_DOS:dsprintf(ver,"DOS,");break;
case VOS_OS216:dsprintf(ver,"OS/2-16,");break;
case VOS_OS232:dsprintf(ver,"OS/2-32,");break;
case VOS_NT:dsprintf(ver,"NT,");break;
case VOS_DOS:DPRINTF("DOS,");break;
case VOS_OS216:DPRINTF("OS/2-16,");break;
case VOS_OS232:DPRINTF("OS/2-32,");break;
case VOS_NT:DPRINTF("NT,");break;
case VOS_UNKNOWN:
default:
dsprintf(ver,"UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break;
DPRINTF("UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break;
}
switch (LOWORD(vffi->dwFileOS)) {
case VOS__BASE:dsprintf(ver,"BASE");break;
case VOS__WINDOWS16:dsprintf(ver,"WIN16");break;
case VOS__WINDOWS32:dsprintf(ver,"WIN32");break;
case VOS__PM16:dsprintf(ver,"PM16");break;
case VOS__PM32:dsprintf(ver,"PM32");break;
default:dsprintf(ver,"UNKNOWN(0x%x)",LOWORD(vffi->dwFileOS));break;
case VOS__BASE:DPRINTF("BASE");break;
case VOS__WINDOWS16:DPRINTF("WIN16");break;
case VOS__WINDOWS32:DPRINTF("WIN32");break;
case VOS__PM16:DPRINTF("PM16");break;
case VOS__PM32:DPRINTF("PM32");break;
default:DPRINTF("UNKNOWN(0x%x)",LOWORD(vffi->dwFileOS));break;
}
TRACE("(%s)\n", dbg_str(ver));
DPRINTF(")\n");
dbg_reset_str(ver);
switch (vffi->dwFileType) {
default:
case VFT_UNKNOWN:
dsprintf(ver,"filetype=Unknown(0x%lx)",vffi->dwFileType);
TRACE("filetype=Unknown(0x%lx)",vffi->dwFileType);
break;
case VFT_APP:dsprintf(ver,"filetype=APP,");break;
case VFT_DLL:dsprintf(ver,"filetype=DLL,");break;
case VFT_APP:TRACE("filetype=APP,");break;
case VFT_DLL:TRACE("filetype=DLL,");break;
case VFT_DRV:
dsprintf(ver,"filetype=DRV,");
TRACE("filetype=DRV,");
switch(vffi->dwFileSubtype) {
default:
case VFT2_UNKNOWN:
dsprintf(ver,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
DPRINTF("UNKNOWN(0x%lx)",vffi->dwFileSubtype);
break;
case VFT2_DRV_PRINTER:
dsprintf(ver,"PRINTER");
DPRINTF("PRINTER");
break;
case VFT2_DRV_KEYBOARD:
dsprintf(ver,"KEYBOARD");
DPRINTF("KEYBOARD");
break;
case VFT2_DRV_LANGUAGE:
dsprintf(ver,"LANGUAGE");
DPRINTF("LANGUAGE");
break;
case VFT2_DRV_DISPLAY:
dsprintf(ver,"DISPLAY");
DPRINTF("DISPLAY");
break;
case VFT2_DRV_MOUSE:
dsprintf(ver,"MOUSE");
DPRINTF("MOUSE");
break;
case VFT2_DRV_NETWORK:
dsprintf(ver,"NETWORK");
DPRINTF("NETWORK");
break;
case VFT2_DRV_SYSTEM:
dsprintf(ver,"SYSTEM");
DPRINTF("SYSTEM");
break;
case VFT2_DRV_INSTALLABLE:
dsprintf(ver,"INSTALLABLE");
DPRINTF("INSTALLABLE");
break;
case VFT2_DRV_SOUND:
dsprintf(ver,"SOUND");
DPRINTF("SOUND");
break;
case VFT2_DRV_COMM:
dsprintf(ver,"COMM");
DPRINTF("COMM");
break;
case VFT2_DRV_INPUTMETHOD:
dsprintf(ver,"INPUTMETHOD");
DPRINTF("INPUTMETHOD");
break;
}
break;
case VFT_FONT:
dsprintf(ver,"filetype=FONT.");
TRACE("filetype=FONT.");
switch (vffi->dwFileSubtype) {
default:
dsprintf(ver,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
DPRINTF("UNKNOWN(0x%lx)",vffi->dwFileSubtype);
break;
case VFT2_FONT_RASTER:dsprintf(ver,"RASTER");break;
case VFT2_FONT_VECTOR:dsprintf(ver,"VECTOR");break;
case VFT2_FONT_TRUETYPE:dsprintf(ver,"TRUETYPE");break;
case VFT2_FONT_RASTER:DPRINTF("RASTER");break;
case VFT2_FONT_VECTOR:DPRINTF("VECTOR");break;
case VFT2_FONT_TRUETYPE:DPRINTF("TRUETYPE");break;
}
break;
case VFT_VXD:dsprintf(ver,"filetype=VXD");break;
case VFT_STATIC_LIB:dsprintf(ver,"filetype=STATIC_LIB");break;
case VFT_VXD:TRACE("filetype=VXD");break;
case VFT_STATIC_LIB:TRACE("filetype=STATIC_LIB");break;
}
TRACE("%s\n", dbg_str(ver));
DPRINTF("\n");
TRACE(" filedata=0x%lx.0x%lx\n",
vffi->dwFileDateMS,vffi->dwFileDateLS);
}

View file

@ -97,7 +97,6 @@ ASPI_DebugPrintCmd(SRB_ExecSCSICmd16 *prb, UINT16 mode)
int i;
BYTE *cdb;
BYTE *lpBuf = 0;
dbg_decl_str(aspi, 512);
switch (mode)
{
@ -154,11 +153,15 @@ ASPI_DebugPrintCmd(SRB_ExecSCSICmd16 *prb, UINT16 mode)
TRACE("POST Proc: %lx\n", (DWORD) prb->SRB_PostProc);
cdb = &prb->CDBByte[0];
cmd = prb->CDBByte[0];
for (i = 0; i < prb->SRB_CDBLen; i++) {
if (i != 0) dsprintf(aspi, ",");
dsprintf(aspi, "%02x", *cdb++);
if (TRACE_ON(aspi))
{
DPRINTF("CDB buffer[");
for (i = 0; i < prb->SRB_CDBLen; i++) {
if (i != 0) DPRINTF(",");
DPRINTF("%02x", *cdb++);
}
DPRINTF("]\n");
}
TRACE("CDB buffer[%s]\n", dbg_str(aspi));
}
static void
@ -166,14 +169,17 @@ ASPI_PrintSenseArea16(SRB_ExecSCSICmd16 *prb)
{
int i;
BYTE *cdb;
dbg_decl_str(aspi, 512);
cdb = &prb->CDBByte[0];
for (i = 0; i < prb->SRB_SenseLen; i++) {
if (i) dsprintf(aspi, ",");
dsprintf(aspi, "%02x", *cdb++);
if (TRACE_ON(aspi))
{
cdb = &prb->CDBByte[0];
DPRINTF("SenseArea[");
for (i = 0; i < prb->SRB_SenseLen; i++) {
if (i) DPRINTF(",");
DPRINTF("%02x", *cdb++);
}
DPRINTF("]\n");
}
TRACE("SenseArea[%s]\n", dbg_str(aspi));
}
static void

View file

@ -90,7 +90,6 @@ ASPI_DebugPrintCmd(SRB_ExecSCSICmd *prb)
BYTE cmd;
int i;
BYTE *cdb;
dbg_decl_str(aspi, 512);
switch (prb->CDBByte[0]) {
case CMD_INQUIRY:
@ -134,11 +133,15 @@ ASPI_DebugPrintCmd(SRB_ExecSCSICmd *prb)
TRACE("POST Proc: %lx\n", (DWORD) prb->SRB_PostProc);
cdb = &prb->CDBByte[0];
cmd = prb->CDBByte[0];
for (i = 0; i < prb->SRB_CDBLen; i++) {
if (i != 0) dsprintf(aspi, ",");
dsprintf(aspi, "%02x", *cdb++);
if (TRACE_ON(aspi))
{
DPRINTF("CDB buffer[");
for (i = 0; i < prb->SRB_CDBLen; i++) {
if (i != 0) DPRINTF(",");
DPRINTF("%02x", *cdb++);
}
DPRINTF("]\n");
}
TRACE("CDB buffer[%s]\n", dbg_str(aspi));
}
static void
@ -146,14 +149,17 @@ ASPI_PrintSenseArea(SRB_ExecSCSICmd *prb)
{
int i;
BYTE *cdb;
dbg_decl_str(aspi, 512);
cdb = &prb->CDBByte[0];
for (i = 0; i < prb->SRB_SenseLen; i++) {
if (i) dsprintf(aspi, ",");
dsprintf(aspi, "%02x", *cdb++);
if (TRACE_ON(aspi))
{
cdb = &prb->CDBByte[0];
DPRINTF("SenseArea[");
for (i = 0; i < prb->SRB_SenseLen; i++) {
if (i) DPRINTF(",");
DPRINTF("%02x", *cdb++);
}
DPRINTF("]\n");
}
TRACE("SenseArea[%s]\n", dbg_str(aspi));
}
static void

View file

@ -424,7 +424,6 @@ static DWORD RELAY_CallProc32W(int Ex)
VA_LIST16 valist;
int i;
int aix;
dbg_decl_str(relay, 1024);
SYSLEVEL_ReleaseWin16Lock();
@ -432,7 +431,7 @@ static DWORD RELAY_CallProc32W(int Ex)
nrofargs = VA_ARG16( valist, DWORD );
argconvmask = VA_ARG16( valist, DWORD );
proc32 = VA_ARG16( valist, FARPROC );
dsprintf(relay, "CallProc32W(%ld,%ld,%p, Ex%d args[",nrofargs,argconvmask,proc32,Ex);
TRACE("CallProc32W(%ld,%ld,%p, Ex%d args[",nrofargs,argconvmask,proc32,Ex);
args = (DWORD*)HEAP_xalloc( GetProcessHeap(), 0,
sizeof(DWORD)*nrofargs );
/* CallProcEx doesn't need its args reversed */
@ -446,15 +445,15 @@ static DWORD RELAY_CallProc32W(int Ex)
{
SEGPTR ptr = VA_ARG16( valist, SEGPTR );
args[aix] = (DWORD)PTR_SEG_TO_LIN(ptr);
dsprintf(relay,"%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
if (TRACE_ON(relay)) DPRINTF("%08lx(%p),",ptr,PTR_SEG_TO_LIN(ptr));
}
else
{
args[aix] = VA_ARG16( valist, DWORD );
dsprintf(relay,"%ld,",args[aix]);
if (TRACE_ON(relay)) DPRINTF("%ld,",args[aix]);
}
}
dsprintf(relay,"])");
if (TRACE_ON(relay)) DPRINTF("])\n");
VA_END16( valist );
if (!proc32) ret = 0;
@ -493,7 +492,7 @@ static DWORD RELAY_CallProc32W(int Ex)
/* POP nrofargs DWORD arguments and 3 DWORD parameters */
if (!Ex) stack16_pop( (3 + nrofargs) * sizeof(DWORD) );
TRACE("%s - returns %08lx\n",dbg_str(relay),ret);
TRACE("CallProc32W - returns %08lx\n",ret);
HeapFree( GetProcessHeap(), 0, args );
SYSLEVEL_RestoreWin16Lock();

View file

@ -31,26 +31,12 @@ extern const char * const debug_ch_name[];
(dbg_printf("%s:%s:%s ", debug_cl_name[(dbcl)], debug_ch_name[(dbch)], __FUNCTION__),0)) \
? 0 : dbg_printf
#define __DUMMY_DPRINTF 1 ? 0 : ((int (*)(char *, ...)) NULL)
#define __DUMMY_DPRINTF 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)
/* Exported definitions and macros */
#define dbg_str(name) debug_str_##name
#define dbg_buf(name) debug_buf_##name
#define dbg_decl_str(name, size) \
char dbg_str(name)[size], *dbg_buf(name)=dbg_str(name)
#define dbg_reset_str(name) \
dbg_buf(name)=dbg_str(name)
#define dsprintf(name, format, args...) \
dbg_buf(name)+=sprintf(dbg_buf(name), format, ## args)
/* use configure to allow user to compile out debugging messages */
#ifndef NO_TRACE_MSGS
#define TRACE __DPRINTF(__DBCL_TRACE,*DBCH_DEFAULT)
#define TRACE_(ch) __DPRINTF(__DBCL_TRACE,dbch_##ch)
@ -92,20 +78,6 @@ extern const char * const debug_ch_name[];
#define DPRINTF dbg_printf
#define MESSAGE dbg_printf
#ifdef OLD_DEBUG_MACROS
/* transition macros */
#undef TRACE
#undef WARN
#undef FIXME
#undef ERR
#define TRACE(ch, fmt, args...) TRACE_(ch)(fmt, ## args)
#define WARN(ch, fmt, args...) WARN_(ch)(fmt, ## args)
#define FIXME(ch, fmt, args...) FIXME_(ch)(fmt, ## args)
#define ERR(ch, fmt, args...) ERR_(ch)(fmt, ## args)
#define MSG(format, args...) fprintf(stderr, format, ## args)
#define DUMP dbg_printf
#endif
#endif /* __WINE__ */
#endif /* __WINE_DEBUGTOOLS_H */

View file

@ -101,18 +101,19 @@ void dump_exports( HMODULE hModule )
for (i=0;i<pe_exports->NumberOfFunctions;i++, function++)
{
if (!*function) continue; /* No such function */
if (TRACE_ON(win32)){
dbg_decl_str(win32, 1024);
dsprintf(win32,"%4ld %08lx %08x",
i + pe_exports->Base, *function, RVA(*function) );
if (TRACE_ON(win32))
{
DPRINTF( "%4ld %08lx %08x", i + pe_exports->Base, *function, RVA(*function) );
/* Check if we have a name for it */
for (j = 0; j < pe_exports->NumberOfNames; j++)
if (ordinal[j] == i)
dsprintf(win32, " %s", (char*)RVA(name[j]) );
{
DPRINTF( " %s", (char*)RVA(name[j]) );
break;
}
if ((*function >= rva_start) && (*function <= rva_end))
dsprintf(win32, " (forwarded -> %s)", (char *)RVA(*function));
TRACE_(win32)("%s\n", dbg_str(win32));
DPRINTF(" (forwarded -> %s)", (char *)RVA(*function));
DPRINTF("\n");
}
}
}

View file

@ -890,12 +890,12 @@ DWORD WINAPIV SSCall(
DWORD i,ret;
DWORD *args = ((DWORD *)&fun) + 1;
if(TRACE_ON(thunk)){
dbg_decl_str(thunk, 256);
if(TRACE_ON(thunk))
{
DPRINTF("(%ld,0x%08lx,%p,[",nr,flags,fun);
for (i=0;i<nr/4;i++)
dsprintf(thunk,"0x%08lx,",args[i]);
TRACE_(thunk)("(%ld,0x%08lx,%p,[%s])\n",
nr,flags,fun,dbg_str(thunk));
DPRINTF("0x%08lx,",args[i]);
DPRINTF("])\n");
}
switch (nr) {
case 0: ret = fun();

View file

@ -859,10 +859,9 @@ void X11DRV_KEYBOARD_Init(void)
if (TRACE_ON(keyboard))
{
dbg_decl_str(keyboard, 1024);
TRACE_(keyboard)("OEM specific virtual key %X assigned "
"to keycode %X:\n", OEMvkey, e2.keycode);
TRACE_(keyboard)("OEM specific virtual key %X assigned to keycode %X:\n",
OEMvkey, e2.keycode);
TRACE_(keyboard)("(");
for (i = 0; i < keysyms_per_keycode; i += 1)
{
char *ksname;
@ -871,9 +870,9 @@ void X11DRV_KEYBOARD_Init(void)
ksname = TSXKeysymToString(keysym);
if (!ksname)
ksname = "NoSymbol";
dsprintf(keyboard, "%lX (%s) ", keysym, ksname);
DPRINTF( "%lX (%s) ", keysym, ksname);
}
TRACE_(keyboard)("(%s)\n", dbg_str(keyboard));
DPRINTF(")\n");
}
}
}