Home | History | Annotate | Line # | Download | only in libedit
el.h revision 1.1
      1  1.1  cgd /*-
      2  1.1  cgd  * Copyright (c) 1992, 1993
      3  1.1  cgd  *	The Regents of the University of California.  All rights reserved.
      4  1.1  cgd  *
      5  1.1  cgd  * This code is derived from software contributed to Berkeley by
      6  1.1  cgd  * Christos Zoulas of Cornell University.
      7  1.1  cgd  *
      8  1.1  cgd  * Redistribution and use in source and binary forms, with or without
      9  1.1  cgd  * modification, are permitted provided that the following conditions
     10  1.1  cgd  * are met:
     11  1.1  cgd  * 1. Redistributions of source code must retain the above copyright
     12  1.1  cgd  *    notice, this list of conditions and the following disclaimer.
     13  1.1  cgd  * 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  cgd  *    notice, this list of conditions and the following disclaimer in the
     15  1.1  cgd  *    documentation and/or other materials provided with the distribution.
     16  1.1  cgd  * 3. All advertising materials mentioning features or use of this software
     17  1.1  cgd  *    must display the following acknowledgement:
     18  1.1  cgd  *	This product includes software developed by the University of
     19  1.1  cgd  *	California, Berkeley and its contributors.
     20  1.1  cgd  * 4. Neither the name of the University nor the names of its contributors
     21  1.1  cgd  *    may be used to endorse or promote products derived from this software
     22  1.1  cgd  *    without specific prior written permission.
     23  1.1  cgd  *
     24  1.1  cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  1.1  cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  1.1  cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  1.1  cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  1.1  cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  1.1  cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  1.1  cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  1.1  cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  1.1  cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  1.1  cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  1.1  cgd  * SUCH DAMAGE.
     35  1.1  cgd  *
     36  1.1  cgd  *	@(#)el.h	8.1 (Berkeley) 6/4/93
     37  1.1  cgd  */
     38  1.1  cgd 
     39  1.1  cgd /*
     40  1.1  cgd  * el.h: Internal structures.
     41  1.1  cgd  */
     42  1.1  cgd #ifndef _h_el
     43  1.1  cgd #define _h_el
     44  1.1  cgd /*
     45  1.1  cgd  * Local defaults
     46  1.1  cgd  */
     47  1.1  cgd #define KSHVI
     48  1.1  cgd #define VIDEFAULT
     49  1.1  cgd #define ANCHOR
     50  1.1  cgd 
     51  1.1  cgd #include <stdio.h>
     52  1.1  cgd #include <sys/types.h>
     53  1.1  cgd 
     54  1.1  cgd #define EL_BUFSIZ	1024		/* Maximum line size		*/
     55  1.1  cgd 
     56  1.1  cgd #define HANDLE_SIGNALS	1
     57  1.1  cgd 
     58  1.1  cgd typedef int bool_t;			/* True or not			*/
     59  1.1  cgd 
     60  1.1  cgd typedef unsigned char el_action_t;	/* Index to command array	*/
     61  1.1  cgd 
     62  1.1  cgd typedef struct coord_t {		/* Position on the screen	*/
     63  1.1  cgd     int h, v;
     64  1.1  cgd } coord_t;
     65  1.1  cgd 
     66  1.1  cgd typedef struct el_line_t {
     67  1.1  cgd     char *buffer, 			/* Input line 			*/
     68  1.1  cgd 	 *cursor, 			/* Cursor position 		*/
     69  1.1  cgd 	 *lastchar,			/* Last character 		*/
     70  1.1  cgd 	 *limit;			/* Max position			*/
     71  1.1  cgd } el_line_t;
     72  1.1  cgd 
     73  1.1  cgd /*
     74  1.1  cgd  * Editor state
     75  1.1  cgd  */
     76  1.1  cgd typedef struct el_state_t {
     77  1.1  cgd     int 	inputmode;		/* What mode are we in? 	*/
     78  1.1  cgd     int 	doingarg;		/* Are we getting an argument?	*/
     79  1.1  cgd     int	        argument;		/* Numeric argument 		*/
     80  1.1  cgd     int		metanext;		/* Is the next char a meta char */
     81  1.1  cgd     el_action_t lastcmd;		/* Previous command		*/
     82  1.1  cgd } el_state_t;
     83  1.1  cgd 
     84  1.1  cgd /*
     85  1.1  cgd  * Until we come up with something better...
     86  1.1  cgd  */
     87  1.1  cgd #define el_malloc(a)	malloc(a)
     88  1.1  cgd #define el_realloc(a,b)	realloc(a, b)
     89  1.1  cgd #define el_free(a)	free(a)
     90  1.1  cgd 
     91  1.1  cgd #include "tty.h"
     92  1.1  cgd #include "prompt.h"
     93  1.1  cgd #include "key.h"
     94  1.1  cgd #include "term.h"
     95  1.1  cgd #include "refresh.h"
     96  1.1  cgd #include "chared.h"
     97  1.1  cgd #include "common.h"
     98  1.1  cgd #include "search.h"
     99  1.1  cgd #include "hist.h"
    100  1.1  cgd #include "map.h"
    101  1.1  cgd #include "parse.h"
    102  1.1  cgd #include "sig.h"
    103  1.1  cgd #include "help.h"
    104  1.1  cgd 
    105  1.1  cgd struct editline {
    106  1.1  cgd     char	 *el_prog;	/* the program name 			*/
    107  1.1  cgd     FILE         *el_outfile;	/* Stdio stuff				*/
    108  1.1  cgd     FILE         *el_errfile;	/* Stdio stuff				*/
    109  1.1  cgd     int           el_infd;	/* Input file descriptor		*/
    110  1.1  cgd     int		  el_flags;	/* Various flags.			*/
    111  1.1  cgd     coord_t       el_cursor;	/* Cursor location			*/
    112  1.1  cgd     char        **el_display, 	/* Real screen image = what is there	*/
    113  1.1  cgd 	        **el_vdisplay;	/* Virtual screen image = what we see	*/
    114  1.1  cgd 
    115  1.1  cgd     el_line_t     el_line;	/* The current line information		*/
    116  1.1  cgd     el_state_t	  el_state;	/* Current editor state			*/
    117  1.1  cgd     el_term_t     el_term;	/* Terminal dependent stuff		*/
    118  1.1  cgd     el_tty_t	  el_tty;	/* Tty dependent stuff			*/
    119  1.1  cgd     el_refresh_t  el_refresh;	/* Refresh stuff			*/
    120  1.1  cgd     el_prompt_t   el_prompt;	/* Prompt stuff				*/
    121  1.1  cgd     el_chared_t	  el_chared;	/* Characted editor stuff		*/
    122  1.1  cgd     el_map_t	  el_map;	/* Key mapping stuff			*/
    123  1.1  cgd     el_key_t	  el_key;	/* Key binding stuff			*/
    124  1.1  cgd     el_history_t  el_history;	/* History stuff			*/
    125  1.1  cgd     el_search_t	  el_search;	/* Search stuff				*/
    126  1.1  cgd     el_signal_t	  el_signal;	/* Signal handling stuff		*/
    127  1.1  cgd };
    128  1.1  cgd 
    129  1.1  cgd #endif /* _h_el */
    130