xref: /illumos-gate/usr/src/ucbcmd/sed/sed.h (revision b1e2e3fb17324e9ddf43db264a0c64da7756d9e6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #ifndef	_SED_H
31 #define	_SED_H
32 
33 /*
34  * sed -- stream  editor
35  */
36 
37 #include <ctype.h>
38 #include <locale.h>
39 
40 /*
41  * define some macros for rexexp.h
42  */
43 
44 #define INIT	extern char *cp;	/* cp points to RE string */\
45 		register char *sp = cp;
46 #define GETC()		(*sp++)
47 #define PEEKC()		(*sp)
48 #define UNGETC(c)	(--sp)
49 #define RETURN(c)	cp = sp; return(ep);
50 
51 #define CEND	16
52 #define CLNUM	14
53 
54 #define NLINES  256
55 #define DEPTH   20
56 #define PTRSIZE 200
57 #define RESIZE  10000
58 #define ABUFSIZE        20
59 #define LBSIZE  4000
60 #define ESIZE   256
61 #define LABSIZE 50
62 
63 extern union reptr     *abuf[];
64 extern union reptr **aptr;
65 extern char    genbuf[];
66 extern char	*lcomend;
67 extern long long lnum;
68 extern char    linebuf[];
69 extern char    holdsp[];
70 extern char    *spend;
71 extern char    *hspend;
72 extern int     nflag;
73 extern long long tlno[];
74 
75 #define ACOM    01
76 #define BCOM    020
77 #define CCOM    02
78 #define CDCOM   025
79 #define CNCOM   022
80 #define COCOM   017
81 #define CPCOM   023
82 #define DCOM    03
83 #define ECOM    015
84 #define EQCOM   013
85 #define FCOM    016
86 #define GCOM    027
87 #define CGCOM   030
88 #define HCOM    031
89 #define CHCOM   032
90 #define ICOM    04
91 #define LCOM    05
92 #define NCOM    012
93 #define PCOM    010
94 #define QCOM    011
95 #define RCOM    06
96 #define SCOM    07
97 #define TCOM    021
98 #define WCOM    014
99 #define CWCOM   024
100 #define YCOM    026
101 #define XCOM    033
102 
103 
104 union   reptr {
105         struct reptr1 {
106                 char    *ad1;
107                 char    *ad2;
108                 char    *re1;
109                 char    *rhs;
110                 FILE    *fcode;
111                 char    command;
112                 int    gfl;
113                 char    pfl;
114                 char    inar;
115                 char    negfl;
116         } r1;
117         struct reptr2 {
118                 char    *ad1;
119                 char    *ad2;
120                 union reptr     *lb1;
121                 char    *rhs;
122                 FILE    *fcode;
123                 char    command;
124                 int    gfl;
125                 char    pfl;
126                 char    inar;
127                 char    negfl;
128         } r2;
129 };
130 extern union reptr ptrspace[];
131 
132 
133 
134 struct label {
135         char    asc[9];
136         union reptr     *chain;
137         union reptr     *address;
138 };
139 
140 
141 
142 extern int     eargc;
143 
144 extern union reptr     *pending;
145 char    *compile();
146 char    *ycomp();
147 char    *address();
148 char    *text();
149 char    *compsub();
150 struct label    *search();
151 char    *gline();
152 char    *place();
153 void comperr(char *) __NORETURN;
154 void regerr(int) __NORETURN;
155 #define ERROR(c)	regerr(c)
156 void execute(char *);
157 
158 #endif	/* _SED_H */
159