Remove all optional compile flags from dtwm that are not referenced anywhere, and...
[oweals/cde.git] / cde / lib / DtSearch / boolpars.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: boolpars.h /main/1 1996/03/29 17:03:47 cde-ibm $
24  *
25  * (c) Copyright 1996 Digital Equipment Corporation.
26  * (c) Copyright 1996 Hewlett-Packard Company.
27  * (c) Copyright 1996 International Business Machines Corp.
28  * (c) Copyright 1996 Sun Microsystems, Inc.
29  * (c) Copyright 1996 Novell, Inc. 
30  * (c) Copyright 1996 FUJITSU LIMITED.
31  * (c) Copyright 1996 Hitachi.
32  */
33 /*
34  *   COMPONENT_NAME: austext
35  *
36  *   FUNCTIONS: none
37  *
38  *   ORIGINS: 27
39  *
40  *
41  *   (C) COPYRIGHT International Business Machines Corp. 1996
42  *   All Rights Reserved
43  *   Licensed Materials - Property of IBM
44  *   US Government Users Restricted Rights - Use, duplication or
45  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
46  */
47 #ifndef _boolpars_h
48 #define _boolpars_h
49 /******************** BOOLPARS.H ********************
50  * $Id: boolpars.h /main/1 1996/03/29 17:03:47 cde-ibm $
51  * February 1996.
52  * Header for boolpars.c AusText/DtSearch yacc-based boolean query parser.
53  *
54  * FORMAT OF TRUTH TABLE:
55  * Pointer to TRUTHTAB struct is main yacc stack value.
56  * Represents 256 unsigned chars, every possible permutation of 8 (max)
57  * query stems.  The unsigned chars ("permutes") are bit vectors.
58  * Bit #0 (lowest order) is for first word in stemsarray stems[0],
59  * bit #1 is stems[1], etc.
60  * Example: truthtab for query consisting of a single word,
61  *      call it 'A' (assigned bit #0), is the 128 chars 1, 3, 5, 7, ...,
62  *      ie all bitvector permutations with low order bit turned on.
63  * B:      (bit #1) is the 128 chars 2, 3, 6, 7, ..., ie all permutations
64  *         with 2nd bit turned on.
65  * A & B:  Intersection of truth tables: the 64 chars 3, 7, ...,
66  *         all the bit vector permutations they have in common.
67  * A | B:  Union of truth tables:  the 192 permutes 1,2,3, 5,6,7, 9,10,11...
68  * ~B:     Complement of truth table, U - B: the 128 chars 0, 1, 4, 5, ...,
69  *         ie every bitvector permutation NOT in B.
70  * 
71  * The zero permute (all bits zero) refers to the entire
72  * balance of the database containing none of the query stems.
73  * Needless to say searches with the zero permute in their
74  * truth table will take an incredibly long time!
75  *
76  * The 'universal set' U is all 256 possible permutes.
77  * The 'empty set' is indicated by truthtab.pmsz == 0;
78  *
79  * The permutes in a truth table are maintained in
80  * ascending order for ease of comparisons.
81  *
82  * Truth table manipulations require and depend on
83  * DtSrMAX_STEMCOUNT being defined only as 8.
84  *
85  * Newly allocated truth tables are maintained on the 'ttlist'
86  * using the 'next' field.  This is to ensure they are eventually
87  * freed to prevent memory leaks.
88  *
89  * If 'stemno' >= 0 it points to the word in usrblk.stems to which
90  * it applies.  Stemno == -1 means truth table is not directly
91  * associated with a word in usrblk.stems.
92  * 
93  * $Log$
94  * Revision 1.1  1996/03/05  15:52:06  miker
95  * Initial revision
96  *
97  */
98
99 #define COLLOC_STEM_FORMAT      "@%02d%02d%d"
100
101 /****************************************/
102 /*                                      */
103 /*              TRUTHTAB                */
104 /*                                      */
105 /****************************************/
106 /* Truth table returned from boolean_parse() */
107 typedef struct tttag {
108     struct tttag   *next;
109     int            stemno;      /* -1 means not assoc with stems[] array */
110     int            pmsz;        /* number of bytes in permutes array */
111     unsigned char  *permutes;   /* array of bit vector permutations */
112     }   TRUTHTAB;
113
114 /****************************************/
115 /*                                      */
116 /*               Globals                */
117 /*                                      */
118 /****************************************/
119 extern int      qry_has_no_NOTs;
120 extern int      qry_is_all_ANDs;
121 extern int      parser_invalid_wordcount;
122 extern TRUTHTAB final_truthtab;
123
124 /****************************************/
125 /*                                      */
126 /*          Function Prototypes         */
127 /*                                      */
128 /****************************************/
129 extern void     add_syntax_errmsg (int msgno);
130 extern TRUTHTAB *boolyac_AND (TRUTHTAB *tt1, TRUTHTAB *tt2);
131 extern TRUTHTAB *boolyac_COLLOC (TRUTHTAB *tt1, int colval, TRUTHTAB *tt2);
132 extern TRUTHTAB *boolyac_NOT (TRUTHTAB *tt1);
133 extern TRUTHTAB *boolyac_OR (TRUTHTAB *tt1, TRUTHTAB *tt2);
134 extern TRUTHTAB *copy_final_truthtab (TRUTHTAB *tt);
135
136 /******************** BOOLPARS.H *********************/
137 #endif /* _boolpars_h */