119304Speter/*-
219304Speter * Copyright (c) 1993, 1994
319304Speter *	The Regents of the University of California.  All rights reserved.
419304Speter * Copyright (c) 1993, 1994, 1995, 1996
519304Speter *	Keith Bostic.  All rights reserved.
619304Speter *
719304Speter * See the LICENSE file for redistribution information.
819304Speter *
919304Speter *	@(#)msg.h	10.10 (Berkeley) 5/10/96
1019304Speter */
1119304Speter
1219304Speter/*
1319304Speter * Common messages (continuation or confirmation).
1419304Speter */
1519304Spetertypedef enum {
1619304Speter	CMSG_CONF, CMSG_CONT, CMSG_CONT_EX,
1719304Speter	CMSG_CONT_R, CMSG_CONT_S, CMSG_CONT_Q } cmsg_t;
1819304Speter
1919304Speter/*
2019304Speter * Message types.
2119304Speter *
2219304Speter * !!!
2319304Speter * In historical vi, O_VERBOSE didn't exist, and O_TERSE made the error
2419304Speter * messages shorter.  In this implementation, O_TERSE has no effect and
2519304Speter * O_VERBOSE results in informational displays about common errors, for
2619304Speter * naive users.
2719304Speter *
2819304Speter * M_NONE	Display to the user, no reformatting, no nothing.
2919304Speter *
3019304Speter * M_BERR	Error: M_ERR if O_VERBOSE, else bell.
3119304Speter * M_ERR	Error: Display in inverse video.
3219304Speter * M_INFO	 Info: Display in normal video.
3319304Speter * M_SYSERR	Error: M_ERR, using strerror(3) message.
3419304Speter * M_VINFO	 Info: M_INFO if O_VERBOSE, else ignore.
3519304Speter *
3619304Speter * The underlying message display routines only need to know about M_NONE,
3719304Speter * M_ERR and M_INFO -- all the other message types are converted into one
3819304Speter * of them by the message routines.
3919304Speter */
4019304Spetertypedef enum {
4119304Speter	M_NONE = 1, M_BERR, M_ERR, M_INFO, M_SYSERR, M_VINFO } mtype_t;
4219304Speter
4319304Speter/*
4419304Speter * There are major problems with error messages being generated by routines
4519304Speter * preparing the screen to display error messages.  It's possible for the
4619304Speter * editor to generate messages before we have a screen in which to display
4719304Speter * them, or during the transition between ex (and vi startup) and a true vi.
4819304Speter * There's a queue in the global area to hold them.
4919304Speter *
5019304Speter * If SC_EX/SC_VI is set, that's the mode that the editor is in.  If the flag
5119304Speter * S_SCREEN_READY is set, that means that the screen is prepared to display
5219304Speter * messages.
5319304Speter */
5419304Spetertypedef struct _msgh MSGH;	/* MSGS list head structure. */
55254225SpeterSLIST_HEAD(_msgh, _msg);
5619304Speterstruct _msg {
57254225Speter	SLIST_ENTRY(_msg) q;	/* Linked list of messages. */
5819304Speter	mtype_t	 mtype;		/* Message type: M_NONE, M_ERR, M_INFO. */
5919304Speter	char	*buf;		/* Message buffer. */
6019304Speter	size_t	 len;		/* Message length. */
6119304Speter};
6219304Speter
6319304Speter/* Flags to msgq_status(). */
6419304Speter#define	MSTAT_SHOWLAST	0x01	/* Show the line number of the last line. */
6519304Speter#define	MSTAT_TRUNCATE	0x02	/* Truncate the file name if it's too long. */
66