1/* $NetBSD: tag.h,v 1.1.1.2 2008/05/18 14:31:21 aymeric 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 * Id: tag.h,v 10.8 2000/07/14 14:29:22 skimo Exp (Berkeley) Date: 2000/07/14 14:29:22 14 */ 15 16/* 17 * Cscope connection information. One of these is maintained per cscope 18 * connection, linked from the EX_PRIVATE structure. 19 */ 20struct _csc { 21 LIST_ENTRY(_csc) q; /* Linked list of cscope connections. */ 22 23 char *dname; /* Base directory of this cscope connection. */ 24 size_t dlen; /* Length of base directory. */ 25 pid_t pid; /* PID of the connected cscope process. */ 26 time_t mtime; /* Last modification time of cscope database. */ 27 28 FILE *from_fp; /* from cscope: FILE. */ 29 int from_fd; /* from cscope: file descriptor. */ 30 FILE *to_fp; /* to cscope: FILE. */ 31 int to_fd; /* to cscope: file descriptor. */ 32 33 char **paths; /* Array of search paths for this cscope. */ 34 char *pbuf; /* Search path buffer. */ 35 size_t pblen; /* Search path buffer length. */ 36 37 char buf[1]; /* Variable length buffer. */ 38}; 39 40/* 41 * Tag file information. One of these is maintained per tag file, linked 42 * from the EXPRIVATE structure. 43 */ 44struct _tagf { /* Tag files. */ 45 TAILQ_ENTRY(_tagf) q; /* Linked list of tag files. */ 46 char *name; /* Tag file name. */ 47 int errnum; /* Errno. */ 48 49#define TAGF_ERR 0x01 /* Error occurred. */ 50#define TAGF_ERR_WARN 0x02 /* Error reported. */ 51 u_int8_t flags; 52}; 53 54/* 55 * Tags are structured internally as follows: 56 * 57 * +----+ +----+ +----+ +----+ 58 * | EP | -> | Q1 | <-- | T1 | <-- | T2 | 59 * +----+ +----+ --> +----+ --> +----+ 60 * | 61 * +----+ +----+ 62 * | Q2 | <-- | T1 | 63 * +----+ --> +----+ 64 * | 65 * +----+ +----+ 66 * | Q3 | <-- | T1 | 67 * +----+ --> +----+ 68 * 69 * Each Q is a TAGQ, or tag "query", which is the result of one tag or cscope 70 * command. Each Q references one or more TAG's, or tagged file locations. 71 * 72 * tag: put a new Q at the head (^]) 73 * tagnext: T1 -> T2 inside Q (^N) 74 * tagprev: T2 -> T1 inside Q (^P) 75 * tagpop: discard Q (^T) 76 * tagtop: discard all Q 77 */ 78struct _tag { /* Tag list. */ 79 CIRCLEQ_ENTRY(_tag) q; /* Linked list of tags. */ 80 81 /* Tag pop/return information. */ 82 FREF *frp; /* Saved file. */ 83 db_recno_t lno; /* Saved line number. */ 84 size_t cno; /* Saved column number. */ 85 86 char *fname; /* Filename. */ 87 size_t fnlen; /* Filename length. */ 88 db_recno_t slno; /* Search line number. */ 89 CHAR_T *search; /* Search string. */ 90 size_t slen; /* Search string length. */ 91 CHAR_T *msg; /* Message string. */ 92 size_t mlen; /* Message string length. */ 93 94 CHAR_T buf[1]; /* Variable length buffer. */ 95}; 96 97struct _tagq { /* Tag queue. */ 98 CIRCLEQ_ENTRY(_tagq) q; /* Linked list of tag queues. */ 99 /* This queue's tag list. */ 100 CIRCLEQ_HEAD(_tagqh, _tag) tagq; 101 102 TAG *current; /* Current TAG within the queue. */ 103 104 char *tag; /* Tag string. */ 105 size_t tlen; /* Tag string length. */ 106 107#define TAG_CSCOPE 0x01 /* Cscope tag. */ 108 u_int8_t flags; 109 110 char buf[1]; /* Variable length buffer. */ 111}; 112