* _scm.h: Removed #include <errno.h>.
[bpt/guile.git] / libguile / iselect.c
index 6874da8..8678635 100644 (file)
@@ -1,4 +1,4 @@
-/*     Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+/*     Copyright (C) 1997, 1998, 2000, 2001 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
  * If you do not wish that, delete this exception notice.  */
 \f
 #include <stdio.h>
+#include <errno.h>
 #include <limits.h>
 #include <string.h>
 
-#include "_scm.h"
-#include "async.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "libguile/_scm.h"
+#include "libguile/async.h"
 
-#include "iselect.h"
+#include "libguile/iselect.h"
 
 #ifdef GUILE_ISELECT
 
-#include "coop-threads.h"
+#include "libguile/coop-threads.h"
 
 #ifdef MISSING_BZERO_DECL
 extern void bzero (void *, size_t);
@@ -69,7 +74,7 @@ extern void bzero (void *, size_t);
 #if LONG_MAX >> 16 == 0
 #define SCM_NLONGBITS(p) (bc[((unsigned char *)(p))[0]]\
                          + bc[((unsigned char *)(p))[1]])
-#elif LONG_MAX >> 32 == 0
+#elif LONG_MAX >> 32 == 0 || LONG_MAX == 2147483647L /* bug in Sun CC 4.2 */
 #define SCM_NLONGBITS(p) (bc[((unsigned char *)(p))[0]]\
                          + bc[((unsigned char *)(p))[1]]\
                          + bc[((unsigned char *)(p))[2]]\
@@ -83,6 +88,8 @@ extern void bzero (void *, size_t);
                          + bc[((unsigned char *)(p))[5]]\
                          + bc[((unsigned char *)(p))[6]]\
                          + bc[((unsigned char *)(p))[7]])
+#else
+#error Could not determine suitable definition for SCM_NLONGBITS
 #endif
 
 #ifdef HAVE_BZERO
@@ -238,6 +245,7 @@ add_fd_sets (coop_t *t)
       if (t->exceptfds != NULL && ((ulongptr) t->exceptfds)[i] != 0)
        ((ulongptr) &gexceptfds)[i] |= ((ulongptr) t->exceptfds)[i];
     cont_except:
+      ;
     }
 }
 
@@ -620,7 +628,9 @@ scm_init_iselect ()
   timeout0.tv_usec = 0;
 #endif
   init_bc (0x80, 0, 0);
-#include "iselect.x"
+#ifndef SCM_MAGIC_SNARFER
+#include "libguile/iselect.x"
+#endif
 }
 
 #endif /* GUILE_ISELECT */
@@ -693,3 +703,9 @@ scm_internal_select (int nfds,
   return coop_global_curr->retval;
 #endif /* GUILE_ISELECT */
 }
+
+/*
+  Local Variables:
+  c-file-style: "gnu"
+  End:
+*/