1 /*===========================================================================
2 Copyright (c) 1998-2000, The Santa Cruz Operation
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 *Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
11 *Redistributions in binary form must reproduce the above copyright notice,
12 this list of conditions and the following disclaimer in the documentation
13 and/or other materials provided with the distribution.
15 *Neither name of The Santa Cruz Operation nor the names of its contributors
16 may be used to endorse or promote products derived from this software
17 without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
20 IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
23 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 =========================================================================*/
33 /* $Id: invlib.h,v 1.7 2004/02/12 18:14:05 broeker Exp $ */
36 #ifndef CSCOPE_INVLIB_H
37 #define CSCOPE_INVLIB_H
39 #include <stdio.h> /* need definition of FILE* */
42 /* inverted index definitions */
44 /* postings temporary file long number coding into characters */
45 /* FIXME HBB: where would these definitions come from ? */
47 # define BASE 223 /* 255 - ' ' */
48 # define PRECISION 4 /* maximum digits after converting a long */
50 # if CHAR_MAX==127 /* assume sign-extension of a char when converted to an int */
51 # define BASE 95 /* 127 - ' ' */
52 # define PRECISION 5 /* maximum digits after converting a long */
54 #error Need a platform with 8 bits in a char value
58 /* inverted index access parameters */
63 /* boolean set operations */
69 /* note that the entire first block is for parameters */
71 long version; /* inverted index format version */
72 long filestat; /* file status word */
73 long sizeblk; /* size of logical block in bytes */
74 long startbyte; /* first byte of superfinger */
75 long supsize; /* size of superfinger in bytes */
76 long cntlsize; /* size of max cntl space (should be a multiple of BUFSIZ) */
77 long share; /* flag whether to use shared memory */
81 FILE *invfile; /* the inverted file ptr */
82 FILE *postfile; /* posting file ptr */
83 PARAM param; /* control parameters for the file */
84 char *iindex; /* ptr to space for superindex */
85 union logicalblk *logblk; /* ptr to space for a logical block */
86 long numblk; /* number of block presently at *logblk */
87 long keypnt; /* number item in present block found */
91 short offset; /* offset in this logical block */
92 unsigned char size; /* size of term */
93 unsigned char space; /* number of longs of growth space */
94 long post; /* number of postings for this entry */
98 long lineoffset; /* source line database offset */
99 long fcnoffset; /* function name database offset */
100 long fileindex : 24; /* source file name index */
101 long type : 8; /* reference type (mark character) */
104 extern long *srcoffset; /* source file name database offsets */
105 extern int nsrcoffset; /* number of file name database offsets */
108 void boolclear(void);
109 POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg);
110 void invclose(INVCONTROL *invcntl);
111 void invdump(INVCONTROL *invcntl, char *term);
112 long invfind(INVCONTROL *invcntl, char *searchterm);
113 int invforward(INVCONTROL *invcntl);
114 int invopen(INVCONTROL *invcntl, char *invname, char *invpost, int status);
115 long invmake(char *invname, char *invpost, FILE *infile);
116 long invterm(INVCONTROL *invcntl, char *term);
118 #endif /* CSCOPE_INVLIB_H */