trace.h revision 6879286f
1/* $XTermId: trace.h,v 1.56 2010/11/11 01:10:52 tom Exp $ */ 2 3/* 4 * 5 * Copyright 1997-2009,2010 by Thomas E. Dickey 6 * 7 * All Rights Reserved 8 * 9 * Permission is hereby granted, free of charge, to any person obtaining a 10 * copy of this software and associated documentation files (the 11 * "Software"), to deal in the Software without restriction, including 12 * without limitation the rights to use, copy, modify, merge, publish, 13 * distribute, sublicense, and/or sell copies of the Software, and to 14 * permit persons to whom the Software is furnished to do so, subject to 15 * the following conditions: 16 * 17 * The above copyright notice and this permission notice shall be included 18 * in all copies or substantial portions of the Software. 19 * 20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 24 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 * 28 * Except as contained in this notice, the name(s) of the above copyright 29 * holders shall not be used in advertising or otherwise to promote the 30 * sale, use or other dealings in this Software without prior written 31 * authorization. 32 * 33 */ 34 35/* 36 * Common/useful definitions for XTERM application 37 */ 38#ifndef included_trace_h 39#define included_trace_h 40 41#include <xterm.h> 42 43#if OPT_TRACE 44 45extern void Trace ( const char *, ... ) GCC_PRINTFLIKE(1,2); 46 47#undef TRACE 48#define TRACE(p) Trace p 49 50extern void TraceClose (void); 51 52#undef TRACE_CLOSE 53#define TRACE_CLOSE TraceClose 54 55#if OPT_TRACE > 1 56#define TRACE2(p) Trace p 57#endif 58 59extern char * visibleChars (const Char * /* buf */, unsigned /* len */); 60extern char * visibleIChar (IChar *, unsigned); 61extern char * visibleIChars (IChar * /* buf */, unsigned /* len */); 62extern const char * visibleChrsetName(unsigned /* chrset */); 63extern const char * visibleEventType (int); 64extern const char * visibleNotifyDetail(int /* code */); 65extern const char * visibleSelectionTarget(Display * /* d */, Atom /* a */); 66extern const char * visibleXError (int /* code */); 67 68extern void TraceArgv(const char * /* tag */, char ** /* argv */); 69#undef TRACE_ARGV 70#define TRACE_ARGV(tag,argv) TraceArgv(tag,argv) 71 72extern const char *trace_who; 73#undef TRACE_CHILD 74#define TRACE_CHILD int tracing_child = (trace_who = "child") != 0; (void) tracing_child; 75 76extern void TraceFocus(Widget, XEvent *); 77#undef TRACE_FOCUS 78#define TRACE_FOCUS(w,e) TraceFocus((Widget)w, (XEvent *)e) 79 80extern void TraceSizeHints(XSizeHints *); 81#undef TRACE_HINTS 82#define TRACE_HINTS(hints) TraceSizeHints(hints) 83 84extern void TraceIds(const char * /* fname */, int /* lnum */); 85#undef TRACE_IDS 86#define TRACE_IDS TraceIds(__FILE__, __LINE__) 87 88extern void TraceOptions(OptionHelp * /* options */, XrmOptionDescRec * /* resources */, Cardinal /* count */); 89#undef TRACE_OPTS 90#define TRACE_OPTS(opts,ress,lens) TraceOptions(opts,ress,lens) 91 92extern void TraceTranslations(const char *, Widget); 93#undef TRACE_TRANS 94#define TRACE_TRANS(name,w) TraceTranslations(name,w) 95 96extern void TraceWMSizeHints(XtermWidget); 97#undef TRACE_WM_HINTS 98#define TRACE_WM_HINTS(w) TraceWMSizeHints(w) 99 100extern void TraceXtermResources(void); 101#undef TRACE_XRES 102#define TRACE_XRES() TraceXtermResources() 103 104extern int TraceResizeRequest(const char * /* fn */, int /* ln */, Widget /* w */, Dimension /* reqwide */, Dimension /* reqhigh */, Dimension * /* gotwide */, Dimension * /* gothigh */); 105#undef REQ_RESIZE 106#define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \ 107 TraceResizeRequest(__FILE__, __LINE__, w, \ 108 (Dimension) (reqwide), (Dimension) (reqhigh), \ 109 (gotwide), (gothigh)) 110 111#else 112 113#define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \ 114 XtMakeResizeRequest((Widget) (w), \ 115 (Dimension) (reqwide), (Dimension) (reqhigh), \ 116 (gotwide), (gothigh)) 117 118#endif 119 120/* 121 * The whole wnew->screen struct is zeroed in VTInitialize. Use these macros 122 * where applicable for copying the pieces from the request widget into the 123 * new widget. We do not have to use them for wnew->misc, but the associated 124 * traces are very useful for debugging. 125 */ 126#if OPT_TRACE 127#define init_Bres(name) \ 128 TRACE(("init " #name " = %s\n", \ 129 BtoS(wnew->name = request->name))) 130#define init_Dres2(name,i) \ 131 TRACE(("init " #name "[%d] = %f\n", i, \ 132 wnew->name[i] = request->name[i])) 133#define init_Ires(name) \ 134 TRACE(("init " #name " = %d\n", \ 135 wnew->name = request->name)) 136#define init_Sres(name) \ 137 TRACE(("init " #name " = \"%s\"\n", \ 138 (wnew->name = x_strtrim(request->name)) != NULL \ 139 ? wnew->name : "<null>")) 140#define init_Sres2(name,i) \ 141 TRACE(("init " #name "[%d] = \"%s\"\n", i, \ 142 (wnew->name(i) = x_strtrim(request->name(i))) != NULL \ 143 ? wnew->name(i) : "<null>")) 144#define init_Tres(offset) \ 145 TRACE(("init screen.Tcolors[" #offset "] = %#lx\n", \ 146 fill_Tres(wnew, request, offset))) 147#else 148#define init_Bres(name) wnew->name = request->name 149#define init_Dres2(name,i) wnew->name[i] = request->name[i] 150#define init_Ires(name) wnew->name = request->name 151#define init_Sres(name) wnew->name = x_strtrim(request->name) 152#define init_Sres2(name,i) wnew->name(i) = x_strtrim(request->name(i)) 153#define init_Tres(offset) fill_Tres(wnew, request, offset) 154#endif 155 156 157#endif /* included_trace_h */ 158