Hi!
Disclaimer: I really don't know that much about the internals of Emacs, so maybe there are better ways to do this...
Anyway, after looking at the `window' structure I see no "name" field. However, it contains a pointer to the frame, which has a name. Also, it contains a linked list of pointers to next and previous windows. By following the link to the previous windows until you have reached the beginning, you can count which position number it has. Using this you can print something like:
window 5 on frame XXXX
Of course, you can package the argument string and the code to retrieve the values (which may be done inline or using support functions) in macros so that you can write something like:
NSTRACE_MSG ("bla bla " NSTRACE_FMT_WIN, NSTRACE_ARG_WIN(w));
Or even:
NSTRACE_WIN ("bla bla", w)
See the rest of the NSTRACE macros for inspiration.
-- Anders