1 | /* annotati.h -*- C++ -*-
|
---|
2 | Copyright (c) 1996 Eberhard Mattes
|
---|
3 |
|
---|
4 | This file is part of pmgdb.
|
---|
5 |
|
---|
6 | pmgdb is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | pmgdb is distributed in the hope that it will be useful,
|
---|
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | GNU General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with pmgdb; see the file COPYING. If not, write to
|
---|
18 | the Free Software Foundation, 59 Temple Place - Suite 330,
|
---|
19 | Boston, MA 02111-1307, USA. */
|
---|
20 |
|
---|
21 |
|
---|
22 | class annotation
|
---|
23 | {
|
---|
24 | public:
|
---|
25 |
|
---|
26 | enum code
|
---|
27 | {
|
---|
28 | UNKNOWN,
|
---|
29 | TEXT,
|
---|
30 | READ_ERROR,
|
---|
31 | arg_begin,
|
---|
32 | arg_end,
|
---|
33 | arg_name_end,
|
---|
34 | arg_value,
|
---|
35 | array_section_begin,
|
---|
36 | array_section_end,
|
---|
37 | breakpoint,
|
---|
38 | breakpoint_new,
|
---|
39 | breakpoints_headers,
|
---|
40 | breakpoints_table,
|
---|
41 | breakpoints_table_end,
|
---|
42 | breakpoints_invalid,
|
---|
43 | commands,
|
---|
44 | display_begin,
|
---|
45 | display_delete,
|
---|
46 | display_disable,
|
---|
47 | display_enable,
|
---|
48 | display_end,
|
---|
49 | display_expression,
|
---|
50 | display_expression_end,
|
---|
51 | display_format,
|
---|
52 | display_number_end,
|
---|
53 | display_value,
|
---|
54 | error_begin,
|
---|
55 | error,
|
---|
56 | elt,
|
---|
57 | elt_rep,
|
---|
58 | elt_rep_end,
|
---|
59 | exec_file,
|
---|
60 | exec_file_invalid,
|
---|
61 | exited,
|
---|
62 | field,
|
---|
63 | field_begin,
|
---|
64 | field_end,
|
---|
65 | field_name_end,
|
---|
66 | field_value,
|
---|
67 | frame,
|
---|
68 | frame_args,
|
---|
69 | frame_begin,
|
---|
70 | frame_end,
|
---|
71 | frame_function_name,
|
---|
72 | frame_source_begin,
|
---|
73 | frame_source_end,
|
---|
74 | frame_source_file,
|
---|
75 | frame_source_file_end,
|
---|
76 | frame_source_line,
|
---|
77 | frames_invalid,
|
---|
78 | overload_choice,
|
---|
79 | prompt,
|
---|
80 | prompt_for_continue,
|
---|
81 | pre_commands,
|
---|
82 | pre_overload_choice,
|
---|
83 | pre_prompt,
|
---|
84 | pre_prompt_for_continue,
|
---|
85 | pre_query,
|
---|
86 | post_commands,
|
---|
87 | post_overload_choice,
|
---|
88 | post_prompt,
|
---|
89 | post_prompt_for_continue,
|
---|
90 | post_query,
|
---|
91 | query,
|
---|
92 | quit,
|
---|
93 | record,
|
---|
94 | show_value,
|
---|
95 | show_value_end,
|
---|
96 | starting,
|
---|
97 | stopped,
|
---|
98 | signalled,
|
---|
99 | source,
|
---|
100 | source_file,
|
---|
101 | source_location,
|
---|
102 | source_location_end,
|
---|
103 | signal,
|
---|
104 | signal_handler_caller,
|
---|
105 | signal_name,
|
---|
106 | signal_name_end,
|
---|
107 | signal_string,
|
---|
108 | signal_string_end,
|
---|
109 | thread_add,
|
---|
110 | thread_disable,
|
---|
111 | thread_enable,
|
---|
112 | thread_end,
|
---|
113 | thread_switch,
|
---|
114 | value_begin,
|
---|
115 | value_end,
|
---|
116 | value_history_begin,
|
---|
117 | value_history_end,
|
---|
118 | value_history_value,
|
---|
119 | watchpoint
|
---|
120 | };
|
---|
121 |
|
---|
122 | annotation ();
|
---|
123 | ~annotation ();
|
---|
124 | void start (int fd);
|
---|
125 | code get_next ();
|
---|
126 | code get_code () const { return last_code; }
|
---|
127 | const char *get_text () const { return last_text; }
|
---|
128 | int get_text_len () const { return last_text_len; }
|
---|
129 | const char *get_args () const { return last_args; }
|
---|
130 | int get_args_len () const { return last_args_len; }
|
---|
131 |
|
---|
132 | private:
|
---|
133 |
|
---|
134 | enum
|
---|
135 | {
|
---|
136 | hash_size = 97
|
---|
137 | } constants;
|
---|
138 |
|
---|
139 | struct node;
|
---|
140 |
|
---|
141 | unsigned hash (const char *s, int len);
|
---|
142 | void init (code c, const char *s);
|
---|
143 | void parse (const char *s, int len);
|
---|
144 | bool fill ();
|
---|
145 |
|
---|
146 | int fd;
|
---|
147 | node *table[hash_size];
|
---|
148 | code last_code;
|
---|
149 | const char *last_text, *last_args;
|
---|
150 | int last_args_len, last_text_len;
|
---|
151 | int buf_size;
|
---|
152 | int buf_in, buf_out;
|
---|
153 | char *buf;
|
---|
154 | };
|
---|