xref: /minix3/external/bsd/nvi/dist/common/mark.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /*	$NetBSD: mark.h,v 1.2 2013/11/22 15:52:05 christos Exp $	*/
2*84d9c625SLionel Sambuc /*-
3*84d9c625SLionel Sambuc  * Copyright (c) 1992, 1993, 1994
4*84d9c625SLionel Sambuc  *	The Regents of the University of California.  All rights reserved.
5*84d9c625SLionel Sambuc  * Copyright (c) 1992, 1993, 1994, 1995, 1996
6*84d9c625SLionel Sambuc  *	Keith Bostic.  All rights reserved.
7*84d9c625SLionel Sambuc  *
8*84d9c625SLionel Sambuc  * See the LICENSE file for redistribution information.
9*84d9c625SLionel Sambuc  *
10*84d9c625SLionel Sambuc  *	Id: mark.h,v 10.5 2000/07/14 14:29:16 skimo Exp  (Berkeley) Date: 2000/07/14 14:29:16
11*84d9c625SLionel Sambuc  */
12*84d9c625SLionel Sambuc 
13*84d9c625SLionel Sambuc /*
14*84d9c625SLionel Sambuc  * The MARK and LMARK structures define positions in the file.  There are
15*84d9c625SLionel Sambuc  * two structures because the mark subroutines are the only places where
16*84d9c625SLionel Sambuc  * anything cares about something other than line and column.
17*84d9c625SLionel Sambuc  *
18*84d9c625SLionel Sambuc  * Because of the different interfaces used by the db(3) package, curses,
19*84d9c625SLionel Sambuc  * and users, the line number is 1 based and the column number is 0 based.
20*84d9c625SLionel Sambuc  * Additionally, it is known that the out-of-band line number is less than
21*84d9c625SLionel Sambuc  * any legal line number.  The line number is of type db_recno_t, as that's
22*84d9c625SLionel Sambuc  * the underlying type of the database.  The column number is of type size_t,
23*84d9c625SLionel Sambuc  * guaranteeing that we can malloc a line.
24*84d9c625SLionel Sambuc  */
25*84d9c625SLionel Sambuc struct _mark {
26*84d9c625SLionel Sambuc #define	OOBLNO		0		/* Out-of-band line number. */
27*84d9c625SLionel Sambuc 	db_recno_t	 lno;			/* Line number. */
28*84d9c625SLionel Sambuc 	size_t	 cno;			/* Column number. */
29*84d9c625SLionel Sambuc };
30*84d9c625SLionel Sambuc 
31*84d9c625SLionel Sambuc struct _lmark {
32*84d9c625SLionel Sambuc 	LIST_ENTRY(_lmark) q;		/* Linked list of marks. */
33*84d9c625SLionel Sambuc 	db_recno_t	 lno;			/* Line number. */
34*84d9c625SLionel Sambuc 	size_t	 cno;			/* Column number. */
35*84d9c625SLionel Sambuc 	/* XXXX Needed ? Can non ascii-chars be mark names ? */
36*84d9c625SLionel Sambuc 	CHAR_T	 name;			/* Mark name. */
37*84d9c625SLionel Sambuc 
38*84d9c625SLionel Sambuc #define	MARK_DELETED	0x01		/* Mark was deleted. */
39*84d9c625SLionel Sambuc #define	MARK_USERSET	0x02		/* User set this mark. */
40*84d9c625SLionel Sambuc 	u_int8_t flags;
41*84d9c625SLionel Sambuc };
42*84d9c625SLionel Sambuc 
43*84d9c625SLionel Sambuc #define	ABSMARK1	'\''		/* Absolute mark name. */
44*84d9c625SLionel Sambuc #define	ABSMARK2	'`'		/* Absolute mark name. */
45