modules/up/src/rpsl/gnu/SymID.defs.h

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. SymIDEQ
  2. SymIDLE
  3. SymIDCMP
  4. SymIDHASH
  5. HASHTABLE_TOO_CROWDED

   1 // This may look like C code, but it is really -*- C++ -*-
   2 /* 
   3 Copyright (C) 1988 Free Software Foundation
   4     written by Doug Lea (dl@rocky.oswego.edu)
   5 
   6 This file is part of the GNU C++ Library.  This library is free
   7 software; you can redistribute it and/or modify it under the terms of
   8 the GNU Library General Public License as published by the Free
   9 Software Foundation; either version 2 of the License, or (at your
  10 option) any later version.  This library is distributed in the hope
  11 that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13 PURPOSE.  See the GNU Library General Public License for more details.
  14 You should have received a copy of the GNU Library General Public
  15 License along with this library; if not, write to the Free Software
  16 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17 */
  18 
  19 
  20 #ifndef _SymIDdefs_h
  21 #define _SymIDdefs_h 1
  22 
  23 #include "config.h"
  24 #include <cstring>
  25 
  26 // Added by wlee to get rid of implicit declaration warning message
  27 #include "std.h"
  28 
  29 typedef char* SymID;
  30 
  31 // equality operator
  32 #ifndef SymIDEQ
  33 #define SymIDEQ(a, b)  (strcasecmp((a),(b)) == 0)
     /* [<][>][^][v][top][bottom][index][help] */
  34 #endif
  35 
  36 // less-than-or-equal
  37 #ifndef SymIDLE
  38 #define SymIDLE(a, b)  (strcasecmp((a),(b)) <= 0)
     /* [<][>][^][v][top][bottom][index][help] */
  39 #endif
  40 
  41 // comparison : less-than -> < 0; equal -> 0; greater-than -> > 0
  42 #ifndef SymIDCMP
  43 #define SymIDCMP(a, b) (strcasecmp((a),(b)))
     /* [<][>][^][v][top][bottom][index][help] */
  44 #endif
  45 
  46 // hash function
  47 #ifndef SymIDHASH
  48 extern unsigned int hashpjw(const char* s);
  49 #define SymIDHASH(x)  hashpjw(x)
     /* [<][>][^][v][top][bottom][index][help] */
  50 #endif
  51 
  52 // initial capacity for structures requiring one
  53 
  54 #ifndef DEFAULT_INITIAL_CAPACITY
  55 #define DEFAULT_INITIAL_CAPACITY 100
  56 #endif
  57 
  58 // HASHTABLE_TOO_CROWDED(COUNT, SIZE) is true iff a hash table with COUNT
  59 // elements and SIZE slots is too full, and should be resized.
  60 // This is so if available space is less than 1/8.
  61 
  62 #define HASHTABLE_TOO_CROWDED(COUNT, SIZE) ((SIZE) - ((SIZE) >> 3) <= (COUNT))
     /* [<][>][^][v][top][bottom][index][help] */
  63 
  64 #endif

/* [<][>][^][v][top][bottom][index][help] */