1/*	$NetBSD$	*/
2/*-
3 * Copyright (c) 1993, 1994
4 *	The Regents of the University of California.  All rights reserved.
5 * Copyright (c) 1993, 1994, 1995, 1996
6 *	Keith Bostic.  All rights reserved.
7 *
8 * See the LICENSE file for redistribution information.
9 *
10 *	Id: msg.h,v 10.11 2000/04/21 21:26:19 skimo Exp  (Berkeley) Date: 2000/04/21 21:26:19
11 */
12
13/*
14 * Common messages (continuation or confirmation).
15 */
16typedef enum {
17	CMSG_CONF, CMSG_CONT, CMSG_CONT_EX,
18	CMSG_CONT_R, CMSG_CONT_S, CMSG_CONT_Q } cmsg_t;
19
20/*
21 * Message types.
22 *
23 * !!!
24 * In historical vi, O_VERBOSE didn't exist, and O_TERSE made the error
25 * messages shorter.  In this implementation, O_TERSE has no effect and
26 * O_VERBOSE results in informational displays about common errors, for
27 * naive users.
28 *
29 * M_NONE	Display to the user, no reformatting, no nothing.
30 *
31 * M_BERR	Error: M_ERR if O_VERBOSE, else bell.
32 * M_ERR	Error: Display in inverse video.
33 * M_INFO	 Info: Display in normal video.
34 * M_SYSERR	Error: M_ERR, using strerror(3) message.
35 * M_VINFO	 Info: M_INFO if O_VERBOSE, else ignore.
36 *
37 * The underlying message display routines only need to know about M_NONE,
38 * M_ERR and M_INFO -- all the other message types are converted into one
39 * of them by the message routines.
40 */
41typedef enum {
42	M_NONE = 1, M_BERR, M_ERR, M_INFO, M_SYSERR, M_VINFO, M_DBERR } mtype_t;
43
44/*
45 * There are major problems with error messages being generated by routines
46 * preparing the screen to display error messages.  It's possible for the
47 * editor to generate messages before we have a screen in which to display
48 * them, or during the transition between ex (and vi startup) and a true vi.
49 * There's a queue in the global area to hold them.
50 *
51 * If SC_EX/SC_VI is set, that's the mode that the editor is in.  If the flag
52 * S_SCREEN_READY is set, that means that the screen is prepared to display
53 * messages.
54 */
55typedef struct _msgh MSGH;	/* MSGS list head structure. */
56LIST_HEAD(_msgh, _msg);
57struct _msg {
58	LIST_ENTRY(_msg) q;	/* Linked list of messages. */
59	mtype_t	 mtype;		/* Message type: M_NONE, M_ERR, M_INFO. */
60	char	*buf;		/* Message buffer. */
61	size_t	 len;		/* Message length. */
62};
63
64/* Flags to msgq_status(). */
65#define	MSTAT_SHOWLAST	0x01	/* Show the line number of the last line. */
66#define	MSTAT_TRUNCATE	0x02	/* Truncate the file name if it's too long. */
67