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