"Fossies" - the Fresh Open Source Software Archive

Member "xterm-379/trace.h" (6 Oct 2022, 8428 Bytes) of package /linux/misc/xterm-379.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "trace.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 373_vs_374.

    1 /* $XTermId: trace.h,v 1.94 2022/10/06 20:40:49 tom Exp $ */
    2 
    3 /*
    4  * Copyright 1997-2021,2022 by Thomas E. Dickey
    5  *
    6  *                         All Rights Reserved
    7  *
    8  * Permission is hereby granted, free of charge, to any person obtaining a
    9  * copy of this software and associated documentation files (the
   10  * "Software"), to deal in the Software without restriction, including
   11  * without limitation the rights to use, copy, modify, merge, publish,
   12  * distribute, sublicense, and/or sell copies of the Software, and to
   13  * permit persons to whom the Software is furnished to do so, subject to
   14  * the following conditions:
   15  *
   16  * The above copyright notice and this permission notice shall be included
   17  * in all copies or substantial portions of the Software.
   18  *
   19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   22  * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
   23  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   24  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   25  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   26  *
   27  * Except as contained in this notice, the name(s) of the above copyright
   28  * holders shall not be used in advertising or otherwise to promote the
   29  * sale, use or other dealings in this Software without prior written
   30  * authorization.
   31  */
   32 
   33 /*
   34  * Common/useful definitions for XTERM application
   35  */
   36 #ifndef included_trace_h
   37 #define included_trace_h
   38 /* *INDENT-OFF* */
   39 
   40 #include <xterm.h>
   41 
   42 #if OPT_TRACE
   43 
   44 #include <stdarg.h>
   45 
   46 extern  void    Trace ( const char *, ... ) GCC_PRINTFLIKE(1,2);
   47 extern  void    TraceVA ( const char *fmt, va_list ap );
   48 extern  void    TraceXError (Display *d, XErrorEvent *ev);
   49 
   50 #undef  if_TRACE
   51 #define if_TRACE(stmt)      stmt
   52 
   53 #undef  TRACE
   54 #define TRACE(p) Trace p
   55 
   56 #undef  TRACE_VA
   57 #define TRACE_VA(p) TraceVA p
   58 #define TRACE_X_ERR(d,e) TraceXError(d,e)
   59 
   60 extern  void    TraceClose (void);
   61 
   62 #undef  TRACE_CLOSE
   63 #define TRACE_CLOSE TraceClose
   64 
   65 #if OPT_TRACE > 1
   66 #define TRACE2(p) Trace p
   67 #endif
   68 
   69 #define TRACE_L "{{"
   70 #define TRACE_R "}}"
   71 
   72 extern  const char * visibleChars(const Char * /* buf */, size_t /* len */);
   73 extern  const char * visibleEventMode(EventMode);
   74 extern  const char * visibleIChars(const IChar * /* buf */, size_t /* len */);
   75 extern  const char * visibleUChar(unsigned);
   76 extern  const char * visibleDblChrset(unsigned /* chrset */);
   77 extern  const char * visibleEventType (int);
   78 extern  const char * visibleMappingMode (int);
   79 extern  const char * visibleNotifyDetail(int /* code */);
   80 extern  const char * visibleNotifyMode (int /* code */);
   81 extern  const char * visibleScsCode(DECNRCM_codes /* chrset */);
   82 extern  const char * visibleSelectionTarget(Display * /* d */, Atom /* a */);
   83 extern  const char * visibleTekparse (int);
   84 extern  const char * visibleVTparse (int);
   85 extern  const char * visibleXError (int /* code */);
   86 
   87 extern  const char * TraceAtomName(Display * /* d */, Atom /* a */);
   88 
   89 extern  void    TraceArgv(const char * /* tag */, char ** /* argv */);
   90 #undef  TRACE_ARGV
   91 #define TRACE_ARGV(tag,argv) TraceArgv(tag,argv)
   92 
   93 extern  const   char *trace_who;
   94 #undef  TRACE_CHILD
   95 #define TRACE_CHILD int tracing_child = (trace_who = "child") != 0; (void) tracing_child;
   96 
   97 extern  void    TraceEvent(const char *, XEvent *, String *, Cardinal *);
   98 #undef  TRACE_EVENT
   99 #define TRACE_EVENT(t,e,s,n) TraceEvent(t, (XEvent *)e, s, n)
  100 
  101 #undef  TRACE_FALLBACK
  102 #if OPT_RENDERFONT && OPT_WIDE_CHARS
  103 extern  void    TraceFallback(XtermWidget, const char *, unsigned, int, XftFont *);
  104 #define TRACE_FALLBACK(w,t,c,n,f) TraceFallback(w, t, c, n, f)
  105 #else
  106 #define TRACE_FALLBACK(w,t,c,n,f) /*nothing*/
  107 #endif
  108 
  109 extern  void    TraceFocus(Widget, XEvent *);
  110 #undef  TRACE_FOCUS
  111 #define TRACE_FOCUS(w,e) TraceFocus((Widget)w, (XEvent *)e)
  112 
  113 extern  void    TraceSizeHints(XSizeHints *);
  114 #undef  TRACE_HINTS
  115 #define TRACE_HINTS(hints) TraceSizeHints(hints)
  116 
  117 extern  void    TraceIds(const char * /* fname */, int  /* lnum */);
  118 #undef  TRACE_IDS
  119 #define TRACE_IDS TraceIds(__FILE__, __LINE__)
  120 
  121 extern  void    TraceTime(const char * /* fname */, int  /* lnum */);
  122 #undef  TRACE_TIME
  123 #define TRACE_TIME TraceTime(__FILE__, __LINE__)
  124 
  125 extern  void    TraceOptions(OptionHelp * /* options */, XrmOptionDescRec * /* resources */, Cardinal  /* count */);
  126 #undef  TRACE_OPTS
  127 #define TRACE_OPTS(opts,ress,lens) TraceOptions(opts,ress,lens)
  128 
  129 extern  void    TraceTranslations(const char *, Widget);
  130 #undef  TRACE_TRANS
  131 #define TRACE_TRANS(name,w) TraceTranslations(name,w)
  132 
  133 extern  void    TraceWindowAttributes(XWindowAttributes *);
  134 #undef  TRACE_WIN_ATTRS
  135 #define TRACE_WIN_ATTRS(a) TraceWindowAttributes(a)
  136 
  137 extern  void    TraceWMSizeHints(XtermWidget);
  138 #undef  TRACE_WM_HINTS
  139 #define TRACE_WM_HINTS(w) TraceWMSizeHints(w)
  140 
  141 extern  void    TraceXtermResources(void);
  142 #undef  TRACE_XRES
  143 #define TRACE_XRES() TraceXtermResources()
  144 
  145 extern  XtGeometryResult TraceResizeRequest(const char * /* fn */, int  /* ln */, Widget  /* w */, unsigned  /* reqwide */, unsigned  /* reqhigh */, Dimension * /* gotwide */, Dimension * /* gothigh */);
  146 #undef  REQ_RESIZE
  147 #define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \
  148     TraceResizeRequest(__FILE__, __LINE__, w, \
  149                (reqwide), (reqhigh), \
  150                (gotwide), (gothigh))
  151 
  152 extern const char * ModifierName(unsigned /* modifier */);
  153 #define FMT_MODIFIER_NAMES "%s%s%s%s%s%s%s%s"
  154 #define ARG_MODIFIER_NAMES(state) \
  155        ModifierName(state & ShiftMask), \
  156        ModifierName(state & LockMask), \
  157        ModifierName(state & ControlMask), \
  158        ModifierName(state & Mod1Mask), \
  159        ModifierName(state & Mod2Mask), \
  160        ModifierName(state & Mod3Mask), \
  161        ModifierName(state & Mod4Mask), \
  162        ModifierName(state & Mod5Mask)
  163 
  164 #else
  165 
  166 #define REQ_RESIZE(w, reqwide, reqhigh, gotwide, gothigh) \
  167     XtMakeResizeRequest((Widget) (w), \
  168                 (Dimension) (reqwide), (Dimension) (reqhigh), \
  169                 (gotwide), (gothigh))
  170 
  171 #define if_TRACE(stmt)      /*nothing*/
  172 #define TRACE(p)        /*nothing*/
  173 #define TRACE_CLOSE()       /*nothing*/
  174 #define TRACE_ARGV(tag,argv)    /*nothing*/
  175 #define TRACE_CHILD     /*nothing*/
  176 #define TRACE_EVENT(t,e,s,n)    /*nothing*/
  177 #define TRACE_FALLBACK(w,t,c,n,f) /*nothing*/
  178 #define TRACE_FOCUS(w,e)    /*nothing*/
  179 #define TRACE_HINTS(hints)  /*nothing*/
  180 #define TRACE_IDS       /*nothing*/
  181 #define TRACE_OPTS(opts,ress,lens) /*nothing*/
  182 #define TRACE_TRANS(name,w) /*nothing*/
  183 #define TRACE_WIN_ATTRS(w)  /*nothing*/
  184 #define TRACE_WM_HINTS(w)   /*nothing*/
  185 #define TRACE_X_ERR(d,e)    /*nothing*/
  186 #define TRACE_XRES()        /*nothing*/
  187 
  188 #endif
  189 
  190 #ifndef TRACE2
  191 #define TRACE2(p)       /*nothing*/
  192 #endif
  193 
  194 extern void TraceScreen(XtermWidget /* xw */, int /* whichBuf */);
  195 
  196 /*
  197  * The whole wnew->screen struct is zeroed in VTInitialize.  Use these macros
  198  * where applicable for copying the pieces from the request widget into the
  199  * new widget.  We do not have to use them for wnew->misc, but the associated
  200  * traces are very useful for debugging.
  201  */
  202 #if OPT_TRACE
  203 #define init_Bres(name) \
  204     TRACE(("init " #name " = %s\n", \
  205         BtoS(wnew->name = request->name)))
  206 #define init_Dres(name) \
  207     TRACE(("init " #name " = %f\n", \
  208         wnew->name = request->name))
  209 #define init_Dres2(name,i) \
  210     TRACE(("init " #name "[%d] = %f\n", i, \
  211         wnew->name[i] = request->name[i]))
  212 #define init_Ires(name) \
  213     TRACE(("init " #name " = %d\n", \
  214         wnew->name = request->name))
  215 #define init_Mres(name) \
  216     TRACE(("init " #name " = %s\n", \
  217         MtoS(wnew->name = request->name)))
  218 #define init_Sres(name) \
  219     TRACE(("init " #name " = \"%s\"\n", \
  220         (wnew->name = x_strtrim(request->name)) != NULL \
  221             ? wnew->name : "<null>"))
  222 #define init_Sres2(name,i) \
  223     TRACE(("init " #name "[%d] = \"%s\"\n", i, \
  224         (wnew->name(i) = x_strtrim(request->name(i))) != NULL \
  225             ? wnew->name(i) : "<null>"))
  226 #define init_Tres(offset) \
  227     TRACE(("init screen.Tcolors[" #offset "] = %#lx\n", \
  228         fill_Tres(wnew, request, offset)))
  229 #else
  230 #define init_Bres(name)    wnew->name = request->name
  231 #define init_Dres(name)    wnew->name = request->name
  232 #define init_Dres2(name,i) wnew->name[i] = request->name[i]
  233 #define init_Ires(name)    wnew->name = request->name
  234 #define init_Mres(name)    wnew->name = request->name
  235 #define init_Sres(name)    wnew->name = x_strtrim(request->name)
  236 #define init_Sres2(name,i) wnew->name(i) = x_strtrim(request->name(i))
  237 #define init_Tres(offset)  fill_Tres(wnew, request, offset)
  238 #endif
  239 
  240 /* *INDENT-ON* */
  241 
  242 #endif /* included_trace_h */