1 /* |
|
2 * Copyright (c) 2005, 2008 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * Use is subject to license terms. |
|
4 * |
|
5 * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T |
|
6 * All Rights Reserved |
|
7 * |
|
8 * University Copyright- Copyright (c) 1982, 1986, 1988 |
|
9 * The Regents of the University of California |
|
10 * All Rights Reserved |
|
11 * |
|
12 * University Acknowledgment- Portions of this document are derived from |
|
13 * software developed by the University of California, Berkeley, and its |
|
14 * contributors. |
|
15 * |
|
16 * Licensed under the Apache License, Version 2.0 (the "License"); |
|
17 * you may not use this file except in compliance with the License. |
|
18 * You may obtain a copy of the License at |
|
19 * http://www.apache.org/licenses/LICENSE-2.0. |
|
20 * |
|
21 * Unless required by applicable law or agreed to in writing, software |
|
22 * distributed under the License is distributed on an "AS IS" BASIS, |
|
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
|
24 * or implied. |
|
25 * See the License for the specific language governing permissions and |
|
26 * limitations under the License. |
|
27 */ |
|
28 |
|
29 #ifndef _REGEXP_H |
|
30 #define _REGEXP_H |
|
31 |
|
32 #include "libsed.h" |
|
33 |
|
34 #ifdef __cplusplus |
|
35 extern "C" { |
|
36 #endif |
|
37 |
|
38 #define CBRA 2 |
|
39 #define CCHR 4 |
|
40 #define CDOT 8 |
|
41 #define CCL 12 |
|
42 #define CXCL 16 |
|
43 #define CDOL 20 |
|
44 #define CCEOF 22 |
|
45 #define CKET 24 |
|
46 #define CBACK 36 |
|
47 #define NCCL 40 |
|
48 |
|
49 #define STAR 01 |
|
50 #define RNGE 03 |
|
51 |
|
52 #define NBRA 9 |
|
53 |
|
54 #define PLACE(c) ep[c >> 3] |= bittab[c & 07] |
|
55 #define ISTHERE(c) (ep[c >> 3] & bittab[c & 07]) |
|
56 |
|
57 typedef struct _step_vars_storage { |
|
58 char *loc1, *loc2, *locs; |
|
59 char *braslist[NBRA]; |
|
60 char *braelist[NBRA]; |
|
61 int low; |
|
62 int size; |
|
63 } step_vars_storage; |
|
64 |
|
65 typedef struct _sed_comp_args { |
|
66 int circf; /* Regular expression starts with ^ */ |
|
67 int nbra; /* braces count */ |
|
68 } sed_comp_args; |
|
69 |
|
70 extern char *sed_compile(sed_commands_t *commands, sed_comp_args *compargs, |
|
71 char *ep, char *endbuf, int seof); |
|
72 extern void command_errf(sed_commands_t *commands, const char *fmt, ...); |
|
73 |
|
74 #define SEDERR_CGMES "command garbled: %s" |
|
75 #define SEDERR_SMMES "Space missing before filename: %s" |
|
76 #define SEDERR_TMMES "too much command text: %s" |
|
77 #define SEDERR_LTLMES "label too long: %s" |
|
78 #define SEDERR_ULMES "undefined label: %s" |
|
79 #define SEDERR_DLMES "duplicate labels: %s" |
|
80 #define SEDERR_TMLMES "too many labels: %s" |
|
81 #define SEDERR_AD0MES "no addresses allowed: %s" |
|
82 #define SEDERR_AD1MES "only one address allowed: %s" |
|
83 #define SEDERR_TOOBIG "suffix too large: %s" |
|
84 #define SEDERR_OOMMES "out of memory" |
|
85 #define SEDERR_COPFMES "cannot open pattern file: %s" |
|
86 #define SEDERR_COIFMES "cannot open input file: %s" |
|
87 #define SEDERR_TMOMES "too many {'s" |
|
88 #define SEDERR_TMCMES "too many }'s" |
|
89 #define SEDERR_NRMES "first RE may not be null" |
|
90 #define SEDERR_UCMES "unrecognized command: %s" |
|
91 #define SEDERR_TMWFMES "too many files in w commands" |
|
92 #define SEDERR_COMES "cannot open %s" |
|
93 #define SEDERR_CCMES "cannot create %s" |
|
94 #define SEDERR_TMLNMES "too many line numbers" |
|
95 #define SEDERR_TMAMES "too many appends after line %lld" |
|
96 #define SEDERR_TMRMES "too many reads after line %lld" |
|
97 #define SEDERR_DOORNG "``\\digit'' out of range: %s" |
|
98 #define SEDERR_EDMOSUB "ending delimiter missing on substitution: %s" |
|
99 #define SEDERR_EDMOSTR "ending delimiter missing on string: %s" |
|
100 #define SEDERR_FNTL "file name too long: %s" |
|
101 #define SEDERR_CLTL "command line too long" |
|
102 #define SEDERR_TSNTSS "transform strings not the same size: %s" |
|
103 #define SEDERR_OLTL "output line too long." |
|
104 #define SEDERR_HSOVERFLOW "hold space overflowed." |
|
105 #define SEDERR_INTERNAL "internal sed error" |
|
106 |
|
107 #ifdef __cplusplus |
|
108 } |
|
109 #endif |
|
110 |
|
111 #endif /* _REGEXP_H */ |
|