msg.h revision 254225
1139790Simp/*-
226159Sse * Copyright (c) 1993, 1994
366529Smsmith *	The Regents of the University of California.  All rights reserved.
466529Smsmith * Copyright (c) 1993, 1994, 1995, 1996
5138468Sscottl *	Keith Bostic.  All rights reserved.
626159Sse *
726159Sse * See the LICENSE file for redistribution information.
826159Sse *
926159Sse *	@(#)msg.h	10.10 (Berkeley) 5/10/96
1026159Sse */
1126159Sse
1226159Sse/*
1326159Sse * Common messages (continuation or confirmation).
1426159Sse */
1526159Ssetypedef enum {
1626159Sse	CMSG_CONF, CMSG_CONT, CMSG_CONT_EX,
1726159Sse	CMSG_CONT_R, CMSG_CONT_S, CMSG_CONT_Q } cmsg_t;
1826159Sse
1926159Sse/*
2026159Sse * Message types.
2126159Sse *
2226159Sse * !!!
2326159Sse * In historical vi, O_VERBOSE didn't exist, and O_TERSE made the error
2426159Sse * messages shorter.  In this implementation, O_TERSE has no effect and
2526159Sse * O_VERBOSE results in informational displays about common errors, for
2626159Sse * naive users.
2726159Sse *
2826159Sse * M_NONE	Display to the user, no reformatting, no nothing.
296104Sse *
30115706Sobrien * M_BERR	Error: M_ERR if O_VERBOSE, else bell.
31115706Sobrien * M_ERR	Error: Display in inverse video.
32115706Sobrien * M_INFO	 Info: Display in normal video.
33152219Simp * M_SYSERR	Error: M_ERR, using strerror(3) message.
34152219Simp * M_VINFO	 Info: M_INFO if O_VERBOSE, else ignore.
35125981Sjhb *
366734Sbde * The underlying message display routines only need to know about M_NONE,
3747307Speter * M_ERR and M_INFO -- all the other message types are converted into one
38111068Speter * of them by the message routines.
39111068Speter */
40138429Sscottltypedef enum {
41138429Sscottl	M_NONE = 1, M_BERR, M_ERR, M_INFO, M_SYSERR, M_VINFO } mtype_t;
42100435Simp
43100435Simp/*
4466529Smsmith * There are major problems with error messages being generated by routines
4559294Smsmith * preparing the screen to display error messages.  It's possible for the
4659294Smsmith * editor to generate messages before we have a screen in which to display
47138429Sscottl * them, or during the transition between ex (and vi startup) and a true vi.
48138429Sscottl * There's a queue in the global area to hold them.
49138429Sscottl *
50138429Sscottl * If SC_EX/SC_VI is set, that's the mode that the editor is in.  If the flag
51138429Sscottl * S_SCREEN_READY is set, that means that the screen is prepared to display
52138429Sscottl * messages.
53138429Sscottl */
54152219Simptypedef struct _msgh MSGH;	/* MSGS list head structure. */
55152219SimpSLIST_HEAD(_msgh, _msg);
56152219Simpstruct _msg {
57152219Simp	SLIST_ENTRY(_msg) q;	/* Linked list of messages. */
58103868Sjhb	mtype_t	 mtype;		/* Message type: M_NONE, M_ERR, M_INFO. */
59103868Sjhb	char	*buf;		/* Message buffer. */
60103868Sjhb	size_t	 len;		/* Message length. */
61103868Sjhb};
6282441Simp
63138429Sscottl/* Flags to msgq_status(). */
64138429Sscottl#define	MSTAT_SHOWLAST	0x01	/* Show the line number of the last line. */
65138429Sscottl#define	MSTAT_TRUNCATE	0x02	/* Truncate the file name if it's too long. */
66138429Sscottl