*** empty log message ***
[bpt/guile.git] / libguile / boolean.h
index 52a28b5..bc80e9f 100644 (file)
@@ -2,7 +2,7 @@
 
 #ifndef BOOLEANH
 #define BOOLEANH
-/*     Copyright (C) 1995,1996 Free Software Foundation, Inc.
+/*     Copyright (C) 1995,1996, 2000 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
 /* Boolean Values 
  *
  */ 
-#define SCM_FALSEP(x)          (SCM_BOOL_F == (x))
-#define SCM_NFALSEP(x)                 (SCM_BOOL_F != (x))
+#define SCM_FALSEP(x)          (SCM_EQ_P ((x), SCM_BOOL_F))
+#define SCM_NFALSEP(x)         (!SCM_FALSEP (x))
+
+#define SCM_BOOLP(x)           (SCM_EQ_P ((x), SCM_BOOL_F) || SCM_EQ_P ((x), SCM_BOOL_T))
+
+/* Convert from a C boolean to a SCM boolean value */
+#define SCM_BOOL(f)            ((f) ? SCM_BOOL_T : SCM_BOOL_F)
+
+/* Convert from a C boolean to a SCM boolean value and negate it */
+#define SCM_NEGATE_BOOL(f)     ((f) ? SCM_BOOL_F : SCM_BOOL_T)
 
 /* SCM_BOOL_NOT returns the other boolean.  
  * The order of ^s here is important for Borland C++ (!?!?!)
  */
-#define SCM_BOOL_NOT(x)  ((x) ^ (SCM_BOOL_T ^ SCM_BOOL_F))
+#define SCM_BOOL_NOT(x)                (SCM_PACK (SCM_UNPACK (x) \
+                                          ^ (SCM_UNPACK (SCM_BOOL_T) \
+                                             ^ SCM_UNPACK (SCM_BOOL_F))))
 
 \f
 
-extern SCM scm_not SCM_P ((SCM x));
-extern SCM scm_boolean_p SCM_P ((SCM obj));
-extern void scm_init_boolean SCM_P ((void));
+extern SCM scm_not (SCM x);
+extern SCM scm_boolean_p (SCM obj);
+extern void scm_init_boolean (void);
 
 #endif  /* BOOLEANH */
+
+/*
+  Local Variables:
+  c-file-style: "gnu"
+  End:
+*/