xref: /dragonfly/contrib/nvi2/common/mark.h (revision 9348a738)
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  *	$Id: mark.h,v 10.6 2011/07/04 14:41:51 zy Exp $
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 	SLIST_ENTRY(_lmark) q;		/* Linked list of marks. */
32 	recno_t	 lno;			/* Line number. */
33 	size_t	 cno;			/* Column number. */
34 	/* XXXX Needed ? Can non ascii-chars be mark names ? */
35 	CHAR_T	 name;			/* Mark name. */
36 
37 #define	MARK_DELETED	0x01		/* Mark was deleted. */
38 #define	MARK_USERSET	0x02		/* User set this mark. */
39 	u_int8_t flags;
40 };
41 
42 #define	ABSMARK1	'\''		/* Absolute mark name. */
43 #define	ABSMARK2	'`'		/* Absolute mark name. */
44