xref: /openbsd/usr.bin/vi/common/common.h (revision 8fad99e1)
1 /*	$OpenBSD: common.h,v 1.10 2021/01/26 18:19:43 deraadt Exp $	*/
2 
3 /*-
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.
8  *
9  * See the LICENSE file for redistribution information.
10  *
11  *	@(#)common.h	10.13 (Berkeley) 9/25/96
12  */
13 
14 #include <sys/time.h>
15 #include <db.h>
16 #include <regex.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 _event		EVENT;
24 typedef struct _excmd		EXCMD;
25 typedef struct _exf		EXF;
26 typedef struct _fref		FREF;
27 typedef struct _gs		GS;
28 typedef struct _lmark		LMARK;
29 typedef struct _mark		MARK;
30 typedef struct _msg		MSGS;
31 typedef struct _option		OPTION;
32 typedef struct _optlist		OPTLIST;
33 typedef struct _scr		SCR;
34 typedef struct _script		SCRIPT;
35 typedef struct _seq		SEQ;
36 typedef struct _tag		TAG;
37 typedef struct _tagf		TAGF;
38 typedef struct _tagq		TAGQ;
39 typedef struct _text		TEXT;
40 
41 /* Autoindent state. */
42 typedef enum { C_NOTSET, C_CARATSET, C_NOCHANGE, C_ZEROSET } carat_t;
43 
44 /* Busy message types. */
45 typedef enum { BUSY_ON = 1, BUSY_OFF, BUSY_UPDATE } busy_t;
46 
47 /*
48  * Routines that return a confirmation return:
49  *
50  *	CONF_NO		User answered no.
51  *	CONF_QUIT	User answered quit, eof or an error.
52  *	CONF_YES	User answered yes.
53  */
54 typedef enum { CONF_NO, CONF_QUIT, CONF_YES } conf_t;
55 
56 /* Directions. */
57 typedef enum { NOTSET, FORWARD, BACKWARD } dir_t;
58 
59 /* Line operations. */
60 typedef enum { LINE_APPEND, LINE_DELETE, LINE_INSERT, LINE_RESET } lnop_t;
61 
62 /* Lock return values. */
63 typedef enum { LOCK_FAILED, LOCK_SUCCESS, LOCK_UNAVAIL } lockr_t;
64 
65 /* Sequence types. */
66 typedef enum { SEQ_ABBREV, SEQ_COMMAND, SEQ_INPUT } seq_t;
67 
68 /* Program modes. */
69 extern enum pmode { MODE_EX, MODE_VI, MODE_VIEW } pmode;
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 "../ex/ex.h"		/* Required by gs.h. */
84 #include "gs.h"			/* Required by screen.h. */
85 #include "screen.h"		/* Required by exf.h. */
86 #include "exf.h"
87 #include "log.h"
88 #include "mem.h"
89 
90 #include "com_extern.h"
91