Removed definition of GUILE_PTHREAD_COMPAT inside commentary
[bpt/guile.git] / libguile / vectors.h
index b33a592..c0692a0 100644 (file)
  * 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.  */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+   gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
 \f
 
 #include "libguile/__scm.h"
 
 \f
 
-#define SCM_VECTORP(x) (SCM_TYP7S(x)==scm_tc7_vector)
-#define SCM_NVECTORP(x) (!SCM_VECTORP(x))
-#define SCM_VELTS(x) ((SCM *)SCM_CDR(x))
+#define SCM_VECTORP(x) (SCM_NIMP (x) && (SCM_TYP7S (x) == scm_tc7_vector))
+#define SCM_NVECTORP(x) (!SCM_VECTORP (x))
+#define SCM_VELTS(x) ((SCM *) SCM_UNPACK (SCM_CDR (x)))
+#define SCM_VELTS_AS_STACKITEMS(x) ((SCM_STACKITEM *) SCM_UNPACK (SCM_CDR (x)))
 #define SCM_SETVELTS SCM_SETCDR
 
+
+\f
+/*
+  bit vectors
+ */
+#define SCM_BITVEC_REF(a, i) ((SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_LONG_BIT]) & (1L<<((i)%SCM_LONG_BIT))) ? 1 : 0)
+#define SCM_BITVEC_SET(a, i) SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_LONG_BIT]) |= (1L<<((i)%SCM_LONG_BIT))
+#define SCM_BITVEC_CLR(a, i) SCM_UNPACK(SCM_VELTS(a)[(i)/SCM_LONG_BIT]) &= ~(1L<<((i)%SCM_LONG_BIT))
+
+
 \f
 
-extern SCM scm_vector_p SCM_P ((SCM x));
-extern SCM scm_vector_length SCM_P ((SCM v));
-extern SCM scm_vector SCM_P ((SCM l));
-extern SCM scm_vector_ref SCM_P ((SCM v, SCM k));
-extern SCM scm_vector_set_x SCM_P ((SCM v, SCM k, SCM obj));
-extern SCM scm_make_vector SCM_P ((SCM k, SCM fill));
-extern SCM scm_vector_to_list SCM_P ((SCM v));
-extern SCM scm_vector_fill_x SCM_P ((SCM v, SCM fill_x));
-extern SCM scm_vector_equal_p SCM_P ((SCM x, SCM y));
-extern SCM scm_vector_move_left_x SCM_P ((SCM vec1, SCM start1, SCM end1, SCM
-                                  vec2, SCM start2));
-extern SCM scm_vector_move_right_x SCM_P ((SCM vec1, SCM start1, SCM end1, SCM
-                                  vec2, SCM start2));
-extern void scm_init_vectors SCM_P ((void));
+extern SCM scm_vector_set_length_x (SCM vect, SCM len);
+extern SCM scm_vector_p (SCM x);
+extern SCM scm_vector_length (SCM v);
+extern SCM scm_vector (SCM l);
+extern SCM scm_vector_ref (SCM v, SCM k);
+extern SCM scm_vector_set_x (SCM v, SCM k, SCM obj);
+extern SCM scm_make_vector (SCM k, SCM fill);
+extern SCM scm_vector_to_list (SCM v);
+extern SCM scm_vector_fill_x (SCM v, SCM fill_x);
+extern SCM scm_vector_equal_p (SCM x, SCM y);
+extern SCM scm_vector_move_left_x (SCM vec1, SCM start1, SCM end1,
+                                  SCM vec2, SCM start2);
+extern SCM scm_vector_move_right_x (SCM vec1, SCM start1, SCM end1, 
+                                    SCM vec2, SCM start2);
+extern void scm_init_vectors (void);
 
 #endif  /* VECTORSH */
+
+/*
+  Local Variables:
+  c-file-style: "gnu"
+  End:
+*/