changeset 28962:3f62d70df67c

(map_char_table): Pay attention to character number of charset. Check the validity of charset at the first level. For leaf nodes that has nil value, call C_FUNCTION or FUNCTION with the default value.
author Kenichi Handa <handa@m17n.org>
date Wed, 17 May 2000 23:30:06 +0000
parents 8092e0d9d8b9
children 24af4ff8f7b6
files src/fns.c
diffstat 1 files changed, 46 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Wed May 17 19:32:32 2000 +0000
+++ b/src/fns.c	Wed May 17 23:30:06 2000 +0000
@@ -2341,15 +2341,24 @@
     }
   else
     {
+      int charset = XFASTINT (indices[0]) - 128;
+
       i = 32;
       to = SUB_CHAR_TABLE_ORDINARY_SLOTS;
+      if (CHARSET_CHARS (charset) == 94)
+	i++, to--;
     }
 
   for (; i < to; i++)
     {
-      Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i];
-
+      Lisp_Object elt;
+      int charset;
+
+      elt = XCHAR_TABLE (subtable)->contents[i];
       XSETFASTINT (indices[depth], i);
+      charset = XFASTINT (indices[0]) - 128;
+      if (!CHARSET_DEFINED_P (charset))
+	continue;
 
       if (SUB_CHAR_TABLE_P (elt))
 	{
@@ -2359,18 +2368,17 @@
 	}
       else
 	{
-	  int charset = XFASTINT (indices[0]) - 128, c1, c2, c;
-
-	  if (CHARSET_DEFINED_P (charset))
-	    {
-	      c1 = depth >= 1 ? XFASTINT (indices[1]) : 0;
-	      c2 = depth >= 2 ? XFASTINT (indices[2]) : 0;
-	      c = MAKE_NON_ASCII_CHAR (charset, c1, c2);
-	      if (c_function)
-		(*c_function) (arg, make_number (c), elt);
-	      else
-		call2 (function, make_number (c), elt);
-	    }
+	  int c1, c2, c;
+
+	  if (NILP (elt))
+	    elt = XCHAR_TABLE (subtable)->defalt;
+	  c1 = depth >= 1 ? XFASTINT (indices[1]) : 0;
+	  c2 = depth >= 2 ? XFASTINT (indices[2]) : 0;
+	  c = MAKE_NON_ASCII_CHAR (charset, c1, c2);
+	  if (c_function)
+	    (*c_function) (arg, make_number (c), elt);
+	  else
+	    call2 (function, make_number (c), elt);
   	}
     }
 }
@@ -4722,7 +4730,29 @@
   return Fput (name, Qhash_table_test, list2 (test, hash));
 }
 
-
+
+#include <sys/times.h>
+#include <limits.h>
+
+DEFUN ("cpu-ticks", Fcpy_ticks, Scpu_ticks, 0, 0, 0,
+       "Return time-accounting information.\n\
+Value is a list (UTIME STIME CUTIME CSTIME), where\n\
+UTIME is the CPU time used by the current process in the user space,\n\
+STIME is the CPU time used by the current process in the system kernel space\n\
+CUTIME is the CPU time used by the current and its children processs\n\
+  in the user space,\n\
+CSTIME is the CPU time used by the current and its children processs\n\
+  in the system kernel space.")
+     ()
+{
+  struct tms buf;
+
+  times (&buf);
+  return list4 (make_number (buf.tms_utime),
+		make_number (buf.tms_stime),
+		make_number (buf.tms_cutime),
+		make_number (buf.tms_cstime));
+}
 
 
 void
@@ -4867,6 +4897,7 @@
   defsubr (&Sbase64_decode_region);
   defsubr (&Sbase64_encode_string);
   defsubr (&Sbase64_decode_string);
+  defsubr (&Scpu_ticks);
 }