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