summaryrefslogtreecommitdiff
path: root/usr.bin/vi/common/msg.h
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-22 11:37:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-22 11:37:15 +0000
commit0157a77a51c5e35e093ae03581f66dea010edcc8 (patch)
tree5e8bd32aa4d2b5ed37b7cf3ad26e8bdfc7f20a04 /usr.bin/vi/common/msg.h
parent806021be093ad00ce2022a532c0f4cc99b0065ac (diff)
new vi
Diffstat (limited to 'usr.bin/vi/common/msg.h')
-rw-r--r--usr.bin/vi/common/msg.h91
1 files changed, 37 insertions, 54 deletions
diff --git a/usr.bin/vi/common/msg.h b/usr.bin/vi/common/msg.h
index fc6e365087e..b10f4ccae5c 100644
--- a/usr.bin/vi/common/msg.h
+++ b/usr.bin/vi/common/msg.h
@@ -1,37 +1,20 @@
/*-
* Copyright (c) 1993, 1994
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1993, 1994, 1995, 1996
+ * Keith Bostic. All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * See the LICENSE file for redistribution information.
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)msg.h 8.13 (Berkeley) 8/8/94
+ * @(#)msg.h 10.10 (Berkeley) 5/10/96
+ */
+
+/*
+ * Common messages (continuation or confirmation).
*/
+typedef enum {
+ CMSG_CONF, CMSG_CONT, CMSG_CONT_EX,
+ CMSG_CONT_R, CMSG_CONT_S, CMSG_CONT_Q } cmsg_t;
/*
* Message types.
@@ -39,44 +22,44 @@
* !!!
* In historical vi, O_VERBOSE didn't exist, and O_TERSE made the error
* messages shorter. In this implementation, O_TERSE has no effect and
- * O_VERBOSE results in informational displays about common errors for
+ * O_VERBOSE results in informational displays about common errors, for
* naive users.
*
+ * M_NONE Display to the user, no reformatting, no nothing.
+ *
* M_BERR Error: M_ERR if O_VERBOSE, else bell.
* M_ERR Error: Display in inverse video.
* M_INFO Info: Display in normal video.
* M_SYSERR Error: M_ERR, using strerror(3) message.
* M_VINFO Info: M_INFO if O_VERBOSE, else ignore.
+ *
+ * The underlying message display routines only need to know about M_NONE,
+ * M_ERR and M_INFO -- all the other message types are converted into one
+ * of them by the message routines.
*/
-enum msgtype { M_BERR, M_ERR, M_INFO, M_SYSERR, M_VINFO };
+typedef enum {
+ M_NONE = 1, M_BERR, M_ERR, M_INFO, M_SYSERR, M_VINFO } mtype_t;
-typedef struct _msgh MSGH; /* MESG list head structure. */
+/*
+ * There are major problems with error messages being generated by routines
+ * preparing the screen to display error messages. It's possible for the
+ * editor to generate messages before we have a screen in which to display
+ * them, or during the transition between ex (and vi startup) and a true vi.
+ * There's a queue in the global area to hold them.
+ *
+ * If SC_EX/SC_VI is set, that's the mode that the editor is in. If the flag
+ * S_SCREEN_READY is set, that means that the screen is prepared to display
+ * messages.
+ */
+typedef struct _msgh MSGH; /* MSGS list head structure. */
LIST_HEAD(_msgh, _msg);
-
struct _msg {
LIST_ENTRY(_msg) q; /* Linked list of messages. */
- char *mbuf; /* Message buffer. */
- size_t blen; /* Message buffer length. */
+ mtype_t mtype; /* Message type: M_NONE, M_ERR, M_INFO. */
+ char *buf; /* Message buffer. */
size_t len; /* Message length. */
-
-#define M_EMPTY 0x01 /* No message. */
-#define M_INV_VIDEO 0x02 /* Inverse video. */
- u_int8_t flags;
};
-/*
- * Define MSG_CATALOG for the Makefile compile command
- * line to enable message catalogs.
- */
-#ifdef MSG_CATALOG
-#define M(number, fmt) number
-char *get_msg __P((SCR *, char *));
-#else
-#define M(number, fmt) fmt
-#endif
-
-/* Messages. */
-void msg_app __P((GS *, SCR *, int, char *, size_t));
-int msg_rpt __P((SCR *, int));
-int msg_status __P((SCR *, EXF *, recno_t, int));
-void msgq __P((SCR *, enum msgtype, const char *, ...));
+/* Flags to msgq_status(). */
+#define MSTAT_SHOWLAST 0x01 /* Show the line number of the last line. */
+#define MSTAT_TRUNCATE 0x02 /* Truncate the file name if it's too long. */