Apache2
regexp.h
Go to the documentation of this file.
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;
64 
65 typedef struct _sed_comp_args {
66  int circf; /* Regular expression starts with ^ */
67  int nbra; /* braces count */
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  __attribute__((format(printf,2,3)));
74 
75 #define SEDERR_CGMES "command garbled: %s"
76 #define SEDERR_SMMES "Space missing before filename: %s"
77 #define SEDERR_TMMES "too much command text: %s"
78 #define SEDERR_LTLMES "label too long: %s"
79 #define SEDERR_ULMES "undefined label: %s"
80 #define SEDERR_DLMES "duplicate labels: %s"
81 #define SEDERR_TMLMES "too many labels: %s"
82 #define SEDERR_AD0MES "no addresses allowed: %s"
83 #define SEDERR_AD1MES "only one address allowed: %s"
84 #define SEDERR_TOOBIG "suffix too large: %s"
85 #define SEDERR_OOMMES "out of memory"
86 #define SEDERR_COPFMES "cannot open pattern file: %s"
87 #define SEDERR_COIFMES "cannot open input file: %s"
88 #define SEDERR_TMOMES "too many {'s"
89 #define SEDERR_TMCMES "too many }'s"
90 #define SEDERR_NRMES "first RE may not be null"
91 #define SEDERR_UCMES "unrecognized command: %s"
92 #define SEDERR_TMWFMES "too many files in w commands"
93 #define SEDERR_COMES "cannot open %s"
94 #define SEDERR_CCMES "cannot create %s"
95 #define SEDERR_TMLNMES "too many line numbers"
96 #define SEDERR_TMAMES "too many appends after line %" APR_INT64_T_FMT
97 #define SEDERR_TMRMES "too many reads after line %" APR_INT64_T_FMT
98 #define SEDERR_DOORNG "``\\digit'' out of range: %s"
99 #define SEDERR_EDMOSUB "ending delimiter missing on substitution: %s"
100 #define SEDERR_EDMOSTR "ending delimiter missing on string: %s"
101 #define SEDERR_FNTL "file name too long: %s"
102 #define SEDERR_CLTL "command line too long"
103 #define SEDERR_TSNTSS "transform strings not the same size: %s"
104 #define SEDERR_OLTL "output line too long."
105 #define SEDERR_HSOVERFLOW "hold space overflowed."
106 #define SEDERR_INTERNAL "internal sed error"
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* _REGEXP_H */
#define __attribute__(__x)
Definition: apr.h:63
#define NBRA
Definition: regexp.h:52
void command_errf(sed_commands_t *commands, const char *fmt,...) __attribute__((format(printf
char * sed_compile(sed_commands_t *commands, sed_comp_args *compargs, char *ep, char *endbuf, int seof)
struct _sed_comp_args sed_comp_args
struct _step_vars_storage step_vars_storage
Definition: regexp.h:65
int nbra
Definition: regexp.h:67
int circf
Definition: regexp.h:66
Definition: regexp.h:57
int size
Definition: regexp.h:62
int low
Definition: regexp.h:61
char * braelist[NBRA]
Definition: regexp.h:60
char * loc2
Definition: regexp.h:58
char * loc1
Definition: regexp.h:58
char * braslist[NBRA]
Definition: regexp.h:59
char * locs
Definition: regexp.h:58
Definition: libsed.h:68