gs.h now needs cut.h
[nvi.git] / common / common.h
blob4ce4a3787f1d9a4def1f21e0ccc84008ed2787cd
1 /*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * %sccs.include.redist.c%
7 * $Id: common.h,v 8.33 1994/01/09 14:19:29 bostic Exp $ (Berkeley) $Date: 1994/01/09 14:19:29 $
8 */
10 /* System includes. */
11 #include <sys/queue.h> /* Required by screen.h. */
12 #include <sys/time.h> /* Required by screen.h. */
14 #include <bitstring.h> /* Required by screen.h. */
15 #include <limits.h> /* Required by screen.h. */
16 #include <signal.h> /* Required by screen.h. */
17 #include <stdio.h> /* Required by screen.h. */
18 #include <termios.h> /* Required by gs.h. */
21 * Required by screen.h. This is the first include that can pull
22 * in "compat.h". Should be after every other system include.
24 #include <regex.h>
27 * Forward structure declarations. Not pretty, but the include files
28 * are far too interrelated for a clean solution.
30 typedef struct _cb CB;
31 typedef struct _ch CH;
32 typedef struct _chname CHNAME;
33 typedef struct _excmdarg EXCMDARG;
34 typedef struct _exf EXF;
35 typedef struct _fref FREF;
36 typedef struct _gs GS;
37 typedef struct _ibuf IBUF;
38 typedef struct _mark MARK;
39 typedef struct _msg MSG;
40 typedef struct _option OPTION;
41 typedef struct _optlist OPTLIST;
42 typedef struct _scr SCR;
43 typedef struct _script SCRIPT;
44 typedef struct _seq SEQ;
45 typedef struct _tag TAG;
46 typedef struct _tagf TAGF;
47 typedef struct _text TEXT;
50 * Fundamental character types.
52 * CHAR_T An integral type that can hold any character.
53 * ARG_CHAR_T The type of a CHAR_T when passed as an argument using
54 * traditional promotion rules. It should also be able
55 * to be compared against any CHAR_T for equality without
56 * problems.
57 * MAX_CHAR_T The maximum value of any character.
59 * If no integral type can hold a character, don't even try the port.
61 typedef u_char CHAR_T;
62 typedef u_int ARG_CHAR_T;
63 #define MAX_CHAR_T 0xff
65 /* The maximum number of columns any character can take up on a screen. */
66 #define MAX_CHARACTER_COLUMNS 4
69 * Local includes.
71 #include <db.h> /* Required by exf.h; includes compat.h. */
73 #include "search.h" /* Required by screen.h. */
74 #include "args.h" /* Required by options.h. */
75 #include "options.h" /* Required by screen.h. */
76 #include "term.h" /* Required by screen.h. */
78 #include "msg.h" /* Required by gs.h. */
79 #include "cut.h" /* Required by gs.h. */
80 #include "gs.h" /* Required by screen.h. */
81 #include "screen.h" /* Required by exf.h. */
82 #include "mark.h" /* Required by exf.h. */
83 #include "exf.h"
84 #include "log.h"
85 #include "mem.h"
87 #if FWOPEN_NOT_AVAILABLE /* See PORT/clib/fwopen.c. */
88 #define EXCOOKIE sp
89 int ex_fflush __P((SCR *));
90 int ex_printf __P((SCR *, const char *, ...));
91 FILE *fwopen __P((SCR *, void *));
92 #else
93 #define EXCOOKIE sp->stdfp
94 #define ex_fflush fflush
95 #define ex_printf fprintf
96 #endif
98 /* Macros to set/clear/test flags. */
99 #define F_SET(p, f) (p)->flags |= (f)
100 #define F_CLR(p, f) (p)->flags &= ~(f)
101 #define F_ISSET(p, f) ((p)->flags & (f))
103 #define LF_INIT(f) flags = (f)
104 #define LF_SET(f) flags |= (f)
105 #define LF_CLR(f) flags &= ~(f)
106 #define LF_ISSET(f) (flags & (f))
109 * XXX
110 * MIN/MAX have traditionally been in <sys/param.h>. Don't
111 * try to get them from there, it's just not worth the effort.
113 #ifndef MAX
114 #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
115 #endif
116 #ifndef MIN
117 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
118 #endif
120 /* Function prototypes that don't seem to belong anywhere else. */
121 u_long baud_from_bval __P((SCR *));
122 char *charname __P((SCR *, ARG_CHAR_T));
123 void busy_off __P((SCR *));
124 void busy_on __P((SCR *, int, char const *));
125 int nonblank __P((SCR *, EXF *, recno_t, size_t *));
126 void set_alt_name __P((SCR *, char *));
127 int set_window_size __P((SCR *, u_int, int));
128 int status __P((SCR *, EXF *, recno_t, int));
129 char *tail __P((char *));
130 CHAR_T *v_strdup __P((SCR *, CHAR_T *, size_t));
132 #ifdef DEBUG
133 void TRACE __P((SCR *, const char *, ...));
134 #endif
136 /* Digraphs (not currently real). */
137 int digraph __P((SCR *, int, int));
138 int digraph_init __P((SCR *));
139 void digraph_save __P((SCR *, int));