2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
7 * $Id: cut.h,v 8.8 1993/11/19 11:55:04 bostic Exp $ (Berkeley) $Date: 1993/11/19 11:55:04 $
10 typedef struct _texth TEXTH
; /* TEXT list head structure. */
11 CIRCLEQ_HEAD(_texth
, _text
);
15 LIST_ENTRY(_cb
) q
; /* Linked list of cut buffers. */
16 TEXTH textq
; /* Linked list of TEXT structures. */
17 CHAR_T name
; /* Cut buffer name. */
18 size_t len
; /* Total length of cut text. */
20 #define CB_LMODE 0x01 /* Cut was in line mode. */
24 /* Lines/blocks of text. */
25 struct _text
{ /* Text: a linked list of lines. */
26 CIRCLEQ_ENTRY(_text
) q
; /* Linked list of text structures. */
27 char *lb
; /* Line buffer. */
28 size_t lb_len
; /* Line buffer length. */
29 size_t len
; /* Line length. */
31 /* These fields are used by the vi text input routine. */
32 recno_t lno
; /* 1-N: line number. */
33 size_t ai
; /* 0-N: autoindent bytes. */
34 size_t insert
; /* 0-N: bytes to insert (push). */
35 size_t offset
; /* 0-N: initial, unerasable bytes. */
36 size_t owrite
; /* 0-N: bytes to overwrite. */
38 /* These fields are used by the ex text input routine. */
39 u_char
*wd
; /* Width buffer. */
40 size_t wd_len
; /* Width buffer length. */
43 #define DEFCB '1' /* Buffer '1' is the default buffer. */
46 * Get named buffer 'name'.
47 * Translate upper-case buffer names to lower-case buffer names.
49 #define CBNAME(sp, cbp, name) { \
50 name = isupper(name) ? tolower(name) : (name); \
51 for (cbp = sp->gp->cutq.lh_first; \
52 cbp != NULL; cbp = cbp->q.le_next) \
53 if (cbp->name == name) \
57 /* Get a cut buffer, and check to see if it's empty. */
58 #define CBEMPTY(sp, cbp, name) { \
59 CBNAME(sp, cbp, name); \
63 "The default buffer is empty."); \
66 "Buffer %s is empty.", charname(sp, name)); \
71 int cut
__P((SCR
*, EXF
*, ARG_CHAR_T
, MARK
*, MARK
*, int));
72 int delete __P((SCR
*, EXF
*, MARK
*, MARK
*, int));
73 int put
__P((SCR
*, EXF
*, ARG_CHAR_T
, MARK
*, MARK
*, int));
74 void text_free
__P((TEXT
*));
75 TEXT
*text_init
__P((SCR
*, const char *, size_t, size_t));
76 void text_lfree
__P((TEXTH
*));