xref: /illumos-gate/usr/src/ucbcmd/sed/sed.h (revision 566b4223)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23bdcaf822Sbasabi  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
30bdcaf822Sbasabi #ifndef	_SED_H
31bdcaf822Sbasabi #define	_SED_H
32bdcaf822Sbasabi 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * sed -- stream  editor
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #include <ctype.h>
387c478bd9Sstevel@tonic-gate #include <locale.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * define some macros for rexexp.h
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate #define INIT	extern char *cp;	/* cp points to RE string */\
457c478bd9Sstevel@tonic-gate 		register char *sp = cp;
467c478bd9Sstevel@tonic-gate #define GETC()		(*sp++)
477c478bd9Sstevel@tonic-gate #define PEEKC()		(*sp)
487c478bd9Sstevel@tonic-gate #define UNGETC(c)	(--sp)
497c478bd9Sstevel@tonic-gate #define RETURN(c)	cp = sp; return(ep);
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define CEND	16
527c478bd9Sstevel@tonic-gate #define CLNUM	14
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate #define NLINES  256
557c478bd9Sstevel@tonic-gate #define DEPTH   20
567c478bd9Sstevel@tonic-gate #define PTRSIZE 200
577c478bd9Sstevel@tonic-gate #define RESIZE  10000
587c478bd9Sstevel@tonic-gate #define ABUFSIZE        20
597c478bd9Sstevel@tonic-gate #define LBSIZE  4000
607c478bd9Sstevel@tonic-gate #define ESIZE   256
617c478bd9Sstevel@tonic-gate #define LABSIZE 50
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate extern union reptr     *abuf[];
647c478bd9Sstevel@tonic-gate extern union reptr **aptr;
657c478bd9Sstevel@tonic-gate extern char    genbuf[];
667c478bd9Sstevel@tonic-gate extern char	*lcomend;
677c478bd9Sstevel@tonic-gate extern long long lnum;
687c478bd9Sstevel@tonic-gate extern char    linebuf[];
697c478bd9Sstevel@tonic-gate extern char    holdsp[];
707c478bd9Sstevel@tonic-gate extern char    *spend;
717c478bd9Sstevel@tonic-gate extern char    *hspend;
727c478bd9Sstevel@tonic-gate extern int     nflag;
737c478bd9Sstevel@tonic-gate extern long long tlno[];
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate #define ACOM    01
767c478bd9Sstevel@tonic-gate #define BCOM    020
777c478bd9Sstevel@tonic-gate #define CCOM    02
787c478bd9Sstevel@tonic-gate #define CDCOM   025
797c478bd9Sstevel@tonic-gate #define CNCOM   022
807c478bd9Sstevel@tonic-gate #define COCOM   017
817c478bd9Sstevel@tonic-gate #define CPCOM   023
827c478bd9Sstevel@tonic-gate #define DCOM    03
837c478bd9Sstevel@tonic-gate #define ECOM    015
847c478bd9Sstevel@tonic-gate #define EQCOM   013
857c478bd9Sstevel@tonic-gate #define FCOM    016
867c478bd9Sstevel@tonic-gate #define GCOM    027
877c478bd9Sstevel@tonic-gate #define CGCOM   030
887c478bd9Sstevel@tonic-gate #define HCOM    031
897c478bd9Sstevel@tonic-gate #define CHCOM   032
907c478bd9Sstevel@tonic-gate #define ICOM    04
917c478bd9Sstevel@tonic-gate #define LCOM    05
927c478bd9Sstevel@tonic-gate #define NCOM    012
937c478bd9Sstevel@tonic-gate #define PCOM    010
947c478bd9Sstevel@tonic-gate #define QCOM    011
957c478bd9Sstevel@tonic-gate #define RCOM    06
967c478bd9Sstevel@tonic-gate #define SCOM    07
977c478bd9Sstevel@tonic-gate #define TCOM    021
987c478bd9Sstevel@tonic-gate #define WCOM    014
997c478bd9Sstevel@tonic-gate #define CWCOM   024
1007c478bd9Sstevel@tonic-gate #define YCOM    026
1017c478bd9Sstevel@tonic-gate #define XCOM    033
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate union   reptr {
1057c478bd9Sstevel@tonic-gate         struct reptr1 {
1067c478bd9Sstevel@tonic-gate                 char    *ad1;
1077c478bd9Sstevel@tonic-gate                 char    *ad2;
1087c478bd9Sstevel@tonic-gate                 char    *re1;
1097c478bd9Sstevel@tonic-gate                 char    *rhs;
1107c478bd9Sstevel@tonic-gate                 FILE    *fcode;
1117c478bd9Sstevel@tonic-gate                 char    command;
1127c478bd9Sstevel@tonic-gate                 int    gfl;
1137c478bd9Sstevel@tonic-gate                 char    pfl;
1147c478bd9Sstevel@tonic-gate                 char    inar;
1157c478bd9Sstevel@tonic-gate                 char    negfl;
1167c478bd9Sstevel@tonic-gate         } r1;
1177c478bd9Sstevel@tonic-gate         struct reptr2 {
1187c478bd9Sstevel@tonic-gate                 char    *ad1;
1197c478bd9Sstevel@tonic-gate                 char    *ad2;
1207c478bd9Sstevel@tonic-gate                 union reptr     *lb1;
1217c478bd9Sstevel@tonic-gate                 char    *rhs;
1227c478bd9Sstevel@tonic-gate                 FILE    *fcode;
1237c478bd9Sstevel@tonic-gate                 char    command;
1247c478bd9Sstevel@tonic-gate                 int    gfl;
1257c478bd9Sstevel@tonic-gate                 char    pfl;
1267c478bd9Sstevel@tonic-gate                 char    inar;
1277c478bd9Sstevel@tonic-gate                 char    negfl;
1287c478bd9Sstevel@tonic-gate         } r2;
1297c478bd9Sstevel@tonic-gate };
1307c478bd9Sstevel@tonic-gate extern union reptr ptrspace[];
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate struct label {
1357c478bd9Sstevel@tonic-gate         char    asc[9];
1367c478bd9Sstevel@tonic-gate         union reptr     *chain;
1377c478bd9Sstevel@tonic-gate         union reptr     *address;
1387c478bd9Sstevel@tonic-gate };
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate extern int     eargc;
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate extern union reptr     *pending;
1457c478bd9Sstevel@tonic-gate char    *compile();
1467c478bd9Sstevel@tonic-gate char    *ycomp();
1477c478bd9Sstevel@tonic-gate char    *address();
1487c478bd9Sstevel@tonic-gate char    *text();
1497c478bd9Sstevel@tonic-gate char    *compsub();
1507c478bd9Sstevel@tonic-gate struct label    *search();
1517c478bd9Sstevel@tonic-gate char    *gline();
1527c478bd9Sstevel@tonic-gate char    *place();
153*566b4223SToomas Soome void comperr(char *) __NORETURN;
154*566b4223SToomas Soome void regerr(int) __NORETURN;
155*566b4223SToomas Soome #define ERROR(c)	regerr(c)
156bdcaf822Sbasabi void execute(char *);
157bdcaf822Sbasabi 
158bdcaf822Sbasabi #endif	/* _SED_H */
159