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