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