root/src/noitedit/el.h

Revision bafab25395cb398ddf5eae42145f0d0bfc00ec22, 4.9 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

import of libedit... prepare to hack

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