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