* Add this nice filesystem testing tool that I've recently
[dragonfly.git] / contrib / gperf / src / bool-array.h
1 /* This may look like C code, but it is really -*- C++ -*- */
2
3 /* Simple lookup table abstraction implemented as an Iteration Number Array.
4
5    Copyright (C) 1989-1998 Free Software Foundation, Inc.
6    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
7
8 This file is part of GNU GPERF.
9
10 GNU GPERF is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 1, or (at your option)
13 any later version.
14
15 GNU GPERF is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GNU GPERF; see the file COPYING.  If not, write to the Free
22 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23
24 /* Define and implement a simple boolean array abstraction,
25    uses an Iteration Numbering implementation to save on initialization time. */
26
27 #ifndef bool_array_h
28 #define bool_array_h 1
29
30 #include "trace.h"
31
32 #ifdef LO_CAL
33 /* If we are on a memory diet then we'll only make these use a limited
34    amount of storage space. */
35 typedef unsigned short STORAGE_TYPE;
36 #else
37 typedef unsigned int STORAGE_TYPE;
38 #endif
39
40 class Bool_Array
41 {
42 private:
43   static STORAGE_TYPE *storage_array;    /* Initialization of the index space. */
44   static STORAGE_TYPE  iteration_number; /* Keep track of the current iteration. */
45   static unsigned int  size;             /* Keep track of array size. */
46
47 public:
48        Bool_Array (void);
49       ~Bool_Array (void);
50   static void init (STORAGE_TYPE *buffer, unsigned int s);
51   static int  find (int hash_value);
52   static void reset (void);
53 };
54
55 #ifdef __OPTIMIZE__  /* efficiency hack! */
56
57 #include <stdio.h>
58 #include <string.h>
59 #include "options.h"
60 #define INLINE inline
61 #include "bool-array.icc"
62 #undef INLINE
63
64 #endif
65
66 #endif