xref: /titanic_50/usr/src/ucbcmd/sed/sed.h (revision 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 /*
36  * sed -- stream  editor
37  */
38 
39 #include <ctype.h>
40 #include <locale.h>
41 
42 /*
43  * define some macros for rexexp.h
44  */
45 
46 #define INIT	extern char *cp;	/* cp points to RE string */\
47 		register char *sp = cp;
48 #define GETC()		(*sp++)
49 #define PEEKC()		(*sp)
50 #define UNGETC(c)	(--sp)
51 #define RETURN(c)	cp = sp; return(ep);
52 #define ERROR(c)	regerr(c)
53 
54 #define CEND	16
55 #define CLNUM	14
56 
57 #define NLINES  256
58 #define DEPTH   20
59 #define PTRSIZE 200
60 #define RESIZE  10000
61 #define ABUFSIZE        20
62 #define LBSIZE  4000
63 #define ESIZE   256
64 #define LABSIZE 50
65 
66 extern union reptr     *abuf[];
67 extern union reptr **aptr;
68 extern char    genbuf[];
69 extern char	*lcomend;
70 extern long long lnum;
71 extern char    linebuf[];
72 extern char    holdsp[];
73 extern char    *spend;
74 extern char    *hspend;
75 extern int     nflag;
76 extern long long tlno[];
77 
78 #define ACOM    01
79 #define BCOM    020
80 #define CCOM    02
81 #define CDCOM   025
82 #define CNCOM   022
83 #define COCOM   017
84 #define CPCOM   023
85 #define DCOM    03
86 #define ECOM    015
87 #define EQCOM   013
88 #define FCOM    016
89 #define GCOM    027
90 #define CGCOM   030
91 #define HCOM    031
92 #define CHCOM   032
93 #define ICOM    04
94 #define LCOM    05
95 #define NCOM    012
96 #define PCOM    010
97 #define QCOM    011
98 #define RCOM    06
99 #define SCOM    07
100 #define TCOM    021
101 #define WCOM    014
102 #define CWCOM   024
103 #define YCOM    026
104 #define XCOM    033
105 
106 
107 union   reptr {
108         struct reptr1 {
109                 char    *ad1;
110                 char    *ad2;
111                 char    *re1;
112                 char    *rhs;
113                 FILE    *fcode;
114                 char    command;
115                 int    gfl;
116                 char    pfl;
117                 char    inar;
118                 char    negfl;
119         } r1;
120         struct reptr2 {
121                 char    *ad1;
122                 char    *ad2;
123                 union reptr     *lb1;
124                 char    *rhs;
125                 FILE    *fcode;
126                 char    command;
127                 int    gfl;
128                 char    pfl;
129                 char    inar;
130                 char    negfl;
131         } r2;
132 };
133 extern union reptr ptrspace[];
134 
135 
136 
137 struct label {
138         char    asc[9];
139         union reptr     *chain;
140         union reptr     *address;
141 };
142 
143 
144 
145 extern int     eargc;
146 
147 extern union reptr     *pending;
148 char    *compile();
149 char    *ycomp();
150 char    *address();
151 char    *text();
152 char    *compsub();
153 struct label    *search();
154 char    *gline();
155 char    *place();
156 void comperr(char *);
157 void execute(char *);
158 
159 #endif	/* _SED_H */
160