xref: /freebsd/contrib/nvi/common/mark.h (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
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 
10 /*
11  * The MARK and LMARK structures define positions in the file.  There are
12  * two structures because the mark subroutines are the only places where
13  * anything cares about something other than line and column.
14  *
15  * Because of the different interfaces used by the db(3) package, curses,
16  * and users, the line number is 1 based and the column number is 0 based.
17  * Additionally, it is known that the out-of-band line number is less than
18  * any legal line number.  The line number is of type recno_t, as that's
19  * the underlying type of the database.  The column number is of type size_t,
20  * guaranteeing that we can malloc a line.
21  */
22 struct _mark {
23 #define	OOBLNO		0		/* Out-of-band line number. */
24 	recno_t	 lno;			/* Line number. */
25 	size_t	 cno;			/* Column number. */
26 };
27 
28 struct _lmark {
29 	SLIST_ENTRY(_lmark) q;		/* Linked list of marks. */
30 	recno_t	 lno;			/* Line number. */
31 	size_t	 cno;			/* Column number. */
32 	/* XXXX Needed ? Can non ascii-chars be mark names ? */
33 	CHAR_T	 name;			/* Mark name. */
34 
35 #define	MARK_DELETED	0x01		/* Mark was deleted. */
36 #define	MARK_USERSET	0x02		/* User set this mark. */
37 	u_int8_t flags;
38 };
39 
40 #define	ABSMARK1	'\''		/* Absolute mark name. */
41 #define	ABSMARK2	'`'		/* Absolute mark name. */
42