xref: /titanic_51/usr/src/tools/cscope-fast/invlib.h (revision 791a814c934fcd4deb13b26c1f116ff283272a0d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 1999, 2003 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 /* inverted index definitions */
34 
35 /* postings temporary file long number coding into characters */
36 #define	BASE		95	/* 127 - ' ' */
37 #define	PRECISION	5	/* maximum digits after converting a long */
38 
39 /* inverted index access parameters */
40 #define	INVAVAIL	0
41 #define	INVBUSY		1
42 #define	INVALONE	2
43 
44 /* boolean set operations */
45 #define	OR		3
46 #define	AND		4
47 #define	NOT		5
48 #define	REVERSENOT	6
49 
50 /* note that the entire first block is for parameters */
51 typedef	struct	{
52 	long	version;	/* inverted index format version */
53 	long	filestat;	/* file status word  */
54 	long	sizeblk;	/* size of logical block in bytes */
55 	long	startbyte;	/* first byte of superfinger */
56 	long	supsize;	/* size of superfinger in bytes */
57 	long	cntlsize;	/* size of max cntl space (should be a */
58 				/* multiple of BUFSIZ) */
59 	long	share;		/* flag whether to use shared memory */
60 } PARAM;
61 
62 typedef	struct {
63 	FILE	*invfile;	/* the inverted file ptr */
64 	FILE	*postfile;	/* posting file ptr */
65 	PARAM	param;		/* control parameters for the file */
66 	char	*iindex;	/* ptr to space for superindex */
67 	char	*logblk;	/* ptr to space for a logical block */
68 	long	numblk;		/* number of block presently at *logblk */
69 	long	keypnt;		/* number item in present block found */
70 	int	swap;		/* file endian mistmatch? */
71 } INVCONTROL;
72 
73 typedef	struct	{
74 	short	offset;		/* offset in this logical block */
75 	unsigned char size;	/* size of term */
76 	unsigned char space;	/* number of longs of growth space */
77 	long	post;		/* number of postings for this entry */
78 } ENTRY;
79 
80 typedef	struct {
81 	long	lineoffset;	/* source line database offset */
82 	long	fcnoffset;	/* function name database offset */
83 	long	fileindex : 24;	/* source file name index */
84 	long	type : 8;	/* reference type (mark character) */
85 } POSTING;
86 
87 extern	long	*srcoffset;	/* source file name database offsets */
88 extern	int	nsrcoffset;	/* number of file name database offsets */
89 
90 extern void	boolclear(void);
91 extern POSTING	*boolfile(INVCONTROL *invcntl, long *num, int bool);
92 extern void	invclose(INVCONTROL *invcntl);
93 extern long	invfind(INVCONTROL *invcntl, char *searchterm);
94 extern int	invforward(INVCONTROL *invcntl);
95 extern int	invopen(INVCONTROL *invcntl, char *invname, char *invpost,
96 		    int stat);
97 extern int	invterm(INVCONTROL *invcntl, char *term);
98 extern long	invmake(char *invname, char *invpost, FILE *infile);
99