Start flushing out the IPI routines and do some clean-up.
[dragonfly/vkernel-mp.git] / lib / libedit / chared.h
blobba7e25f3b0e116202afe66f4c09256712a4e8483
1 /*-
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Christos Zoulas of Cornell University.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
32 * @(#)chared.h 8.1 (Berkeley) 6/4/93
33 * $NetBSD: chared.h,v 1.17 2006/03/06 21:11:56 christos Exp $
34 * $DragonFly: src/lib/libedit/chared.h,v 1.5 2007/05/05 00:27:39 pavalos Exp $
38 * el.chared.h: Character editor interface
40 #ifndef _h_el_chared
41 #define _h_el_chared
43 #include <ctype.h>
44 #include <string.h>
46 #include "histedit.h"
48 #define EL_MAXMACRO 10
51 * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works
52 * like real vi: i.e. the transition from command<->insert modes moves
53 * the cursor.
55 * On the other hand we really don't want to move the cursor, because
56 * all the editing commands don't include the character under the cursor.
57 * Probably the best fix is to make all the editing commands aware of
58 * this fact.
60 #define VI_MOVE
63 typedef struct c_macro_t {
64 int level;
65 int offset;
66 char **macro;
67 } c_macro_t;
70 * Undo information for vi - no undo in emacs (yet)
72 typedef struct c_undo_t {
73 int len; /* length of saved line */
74 int cursor; /* position of saved cursor */
75 char *buf; /* full saved text */
76 } c_undo_t;
78 /* redo for vi */
79 typedef struct c_redo_t {
80 char *buf; /* redo insert key sequence */
81 char *pos;
82 char *lim;
83 el_action_t cmd; /* command to redo */
84 char ch; /* char that invoked it */
85 int count;
86 int action; /* from cv_action() */
87 } c_redo_t;
90 * Current action information for vi
92 typedef struct c_vcmd_t {
93 int action;
94 char *pos;
95 } c_vcmd_t;
98 * Kill buffer for emacs
100 typedef struct c_kill_t {
101 char *buf;
102 char *last;
103 char *mark;
104 } c_kill_t;
107 * Note that we use both data structures because the user can bind
108 * commands from both editors!
110 typedef struct el_chared_t {
111 c_undo_t c_undo;
112 c_kill_t c_kill;
113 c_redo_t c_redo;
114 c_vcmd_t c_vcmd;
115 c_macro_t c_macro;
116 } el_chared_t;
119 #define STRQQ "\"\""
121 #define isglob(a) (strchr("*[]?", (a)) != NULL)
122 #define isword(a) (isprint(a))
124 #define NOP 0x00
125 #define DELETE 0x01
126 #define INSERT 0x02
127 #define YANK 0x04
129 #define CHAR_FWD (+1)
130 #define CHAR_BACK (-1)
132 #define MODE_INSERT 0
133 #define MODE_REPLACE 1
134 #define MODE_REPLACE_1 2
136 #include "common.h"
137 #include "vi.h"
138 #include "emacs.h"
139 #include "search.h"
140 #include "fcns.h"
143 protected int cv__isword(int);
144 protected int cv__isWord(int);
145 protected void cv_delfini(EditLine *);
146 protected char *cv__endword(char *, char *, int, int (*)(int));
147 protected int ce__isword(int);
148 protected void cv_undo(EditLine *);
149 protected void cv_yank(EditLine *, const char *, int);
150 protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int));
151 protected char *cv_prev_word(char *, char *, int, int (*)(int));
152 protected char *c__next_word(char *, char *, int, int (*)(int));
153 protected char *c__prev_word(char *, char *, int, int (*)(int));
154 protected void c_insert(EditLine *, int);
155 protected void c_delbefore(EditLine *, int);
156 protected void c_delbefore1(EditLine *);
157 protected void c_delafter(EditLine *, int);
158 protected void c_delafter1(EditLine *);
159 protected int c_gets(EditLine *, char *, const char *);
160 protected int c_hpos(EditLine *);
162 protected int ch_init(EditLine *);
163 protected void ch_reset(EditLine *, int);
164 protected int ch_enlargebufs(EditLine *, size_t);
165 protected void ch_end(EditLine *);
167 #endif /* _h_el_chared */