support DB >= 4.1
[nvi.git] / ex / tag.h
blob64db0a41032aa40f73f7b890d28da87820867c54
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.
9 * See the LICENSE file for redistribution information.
11 * $Id: tag.h,v 10.8 2000/07/14 14:29:22 skimo Exp $ (Berkeley) $Date: 2000/07/14 14:29:22 $
15 * Cscope connection information. One of these is maintained per cscope
16 * connection, linked from the EX_PRIVATE structure.
18 struct _csc {
19 LIST_ENTRY(_csc) q; /* Linked list of cscope connections. */
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 time_t mtime; /* Last modification time of cscope database. */
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. */
31 char **paths; /* Array of search paths for this cscope. */
32 char *pbuf; /* Search path buffer. */
33 size_t pblen; /* Search path buffer length. */
35 char buf[1]; /* Variable length buffer. */
39 * Tag file information. One of these is maintained per tag file, linked
40 * from the EXPRIVATE structure.
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. */
47 #define TAGF_ERR 0x01 /* Error occurred. */
48 #define TAGF_ERR_WARN 0x02 /* Error reported. */
49 u_int8_t flags;
53 * Tags are structured internally as follows:
55 * +----+ +----+ +----+ +----+
56 * | EP | -> | Q1 | <-- | T1 | <-- | T2 |
57 * +----+ +----+ --> +----+ --> +----+
58 * |
59 * +----+ +----+
60 * | Q2 | <-- | T1 |
61 * +----+ --> +----+
62 * |
63 * +----+ +----+
64 * | Q3 | <-- | T1 |
65 * +----+ --> +----+
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.
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
76 struct _tag { /* Tag list. */
77 CIRCLEQ_ENTRY(_tag) q; /* Linked list of tags. */
79 /* Tag pop/return information. */
80 FREF *frp; /* Saved file. */
81 db_recno_t lno; /* Saved line number. */
82 size_t cno; /* Saved column number. */
84 char *fname; /* Filename. */
85 size_t fnlen; /* Filename length. */
86 db_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. */
92 CHAR_T buf[1]; /* Variable length buffer. */
95 struct _tagq { /* Tag queue. */
96 CIRCLEQ_ENTRY(_tagq) q; /* Linked list of tag queues. */
97 /* This queue's tag list. */
98 CIRCLEQ_HEAD(_tagqh, _tag) tagq;
100 TAG *current; /* Current TAG within the queue. */
102 char *tag; /* Tag string. */
103 size_t tlen; /* Tag string length. */
105 #define TAG_CSCOPE 0x01 /* Cscope tag. */
106 u_int8_t flags;
108 char buf[1]; /* Variable length buffer. */