/* */
1 /*
2 * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2005, 2006, 2007, 2010
3 * Tama Communications Corporation
4 *
5 * This file is part of GNU GLOBAL.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _GTOP_H_
22 #define _GTOP_H_
23
24 #include <stdio.h>
25
26 #include "gparam.h"
27 #include "dbop.h"
28 #include "idset.h"
29 #include "strbuf.h"
30 #include "strhash.h"
31 #include "varray.h"
32
33 #define COMPACTKEY " __.COMPACT"
34 #define COMPRESSKEY " __.COMPRESS"
35 #define COMPLINEKEY " __.COMPLINE"
36 #define COMPNAMEKEY " __.COMPNAME"
37
38 #define NOTAGS -1
39 #define GPATH 0
40 #define GTAGS 1
41 #define GRTAGS 2
42 #define GSYMS 3
43 #define GTAGLIM 4
44
45 #define GTAGS_READ 0
46 #define GTAGS_CREATE 1
47 #define GTAGS_MODIFY 2
48
49 /**
50 * @name
51 * Defines for gtags_open()
52 */
53 /** @{ */
54 /** compact option */
55 #define GTAGS_COMPACT 1
56 /** compression option */
57 #define GTAGS_COMPRESS 2
58 /** compression option for line number */
59 #define GTAGS_COMPLINE 4
60 /** compression option for line number */
61 #define GTAGS_COMPNAME 8
62 /** extract method from class definition */
63 #define GTAGS_EXTRACTMETHOD 16
64 /** print information for debug */
65 #define GTAGS_DEBUG 65536
66 /** @} */
67
68 /**
69 * @name
70 * Defines for gtags_first()
71 */
72 /** @{ */
73 /** read key part */
74 #define GTOP_KEY 1
75 /** read path part */
76 #define GTOP_PATH 2
77 /** prefixed read */
78 #define GTOP_PREFIX 4
79 /** don't use regular expression */
80 #define GTOP_NOREGEX 8
81 /** ignore case distinction */
82 #define GTOP_IGNORECASE 16
83 /** use basic regular expression */
84 #define GTOP_BASICREGEX 32
85 /** don't sort */
86 #define GTOP_NOSORT 64
87 /** @} */
88
89 /**
90 * This entry corresponds to one raw record.
91 */
92 typedef struct {
93 const char *tagline;
94 const char *path;
95 const char *tag;
96 int lineno;
97 } GTP;
98
99 typedef struct {
100 DBOP *dbop; /**< descripter of #DBOP */
101 DBOP *gtags; /**< descripter of #GTAGS */
102 int format_version; /**< format version */
103 int format; /**< #GTAGS_COMPACT, #GTAGS_COMPRESS */
104 int mode; /**< mode */
105 int db; /**< 0:#GTAGS, 1:#GRTAGS, 2:#GSYMS */
106 int openflags; /**< flags value of gtags_open() */
107 int flags; /**< flags */
108 char root[MAXPATHLEN]; /**< root directory of source tree */
109
110 /**
111 * Stuff for #GTOP_PATH.
112 */
113 /** @{ */
114 int path_count; /**< */
115 int path_index; /**< */
116 char **path_array; /**< */
117 /** @} */
118
119 /**
120 * Stuff for segment_read().
121 */
122 /** @{ */
123 int gtp_count; /**< */
124 int gtp_index; /**< */
125 GTP *gtp_array; /**< */
126 GTP gtp; /**< */
127 POOL *segment_pool; /**< */
128 VARRAY *vb; /**< */
129 char cur_tagname[IDENTLEN]; /**< current tag name */
130 /** @} */
131
132 /**
133 * Stuff for compact format
134 */
135 /** @{ */
136 char cur_path[MAXPATHLEN]; /**< current path */
137 STRBUF *sb; /**< string buffer */
138 /** @} */
139
140 /** used for compact format and path name only read */
141 STRHASH *path_hash;
142 } GTOP;
143
144 const char *dbname(int);
145 GTOP *gtags_open(const char *, const char *, int, int, int);
146 void gtags_put_using(GTOP *, const char *, int, const char *, const char *);
147 void gtags_flush(GTOP *, const char *);
148 void gtags_delete(GTOP *, IDSET *);
149 GTP *gtags_first(GTOP *, const char *, int);
150 GTP *gtags_next(GTOP *);
151 void gtags_close(GTOP *);
152
153 #endif /* ! _GTOP_H_ */
/* */