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