sd: remove 'ssd' driver support
[unleashed/tickless.git] / usr / src / lib / libast / common / comp / regexp.h
blobc467310b9ca290327abd97e2708c0f0eeea068ca
1 /***********************************************************************
2 * *
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
8 * *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
12 * *
13 * Information and Software Systems Research *
14 * AT&T Research *
15 * Florham Park NJ *
16 * *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
20 * *
21 ***********************************************************************/
22 #pragma prototyped
24 * regexp interface and partial implementation
25 * what a novel approach
26 * don't do it again
28 * OBSOLETE: use <regex.h>
31 #ifndef _REGEXP_H
32 #define _REGEXP_H
34 #define NBRA 9
36 typedef struct
38 char* re_braslist[NBRA];
39 char* re_braelist[NBRA];
40 char* re_loc1;
41 char* re_loc2;
42 char* re_locs;
43 int re_circf;
44 int re_nbra;
45 int re_nodelim;
46 int re_sed;
47 } regexp_t;
49 #define braslist _re_info.re_braslist
50 #define braelist _re_info.re_braelist
51 #define circf _re_info.re_circf
52 #define loc1 _re_info.re_loc1
53 #define loc2 _re_info.re_loc2
54 #define locs _re_info.re_locs
55 #define nbra _re_info.re_nbra
56 #define nodelim _re_info.re_nodelim
57 #define sed _re_info.re_sed
59 #define advance(a,b) _re_exec(&_re_info,a,b,1)
60 #define compile(a,b,c,d) _re_read(&_re_info,a,b,c,d)
61 #define step(a,b) _re_exec(&_re_info,a,b,0)
63 #if _BLD_ast && defined(__EXPORT__)
64 #define extern __EXPORT__
65 #endif
67 extern int _re_comp(regexp_t*, const char*, char*, unsigned int);
68 extern int _re_exec(regexp_t*, const char*, const char*, int);
69 extern char* _re_putc(int);
70 extern char* _re_read(regexp_t*, const char*, char*, const char*, int);
72 #undef extern
74 #ifndef _REGEXP_DECLARE
76 regexp_t _re_info;
78 char*
79 _re_read(register regexp_t* re, const char* instring, char* ep, const char* endbuf, int seof)
81 register int c;
83 static const char* prev;
85 #ifdef INIT
86 INIT;
87 #endif
89 re->re_nodelim = 0;
90 if ((c = GETC()) == seof || c == '\n' || c == -1 || c == 0)
92 if (c != seof)
94 UNGETC(c);
95 re->re_nodelim = 1;
97 if (!re->re_sed && !prev)
98 { ERROR(41); }
99 RETURN((char*)endbuf);
101 UNGETC(c);
102 prev = 0;
103 for (;;)
105 if ((c = GETC()) == seof || c == '\n' || c == -1 || c == 0)
107 if (re->re_sed)
108 { ERROR(36); }
109 UNGETC(c);
110 re->re_nodelim = 1;
111 break;
113 if (c == '\\')
115 _re_putc(c);
116 if ((c = GETC()) == seof || c == '\n' || c == -1 || c == 0)
117 { ERROR(36); }
119 _re_putc(c);
121 if (c = _re_comp(re, _re_putc(0), ep, (char*)endbuf - ep))
122 { ERROR(c); }
123 prev = endbuf;
124 RETURN((char*)prev);
127 #endif
129 #endif