el.h

Go to the documentation of this file.
00001 /* $NetBSD: el.h,v 1.11 2002/03/18 16:00:52 christos Exp $  */
00002 
00003 /*-
00004  * Copyright (c) 1992, 1993
00005  * The Regents of the University of California.  All rights reserved.
00006  *
00007  * This code is derived from software contributed to Berkeley by
00008  * Christos Zoulas of Cornell University.
00009  *
00010  * Redistribution and use in source and binary forms, with or without
00011  * modification, are permitted provided that the following conditions
00012  * are met:
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. All advertising materials mentioning features or use of this software
00019  *    must display the following acknowledgement:
00020  * This product includes software developed by the University of
00021  * California, Berkeley and its contributors.
00022  * 4. Neither the name of the University nor the names of its contributors
00023  *    may be used to endorse or promote products derived from this software
00024  *    without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00027  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00029  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00030  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00031  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00032  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00033  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00034  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00035  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00036  * SUCH DAMAGE.
00037  *
00038  * @(#)el.h 8.1 (Berkeley) 6/4/93
00039  */
00040 
00041 /*
00042  * el.h: Internal structures.
00043  */
00044 #ifndef _h_el
00045 #define  _h_el
00046 /*
00047  * Local defaults
00048  */
00049 #define  KSHVI
00050 #define  VIDEFAULT
00051 #define  ANCHOR
00052 
00053 #include <stdio.h>
00054 #include <sys/types.h>
00055 
00056 #define  EL_BUFSIZ   1024     /* Maximum line size    */
00057 
00058 #define  HANDLE_SIGNALS 1<<0
00059 #define  NO_TTY      1<<1
00060 #define  EDIT_DISABLED  1<<2
00061 
00062 typedef int bool_t;        /* True or not       */
00063 
00064 typedef unsigned char el_action_t;  /* Index to command array  */
00065 
00066 typedef struct coord_t {      /* Position on the screen  */
00067    int   h;
00068    int   v;
00069 } coord_t;
00070 
00071 typedef struct el_line_t {
00072    char  *buffer;    /* Input line        */
00073    char  *cursor;    /* Cursor position      */
00074    char  *lastchar;     /* Last character    */
00075    const char  *limit;        /* Max position         */
00076 } el_line_t;
00077 
00078 /*
00079  * Editor state
00080  */
00081 typedef struct el_state_t {
00082    int      inputmode;  /* What mode are we in?    */
00083    int      doingarg;   /* Are we getting an argument?   */
00084    int      argument;   /* Numeric argument     */
00085    int      metanext;   /* Is the next char a meta char */
00086    el_action_t lastcmd; /* Previous command     */
00087 } el_state_t;
00088 
00089 /*
00090  * Until we come up with something better...
00091  */
00092 #define  el_malloc(a)   malloc(a)
00093 #define  el_realloc(a,b)   realloc(a, b)
00094 #define  el_free(a)  free(a)
00095 
00096 #include "tty.h"
00097 #include "prompt.h"
00098 #include "key.h"
00099 #include "term.h"
00100 #include "refresh.h"
00101 #include "chared.h"
00102 #include "common.h"
00103 #include "search.h"
00104 #include "hist.h"
00105 #include "map.h"
00106 #include "parse.h"
00107 #include "sig.h"
00108 #include "help.h"
00109 #include "read.h"
00110 
00111 struct editline {
00112    char      *el_prog;  /* the program name     */
00113    FILE      *el_outfile;  /* Stdio stuff       */
00114    FILE      *el_errfile;  /* Stdio stuff       */
00115    int        el_infd;  /* Input file descriptor   */
00116    int        el_flags; /* Various flags.    */
00117    coord_t       el_cursor;   /* Cursor location      */
00118    char     **el_display;  /* Real screen image = what is there */
00119    char     **el_vdisplay; /* Virtual screen image = what we see */
00120    void      *el_data;  /* Client data       */
00121    el_line_t     el_line;  /* The current line information  */
00122    el_state_t    el_state; /* Current editor state    */
00123    el_term_t     el_term;  /* Terminal dependent stuff   */
00124    el_tty_t   el_tty;   /* Tty dependent stuff     */
00125    el_refresh_t     el_refresh;  /* Refresh stuff     */
00126    el_prompt_t   el_prompt;   /* Prompt stuff         */
00127    el_prompt_t   el_rprompt;  /* Prompt stuff         */
00128    el_chared_t   el_chared;   /* Characted editor stuff  */
00129    el_map_t   el_map;   /* Key mapping stuff    */
00130    el_key_t   el_key;   /* Key binding stuff    */
00131    el_history_t     el_history;  /* History stuff     */
00132    el_search_t   el_search;   /* Search stuff         */
00133    el_signal_t   el_signal;   /* Signal handling stuff   */
00134    el_read_t     el_read;  /* Character reading stuff */
00135 };
00136 
00137 protected int  el_editmode(EditLine *, int, const char **);
00138 
00139 #ifdef DEBUG
00140 #define EL_ABORT(a)  (void) (fprintf(el->el_errfile, "%s, %d: ", \
00141             __FILE__, __LINE__), fprintf a, abort())
00142 #else
00143 #define EL_ABORT(a)  abort()
00144 #endif
00145 #endif /* _h_el */

Generated on Thu Apr 16 06:27:33 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6