[uim-commit] r778 - in trunk: scm test uim

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Mar 9 03:45:58 PST 2005


Author: yamaken
Date: 2005-03-09 03:45:53 -0800 (Wed, 09 Mar 2005)
New Revision: 778

Modified:
   trunk/scm/uim-db.scm
   trunk/scm/util.scm
   trunk/test/Makefile.am
   trunk/test/test-db.scm
   trunk/uim/slib.c
Log:
* uim/slib.c
  - Remove an obsolete prototype decl
  - (integer2string): Move to outside of #if DEBUG_SCM. No actual code
    has been modified
  - (init_dbg):
    * Remove initialization of number->string
    * Add initialization of dbg_mod
  - (init_subrs): Add initialization of integer->string for
    integer2string()
* scm/util.scm
  - (number->string, string->number): New R5RS alias
* scm/uim-db.scm
  - (uim-db-puts): Replace number->string with integer->string

* test/Makefile.am
  - (EXTRA_DIST): Add test-db.scm
* test/test-db.scm
  - svn propset svn:executable on


Modified: trunk/scm/uim-db.scm
===================================================================
--- trunk/scm/uim-db.scm	2005-03-09 11:18:29 UTC (rev 777)
+++ trunk/scm/uim-db.scm	2005-03-09 11:45:53 UTC (rev 778)
@@ -264,7 +264,7 @@
      (lambda (x)
        (case (typeof x)
 	 ((tc_string tc_symbol) (puts x))
-	 ((tc_intnum) (puts (number->string x)))
+	 ((tc_intnum) (puts (integer->string x)))
 	 (else (print x))))
      args)))
 

Modified: trunk/scm/util.scm
===================================================================
--- trunk/scm/util.scm	2005-03-09 11:18:29 UTC (rev 777)
+++ trunk/scm/util.scm	2005-03-09 11:45:53 UTC (rev 778)
@@ -245,6 +245,8 @@
 	(and (pair? x)
 	     (list? (cdr x))))))
 
+(define number->string integer->string)
+(define string->number string->integer)
 (define string->symbol intern)
 
 (define map

Modified: trunk/test/Makefile.am
===================================================================
--- trunk/test/Makefile.am	2005-03-09 11:18:29 UTC (rev 777)
+++ trunk/test/Makefile.am	2005-03-09 11:45:53 UTC (rev 778)
@@ -3,4 +3,4 @@
         test-i18n.scm test-im.scm test-intl.scm test-key.scm \
         test-lazy-load.scm test-plugin.scm test-slib.scm \
         test-uim-test-utils.scm test-uim-util.scm test-ustr.scm \
-        test-util.scm
+        test-util.scm test-db.scm


Property changes on: trunk/test/test-db.scm
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/uim/slib.c
===================================================================
--- trunk/uim/slib.c	2005-03-09 11:18:29 UTC (rev 777)
+++ trunk/uim/slib.c	2005-03-09 11:45:53 UTC (rev 778)
@@ -338,7 +338,6 @@
 static LISP dbg_pos = NIL;
 static LISP dbg_mod = NIL;
 
-static LISP orig_readtl (struct gen_readio * f);
 static int dbg_getc (struct gen_readio * f);
 static void dbg_ungetc (int c, struct gen_readio * f);
 static void dbg_readini (char *file);
@@ -1427,49 +1426,18 @@
   return (x->dbg_info = dbg_get_info (y));
 }
 
-static LISP
-integer2string (LISP args)
-{
-  char buf[sizeof (long)*CHAR_BIT];
-  char *p = buf + sizeof (buf);
-  unsigned long n, r;
-  LISP x, radix;
-  x = car (args);
-  radix = NNULLP (cdr (args)) ? CAR (CDR (args)) : intcons (10);
-  if NINTNUMP
-    (x)
-      my_err ("wta to integer2string", x);
-  if NINTNUMP
-    (radix)
-      my_err ("wta to integer2string", radix);
-  r = INTNM (radix);
-  if (r < 2 || 16 < r)
-    my_err ("invalid radix to integer2string", radix);
-  n = (r == 10) ? labs (INTNM (x)) : INTNM (x);
-  do
-    {
-      if (n % r > 9)
-	*--p = 'A' + n % r - 10;
-      else
-	*--p = '0' + n % r;
-    }
-  while (n /= r);
-  if (r == 10 && INTNM (x) < 0)
-    *--p = '-';
-  return strcons (sizeof(buf)-(p-buf), p);
-}
-
 static void
 init_dbg (void)
 {
   dbg_pos = NIL;
+  dbg_mod = NIL;
   gc_protect (&dbg_pos);
+  gc_protect (&dbg_mod);
   init_subr_1 ("dbg-get-info", dbg_get_info);
   init_subr_1 ("dbg-get-line", dbg_get_line);
   init_subr_1 ("dbg-get-file", dbg_get_file);
   init_subr_2 ("dbg-copy-info!", dbg_copy_info);
   init_subr_1 ("dbg-expand-file-name", dbg_expand_file_name);
-  init_lsubr ("number->string", integer2string);
   setvar (rintern ("dbg-closures"), NIL, NIL);
   provide (rintern ("debug"));
 }
@@ -4903,6 +4871,38 @@
   return intcons(num);
 }
 
+static LISP
+integer2string (LISP args)
+{
+  char buf[sizeof (long)*CHAR_BIT];
+  char *p = buf + sizeof (buf);
+  unsigned long n, r;
+  LISP x, radix;
+  x = car (args);
+  radix = NNULLP (cdr (args)) ? CAR (CDR (args)) : intcons (10);
+  if NINTNUMP
+    (x)
+      my_err ("wta to integer2string", x);
+  if NINTNUMP
+    (radix)
+      my_err ("wta to integer2string", radix);
+  r = INTNM (radix);
+  if (r < 2 || 16 < r)
+    my_err ("invalid radix to integer2string", radix);
+  n = (r == 10) ? labs (INTNM (x)) : INTNM (x);
+  do
+    {
+      if (n % r > 9)
+	*--p = 'A' + n % r - 10;
+      else
+	*--p = '0' + n % r;
+    }
+  while (n /= r);
+  if (r == 10 && INTNM (x) < 0)
+    *--p = '-';
+  return strcons (sizeof(buf)-(p-buf), p);
+}
+
 static void
 init_subrs (void)
 {
@@ -4948,6 +4948,7 @@
   init_subr_1 ("string-dimension", string_dim);
   init_lsubr ("string-append", string_append);
   init_subr_1 ("string->integer", string2integer);
+  init_lsubr ("integer->string", integer2string);
   init_subr_2 ("string=?", string_equal);
   init_subr_2 ("eval", leval);
   init_subr_2 ("apply", lapply);



More information about the Uim-commit mailing list