Standard way of printing RECT in trace statements?

Dan Kegel dank at kegel.com
Wed Dec 25 23:14:16 CST 2002


Dimitrie O. Paun wrote:
> Most of the case can be transformed to debugrect(), but that requires
> some infrastructure work, so it belongs in a separate patch.

I assume you're referring to the routine in listview.c:
   static inline char* debugrect(const RECT *rect)

While that works, it also seems worth considering
a macro-based approach.  For instance:

#define _RECT_FMT "(%ld,%ld)-(%ld,%ld)"
#define _RECT_ARG(r) (r).left, (r).top, (r).right, (r).bottom
...

Example use:
     TRACE("Combo client " _RECT_FMT ", setting Edit to " _RECT_FMT "\n",
           _RECT_ARG(rect), x, y, x + w, y + h);

(FWIW, the Linux kernel uses a similar macro, NIPQUAD, to display
IP addresses.)

Although this doesn't hide things as well as the inline function,
it might have some advantage in size and runtime, since it does
more of its work at compile time.

Either way, having a standard way of inserting values of Windows
structures into TRACE statements would probably be nice to have.
- Dan

-- 
Dan Kegel
Linux User #78045
http://www.kegel.com




More information about the wine-devel mailing list