1 /*- 2 * Copyright (c) 1992 The Regents of the University of California. 3 * 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 5.2 (Berkeley) 07/03/92 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 #ifdef sun 27 #include <malloc.h> 28 #endif 29 #include <sys/types.h> 30 31 #define EL_BUFSIZ 1024 /* Maximum line size */ 32 33 #define HANDLE_SIGNALS 1 34 35 typedef int bool_t; /* True or not */ 36 37 typedef unsigned char el_action_t; /* Index to command array */ 38 39 typedef struct coord_t { /* Position on the screen */ 40 int h, v; 41 } coord_t; 42 43 typedef struct el_line_t { 44 char *buffer, /* Input line */ 45 *cursor, /* Cursor position */ 46 *lastchar, /* Last character */ 47 *limit; /* Max position */ 48 } el_line_t; 49 50 /* 51 * Editor state 52 */ 53 typedef struct el_state_t { 54 int inputmode; /* What mode are we in? */ 55 int doingarg; /* Are we getting an argument? */ 56 int argument; /* Numeric argument */ 57 int metanext; /* Is the next char a meta char */ 58 el_action_t lastcmd; /* Previous command */ 59 } el_state_t; 60 61 /* 62 * Until we come up with something better... 63 */ 64 #define el_malloc(a) malloc(a) 65 #define el_realloc(a,b) realloc(a, b) 66 #define el_free(a) free(a) 67 68 #include "tty.h" 69 #include "prompt.h" 70 #include "key.h" 71 #include "term.h" 72 #include "refresh.h" 73 #include "chared.h" 74 #include "common.h" 75 #include "search.h" 76 #include "hist.h" 77 #include "map.h" 78 #include "parse.h" 79 #include "sig.h" 80 #include "help.h" 81 82 struct editline { 83 char *el_prog; /* the program name */ 84 FILE *el_outfile; /* Stdio stuff */ 85 FILE *el_errfile; /* Stdio stuff */ 86 int el_infd; /* Input file descriptor */ 87 int el_flags; /* Various flags. */ 88 coord_t el_cursor; /* Cursor location */ 89 char **el_display, /* Real screen image = what is there */ 90 **el_vdisplay; /* Virtual screen image = what we see */ 91 92 el_line_t el_line; /* The current line information */ 93 el_state_t el_state; /* Current editor state */ 94 el_term_t el_term; /* Terminal dependent stuff */ 95 el_tty_t el_tty; /* Tty dependent stuff */ 96 el_refresh_t el_refresh; /* Refresh stuff */ 97 el_prompt_t el_prompt; /* Prompt stuff */ 98 el_chared_t el_chared; /* Characted editor stuff */ 99 el_map_t el_map; /* Key mapping stuff */ 100 el_key_t el_key; /* Key binding stuff */ 101 el_history_t el_history; /* History stuff */ 102 el_search_t el_search; /* Search stuff */ 103 el_signal_t el_signal; /* Signal handling stuff */ 104 }; 105 106 #endif /* _h_el */ 107