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 /* inverted index definitions */
32 
33 /* postings temporary file long number coding into characters */
34 #define	BASE		95	/* 127 - ' ' */
35 #define	PRECISION	5	/* maximum digits after converting a long */
36 
37 /* inverted index access parameters */
38 #define	INVAVAIL	0
39 #define	INVBUSY		1
40 #define	INVALONE	2
41 
42 /* boolean set operations */
43 #define	OR		3
44 #define	AND		4
45 #define	NOT		5
46 #define	REVERSENOT	6
47 
48 /* note that the entire first block is for parameters */
49 typedef	struct	{
50 	long	version;	/* inverted index format version */
51 	long	filestat;	/* file status word  */
52 	long	sizeblk;	/* size of logical block in bytes */
53 	long	startbyte;	/* first byte of superfinger */
54 	long	supsize;	/* size of superfinger in bytes */
55 	long	cntlsize;	/* size of max cntl space (should be a */
56 				/* multiple of BUFSIZ) */
57 	long	share;		/* flag whether to use shared memory */
58 } PARAM;
59 
60 typedef	struct {
61 	FILE	*invfile;	/* the inverted file ptr */
62 	FILE	*postfile;	/* posting file ptr */
63 	PARAM	param;		/* control parameters for the file */
64 	char	*iindex;	/* ptr to space for superindex */
65 	char	*logblk;	/* ptr to space for a logical block */
66 	long	numblk;		/* number of block presently at *logblk */
67 	long	keypnt;		/* number item in present block found */
68 	int	swap;		/* file endian mistmatch? */
69 } INVCONTROL;
70 
71 typedef	struct	{
72 	short	offset;		/* offset in this logical block */
73 	unsigned char size;	/* size of term */
74 	unsigned char space;	/* number of longs of growth space */
75 	long	post;		/* number of postings for this entry */
76 } ENTRY;
77 
78 typedef	struct {
79 	long	lineoffset;	/* source line database offset */
80 	long	fcnoffset;	/* function name database offset */
81 	long	fileindex : 24;	/* source file name index */
82 	long	type : 8;	/* reference type (mark character) */
83 } POSTING;
84 
85 extern	long	*srcoffset;	/* source file name database offsets */
86 extern	int	nsrcoffset;	/* number of file name database offsets */
87 
88 extern void	boolclear(void);
89 extern POSTING	*boolfile(INVCONTROL *invcntl, long *num, int bool);
90 extern void	invclose(INVCONTROL *invcntl);
91 extern long	invfind(INVCONTROL *invcntl, char *searchterm);
92 extern int	invforward(INVCONTROL *invcntl);
93 extern int	invopen(INVCONTROL *invcntl, char *invname, char *invpost,
94 		    int stat);
95 extern int	invterm(INVCONTROL *invcntl, char *term);
96 extern long	invmake(char *invname, char *invpost, FILE *infile);
97