* Makefile.am (modinclude_HEADERS): Added threads-plugin.h.
[bpt/guile.git] / libguile / boolean.h
index 96a44bb..907873e 100644 (file)
@@ -1,22 +1,24 @@
 /* classes: h_files */
 
-#ifndef BOOLEANH
-#define BOOLEANH
-/*     Copyright (C) 1995,1996 Free Software Foundation, Inc.
- * 
+#ifndef SCM_BOOLEAN_H
+#define SCM_BOOLEAN_H
+
+/* 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
  * the Free Software Foundation; either version 2, 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.
- * 
+ *
  * 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.
  *
  * 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 <libguile/__scm.h>
+
+#include "libguile/__scm.h"
 
 \f
 
 /* 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
 
-#ifdef __STDC__
-extern SCM scm_not(SCM x);
-extern SCM scm_boolean_p(SCM obj);
-extern void scm_init_boolean (void);
-
-#else /* STDC */
-extern SCM scm_not();
-extern SCM scm_boolean_p();
-extern void scm_init_boolean ();
-
-#endif /* STDC */
+SCM_API SCM scm_not (SCM x);
+SCM_API SCM scm_boolean_p (SCM obj);
+SCM_API void scm_init_boolean (void);
 
+#endif  /* SCM_BOOLEAN_H */
 
-#endif  /* BOOLEANH */
+/*
+  Local Variables:
+  c-file-style: "gnu"
+  End:
+*/