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.31 1993/12/19 18:54:02 bostic Exp $ (Berkeley) $Date: 1993/12/19 18:54:02 $
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.
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
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
71 #include <db.h> /* Required by exf.h; includes compat.h. */
73 #include "mark.h" /* Required by most everybody. */
75 #include "search.h" /* Required by screen.h. */
76 #include "args.h" /* Required by options.h. */
77 #include "options.h" /* Required by screen.h. */
78 #include "term.h" /* Required by screen.h. */
80 #include "msg.h" /* Required by gs.h. */
81 #include "gs.h" /* Required by screen.h. */
82 #include "cut.h" /* Required by screen.h. */
83 #include "screen.h" /* Required by exf.h. */
89 #if FWOPEN_NOT_AVAILABLE /* See PORT/clib/fwopen.c. */
91 int ex_fflush
__P((SCR
*));
92 int ex_printf
__P((SCR
*, const char *, ...));
93 FILE *fwopen
__P((SCR
*, void *));
95 #define EXCOOKIE sp->stdfp
96 #define ex_fflush fflush
97 #define ex_printf fprintf
100 /* Macros to set/clear/test flags. */
101 #define F_SET(p, f) (p)->flags |= (f)
102 #define F_CLR(p, f) (p)->flags &= ~(f)
103 #define F_ISSET(p, f) ((p)->flags & (f))
105 #define LF_INIT(f) flags = (f)
106 #define LF_SET(f) flags |= (f)
107 #define LF_CLR(f) flags &= ~(f)
108 #define LF_ISSET(f) (flags & (f))
112 * MIN/MAX have traditionally been in <sys/param.h>. Don't
113 * try to get them from there, it's just not worth the effort.
116 #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
119 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
122 /* Function prototypes that don't seem to belong anywhere else. */
123 u_long baud_from_bval
__P((SCR
*));
124 char *charname
__P((SCR
*, ARG_CHAR_T
));
125 void busy_off
__P((SCR
*));
126 void busy_on
__P((SCR
*, int, char const *));
127 int nonblank
__P((SCR
*, EXF
*, recno_t
, size_t *));
128 void set_alt_name
__P((SCR
*, char *));
129 int set_window_size
__P((SCR
*, u_int
, int));
130 int status
__P((SCR
*, EXF
*, recno_t
, int));
131 char *tail
__P((char *));
132 CHAR_T
*v_strdup
__P((SCR
*, CHAR_T
*, size_t));
135 void TRACE
__P((SCR
*, const char *, ...));
138 /* Digraphs (not currently real). */
139 int digraph
__P((SCR
*, int, int));
140 int digraph_init
__P((SCR
*));
141 void digraph_save
__P((SCR
*, int));