Mercurial > dwindows
diff os2/dw.c @ 2901:761b7a12b079
Add va_list versions of dw_debug() and dw_messagebox() for use in C++ bindings.
dw_vdebug() and dw_vmessagebox() work similarly to the standard library versions.
DW::App:Debug() and DW::App:MessageBox() use them for variable arguments.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 25 Dec 2022 00:20:49 +0000 |
parents | c250764b2f32 |
children | 3fe7641f027c |
line wrap: on
line diff
--- a/os2/dw.c Sat Dec 24 14:28:39 2022 +0000 +++ b/os2/dw.c Sun Dec 25 00:20:49 2022 +0000 @@ -4673,15 +4673,21 @@ void API dw_debug(const char *format, ...) { va_list args; - char outbuf[1025] = { 0 }; va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} + +void API dw_vdebug(const char *format, va_list args) +{ + char outbuf[1025] = { 0 }; + #if defined(__IBMC__) vsprintf(outbuf, format, args); #else vsnprintf(outbuf, 1024, format, args); #endif - va_end(args); if(_PmPrintfString) { @@ -4707,16 +4713,24 @@ int API dw_messagebox(const char *title, int flags, const char *format, ...) { va_list args; - char outbuf[1025] = { 0 }; int rc; va_start(args, format); + rc = dw_vmessagebox(title, flags, format, args); + va_end(args); + return rc; +} + +int API dw_vmessagebox(const char *title, int flags, const char *format, va_list args) +{ + char outbuf[1025] = { 0 }; + int rc; + #if defined(__IBMC__) vsprintf(outbuf, format, args); #else vsnprintf(outbuf, 1024, format, args); #endif - va_end(args); rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, (PSZ)outbuf, (PSZ)title, 0, flags | MB_MOVEABLE); if(rc == MBID_OK)