This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / usr.bin / vi / vi.h
CommitLineData
1e64b3ba
JH
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)vi.h 8.33 (Berkeley) 1/9/94
34 */
35
36/* System includes. */
883d16cc 37#include <queue.h> /* Required by screen.h. */
1e64b3ba
JH
38#include <sys/time.h> /* Required by screen.h. */
39
40#include <bitstring.h> /* Required by screen.h. */
41#include <limits.h> /* Required by screen.h. */
42#include <signal.h> /* Required by screen.h. */
43#include <stdio.h> /* Required by screen.h. */
44#include <termios.h> /* Required by gs.h. */
45
46/*
47 * Required by screen.h. This is the first include that can pull
48 * in "compat.h". Should be after every other system include.
49 */
50#include <regex.h>
51
52/*
53 * Forward structure declarations. Not pretty, but the include files
54 * are far too interrelated for a clean solution.
55 */
56typedef struct _cb CB;
57typedef struct _ch CH;
58typedef struct _chname CHNAME;
59typedef struct _excmdarg EXCMDARG;
60typedef struct _exf EXF;
61typedef struct _fref FREF;
62typedef struct _gs GS;
63typedef struct _ibuf IBUF;
64typedef struct _mark MARK;
65typedef struct _msg MSG;
66typedef struct _option OPTION;
67typedef struct _optlist OPTLIST;
68typedef struct _scr SCR;
69typedef struct _script SCRIPT;
70typedef struct _seq SEQ;
71typedef struct _tag TAG;
72typedef struct _tagf TAGF;
73typedef struct _text TEXT;
74
75/*
76 * Fundamental character types.
77 *
78 * CHAR_T An integral type that can hold any character.
79 * ARG_CHAR_T The type of a CHAR_T when passed as an argument using
80 * traditional promotion rules. It should also be able
81 * to be compared against any CHAR_T for equality without
82 * problems.
83 * MAX_CHAR_T The maximum value of any character.
84 *
85 * If no integral type can hold a character, don't even try the port.
86 */
87typedef u_char CHAR_T;
88typedef u_int ARG_CHAR_T;
89#define MAX_CHAR_T 0xff
90
91/* The maximum number of columns any character can take up on a screen. */
92#define MAX_CHARACTER_COLUMNS 4
93
94/*
95 * Local includes.
96 */
97#include <db.h> /* Required by exf.h; includes compat.h. */
98
99#include "search.h" /* Required by screen.h. */
100#include "args.h" /* Required by options.h. */
101#include "options.h" /* Required by screen.h. */
102#include "term.h" /* Required by screen.h. */
103
104#include "msg.h" /* Required by gs.h. */
105#include "cut.h" /* Required by gs.h. */
106#include "gs.h" /* Required by screen.h. */
107#include "screen.h" /* Required by exf.h. */
108#include "mark.h" /* Required by exf.h. */
109#include "exf.h"
110#include "log.h"
111#include "mem.h"
112
113#if FWOPEN_NOT_AVAILABLE /* See PORT/clib/fwopen.c. */
114#define EXCOOKIE sp
115int ex_fflush __P((SCR *));
116int ex_printf __P((SCR *, const char *, ...));
117FILE *fwopen __P((SCR *, void *));
118#else
119#define EXCOOKIE sp->stdfp
120#define ex_fflush fflush
121#define ex_printf fprintf
122#endif
123
124/* Macros to set/clear/test flags. */
125#define F_SET(p, f) (p)->flags |= (f)
126#define F_CLR(p, f) (p)->flags &= ~(f)
127#define F_ISSET(p, f) ((p)->flags & (f))
128
129#define LF_INIT(f) flags = (f)
130#define LF_SET(f) flags |= (f)
131#define LF_CLR(f) flags &= ~(f)
132#define LF_ISSET(f) (flags & (f))
133
134/*
135 * XXX
136 * MIN/MAX have traditionally been in <sys/param.h>. Don't
137 * try to get them from there, it's just not worth the effort.
138 */
139#ifndef MAX
140#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
141#endif
142#ifndef MIN
143#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
144#endif
145
146/* Function prototypes that don't seem to belong anywhere else. */
147u_long baud_from_bval __P((SCR *));
148char *charname __P((SCR *, ARG_CHAR_T));
149void busy_off __P((SCR *));
150void busy_on __P((SCR *, int, char const *));
151int nonblank __P((SCR *, EXF *, recno_t, size_t *));
152void set_alt_name __P((SCR *, char *));
153int set_window_size __P((SCR *, u_int, int));
154int status __P((SCR *, EXF *, recno_t, int));
155char *tail __P((char *));
156CHAR_T *v_strdup __P((SCR *, CHAR_T *, size_t));
157
158#ifdef DEBUG
159void TRACE __P((SCR *, const char *, ...));
160#endif
161
162/* Digraphs (not currently real). */
163int digraph __P((SCR *, int, int));
164int digraph_init __P((SCR *));
165void digraph_save __P((SCR *, int));