]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/global/lib/gtagsop.h
Import Global v3_4_2 sources.
[FreeBSD/FreeBSD.git] / contrib / global / lib / gtagsop.h
1 /*
2  * Copyright (c) 1996, 1997, 1998 Shigio Yamaguchi. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  * 3. All advertising materials mentioning features or use of this software
13  *    must display the following acknowledgement:
14  *      This product includes software developed by Shigio Yamaguchi.
15  * 4. Neither the name of the author nor the names of any co-contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *      gtagsop.h                               23-Dec-97
32  *
33  */
34
35 #ifndef _GTOP_H_
36 #define _GTOP_H_
37 #include <stdio.h>
38 #include "dbop.h"
39 #include "gparam.h"
40 #include "strbuf.h"
41
42 #define VERSIONKEY      " __.VERSION"
43 #define COMPACTKEY      " __.COMPACT"
44 #define PATHINDEXKEY    " __.PATHINDEX"
45
46 #define GTAGS           0
47 #define GRTAGS          1
48 #define GSYMS           2
49 #define GTAGLIM         3
50
51 #define GTAGS_READ      0
52 #define GTAGS_CREATE    1
53 #define GTAGS_MODIFY    2
54
55 /* gtagsopen() */
56 #define GTAGS_STANDARD          0       /* standard format */
57 #define GTAGS_COMPACT           1       /* compact format */
58 #define GTAGS_PATHINDEX         2       /* use path index */
59 /* gtagsadd() */
60 #define GTAGS_UNIQUE            1       /* compress duplicate lines */
61 #define GTAGS_EXTRACTMETHOD     2       /* extract method from class definition */
62 /* gtagsfirst() */
63 #define GTOP_KEY                1       /* read key part */
64 #define GTOP_PREFIX             2       /* prefixed read */
65
66 typedef struct {
67         DBOP    *dbop;                  /* descripter of DBOP */
68         int     format_version;         /* format version */
69         int     format;                 /* GTAGS_STANDARD, GTAGS_COMPACT */
70         int     mode;                   /* mode */
71         int     db;                     /* 0:GTAGS, 1:GRTAGS, 2:GSYMS */
72         int     flags;                  /* flags */
73         char    root[MAXPATHLEN+1];     /* root directory of source tree */
74         /*
75          * Stuff for compact format
76          */
77         int     opened;                 /* wether or not file opened */
78         char    *line;                  /* current record */
79         char    tag[IDENTLEN+1];        /* current tag */
80         char    prev_tag[IDENTLEN+1];   /* previous tag */
81         char    path[MAXPATHLEN+1];     /* current path */
82         char    prev_path[MAXPATHLEN+1];/* previous path */
83         STRBUF  *sb;                    /* string buffer */
84         FILE    *fp;                    /* descriptor of 'path' */
85         char    *lnop;                  /* current line number */
86         int     lno;                    /* integer value of 'lnop' */
87 } GTOP;
88
89 #ifndef __P
90 #if defined(__STDC__)
91 #define __P(protos)     protos
92 #else
93 #define __P(protos)     ()
94 #endif
95 #endif
96
97 const char *dbname __P((int));
98 void    makecommand __P((char *, char *, STRBUF *));
99 int     formatcheck __P((char *, int));
100 GTOP    *gtagsopen __P((char *, char *, int, int, int));
101 void    gtagsput __P((GTOP *, char *, char *));
102 char    *gtagsget __P((GTOP *, char *));
103 void    gtagsadd __P((GTOP *, char *, char *, int));
104 void    gtagsdelete __P((GTOP *, char *));
105 char    *gtagsfirst __P((GTOP *, char *, int));
106 char    *gtagsnext __P((GTOP *));
107 void    gtagsclose __P((GTOP *));
108
109 #endif /* ! _GTOP_H_ */