1/* $OpenBSD: tag.h,v 1.7 2015/11/19 07:53:31 bentley 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 * Copyright (c) 1994, 1996 9 * Rob Mayoff. All rights reserved. 10 * 11 * See the LICENSE file for redistribution information. 12 * 13 * @(#)tag.h 10.5 (Berkeley) 5/15/96 14 */ 15 16/* 17 * Tag file information. One of these is maintained per tag file, linked 18 * from the EXPRIVATE structure. 19 */ 20struct _tagf { /* Tag files. */ 21 TAILQ_ENTRY(_tagf) q; /* Linked list of tag files. */ 22 char *name; /* Tag file name. */ 23 int errnum; /* Errno. */ 24 25#define TAGF_ERR 0x01 /* Error occurred. */ 26#define TAGF_ERR_WARN 0x02 /* Error reported. */ 27 u_int8_t flags; 28}; 29 30/* 31 * Tags are structured internally as follows: 32 * 33 * +----+ +----+ +----+ +----+ 34 * | EP | -> | Q1 | <-- | T1 | <-- | T2 | 35 * +----+ +----+ --> +----+ --> +----+ 36 * | 37 * +----+ +----+ 38 * | Q2 | <-- | T1 | 39 * +----+ --> +----+ 40 * | 41 * +----+ +----+ 42 * | Q3 | <-- | T1 | 43 * +----+ --> +----+ 44 * 45 * Each Q is a TAGQ, or tag "query", which is the result of one tag. 46 * Each Q references one or more TAG's, or tagged file locations. 47 * 48 * tag: put a new Q at the head (^]) 49 * tagnext: T1 -> T2 inside Q (^N) 50 * tagprev: T2 -> T1 inside Q (^P) 51 * tagpop: discard Q (^T) 52 * tagtop: discard all Q 53 */ 54struct _tag { /* Tag list. */ 55 TAILQ_ENTRY(_tag) q; /* Linked list of tags. */ 56 57 /* Tag pop/return information. */ 58 FREF *frp; /* Saved file. */ 59 recno_t lno; /* Saved line number. */ 60 size_t cno; /* Saved column number. */ 61 62 char *fname; /* Filename. */ 63 size_t fnlen; /* Filename length. */ 64 recno_t slno; /* Search line number. */ 65 char *search; /* Search string. */ 66 size_t slen; /* Search string length. */ 67 68 char buf[1]; /* Variable length buffer. */ 69}; 70 71struct _tagq { /* Tag queue. */ 72 TAILQ_ENTRY(_tagq) q; /* Linked list of tag queues. */ 73 /* This queue's tag list. */ 74 TAILQ_HEAD(_tagqh, _tag) tagq; 75 76 TAG *current; /* Current TAG within the queue. */ 77 78 char *tag; /* Tag string. */ 79 size_t tlen; /* Tag string length. */ 80 81 u_int8_t flags; 82 83 char buf[1]; /* Variable length buffer. */ 84}; 85