2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
24 /*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
25 /*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
26 /*%% (c) Copyright 1993, 1994 Novell, Inc. */
27 /*%% $XConsortium: tt_trace_parser.h /main/3 1995/10/23 10:46:45 rswiston $ */
30 * @(#)tt_trace_parser.h 1.8 93/11/04
32 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
34 #ifndef _TT_TRACE_PARSER_H
35 #define _TT_TRACE_PARSER_H
37 #include "api/c/tt_c.h"
38 #include "util/tt_object.h"
39 #include "util/tt_string.h"
40 #include "util/tt_int_rec.h"
41 #include "mp/mp_message.h"
42 #include "util/tt_entry_pt.h"
43 #include "util/tt_trace_parse.h"
45 // Function handling constants
47 const int _TT_FUNS_ALLNONE = 2;
48 const int _TT_FUNS_EXPLICIT = 1;
49 const int _TT_FUNS_NOTSET = 0;
58 class _Tt_trace_parser : public virtual _Tt_allocated {
61 // Constructor / Destructor
64 _Tt_trace_parser(_Tt_trace_parser& templ);
65 _Tt_trace_parser(int fd);
66 _Tt_trace_parser(const char* script);
73 // Is any tracing being done?
77 // Retrieval functions -- used by client and server tracing
80 _Tt_string& sink_val();
81 const char* mode_val(); // sink file open mode
83 // ifunction_val returns one of the consts defined above --
84 // _TT_FUNS_ALLNONE, _TT_FUNS_EXPLICIT, or _TT_FUNS_NOTSET. If
85 // _TT_FUNS_NOTSET is returned, there still may be a value
86 // returned from sfunction_val
90 // sfunction_val returns the list ov functions to trace if an explicit
91 // list was given in the config info. If no such list was specified,
92 // an empty _Tt_string will be returned.
94 _Tt_string_list_ptr sfunction_val();
95 int attributes_val() const;
97 // states can be set to multiple values in the config file,
98 // so states_val returns the list of values specified.
100 _Tt_int_rec_list_ptr states_val();
101 _Tt_string_list_ptr ops_val();
102 _Tt_string_list_ptr sender_ptypes_val();
103 _Tt_string_list_ptr handler_ptypes_val();
104 #ifdef _OPT_TIMERS_SUNOS
108 // Utility functions used by parser -- not intended
109 // for use by any other code
111 // Field setting functions
114 void set_follow(int fval);
117 void set_sink(const _Tt_string& sinkfile, int mode);
120 void clear_functions();
121 void add_function(const _Tt_string& fun);
122 void set_function(int fun);
125 void set_attributes(int attr);
129 int add_state(int state_val);
133 void add_op(const _Tt_string& newop);
136 void clear_sender_ptypes();
137 void add_sender_ptype(const _Tt_string& sp);
140 void clear_handler_ptypes();
141 void add_handler_ptype(const _Tt_string& hp);
144 #ifdef _OPT_TIMERS_SUNOS
145 void set_timers(int tval);
148 // Tracing filters -- used by the tracing admin class
150 // message tracing filter
151 int is_traced(const _Tt_message& msg) const;
152 int is_traced(const _Tt_message& msg,
153 _Tt_dispatch_stage stage) const;
154 int is_traced(_Tt_entry_pt fun) const;
158 // config file or inline config stream -- used by YACC and Lex
160 _Tt_string trace_stream;
164 int mode; // Sink file open mode
166 _Tt_string_list_ptr sfunctions;
168 // discriminator for function values -- either _TT_FUNS_ALLNONE
169 // or _TT_FUNS_EXPLICIT
174 _Tt_int_rec_list_ptr states;
175 _Tt_string_list_ptr ops;
176 _Tt_string_list_ptr sender_ptypes;
177 _Tt_string_list_ptr handler_ptypes;
178 #ifdef _OPT_TIMERS_SUNOS
182 // does initialization common to all constructors
186 // Code common to the two is_traced methods that take a message arg
188 int _is_traced(const _Tt_message& msg) const;