xref: /freebsd/contrib/nvi/common/common.h (revision 52d19df19ed6455df025f7ac2c6cf5db7df8e5ec)
1 /*-
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.
6  *
7  * See the LICENSE file for redistribution information.
8  */
9 
10 #ifndef TCSASOFT
11 #define TCSASOFT 0
12 #endif
13 
14 #include <db.h>
15 #include <regex.h>		/* May refer to the bundled regex. */
16 #include <stdint.h>
17 
18 /*
19  * Forward structure declarations.  Not pretty, but the include files
20  * are far too interrelated for a clean solution.
21  */
22 typedef struct _cb		CB;
23 typedef struct _csc		CSC;
24 typedef struct _conv		CONV;
25 typedef struct _conv_win	CONVWIN;
26 typedef struct _event		EVENT;
27 typedef struct _excmd		EXCMD;
28 typedef struct _exf		EXF;
29 typedef struct _fref		FREF;
30 typedef struct _gs		GS;
31 typedef struct _lmark		LMARK;
32 typedef struct _mark		MARK;
33 typedef struct _msg		MSGS;
34 typedef struct _option		OPTION;
35 typedef struct _optlist		OPTLIST;
36 typedef struct _scr		SCR;
37 typedef struct _script		SCRIPT;
38 typedef struct _seq		SEQ;
39 typedef struct _tag		TAG;
40 typedef struct _tagf		TAGF;
41 typedef struct _tagq		TAGQ;
42 typedef struct _text		TEXT;
43 
44 /* Autoindent state. */
45 typedef enum { C_NOTSET, C_CARATSET, C_ZEROSET } carat_t;
46 
47 /* Busy message types. */
48 typedef enum { BUSY_ON = 1, BUSY_OFF, BUSY_UPDATE } busy_t;
49 
50 /*
51  * Routines that return a confirmation return:
52  *
53  *	CONF_NO		User answered no.
54  *	CONF_QUIT	User answered quit, eof or an error.
55  *	CONF_YES	User answered yes.
56  */
57 typedef enum { CONF_NO, CONF_QUIT, CONF_YES } conf_t;
58 
59 /* Directions. */
60 typedef enum { NOTSET, FORWARD, BACKWARD } dir_t;
61 
62 /* Line operations. */
63 typedef enum { LINE_APPEND, LINE_DELETE, LINE_INSERT, LINE_RESET } lnop_t;
64 
65 /* Lock return values. */
66 typedef enum { LOCK_FAILED, LOCK_SUCCESS, LOCK_UNAVAIL } lockr_t;
67 
68 /* Sequence types. */
69 typedef enum { SEQ_ABBREV, SEQ_COMMAND, SEQ_INPUT } seq_t;
70 
71 /*
72  * Local includes.
73  */
74 #include "key.h"		/* Required by args.h. */
75 #include "args.h"		/* Required by options.h. */
76 #include "options.h"		/* Required by screen.h. */
77 
78 #include "msg.h"		/* Required by gs.h. */
79 #include "cut.h"		/* Required by gs.h. */
80 #include "seq.h"		/* Required by screen.h. */
81 #include "util.h"		/* Required by ex.h. */
82 #include "mark.h"		/* Required by gs.h. */
83 #include "conv.h"		/* Required by ex.h and screen.h */
84 #include "../ex/ex.h"		/* Required by gs.h. */
85 #include "gs.h"			/* Required by screen.h. */
86 #include "screen.h"		/* Required by exf.h. */
87 #include "exf.h"
88 #include "log.h"
89 #include "mem.h"
90 
91 #include "common_extern.h"
92 
93 #ifndef SLIST_REMOVE_AFTER
94 #define SLIST_REMOVE_AFTER(elm, field) do {				\
95 	SLIST_NEXT(elm, field) =					\
96 	    SLIST_NEXT(SLIST_NEXT(elm, field), field);			\
97 } while (0)
98 #endif
99