xref: /openbsd-src/usr.bin/vi/common/common.h (revision a28daedfc357b214be5c701aa8ba8adb29a7f1c2)
1 /*	$OpenBSD: common.h,v 1.5 2009/01/28 13:02:22 sobrado 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 /*
15  * Porting information built at configuration time.  Included before
16  * any of nvi's include files.
17  */
18 #include "port.h"
19 
20 /*
21  * Pseudo-local includes.  These are files that are unlikely to exist
22  * on most machines to which we're porting vi, and we want to include
23  * them in a very specific order, regardless.
24  */
25 #include <db.h>
26 #include <regex.h>
27 
28 /*
29  * Forward structure declarations.  Not pretty, but the include files
30  * are far too interrelated for a clean solution.
31  */
32 typedef struct _cb		CB;
33 typedef struct _csc		CSC;
34 typedef struct _event		EVENT;
35 typedef struct _excmd		EXCMD;
36 typedef struct _exf		EXF;
37 typedef struct _fref		FREF;
38 typedef struct _gs		GS;
39 typedef struct _lmark		LMARK;
40 typedef struct _mark		MARK;
41 typedef struct _msg		MSGS;
42 typedef struct _option		OPTION;
43 typedef struct _optlist		OPTLIST;
44 typedef struct _scr		SCR;
45 typedef struct _script		SCRIPT;
46 typedef struct _seq		SEQ;
47 typedef struct _tag		TAG;
48 typedef struct _tagf		TAGF;
49 typedef struct _tagq		TAGQ;
50 typedef struct _text		TEXT;
51 
52 /* Autoindent state. */
53 typedef enum { C_NOTSET, C_CARATSET, C_NOCHANGE, C_ZEROSET } carat_t;
54 
55 /* Busy message types. */
56 typedef enum { BUSY_ON = 1, BUSY_OFF, BUSY_UPDATE } busy_t;
57 
58 /*
59  * Routines that return a confirmation return:
60  *
61  *	CONF_NO		User answered no.
62  *	CONF_QUIT	User answered quit, eof or an error.
63  *	CONF_YES	User answered yes.
64  */
65 typedef enum { CONF_NO, CONF_QUIT, CONF_YES } conf_t;
66 
67 /* Directions. */
68 typedef enum { NOTSET, FORWARD, BACKWARD } dir_t;
69 
70 /* Line operations. */
71 typedef enum { LINE_APPEND, LINE_DELETE, LINE_INSERT, LINE_RESET } lnop_t;
72 
73 /* Lock return values. */
74 typedef enum { LOCK_FAILED, LOCK_SUCCESS, LOCK_UNAVAIL } lockr_t;
75 
76 /* Sequence types. */
77 typedef enum { SEQ_ABBREV, SEQ_COMMAND, SEQ_INPUT } seq_t;
78 
79 /* Program modes. */
80 enum { MODE_EX, MODE_VI, MODE_VIEW } pmode;
81 
82 /*
83  * Local includes.
84  */
85 #include "key.h"		/* Required by args.h. */
86 #include "args.h"		/* Required by options.h. */
87 #include "options.h"		/* Required by screen.h. */
88 
89 #include "msg.h"		/* Required by gs.h. */
90 #include "cut.h"		/* Required by gs.h. */
91 #include "seq.h"		/* Required by screen.h. */
92 #include "util.h"		/* Required by ex.h. */
93 #include "mark.h"		/* Required by gs.h. */
94 #include "../ex/ex.h"		/* Required by gs.h. */
95 #include "gs.h"			/* Required by screen.h. */
96 #include "screen.h"		/* Required by exf.h. */
97 #include "exf.h"
98 #include "log.h"
99 #include "mem.h"
100 
101 #include "com_extern.h"
102