xref: /original-bsd/local/toolchest/ksh/sh/edit.h (revision 83f510f5)
1 /*
2 
3  *      Copyright (c) 1984, 1985, 1986 AT&T
4  *      All Rights Reserved
5 
6  *      THIS IS UNPUBLISHED PROPRIETARY SOURCE
7  *      CODE OF AT&T.
8  *      The copyright notice above does not
9  *      evidence any actual or intended
10  *      publication of such source code.
11 
12  */
13 
14 /* @(#)edit.h	1.1 */
15 
16 /*
17  *  edit.h -  common data structure for vi and emacs edit options
18  *
19  *   David Korn
20  *   AT&T Bell Laboratories
21  *   Room 5D-112
22  *   Murray Hill, N. J. 07974
23  *   Tel. x7975
24  *
25  */
26 
27 #define LOOKAHEAD	80
28 #ifdef VENIX
29 #define READAHEAD	1
30 #else
31 #define READAHEAD	LOOKAHEAD
32 #endif	/* VENIX */
33 
34 #ifdef MULTIBYTE
35 # ifndef ESS_MAXCHAR
36 # include	"national.h"
37 # endif	/* ESS_MAXCHAR */
38 # if ESS_MAXCHAR<=2
39 typedef unsigned short genchar;
40 # else
41 typedef long genchar;
42 # endif
43 #define CHARSIZE	2
44 #else
45 typedef char genchar;
46 #define CHARSIZE	1
47 #endif /* MULTIBYTE */
48 
49 struct edit
50 {
51 	int	e_kill;
52 	int	e_erase;
53 	int	e_eof;
54 	int	e_fchar;
55 	char	e_plen;		/* length of prompt string */
56 	char	e_crlf;		/* zero if cannot return to beginning of line */
57 	jmp_buf e_env;
58 	int	e_llimit;	/* line length limit */
59 	int	e_hline;	/* current history line number */
60 	int	e_hloff;	/* line number offset for command */
61 	int	e_hismin;	/* minimum history line number */
62 	int	e_hismax;	/* maximum history line number */
63 	int	e_raw;		/* set when in raw mode or alt mode */
64 	int	e_cur;		/* current line position */
65 	int	e_eol;		/* end-of-line position */
66 	int	e_pcur;		/* current physical line position */
67 	int	e_peol;		/* end of physical line position */
68 	int	e_mode;		/* edit mode */
69 	int	e_index;	/* index in look-ahead buffer */
70 	int	e_repeat;
71 	int	e_saved;
72 	int	e_fcol;		/* first column */
73 	int	e_ucol;		/* column for undo */
74 	int	e_addnl;	/* set if new-line must be added */
75 	int	e_wsize;	/* width of display window */
76 	unsigned char	*e_outptr;	/* pointer with output buffer */
77 	genchar	*e_inbuf;	/* pointer to input buffer */
78 	char	*e_prompt;	/* pointer to buffer containing the prompt */
79 	genchar	*e_ubuf;	/* pointer to the undo buffer */
80 	genchar	*e_tmp;		/* temporary workspace buffer */
81 	char	*e_search;	/* temporary workspace buffer */
82 	genchar	*e_Ubuf;	/* temporary workspace buffer */
83 	genchar	*e_physbuf;	/* temporary workspace buffer */
84 	int	e_lbuf[LOOKAHEAD];/* pointer to look-ahead buffer */
85 	int	e_fd;		/* file descriptor */
86 	int	e_ttyspeed;	/* line speed, also indicates tty parms are valid */
87 	int	*e_globals;	/* global variables */
88 	genchar	*e_window;	/* display window  image */
89 	char	e_inmacro;	/* processing macro expansion */
90 };
91 
92 #define FEMAX		50	/* maximum number of file matches for q_expand */
93 #define MAXWINDOW	160	/* maximum width window */
94 #define MINWINDOW	20	/* minimum width window */
95 #define DFLTWINDOW	80	/* default window width */
96 #define	MAXPAT		100	/* maximum length for pattern word */
97 #define	YES	1
98 #define NO	0
99 #define FAST	2
100 #define SLOW	1
101 #define RAWMODE	1
102 #define ALTMODE	2
103 #define DELETE	'\177'
104 #define BELL	'\7'
105 #define ESC	033
106 #define	UEOF	-2			/* user eof char synonym */
107 #define	UERASE	-3			/* user erase char synonym */
108 #define	UINTR	-4			/* user intr char synonym */
109 #define	UKILL	-5			/* user kill char synonym */
110 #define	UQUIT	-6			/* user quit char synonym */
111 
112 #define	cntl(x)		('x'&037)
113 
114 #ifndef KSHELL
115 #define		STRIP		0377
116 #define		TO_PRINT	0100
117 #define 	GMACS	1
118 #define 	EMACS	2
119 #define		VIRAW	4
120 #define		EDITVI	8
121 #define		NOHIST	16
122 #define		EDITMASK	15
123 #define		is_option(m)	(opt_flag&(m))
124 extern char opt_flag;
125 #define read(fd,buff,n)		syscall(3,fd,buff,n)
126 #endif	/* KSHELL */
127 
128 extern void setcooked();
129 extern struct edit editb;
130 extern MSG	big_vi;
131 extern MSG	version;
132