Author: yamakenz
Date: Mon Aug 20 07:14:07 2007
New Revision: 4876

Modified:
   trunk/doc/COMPATIBILITY
   trunk/uim/canna.c
   trunk/uim/uim-scm-abbrev.h
   trunk/uim/uim-scm.c
   trunk/uim/uim-scm.h

Log:
* uim/uim-scm.h
  - (UIM_SCM_USE_DEPRECATED_API): New macro
  - (uim_scm_truep, uim_scm_falsep): New function decl
  - (UIM_SCM_FALSEP, UIM_SCM_NFALSEP): Redefine as deprecated macro
  - (FALSEP, NFALSEP, TRUEP, NTRUEP): Removed
  - (uim_scm_null_list): Enclosed into #if UIM_SCM_USE_DEPRECATED_API
* uim/uim-scm.c
  - (uim_scm_truep, uim_scm_falsep): New function
* uim/uim-scm-abbrev.h
  - (TRUEP, FALSEP): New macro
* uim/canna.c
  - (init_canna_lib): Replace NFALSEP() with TRUEP()
* doc/COMPATIBILITY
  - Add new section "uim-scm API truth predicates reorganization in uim 1.5.0"


Modified: trunk/doc/COMPATIBILITY
==============================================================================
--- trunk/doc/COMPATIBILITY     (original)
+++ trunk/doc/COMPATIBILITY     Mon Aug 20 07:14:07 2007
@@ -57,6 +57,36 @@
 
 The changes are described below in most recently updated order.
 ------------------------------------------------------------------------------
+Summary: uim-scm API truth predicates reorganization in uim 1.5.0
+Affects: uim developers, IM developers
+Updates: C API (uim-scm), libuim ABI
+Version: 1.5.0
+Revision: ac4876
+Date: 2007-08-20
+Modifier: YamaKen
+Related: uim-scm API reorganization in uim 1.5.0
+        Deprecate truth predicates for uim-scm
+URL:
+Changes:
+         (new) uim_scm_truep()
+         (new) uim_scm_falsep()
+     (changed) FALSEP()
+     (changed) TRUEP()
+  (deprecated) UIM_SCM_FALSEP()
+  (deprecated) UIM_SCM_NFALSEP()
+     (removed) NFALSEP()
+     (removed) NTRUEP()
+Description:
+  - uim-scm truth predicates are now function-based. uim_scm_falsep(obj) as
+    (not obj), and uim_scm_truep(obj) as (if obj #t #f). Don't misunderstand
+    uim_scm_truep(obj) as if (eq? obj #t)
+  - Former main predicates UIM_SCM_FALSEP() and UIM_SCM_NFALSEP() are
+    deprecated
+  - FALSEP() is removed from uim-scm.h, but can be used via uim-scm-abbrev.h
+  - TRUEP() is previously defined as (eq? obj #t) in uim-scm.h. It is now
+    redefined as (if obj #t #f) in uim-scm-abbrev.h and removed from uim-scm.h
+  - NFALSEP() and NTRUEP() are removed from uim-scm.h
+------------------------------------------------------------------------------
 Summary: Fix invalid type assumption on PIDs
 Affects: IM developers, uim developers
 Updates: C API
@@ -404,7 +434,8 @@
 Revision: ac4333, ac4334, ac4339, ac4347, ac4351-ac4353, ac4355, ac4444, 
ac4446, ac4751, ac4761, ac4764, ac4788, ac4808, ac4812, ac4813, ac4815, ac4817, 
ac4819, ac4821, ac4830, ac4870, ac4871, ac4873, ac4875
 Date: 2007-01-09 -
 Modifier: YamaKen
-Related: SigScheme introduction to uim
+Related: uim-scm API truth predicates reorganization in uim 1.5.0
+        SigScheme introduction to uim
         Bit width extension of uim_scm_c_bool() and uim_scm_make_bool()
 URL:
 Changes:

Modified: trunk/uim/canna.c
==============================================================================
--- trunk/uim/canna.c   (original)
+++ trunk/uim/canna.c   Mon Aug 20 07:14:07 2007
@@ -110,7 +110,7 @@
 static uim_lisp
 init_canna_lib(uim_lisp str_)
 {
-  cannaserver = (NFALSEP(str_)) ? uim_scm_c_str(str_) : NULL;
+  cannaserver = (TRUEP(str_)) ? uim_scm_c_str(str_) : NULL;
 
   /* Immediate init & quit to test cannaserver connectivity? Real
    * initialization is exist at beginning of create_context(). I don't

Modified: trunk/uim/uim-scm-abbrev.h
==============================================================================
--- trunk/uim/uim-scm-abbrev.h  (original)
+++ trunk/uim/uim-scm-abbrev.h  Mon Aug 20 07:14:07 2007
@@ -56,6 +56,8 @@
 #define FPTRP     uim_scm_func_ptrp
 #define NULLP     uim_scm_nullp
 #define CONSP     uim_scm_consp
+#define TRUEP     uim_scm_truep    /* (if obj #t #f) */
+#define FALSEP    uim_scm_falsep
 
 #define CAR       uim_scm_car
 #define CDR       uim_scm_cdr

Modified: trunk/uim/uim-scm.c
==============================================================================
--- trunk/uim/uim-scm.c (original)
+++ trunk/uim/uim-scm.c Mon Aug 20 07:14:07 2007
@@ -842,6 +842,23 @@
   return ary;
 }
 
+/* (if obj #t #f) */
+uim_bool
+uim_scm_truep(uim_lisp obj)
+{
+  assert(uim_scm_gc_any_contextp());
+
+  return (SCM_TRUEP((ScmObj)obj));
+}
+
+uim_bool
+uim_scm_falsep(uim_lisp obj)
+{
+  assert(uim_scm_gc_any_contextp());
+
+  return (SCM_FALSEP((ScmObj)obj));
+}
+
 uim_bool
 uim_scm_nullp(uim_lisp obj)
 {

Modified: trunk/uim/uim-scm.h
==============================================================================
--- trunk/uim/uim-scm.h (original)
+++ trunk/uim/uim-scm.h Mon Aug 20 07:14:07 2007
@@ -58,6 +58,7 @@
 extern "C" {
 #endif
 
+#define UIM_SCM_USE_DEPRECATED_API 1
 
 /*
   uim companion tools should treat lisp object as opaque. struct
@@ -67,17 +68,6 @@
 typedef void (*uim_func_ptr)(void);
 typedef void *(*uim_gc_gate_func_ptr)(void *);
 
-#define UIM_SCM_FALSEP(x)  (uim_scm_eq((x), uim_scm_f()))
-#define UIM_SCM_NFALSEP(x) (!uim_scm_eq((x), uim_scm_f()))
-
-#if 1
-/* deprecated: replace with UIM_SCM_N?FALSEP() */
-#define FALSEP(x)  (UIM_SCM_FALSEP(x))
-#define NFALSEP(x) (UIM_SCM_NFALSEP(x))
-#define TRUEP(x) (uim_scm_eq(x, uim_scm_t()))
-#define NTRUEP(x) (!uim_scm_eq(x, uim_scm_t()))
-#endif
-
 
 /* subsystem interfaces */
 uim_bool uim_scm_is_initialized(void);
@@ -181,7 +171,6 @@
 uim_lisp
 uim_scm_f(void);
 uim_lisp uim_scm_null(void);
-#define uim_scm_null_list uim_scm_null
 uim_lisp uim_scm_eof(void);
 
 /* list constructors */
@@ -205,6 +194,8 @@
 
 
 /* predicates */
+uim_bool uim_scm_truep(uim_lisp obj);  /* (if obj #t #f) */
+uim_bool uim_scm_falsep(uim_lisp obj);
 uim_bool
 uim_scm_nullp(uim_lisp obj);
 uim_bool
@@ -235,6 +226,16 @@
 uim_lisp uim_scm_vector_ref(uim_lisp vec, long i);
 void uim_scm_vector_set(uim_lisp vec, long i, uim_lisp elm);
 long uim_scm_vector_length(uim_lisp vec);
+
+
+#if UIM_SCM_USE_DEPRECATED_API
+/* deprecated: replace with uim_scm_falsep() and uim_scm_truep(), or
+ * FALSEP() and TRUEP() in uim-scm-abbrev.h */
+#define UIM_SCM_FALSEP(x)  (uim_scm_falsep(x))
+#define UIM_SCM_NFALSEP(x) (uim_scm_truep(x))
+
+#define uim_scm_null_list uim_scm_null
+#endif /* UIM_SCM_USE_DEPRECATED_API */
 
 
 #ifdef __cplusplus

Reply via email to