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