(scm_is_true, scm_is_false, scm_from_bool, scm_to_bool): New.
authorMarius Vollmer <mvo@zagadka.de>
Mon, 5 Jul 2004 17:13:39 +0000 (17:13 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Mon, 5 Jul 2004 17:13:39 +0000 (17:13 +0000)
libguile/boolean.c
libguile/boolean.h

index 97cffe8..1f6b5b0 100644 (file)
@@ -45,7 +45,22 @@ SCM_DEFINE (scm_boolean_p, "boolean?", 1, 0, 0,
 }
 #undef FUNC_NAME
 
+int
+scm_is_bool (SCM x)
+{
+  return scm_is_eq (x, SCM_BOOL_F) || scm_is_eq (SCM_BOOL_T);
+}
 
+int
+scm_to_bool (SCM x)
+{
+  if (scm_is_eq (x, SCM_BOOL_F))
+    return 0;
+  else if (scm_is_eq (x, SCM_BOOL_T))
+    return 1;
+  else    
+    scm_wrong_type_arg (NULL, 0, x);
+}
 
 void
 scm_init_boolean ()
index 982c950..63cc060 100644 (file)
                                           ^ (SCM_UNPACK (SCM_BOOL_T) \
                                              ^ SCM_UNPACK (SCM_BOOL_F))))
 
+#define scm_is_false(x) scm_is_eq ((x), SCM_BOOL_F)
+#define scm_is_true(x)  !scm_is_false (x)
+
+SCM_API int scm_is_bool(x);
+#define scm_from_bool(x) ((f) ? SCM_BOOL_T : SCM_BOOL_F)
+SCM_API int scm_to_bool (SCM x);
+
 \f
 
 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 */