]> andersk Git - splint.git/commitdiff
Removed stray hashTable.c file
authorevans1629 <evans1629>
Mon, 7 Jan 2002 18:40:35 +0000 (18:40 +0000)
committerevans1629 <evans1629>
Mon, 7 Jan 2002 18:40:35 +0000 (18:40 +0000)
configure.ac
src/Headers/basic.h
src/Headers/hashTable.h [deleted file]
src/Headers/version.h
src/cpplib.c
src/hashTable.c [deleted file]

index 53a0376114f23e2e15d22de0a76a970cda744476..20643032dba1f5147518f4611a89fb8f9486cc05 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process with autoconf to create a configure script  -*- Autoconf -*-
 AC_PREREQ(2.50)
-AC_INIT([Splint], [3.0.1], [splint-bug@cs.virginia.edu], [splint])
+AC_INIT([Splint], [3.0.1.1], [splint-bug@cs.virginia.edu], [splint])
 
 dnl This MUST precede any other macro
 AC_CONFIG_AUX_DIR([config])
index 06bbe611a30de99fa109c13cec31518d3a2ffff1..9d7e8869cbd58415871498ea65881768e847e264 100644 (file)
@@ -8,7 +8,9 @@
 # define BASIC_H
 
 # ifdef HAVE_CONFIG_H
-# include "config.h"
+# include "../../config.h"
+# else
+# error "No config.h file!"
 # endif
 
 # include <stdlib.h>
diff --git a/src/Headers/hashTable.h b/src/Headers/hashTable.h
deleted file mode 100644 (file)
index bf50fce..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000.
-** See ../LICENSE for license information.
-**
-*/
-/*
-** hashTable.h
-*/
-
-# ifndef HTABLE_H
-# define HTABLE_H
-
-/*@constant int HBUCKET_BASESIZE; @*/
-# define HBUCKET_BASESIZE 2
-
-/*@constant int HBUCKET_DNE; @*/
-# define HBUCKET_DNE NOT_FOUND
-
-typedef struct _hashTable *hashTable ;
-
-typedef struct _hentry
-{
-  /*@dependent@*/ cstring key;
-                  int     val;
-} hentry;
-
-typedef /*@null@*/ struct _hbucket
-{
-  int size;
-  int nspace;
-  /*@only@*/ hentry *entries;
-} *hbucket;
-
-typedef /*@only@*/ hbucket o_hbucket;
-
-struct _hashTable
-{
-  int size;
-  int nentries;
-  /*@only@*/ o_hbucket *buckets;
-} ;
-
-
-extern /*@only@*/ hashTable hashTable_create(int p_size);
-extern void hashTable_insert (hashTable p_h, cstring p_key, int p_value);
-extern int hashTable_lookup (hashTable p_h, cstring p_key);
-extern /*@unused@*/ /*@only@*/ cstring hashTable_stats(hashTable p_h);
-extern void hashTable_free (/*@only@*/ hashTable p_h);
-extern void hashTable_remove (hashTable p_h, cstring p_key) /*@modifies p_h@*/ ;
-extern void 
-  hashTable_replaceKey (hashTable p_h, cstring p_oldkey, /*@dependent@*/ cstring p_newkey);
-
-# else
-# error "Multiple include"
-# endif 
-
-
-
-
-
-
-
-
-
-
-
-
-
index 9f5096df44a2ec78b791300a53d1f9ba34c2ac2c..3035e785a33e6c829733fd0de33fd11e83c3a296 100644 (file)
@@ -12,9 +12,6 @@
 /*@constant observer char *SPLINT_MAINTAINER; @*/
 # define SPLINT_MAINTAINER "splint-bug@cs.virginia.edu"
 
-/*@constant observer char *CPP_VERSION;@*/
-# define CPP_VERSION "cygnus-2.7.2-970404"
-
 # else
 # error "Multiple include"
 # endif
index 2c15062b7df465ff56561c244c282dca920e11bf..9df975245a2cb8d4f996690bbacff00aa00dcb24 100644 (file)
@@ -3445,7 +3445,7 @@ special_symbol (hashNode hp, cppReader *pfile)
       break;
 
     case T_VERSION:
-      buf = message ("\"%s\"", cstring_makeLiteralTemp (CPP_VERSION));
+      buf = cstring_makeLiteral ("\"--- cpp version---\"");
       break;
 
 #ifndef NO_BUILTIN_SIZE_TYPE
diff --git a/src/hashTable.c b/src/hashTable.c
deleted file mode 100644 (file)
index 769e4ed..0000000
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
-** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2000 University of Virginia,
-**         Massachusetts Institute of Technology
-**
-** This program is free software; you can redistribute it and/or modify it
-** under the terms of the GNU General Public License as published by the
-** Free Software Foundation; either version 2 of the License, or (at your
-** option) any later version.
-** 
-** This program is distributed in the hope that it will be useful, but
-** WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-** General Public License for more details.
-** 
-** The GNU General Public License is available from http://www.gnu.org/ or
-** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-** MA 02111-1307, USA.
-**
-** For information on splint: splint@cs.virginia.edu
-** To report a bug: splint-bug@cs.virginia.edu
-** For more information: http://www.splint.org
-*/
-/*
-** hashTable.c
-**
-** Since hsearch defined in <search.h> only allows one hash table,
-** I'll implement my own.
-**
-** Try to find a decent hash function, etc. later...
-**
-** hashTable is from string -> unsigned
-**
-*/
-
-# include "splintMacros.nf"
-# include "basic.h"
-
-/*@constant null hbucket hbucket_undefined; @*/
-# define hbucket_undefined 0
-
-static /*@truenull@*/ bool hbucket_isNull (/*@null@*/ hbucket h) 
-{ 
-  return (h == hbucket_undefined); 
-}
-
-static hentry
-hentry_create (cstring key, int val)
-{
-  hentry h;
-
-  h.key = key;
-  h.val = val;
-  return (h);
-}
-
-static bool
-hbucket_isEmpty (hbucket h)
-{
-  return (h == hbucket_undefined || h->size == 0);
-}
-
-static cstring
-hbucket_unparse (hbucket h)
-{
-  cstring s = cstring_undefined;
-
-  if (!hbucket_isNull (h))
-    {
-      int i;
-      
-      for (i = 0; i < h->size; i++)
-       {
-         s = message ("%q %s:%d", s, h->entries[i].key, h->entries[i].val);
-       }
-    }
-
-  return s;
-}
-
-static hbucket
-hbucket_single (hentry e)
-{
-  hbucket h = (hbucket) dmalloc (sizeof (*h));
-  
-  h->size = 1;
-  h->nspace = HBUCKET_BASESIZE - 1;
-  h->entries = (hentry *) dmalloc (HBUCKET_BASESIZE * sizeof (*h->entries));
-  h->entries[0] = e;
-  
-  return (h);
-}
-
-static void
-hbucket_grow (/*@notnull@*/ hbucket h)
-{
-  int i;
-  hentry *newentries; 
-  
-  h->nspace += HBUCKET_BASESIZE;
-
-  newentries = (hentry *) 
-    dmalloc ((h->size + HBUCKET_BASESIZE) * sizeof (*newentries));
-  
-  for (i = 0; i < h->size; i++) 
-    {
-      newentries[i] = h->entries[i]; 
-    }
-  
-  sfree (h->entries);
-  h->entries = newentries; 
-}
-
-static int hbucket_lookup (hbucket p_h, cstring p_key);
-
-/*
-** bizarre duplicate behaviour
-** required for duplicate entries
-*/
-
-static void
-hbucket_add (/*@notnull@*/ hbucket h, hentry e)
-{
-  int exloc = hbucket_lookup (h, e.key);
-
-  
-  if (exloc != HBUCKET_DNE)
-    {
-      h->entries[exloc].key = e.key;
-      h->entries[exloc].val = e.val;
-      return;
-    }
-
-  if (h->nspace == 0)
-    {
-            hbucket_grow (h);
-    }
-
-  h->entries[h->size] = e;
-  h->size++;
-  h->nspace--;
-}
-
-static int
-hbucket_ncollisions (hbucket h)
-{
-  if (!hbucket_isNull (h) && (h->size > 1))
-    return (h->size - 1);
-  else
-    return 0;
-}
-
-int
-hbucket_lookup (hbucket h, cstring key)
-{
-  if (!hbucket_isNull (h))
-    {
-      int i;
-      
-      for (i = 0; i < h->size; i++)
-       {
-         if (cstring_equal (h->entries[i].key, key))
-           {
-             return h->entries[i].val;
-           }
-       }
-    }
-
-  return HBUCKET_DNE;
-}
-
-static
-void hbucket_free (/*@only@*/ hbucket h)
-{
-  if (!hbucket_isNull (h))
-    {
-      sfree (h->entries);
-      sfree (h);
-    }
-}
-
-void 
-hashTable_free (/*@only@*/ hashTable h)
-{
-  int i;
-
-  for (i = 0; i < h->size; i++)
-    {
-      hbucket_free (h->buckets[i]);
-    }
-
-  sfree (h->buckets);
-  sfree (h);
-}
-  
-static int
-hashTable_countCollisions (hashTable h)
-{
-  int nc = 0;
-  int i;
-
-  for (i = 0; i < h->size; i++)
-    {
-      nc += hbucket_ncollisions (h->buckets[i]);
-    }
-
-  return (nc);
-}
-
-
-static int
-hashTable_countEmpty (hashTable h)
-{
-  int nc = 0;
-  int i;
-
-  for (i = 0; i < h->size; i++)
-    {
-      if (hbucket_isEmpty (h->buckets[i]))
-       {
-         nc++;
-       }
-    }
-
-  return (nc);
-}
-
-/*
-** hash function snarfed from quake/hash.c Hash_String
-** by Stephen Harrison
-*/
-
-/*
- * Here are 256 random numbers for use in the hash function
- */
-
-/*@+ignoresigns@*/
-static unsigned int RandomNumbers[256] =
-{
-#include "256_random_numbers.nf"
-};
-/*@=ignoresigns@*/
-
-static unsigned int 
-hashTable_hashValue (hashTable h, cstring key)
-{
-  char *p;
-  unsigned int hash_value = 0;
-
-  for (p = cstring_toCharsSafe (key); *p != '\0'; p++)
-    {
-      hash_value = (hash_value << 1) ^ RandomNumbers[*p % 256];
-    }
-
-  return (hash_value % h->size);
-}
-
-static /*@exposed@*/ hbucket
-hashTable_hash (hashTable h, cstring key)
-{
-  return h->buckets[hashTable_hashValue (h, key)];
-}
-
-
-/*@only@*/ hashTable
-hashTable_create (int size)
-{
-  int i;
-  hashTable h = (hashTable) dmalloc (sizeof (*h));
-  
-  h->size = size;
-  h->nentries = 0;
-  h->buckets = (hbucket *) dmalloc (sizeof (*h->buckets) * size);
-  
-  /*@+loopexec@*/
-  for (i = 0; i < size; i++)
-    {
-      h->buckets[i] = hbucket_undefined;
-    }
-  /*@-loopexec@*/
-  return h;
-}
-
-/*@-mustfree@*/
-static /*@unused@*/ void
-hashTable_print (hashTable h)
-{
-  int i;
-
-  for (i = 0; i < h->size; i++)
-    {
-      hbucket hb = h->buckets[i];
-
-      if (hb != NULL)
-       {
-         llmsg (message ("%d. %s\n", i, hbucket_unparse (hb)));
-       }
-    }
-
-  llmsg (message ("size: %d, collisions: %d, empty: %d", 
-                 h->size, 
-                 hashTable_countCollisions (h),
-                 hashTable_countEmpty (h)));
-}
-/*@=mustfree@*/
-
-/*@only@*/ cstring
-hashTable_stats (hashTable h)
-{
-  return (message ("size: %d, collisions: %d, empty: %d\n", 
-                       h->size, hashTable_countCollisions (h),
-                       hashTable_countEmpty (h)));
-}
-
-static void
-hashTable_addEntry (hashTable h, hentry e)
-{
-  unsigned int hindex = hashTable_hashValue (h, e.key);
-  /*
-  ** using
-  **   hbucket hb = h->buckets[hindex];  
-  ** instead reveals a bug I don't want to deal with right now!
-  */
-
-  h->nentries++;
-  
-  if (hbucket_isNull (h->buckets[hindex]))
-    {
-      h->buckets[hindex] = hbucket_single (e); 
-    }
-  else
-    {
-      hbucket_add (h->buckets[hindex], e);
-    }
-}
-
-void
-hashTable_insert (hashTable h, cstring key, int value)
-{
-  unsigned int hindex;
-  hbucket hb;
-  hentry e;  
-
-  
-  h->nentries++;
-
-  /*
-  ** rehashing based (loosely) on code by Steve Harrison
-  */
-
-  if (h->nentries * 162 > h->size * 100) 
-    {
-      int i;
-      int oldsize = h->size;
-      int newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */
-      hbucket *oldbuckets = h->buckets;
-
-      
-      h->size = newsize;  
-      h->nentries = 0;
-      h->buckets = (hbucket *) dmalloc (sizeof (*h->buckets) * newsize);
-
-      /*@+loopexec@*/
-      for (i = 0; i < newsize; i++)
-       {
-         h->buckets[i] = hbucket_undefined;
-       }
-      /*@=loopexec@*/
-      
-      for (i = 0; i < oldsize; i++)
-       {
-         hbucket bucket = oldbuckets[i];
-         
-         if (!hbucket_isNull (bucket))
-           {
-             int j;
-
-             for (j = 0; j < bucket->size; j++)
-               {
-                 hashTable_addEntry (h, bucket->entries[j]);
-               }
-
-             sfree (bucket);
-           }
-       }
-
-      sfree (oldbuckets);
-    }
-
-  
-  e = hentry_create (key, value);
-  hindex = hashTable_hashValue (h, key);
-  hb = h->buckets[hindex];
-  
-  if (hbucket_isNull (hb))
-    {
-            h->buckets[hindex] = hbucket_single (e);
-    }
-  else
-    {
-            hbucket_add (hb, e);
-    }
-
-  }
-
-int
-hashTable_lookup (hashTable h, cstring key)
-{
-  hbucket hb = hashTable_hash (h, key);
-
-  return (hbucket_lookup (hb, key));
-}
-
-/*
-** This is needed if oldkey is going to be released.
-*/
-
-void
-hashTable_replaceKey (hashTable h, cstring oldkey, /*@dependent@*/ cstring newkey)
-{
-  hbucket hb = hashTable_hash (h, oldkey);
-
-  llassert (cstring_equal (oldkey, newkey));
-
-  if (!hbucket_isNull (hb))
-    {
-      int i;
-      
-      for (i = 0; i < hb->size; i++)
-       {
-         if (cstring_equal (hb->entries[i].key, oldkey))
-           {
-             hb->entries[i].key = newkey;
-             return;
-           }
-       }
-    }
-
-  llbug (message ("hashTable_replaceKey: %s not found", oldkey));
-}
-
-void
-hashTable_remove (hashTable h, cstring key)
-{
-  hbucket hb = hashTable_hash (h, key);
-
-  if (!hbucket_isNull (hb))
-    {
-      int i;
-      
-      for (i = 0; i < hb->size; i++)
-       {
-         if (cstring_equal (hb->entries[i].key, key))
-           {
-             if (i < hb->size - 1)
-               {
-                 hb->entries[i] = hb->entries[hb->size - 1];
-               }
-             
-             hb->size--;
-             return;
-           }
-       }
-    }
-
-  llbug (message ("hashTable_removeKey: %s not found", key));
-}
-
-
This page took 0.07539 seconds and 5 git commands to generate.