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_parse_utils.C /main/3 1995/10/23 10:43:13 rswiston $
30 #include <sys/param.h>
31 #include "tt_trace.tab.h"
32 #include "tt_trace_parser.h"
34 static _Tt_trace_parser_ptr trace_parser(NULL);
37 void process_follow(const int);
38 void process_sink(const char* const);
39 void clear_functions(void);
40 void process_functionlist(const char* const);
41 void process_functions_allnone(const int);
42 void process_attributes(const int);
44 int process_state(const int, const int);
45 void create_op_list(const char* const);
46 void add_op(const char* const);
47 void create_sp_list(const char* const);
48 void add_sender_ptype(const char* const);
49 void create_hp_list(const char* const);
50 void add_handler_ptype(const char* const);
51 int _tt_trace_input();
52 void _tt_trace_unput(int);
55 void set_trace_parser(const _Tt_trace_parser_ptr tp)
60 void process_follow(const int on_off)
62 trace_parser->set_follow(on_off);
65 void process_sink(const char* const fname)
67 _Tt_string tmp_fname(fname); // Shuts compiler up
69 trace_parser->set_sink(tmp_fname);
72 void clear_functions(void)
74 trace_parser->clear_functions();
77 void process_functionlist(const char* const text_item)
79 _Tt_string tmp_item(text_item); // Shuts compiler up
81 trace_parser->add_function(tmp_item);
84 void process_functions_allnone(const int all_none)
86 trace_parser->clear_functions(); /* clear any previous settings */
87 trace_parser->set_function(all_none);
90 void process_attributes(const int all_none)
92 trace_parser->set_attributes(all_none);
95 void clear_states(void)
97 trace_parser->clear_states(); /* clear any previous settings */
100 int process_state(const int state_type, const int state_val)
102 int sval = state_val;
104 if (state_type == _TT_TRACE_STATES_NEDD) {
113 case _TT_TRACE_DELIVER:
114 sval = states_deliver;
116 case _TT_TRACE_DISPATCH:
117 sval = states_dispatch;
125 return trace_parser->add_state(sval);
128 void create_op_list(const char* const op)
130 _Tt_string tmp_op(op); // Shuts compiler up
132 trace_parser->clear_ops();
133 trace_parser->add_op(tmp_op);
136 void add_op(const char* const op)
138 _Tt_string tmp_op(op); // Shuts compiler up
140 trace_parser->add_op(tmp_op);
143 void create_sp_list(const char* const sp)
145 _Tt_string tmp_sp(sp); // Shuts compiler up
147 trace_parser->clear_sender_ptypes();
148 trace_parser->add_sender_ptype(tmp_sp);
151 void add_sender_ptype(const char* const sp)
153 _Tt_string tmp_sp(sp); // Shuts compiler up
155 trace_parser->add_sender_ptype(tmp_sp);
158 void create_hp_list(const char* const hp)
160 _Tt_string tmp_hp(hp); // Shuts compiler up
162 trace_parser->clear_handler_ptypes();
163 trace_parser->add_handler_ptype(tmp_hp);
166 void add_handler_ptype(const char* const hp)
168 _Tt_string tmp_hp(hp); // Shuts compiler up
170 trace_parser->add_handler_ptype(tmp_hp);
173 // Lex utility functions
175 int _tt_trace_input(void)
177 return trace_parser->next_char();
180 void _tt_trace_unput(int ch)
182 trace_parser->ungetc(ch);