bool-array.h revision 58551
158551Skris/* This may look like C code, but it is really -*- C++ -*- */
258551Skris
358551Skris/* Simple lookup table abstraction implemented as an Iteration Number Array.
458551Skris
558551Skris   Copyright (C) 1989-1998 Free Software Foundation, Inc.
658551Skris   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
758551Skris
858551SkrisThis file is part of GNU GPERF.
958551Skris
1058551SkrisGNU GPERF is free software; you can redistribute it and/or modify
1158551Skrisit under the terms of the GNU General Public License as published by
1258551Skristhe Free Software Foundation; either version 1, or (at your option)
1358551Skrisany later version.
1458551Skris
1558551SkrisGNU GPERF is distributed in the hope that it will be useful,
1658551Skrisbut WITHOUT ANY WARRANTY; without even the implied warranty of
1758551SkrisMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1858551SkrisGNU General Public License for more details.
1958551Skris
2058551SkrisYou should have received a copy of the GNU General Public License
2158551Skrisalong with GNU GPERF; see the file COPYING.  If not, write to the Free
2258551SkrisSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2358551Skris
2458551Skris/* Define and implement a simple boolean array abstraction,
2558551Skris   uses an Iteration Numbering implementation to save on initialization time. */
2658551Skris
2758551Skris#ifndef bool_array_h
2858551Skris#define bool_array_h 1
2958551Skris
3058551Skris#include "trace.h"
3158551Skris
3258551Skris#ifdef LO_CAL
3358551Skris/* If we are on a memory diet then we'll only make these use a limited
3458551Skris   amount of storage space. */
3558551Skristypedef unsigned short STORAGE_TYPE;
3658551Skris#else
3758551Skristypedef unsigned int STORAGE_TYPE;
3858551Skris#endif
3958551Skris
4058551Skrisclass Bool_Array
4158551Skris{
4258551Skrisprivate:
4358551Skris  static STORAGE_TYPE *storage_array;    /* Initialization of the index space. */
4458551Skris  static STORAGE_TYPE  iteration_number; /* Keep track of the current iteration. */
4558551Skris  static unsigned int  size;             /* Keep track of array size. */
4658551Skris
4758551Skrispublic:
4858551Skris       Bool_Array (void);
4958551Skris      ~Bool_Array (void);
5058551Skris  static void init (STORAGE_TYPE *buffer, unsigned int s);
5158551Skris  static int  find (int hash_value);
5258551Skris  static void reset (void);
5358551Skris};
5458551Skris
5558551Skris#ifdef __OPTIMIZE__  /* efficiency hack! */
5658551Skris
5758551Skris#include <stdio.h>
5858551Skris#include <string.h>
5958551Skris#include "options.h"
6058551Skris#define INLINE inline
6158551Skris#include "bool-array.icc"
6258551Skris#undef INLINE
6358551Skris
6458551Skris#endif
6558551Skris
6658551Skris#endif
67