* ports.h, ports.c (scm_unread_string): New procedure.
[bpt/guile.git] / libguile / hash.c
index f1739ec..40cf94a 100644 (file)
@@ -1,4 +1,4 @@
-/*     Copyright (C) 1995,1996 Free Software Foundation, Inc.
+/*     Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
  * 
  * 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
@@ -12,7 +12,8 @@
  * 
  * You should have received a copy of the GNU General Public License
  * along with this software; see the file COPYING.  If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
  *
  * As a special exception, the Free Software Foundation gives permission
  * for additional uses of the text contained in its release of GUILE.
@@ -36,8 +37,7 @@
  *
  * If you write modifications of your own for GUILE, it is your choice
  * whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice.  
- */
+ * If you do not wish that, delete this exception notice.  */
 \f
 
 #include <stdio.h>
 extern double floor();
 #endif
 
-#ifdef __STDC__
-unsigned long
-scm_hasher(SCM obj, unsigned long n, scm_sizet d)
-#else
+
 unsigned long
 scm_hasher(obj, n, d)
      SCM obj;
      unsigned long n;
      scm_sizet d;
-#endif
 {
   switch (7 & (int) obj) {
   case 2: case 6:              /* SCM_INUMP(obj) */
@@ -102,9 +98,7 @@ scm_hasher(obj, n, d)
       }
     case scm_tcs_symbols:
     case scm_tc7_string:
-    case scm_tc7_mb_string:
     case scm_tc7_substring:
-    case scm_tc7_mb_substring:
       return scm_strhash(SCM_ROUCHARS(obj), (scm_sizet) SCM_ROLENGTH(obj), n);
     case scm_tc7_wvect:
     case scm_tc7_vector:
@@ -140,30 +134,22 @@ scm_hasher(obj, n, d)
 
 \f
 
-#ifdef __STDC__
-unsigned int
-scm_ihashq (SCM obj, unsigned int n)
-#else
+
 unsigned int
 scm_ihashq (obj, n)
      SCM obj;
      unsigned int n;
-#endif
 {
   return (((unsigned int) obj) >> 1) % n;
 }
 
 
 SCM_PROC(s_hashq, "hashq", 2, 0, 0, scm_hashq);
-#ifdef __STDC__
-SCM
-scm_hashq(SCM obj, SCM n)
-#else
+
 SCM
 scm_hashq(obj, n)
      SCM obj;
      SCM n;
-#endif
 {
   SCM_ASSERT(SCM_INUMP(n) && 0 <= n, n, SCM_ARG2, s_hashq);
   return SCM_MAKINUM(scm_ihashq (obj, SCM_INUM (n)));
@@ -172,15 +158,11 @@ scm_hashq(obj, n)
 
 \f
 
-#ifdef __STDC__
-unsigned int
-scm_ihashv (SCM obj, unsigned int n)
-#else
+
 unsigned int
 scm_ihashv (obj, n)
      SCM obj;
      unsigned int n;
-#endif
 {
   if (SCM_ICHRP(obj))
     return ((unsigned int)(scm_downcase(SCM_ICHR(obj)))) % n; /* downcase!?!! */
@@ -193,15 +175,11 @@ scm_ihashv (obj, n)
 
 
 SCM_PROC(s_hashv, "hashv", 2, 0, 0, scm_hashv);
-#ifdef __STDC__
-SCM
-scm_hashv(SCM obj, SCM n)
-#else
+
 SCM
 scm_hashv(obj, n)
      SCM obj;
      SCM n;
-#endif
 {
   SCM_ASSERT(SCM_INUMP(n) && 0 <= n, n, SCM_ARG2, s_hashv);
   return SCM_MAKINUM(scm_ihashv (obj, SCM_INUM (n)));
@@ -210,29 +188,21 @@ scm_hashv(obj, n)
 
 \f
 
-#ifdef __STDC__
-unsigned int
-scm_ihash (SCM obj, unsigned int n)
-#else
+
 unsigned int
 scm_ihash (obj, n)
      SCM obj;
      unsigned int n;
-#endif
 {
   return (unsigned int)scm_hasher (obj, n, 10);
 }
 
 SCM_PROC(s_hash, "hash", 2, 0, 0, scm_hash);
-#ifdef __STDC__
-SCM
-scm_hash(SCM obj, SCM n)
-#else
+
 SCM
 scm_hash(obj, n)
      SCM obj;
      SCM n;
-#endif
 {
   SCM_ASSERT(SCM_INUMP(n) && 0 <= n, n, SCM_ARG2, s_hash);
   return SCM_MAKINUM(scm_ihash(obj, SCM_INUM(n)));
@@ -241,13 +211,9 @@ scm_hash(obj, n)
 
 \f
 
-#ifdef __STDC__
-void
-scm_init_hash (void)
-#else
+
 void
 scm_init_hash ()
-#endif
 {
 #include "hash.x"
 }