xref: /original-bsd/lib/libedit/el.h (revision 2cb1372a)
1 /*-
2  * Copyright (c) 1992, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Christos Zoulas of Cornell University.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)el.h	8.1 (Berkeley) 06/04/93
11  */
12 
13 /*
14  * el.h: Internal structures.
15  */
16 #ifndef _h_el
17 #define _h_el
18 /*
19  * Local defaults
20  */
21 #define KSHVI
22 #define VIDEFAULT
23 #define ANCHOR
24 
25 #include <stdio.h>
26 #include <sys/types.h>
27 
28 #define EL_BUFSIZ	1024		/* Maximum line size		*/
29 
30 #define HANDLE_SIGNALS	1
31 
32 typedef int bool_t;			/* True or not			*/
33 
34 typedef unsigned char el_action_t;	/* Index to command array	*/
35 
36 typedef struct coord_t {		/* Position on the screen	*/
37     int h, v;
38 } coord_t;
39 
40 typedef struct el_line_t {
41     char *buffer, 			/* Input line 			*/
42 	 *cursor, 			/* Cursor position 		*/
43 	 *lastchar,			/* Last character 		*/
44 	 *limit;			/* Max position			*/
45 } el_line_t;
46 
47 /*
48  * Editor state
49  */
50 typedef struct el_state_t {
51     int 	inputmode;		/* What mode are we in? 	*/
52     int 	doingarg;		/* Are we getting an argument?	*/
53     int	        argument;		/* Numeric argument 		*/
54     int		metanext;		/* Is the next char a meta char */
55     el_action_t lastcmd;		/* Previous command		*/
56 } el_state_t;
57 
58 /*
59  * Until we come up with something better...
60  */
61 #define el_malloc(a)	malloc(a)
62 #define el_realloc(a,b)	realloc(a, b)
63 #define el_free(a)	free(a)
64 
65 #include "tty.h"
66 #include "prompt.h"
67 #include "key.h"
68 #include "term.h"
69 #include "refresh.h"
70 #include "chared.h"
71 #include "common.h"
72 #include "search.h"
73 #include "hist.h"
74 #include "map.h"
75 #include "parse.h"
76 #include "sig.h"
77 #include "help.h"
78 
79 struct editline {
80     char	 *el_prog;	/* the program name 			*/
81     FILE         *el_outfile;	/* Stdio stuff				*/
82     FILE         *el_errfile;	/* Stdio stuff				*/
83     int           el_infd;	/* Input file descriptor		*/
84     int		  el_flags;	/* Various flags.			*/
85     coord_t       el_cursor;	/* Cursor location			*/
86     char        **el_display, 	/* Real screen image = what is there	*/
87 	        **el_vdisplay;	/* Virtual screen image = what we see	*/
88 
89     el_line_t     el_line;	/* The current line information		*/
90     el_state_t	  el_state;	/* Current editor state			*/
91     el_term_t     el_term;	/* Terminal dependent stuff		*/
92     el_tty_t	  el_tty;	/* Tty dependent stuff			*/
93     el_refresh_t  el_refresh;	/* Refresh stuff			*/
94     el_prompt_t   el_prompt;	/* Prompt stuff				*/
95     el_chared_t	  el_chared;	/* Characted editor stuff		*/
96     el_map_t	  el_map;	/* Key mapping stuff			*/
97     el_key_t	  el_key;	/* Key binding stuff			*/
98     el_history_t  el_history;	/* History stuff			*/
99     el_search_t	  el_search;	/* Search stuff				*/
100     el_signal_t	  el_signal;	/* Signal handling stuff		*/
101 };
102 
103 #endif /* _h_el */
104