chared.h (108533) | chared.h (148834) |
---|---|
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 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. | 1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Christos Zoulas of Cornell University. 7 * 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. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by the University of 19 * California, Berkeley and its contributors. 20 * 4. Neither the name of the University nor the names of its contributors | 16 * 3. Neither the name of the University nor the names of its contributors |
21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)chared.h 8.1 (Berkeley) 6/4/93 | 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 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. 31 * 32 * @(#)chared.h 8.1 (Berkeley) 6/4/93 |
37 * $NetBSD: chared.h,v 1.5 2000/09/04 22:06:29 lukem Exp $ 38 * $FreeBSD: head/lib/libedit/chared.h 108533 2003-01-01 18:49:04Z schweikh $ | 33 * $NetBSD: chared.h,v 1.15 2005/08/01 23:00:15 christos Exp $ 34 * $FreeBSD: head/lib/libedit/chared.h 148834 2005-08-07 20:55:59Z stefanf $ |
39 */ 40 41/* 42 * el.chared.h: Character editor interface 43 */ 44#ifndef _h_el_chared 45#define _h_el_chared 46 --- 14 unchanged lines hidden (view full) --- 61 * Probably the best fix is to make all the editing commands aware of 62 * this fact. 63 */ 64#define VI_MOVE 65 66 67typedef struct c_macro_t { 68 int level; | 35 */ 36 37/* 38 * el.chared.h: Character editor interface 39 */ 40#ifndef _h_el_chared 41#define _h_el_chared 42 --- 14 unchanged lines hidden (view full) --- 57 * Probably the best fix is to make all the editing commands aware of 58 * this fact. 59 */ 60#define VI_MOVE 61 62 63typedef struct c_macro_t { 64 int level; |
65 int offset; |
|
69 char **macro; | 66 char **macro; |
70 char *nline; | |
71} c_macro_t; 72 73/* | 67} c_macro_t; 68 69/* |
74 * Undo information for both vi and emacs | 70 * Undo information for vi - no undo in emacs (yet) |
75 */ 76typedef struct c_undo_t { | 71 */ 72typedef struct c_undo_t { |
77 int action; 78 size_t isize; 79 size_t dsize; 80 char *ptr; 81 char *buf; | 73 int len; /* length of saved line */ 74 int cursor; /* position of saved cursor */ 75 char *buf; /* full saved text */ |
82} c_undo_t; 83 | 76} c_undo_t; 77 |
78/* redo for vi */ 79typedef 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; 88 |
|
84/* 85 * Current action information for vi 86 */ 87typedef struct c_vcmd_t { 88 int action; 89 char *pos; | 89/* 90 * Current action information for vi 91 */ 92typedef struct c_vcmd_t { 93 int action; 94 char *pos; |
90 char *ins; | |
91} c_vcmd_t; 92 93/* 94 * Kill buffer for emacs 95 */ 96typedef struct c_kill_t { 97 char *buf; 98 char *last; 99 char *mark; 100} c_kill_t; 101 102/* 103 * Note that we use both data structures because the user can bind 104 * commands from both editors! 105 */ 106typedef struct el_chared_t { 107 c_undo_t c_undo; 108 c_kill_t c_kill; | 95} c_vcmd_t; 96 97/* 98 * Kill buffer for emacs 99 */ 100typedef struct c_kill_t { 101 char *buf; 102 char *last; 103 char *mark; 104} c_kill_t; 105 106/* 107 * Note that we use both data structures because the user can bind 108 * commands from both editors! 109 */ 110typedef struct el_chared_t { 111 c_undo_t c_undo; 112 c_kill_t c_kill; |
113 c_redo_t c_redo; |
|
109 c_vcmd_t c_vcmd; 110 c_macro_t c_macro; 111} el_chared_t; 112 113 114#define STReof "^D\b\b" 115#define STRQQ "\"\"" 116 117#define isglob(a) (strchr("*[]?", (a)) != NULL) 118#define isword(a) (isprint(a)) 119 120#define NOP 0x00 121#define DELETE 0x01 122#define INSERT 0x02 | 114 c_vcmd_t c_vcmd; 115 c_macro_t c_macro; 116} el_chared_t; 117 118 119#define STReof "^D\b\b" 120#define STRQQ "\"\"" 121 122#define isglob(a) (strchr("*[]?", (a)) != NULL) 123#define isword(a) (isprint(a)) 124 125#define NOP 0x00 126#define DELETE 0x01 127#define INSERT 0x02 |
123#define CHANGE 0x04 | 128#define YANK 0x04 |
124 | 129 |
125#define CHAR_FWD 0 126#define CHAR_BACK 1 | 130#define CHAR_FWD (+1) 131#define CHAR_BACK (-1) |
127 128#define MODE_INSERT 0 129#define MODE_REPLACE 1 130#define MODE_REPLACE_1 2 131 132#include "common.h" 133#include "vi.h" 134#include "emacs.h" 135#include "search.h" 136#include "fcns.h" 137 138 139protected int cv__isword(int); | 132 133#define MODE_INSERT 0 134#define MODE_REPLACE 1 135#define MODE_REPLACE_1 2 136 137#include "common.h" 138#include "vi.h" 139#include "emacs.h" 140#include "search.h" 141#include "fcns.h" 142 143 144protected int cv__isword(int); |
145protected int cv__isWord(int); |
|
140protected void cv_delfini(EditLine *); | 146protected void cv_delfini(EditLine *); |
141protected char *cv__endword(char *, char *, int); | 147protected char *cv__endword(char *, char *, int, int (*)(int)); |
142protected int ce__isword(int); | 148protected int ce__isword(int); |
143protected int c___isword(int); 144protected void cv_undo(EditLine *, int, size_t, char *); | 149protected void cv_undo(EditLine *); 150protected void cv_yank(EditLine *, const char *, int); |
145protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); | 151protected char *cv_next_word(EditLine*, char *, char *, int, int (*)(int)); |
146protected char *cv_prev_word(EditLine*, char *, char *, int, int (*)(int)); | 152protected char *cv_prev_word(char *, char *, int, int (*)(int)); |
147protected char *c__next_word(char *, char *, int, int (*)(int)); 148protected char *c__prev_word(char *, char *, int, int (*)(int)); 149protected void c_insert(EditLine *, int); 150protected void c_delbefore(EditLine *, int); | 153protected char *c__next_word(char *, char *, int, int (*)(int)); 154protected char *c__prev_word(char *, char *, int, int (*)(int)); 155protected void c_insert(EditLine *, int); 156protected void c_delbefore(EditLine *, int); |
157protected void c_delbefore1(EditLine *); |
|
151protected void c_delafter(EditLine *, int); | 158protected void c_delafter(EditLine *, int); |
152protected int c_gets(EditLine *, char *); | 159protected void c_delafter1(EditLine *); 160protected int c_gets(EditLine *, char *, const char *); |
153protected int c_hpos(EditLine *); 154 155protected int ch_init(EditLine *); | 161protected int c_hpos(EditLine *); 162 163protected int ch_init(EditLine *); |
156protected void ch_reset(EditLine *); | 164protected void ch_reset(EditLine *, int); |
157protected int ch_enlargebufs(EditLine *, size_t); 158protected void ch_end(EditLine *); 159 160#endif /* _h_el_chared */ | 165protected int ch_enlargebufs(EditLine *, size_t); 166protected void ch_end(EditLine *); 167 168#endif /* _h_el_chared */ |