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