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