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