1 /* 2 * ********************************************************************* 3 * * Copyright (C) 1988, 1990 Stanford University. * 4 * * Permission to use, copy, modify, and distribute this * 5 * * software and its documentation for any purpose and without * 6 * * fee is hereby granted, provided that the above copyright * 7 * * notice appear in all copies. Stanford University * 8 * * makes no representations about the suitability of this * 9 * * software for any purpose. It is provided "as is" without * 10 * * express or implied warranty. Export of this software outside * 11 * * of the United States of America may require an export license. * 12 * ********************************************************************* 13 */ 14 15 #ifndef _ANA_H 16 #define _ANA_H 17 18 #include <X11/Xlib.h> 19 #include <X11/Xutil.h> 20 21 #ifndef _NET_H 22 #include "net.h" 23 #endif 24 25 #ifndef _DEFS_H 26 #include "defs.h" 27 #endif 28 29 #define max( a, b ) ( ( (a) > (b) ) ? (a) : (b) ) 30 #define min( a, b ) ( ( (a) < (b) ) ? (a) : (b) ) 31 #define round( aa ) ( (int) ( (aa) + 0.5 ) ) 32 #define Round( aa ) ( (TimeType) ( (aa) + 0.5 ) ) 33 34 35 typedef unsigned long Pixel; 36 37 /* color information */ 38 typedef struct 39 { 40 Pixel black; 41 Pixel white; 42 Pixel traces; 43 Pixel hilite; 44 Pixel banner_bg; 45 Pixel banner_fg; 46 Pixel border; 47 Pixel disj; 48 int mono; 49 int color_hilite; 50 } COL; 51 52 /* pixmaps */ 53 typedef struct 54 { 55 Pixmap gray; /* full plane pixmap */ 56 Pixmap xpat; /* full plane pixmap */ 57 Pixmap left_arrows; /* full plane pixmap */ 58 Pixmap right_arrows; /* full plane pixmap */ 59 Pixmap tops[3]; /* full plane pixmap */ 60 Pixmap bots[3]; /* full plane pixmap */ 61 Pixmap chk; /* full plane pixmap */ 62 Pixmap icon; /* bitmap */ 63 Pixmap iconbox; 64 Pixmap sizebox; 65 Pixmap select; /* select hilight pattern */ 66 } PIX; 67 68 /* cursors */ 69 typedef struct 70 { 71 Cursor deflt; 72 Cursor left; 73 Cursor right; 74 Cursor timer; 75 Cursor move; 76 } CURS; 77 78 79 typedef struct 80 { 81 GC black; /* fg = black, bg = white */ 82 GC white; /* fg = white, bg = black */ 83 GC inv; /* invert gc, for menus */ 84 GC invert; /* invert: for move, resize, highlight menu */ 85 GC gray; /* for gray pattern */ 86 GC traceBg; /* for traces window */ 87 GC traceFg; 88 GC xpat; /* fpr X pattern */ 89 GC hilite; /* for hilighting */ 90 GC unhilite; 91 GC curs_on; /* turn cursor on/off */ 92 GC curs_off; 93 GC bannerFg; /* banner fg and bg */ 94 GC bannerBg; 95 GC select; /* select pattern */ 96 GC border; 97 } GCS; 98 99 100 #ifndef NULL 101 #define NULL 0 102 #endif 103 104 typedef int Coord; 105 typedef Ulong TimeType; /* 8 bytes (see net.h) */ 106 107 108 typedef struct 109 { 110 int selected; 111 int iconified; 112 int tooSmall; 113 } Wstate; 114 115 116 typedef struct /* Bounding box */ 117 { 118 Coord top, left; /* top left corner */ 119 Coord bot, right; /* bottom right corner */ 120 } BBox; 121 122 123 typedef struct 124 { 125 TimeType first; 126 TimeType last; 127 TimeType start; 128 TimeType steps; 129 TimeType end; 130 TimeType cursor; 131 TimeType delta; 132 } Times; 133 134 135 typedef struct TraceEnt *Trptr; 136 137 typedef struct 138 { 139 int total; /* total number of traces */ 140 int disp; /* number of traces displayed */ 141 int maxName; /* longest name */ 142 int maxDigits; /* longest string of digits */ 143 Trptr first; /* ptr. to last trace displayed */ 144 Trptr last; /* list of traces */ 145 } Traces; 146 147 148 typedef struct /* Cache for history pointer */ 149 { 150 hptr wind; /* window start */ 151 hptr cursor; /* cursor value */ 152 } Cache; 153 154 typedef struct TraceEnt 155 { 156 Trptr next; /* doubly linked list of traces */ 157 Trptr prev; 158 char *name; /* name stripped of path */ 159 int len; /* length of name string */ 160 Coord top, bot; /* position of the trace */ 161 short bdigit; /* # of bits per digit for displaying */ 162 unsigned char vector; /* 1 if bit vector, 0 if node */ 163 union 164 { 165 nptr nd; /* what makes up this trace */ 166 bptr vec; 167 } n; 168 Cache cache[1]; 169 } TraceEnt; 170 171 172 #define IsVector( to ) ( to->vector == TRUE and to->n.vec->nbits > 1 ) 173 174 175 typedef void (*Func)(); 176 177 178 typedef struct 179 { 180 char *str; /* item string */ 181 char mark; /* mark ('+', '-', or 0) */ 182 Func func; /* function to call */ 183 int len; /* length of str */ 184 Coord top, bot; /* y position */ 185 } MenuItem; 186 187 188 typedef struct 189 { 190 char *str; /* header string */ 191 MenuItem *items; /* items for this menu */ 192 int len; /* length of header */ 193 BBox box; /* bounding box of header */ 194 Window w; /* window to pop-up */ 195 Coord width, height; /* size of window */ 196 } Menu; 197 198 199 #define MENU_MARK '+' 200 #define MENU_UNMARK '-' 201 #define MENU_NOMARK '\0' 202 203 204 /* get next history pointer, skipping punted events */ 205 #define NEXTH( H, P ) for( (H) = (P)->next; (H)->punt; (H) = (H)->next ) 206 207 #endif /* _ANA_H */ 208