"Fossies" - the Fresh Open Source Software Archive 
Member "xxgdb-1.12/bsd_regex.h" (16 Nov 1994, 5064 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 /* bsd_regex.h
34 *
35 * Regular expression pattern matching for Berkeley 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_FILE 7
61 #define O_SEARCH 8
62 #define O_PRINT 9
63 #define O_DEBUG 10
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_USE 7
74 #define C_LIST 8
75 #define C_SEARCH 9
76 #define C_PRINT 10
77 #define C_STATUS 11
78
79
80 static PatternRec output_pattern[] = {
81 /* exec */
82 {"\\(.*\n\\)*.*\\(\[[0-9]+\\] \\)?\\(\\(stopped\\|Bus error\\|Segmentation \
83 fault\\|Interrupt\\) in \\([^ ]+\\) at line \
84 \\([0-9]+\\)\\( in file \"\\([^ ]+\\)\"\\)?\\)\n",
85 NULL,
86 {3, -1, 5, 6, 8, -1}
87 },
88 /* done */
89 {"\\(.*\n\\)*execution completed",
90 NULL,
91 {-1, -1, -1, -1, -1, -1}
92 },
93 /* stop at */
94 {"\\[\\([0-9]+\\)\\] stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
95 NULL,
96 {-1, 1, -1, 4, 3, -1}
97 },
98 /* stop in */
99 {"\\[\\([0-9]+\\)\\] stop in \\([^ ]+\\)\n",
100 NULL,
101 {-1, 1, 2, -1, -1, -1}
102 },
103 /* up, down */
104 {"\\([^ ]+\\)(.*), line \\([0-9]+\\) in \"\\([^ ]+\\)\"\n",
105 NULL,
106 {-1, -1, 1, 2, 3, -1}
107 },
108 /* bell */
109 {"\\(not that many levels\n\\|can't continue execution\n\\)",
110 NULL,
111 {-1, -1, -1, -1, -1, -1}
112 },
113 /* list */
114 {"\\([ ]*[0-9]+.*\n\\)*[ ]+\\([0-9]+\\)[ ]+{.*\n",
115 NULL,
116 {-1, -1, -1, 2, -1, -1}
117 },
118 /* file */
119 {"\\([^ ]*\\)\n",
120 NULL,
121 {-1, -1, -1, -1, 1, -1}
122 },
123 /* search */
124 {"[ ]*\\([0-9]+\\).*\n",
125 NULL,
126 {-1, -1, -1, 1, -1, -1}
127 },
128 /* print, display */
129 {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)",
130 NULL,
131 { 3, -1, -1, -1, -1, 2}
132 },
133 NULL
134 };
135
136 static PatternRec command_pattern[] = {
137 {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|return\\)",
138 NULL, {-1, -1, -1, -1, -1, -1}},
139 {"[ ]*\\(stop\\|st\\)[ ]+at[ ]+[0-9]+", NULL, {-1, -1, -1, -1, -1, -1}},
140 {"[ ]*\\(stop\\|st\\)[ ]+in[ ]+[^ ]+", NULL, {-1, -1, -1, -1, -1, -1}},
141 {"[ ]*\\(where\\|up\\|down\\)", NULL, {-1, -1, -1, -1, -1, -1}},
142 {"[ ]*\\(delete\\|d\\)", NULL, {-1, -1, -1, 1, -1, -1}},
143 {"[ ]*func[ ]*\\([^ ]+\\)[ ]*", NULL, {-1, -1, 1, -1, -1, -1}},
144 {"[ ]*file[ ]*", NULL, {-1, -1, -1, -1, 1, -1}},
145 {"[ ]*use[ ]*", NULL, {-1, -1, -1, -1, 1, -1}},
146 {"[ ]*list[ ]*", NULL, {-1, -1, -1, -1, 1, -1}},
147 {"[ ]*\\(/\\|\?\\)", NULL, {-1, -1, -1, -1, -1, -1}},
148 {"[ ]*print[ ]*[^ ]+", NULL, {-1, -1, -1, -1, -1, -1}},
149 NULL
150 };