2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1991, 1993, 1994, 1995, 1996
5 * Keith Bostic. All rights reserved.
7 * See the LICENSE file for redistribution information.
9 * $Id: cut.h,v 10.9 2000/07/22 17:31:18 skimo Exp $ (Berkeley) $Date: 2000/07/22 17:31:18 $
12 typedef struct _texth TEXTH
; /* TEXT list head structure. */
13 CIRCLEQ_HEAD(_texth
, _text
);
17 LIST_ENTRY(_cb
) q
; /* Linked list of cut buffers. */
18 TEXTH textq
; /* Linked list of TEXT structures. */
19 /* XXXX Needed ? Can non ascii-chars be cut buffer names ? */
20 CHAR_T name
; /* Cut buffer name. */
21 size_t len
; /* Total length of cut text. */
23 #define CB_LMODE 0x01 /* Cut was in line mode. */
27 /* Lines/blocks of text. */
28 struct _text
{ /* Text: a linked list of lines. */
29 CIRCLEQ_ENTRY(_text
) q
; /* Linked list of text structures. */
30 CHAR_T
*lb
; /* Line buffer. */
31 size_t lb_len
; /* Line buffer length. */
32 size_t len
; /* Line length. */
34 /* These fields are used by the vi text input routine. */
35 db_recno_t lno
; /* 1-N: file line. */
36 size_t cno
; /* 0-N: file character in line. */
37 size_t ai
; /* 0-N: autoindent bytes. */
38 size_t insert
; /* 0-N: bytes to insert (push). */
39 size_t offset
; /* 0-N: initial, unerasable chars. */
40 size_t owrite
; /* 0-N: chars to overwrite. */
41 size_t R_erase
; /* 0-N: 'R' erase count. */
42 size_t sv_cno
; /* 0-N: Saved line cursor. */
43 size_t sv_len
; /* 0-N: Saved line length. */
46 * These fields returns information from the vi text input routine.
48 * The termination condition. Note, this field is only valid if the
49 * text input routine returns success.
50 * TERM_BS: User backspaced over the prompt.
51 * TERM_CEDIT: User entered <edit-char>.
52 * TERM_CR: User entered <carriage-return>; no data.
53 * TERM_ESC: User entered <escape>; no data.
54 * TERM_OK: Data available.
55 * TERM_SEARCH: Incremental search.
58 TERM_BS
, TERM_CEDIT
, TERM_CR
, TERM_ESC
, TERM_OK
, TERM_SEARCH
63 * Get named buffer 'name'.
64 * Translate upper-case buffer names to lower-case buffer names.
66 #define CBNAME(sp, cbp, nch) { \
68 L__name = isupper(nch) ? tolower(nch) : (nch); \
69 for (cbp = sp->wp->cutq.lh_first; \
70 cbp != NULL; cbp = cbp->q.le_next) \
71 if (cbp->name == L__name) \
75 /* Flags to the cut() routine. */
76 #define CUT_LINEMODE 0x01 /* Cut in line mode. */
77 #define CUT_NUMOPT 0x02 /* Numeric buffer: optional. */
78 #define CUT_NUMREQ 0x04 /* Numeric buffer: required. */