"Fossies" - the Fresh Open Source Software Archive 
Member "xxgdb-1.12/sun_regex.h" (16 Nov 1994, 5574 Bytes) of package /linux/misc/old/xxgdb-1.12.tar.gz:
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.
1 /*****************************************************************************
2 *
3 * xdbx - X Window System interface to the dbx debugger
4 *
5 * Copyright 1989 The University of Texas at Austin
6 * Copyright 1990 Microelectronics and Computer Technology Corporation
7 *
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation for any purpose and without fee is hereby granted,
10 * provided that the above copyright notice appear in all copies and that
11 * both that copyright notice and this permission notice appear in
12 * supporting documentation, and that the name of The University of Texas
13 * and Microelectronics and Computer Technology Corporation (MCC) not be
14 * used in advertising or publicity pertaining to distribution of
15 * the software without specific, written prior permission. The
16 * University of Texas and MCC makes no representations about the
17 * suitability of this software for any purpose. It is provided "as is"
18 * without express or implied warranty.
19 *
20 * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
21 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
23 * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
24 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
25 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 *
28 * Author: Po Cheung
29 * Created: March 10, 1989
30 *
31 *****************************************************************************/
32
33 /* sun_regex.h:
34 *
35 * Regular expression pattern matching for Sun dbx.
36 *
37 * The reg_token array indicates the register no. for each token type.
38 * reg_token[0] : message
39 * reg_token[1] : stop number
40 * reg_token[2] : function name
41 * reg_token[3] : line number
42 * reg_token[4] : file name
43 * reg_token[5] : display command output
44 */
45
46 #define TK_MESG 0
47 #define TK_STOP 1
48 #define TK_FUNC 2
49 #define TK_LINE 3
50 #define TK_FILE 4
51 #define TK_DISP 5
52
53 #define O_EXEC_GDB 0
54 #define O_DONE 1
55 #define O_STOPAT 2
56 #define O_STOPIN 3
57 #define O_UPDOWN 4
58 #define O_BELL 5
59 #define O_LIST 6
60 #define O_SEARCH 6
61 #define O_FILE 7
62 #define O_PRINT 8
63 #define O_DEBUG 9
64
65 #define C_ANY -1
66 #define C_EXEC 0
67 #define C_STOPAT 1
68 #define C_STOPIN 2
69 #define C_UPDOWN 3
70 #define C_DELETE 4
71 #define C_FUNC 5
72 #define C_FILE 6
73 #define C_DEBUG 7
74 #define C_CD 8
75 #define C_USE 9
76 #define C_PWD 10
77 #define C_LIST 11
78 #define C_SEARCH 12
79 #define C_DISPLAY 13
80 #define C_PRINT 14
81
82 static PatternRec output_pattern[] = {
83 /* exec */
84 {"\\(.*\n\\)*.*\\(\\(stopped\\|Bus error\\|Segmentation fault\\|\
85 Interrupt\\|signal.*\\) in \\([^ ]+\\) at line \\([0-9]+\\)\\( in file\
86 \"\\([^ ]+\\)\"\\)?\\)\n\\(.*\n\\)?\\(\\(.*\n\\)*\\)",
87 NULL,
88 {2, -1, 4, 5, 7, 9}
89 },
90 /* done */
91 {"\\(.*\n\\)*\\(execution completed\\|program exited with [0-9]+\\)",
92 NULL,
93 {-1, -1, -1, -1, -1, -1}
94 },
95 /* stop at */
96 {"(\\([0-9]+\\)) stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
97 NULL,
98 {-1, 1, -1, 4, 3, -1}
99 },
100 /* stop in */
101 {"(\\([0-9]+\\)) stop in \\([^ ]+\\)\n",
102 NULL,
103 {-1, 1, 2, -1, -1, -1}
104 },
105 /* up, down */
106 {"\\(.*\n\\)?\\(Current function is \\([^ ]+\\)\n\\)\\([ ]*\\([0-9]+\\).*\n\\)",
107 NULL,
108 {2, -1, 3, 5, -1, -1}
109 },
110 /* bell */
111 {"\\(Already at the \\(top\\|bottom\\) call level\n\\|\
112 No active stack frames\n\\|no program to run\n\\|no process to run\n\\|\
113 program is not active\n\\|can't continue execution\n\\|\
114 .*\ncan't write to process.*\n\\|\
115 \\(Top\\|End\\)-of-file; did not find search string:.*\n\\)",
116 NULL,
117 {-1, -1, -1, -1, -1}
118 },
119 /* list, search */
120 {"[ ]*\\([0-9]+\\).*\n",
121 NULL,
122 {-1, -1, -1, 1, -1, -1}
123 },
124 /* file */
125 {"\\(\\([^ ]*\\)\\|No current source file\\)\n",
126 NULL,
127 {-1, -1, -1, -1, 2, -1}
128 },
129 /* print, display */
130 {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)",
131 NULL,
132 { 3, -1, -1, -1, -1, 2}
133 },
134 /* debug */
135 {"Reading symbolic information...\nRead [0-9]+ symbols\n",
136 NULL,
137 { -1, -1, -1, -1, -1, -1}
138 },
139 NULL
140 };
141
142
143 static PatternRec command_pattern[] = {
144 {"[ ]*\\(run\\|rerun\\|cont\\|next\\|step\\)\\( [0-9]+\\)?[ ]*",
145 NULL, {-1, -1, -1, -1, -1, -1}},
146 {"[ ]*stop[ ]+at[ ]+\\(\"[^ ]+\":\\)?[0-9]+[ ]*\n",
147 NULL, {-1, -1, -1, -1, -1, -1}},
148 {"[ ]*stop[ ]+in[ ]+[^ ]+[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}},
149 {"[ ]*\\(up\\|down\\)[ ]*\\( [0-9]+\\)?[ ]*\n",
150 NULL, {-1, -1, -1, -1, -1, -1}},
151 {"[ ]*\\(delete\\|d\\)[ ]+\\(all\\|[0-9]+\\)",
152 NULL, {-1, -1, -1, 1, -1, -1}},
153 {"[ ]*func[ ]+\\([^ ]+\\)[ ]*\n", NULL, {-1, -1, 1, -1, -1, -1}},
154 {"[ ]*file[ ]*\\([^ ]+\\)?[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}},
155 {"[ ]*debug[ ]*[^ ]+[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}},
156 {"[ ]*cd[ ]*[^ ]+[ ]*", NULL, {-1, -1, -1, -1, -1, -1}},
157 {"[ ]*use[ ]*", NULL, {-1, -1, -1, -1, -1, -1}},
158 {"[ ]*pwd[ ]*\n", NULL, {-1, -1, -1, -1, -1, -1}},
159 {"[ ]*list[ ]*", NULL, {-1, -1, -1, -1, -1, -1}},
160 {"[ ]*\\(/\\|\?\\)[ ]*", NULL, {-1, -1, -1, -1, -1, -1}},
161 {"[ ]*\\(un\\)?display[ ]*[^ ]+[ ]*", NULL, {-1, -1, -1, -1, -1, -1}},
162 {"[ ]*print[ ]*[^ ]+[ ]*", NULL, {-1, -1, -1, -1, -1, -1}},
163 NULL
164 };