aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2000-05-17 23:30:06 +0000
committerKenichi Handa2000-05-17 23:30:06 +0000
commita3b210c4ab25a0b725085e2a1c42f588ad72482e (patch)
tree10f4245afa99b0441eceacf4730956d06f0efbf8 /src
parent392f1ef546dfc7341999a2683ca63221f985de1c (diff)
downloademacs-a3b210c4ab25a0b725085e2a1c42f588ad72482e.tar.gz
emacs-a3b210c4ab25a0b725085e2a1c42f588ad72482e.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c55
1 files changed, 43 insertions, 12 deletions
diff --git a/src/fns.c b/src/fns.c
index 476f6e8c67c..9947edc7e11 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2341,15 +2341,24 @@ map_char_table (c_function, function, subtable, arg, depth, indices)
2341 } 2341 }
2342 else 2342 else
2343 { 2343 {
2344 int charset = XFASTINT (indices[0]) - 128;
2345
2344 i = 32; 2346 i = 32;
2345 to = SUB_CHAR_TABLE_ORDINARY_SLOTS; 2347 to = SUB_CHAR_TABLE_ORDINARY_SLOTS;
2348 if (CHARSET_CHARS (charset) == 94)
2349 i++, to--;
2346 } 2350 }
2347 2351
2348 for (; i < to; i++) 2352 for (; i < to; i++)
2349 { 2353 {
2350 Lisp_Object elt = XCHAR_TABLE (subtable)->contents[i]; 2354 Lisp_Object elt;
2355 int charset;
2351 2356
2357 elt = XCHAR_TABLE (subtable)->contents[i];
2352 XSETFASTINT (indices[depth], i); 2358 XSETFASTINT (indices[depth], i);
2359 charset = XFASTINT (indices[0]) - 128;
2360 if (!CHARSET_DEFINED_P (charset))
2361 continue;
2353 2362
2354 if (SUB_CHAR_TABLE_P (elt)) 2363 if (SUB_CHAR_TABLE_P (elt))
2355 { 2364 {
@@ -2359,18 +2368,17 @@ map_char_table (c_function, function, subtable, arg, depth, indices)
2359 } 2368 }
2360 else 2369 else
2361 { 2370 {
2362 int charset = XFASTINT (indices[0]) - 128, c1, c2, c; 2371 int c1, c2, c;
2363 2372
2364 if (CHARSET_DEFINED_P (charset)) 2373 if (NILP (elt))
2365 { 2374 elt = XCHAR_TABLE (subtable)->defalt;
2366 c1 = depth >= 1 ? XFASTINT (indices[1]) : 0; 2375 c1 = depth >= 1 ? XFASTINT (indices[1]) : 0;
2367 c2 = depth >= 2 ? XFASTINT (indices[2]) : 0; 2376 c2 = depth >= 2 ? XFASTINT (indices[2]) : 0;
2368 c = MAKE_NON_ASCII_CHAR (charset, c1, c2); 2377 c = MAKE_NON_ASCII_CHAR (charset, c1, c2);
2369 if (c_function) 2378 if (c_function)
2370 (*c_function) (arg, make_number (c), elt); 2379 (*c_function) (arg, make_number (c), elt);
2371 else 2380 else
2372 call2 (function, make_number (c), elt); 2381 call2 (function, make_number (c), elt);
2373 }
2374 } 2382 }
2375 } 2383 }
2376} 2384}
@@ -4722,7 +4730,29 @@ integers, including negative integers.")
4722 return Fput (name, Qhash_table_test, list2 (test, hash)); 4730 return Fput (name, Qhash_table_test, list2 (test, hash));
4723} 4731}
4724 4732
4733
4734#include <sys/times.h>
4735#include <limits.h>
4725 4736
4737DEFUN ("cpu-ticks", Fcpy_ticks, Scpu_ticks, 0, 0, 0,
4738 "Return time-accounting information.\n\
4739Value is a list (UTIME STIME CUTIME CSTIME), where\n\
4740UTIME is the CPU time used by the current process in the user space,\n\
4741STIME is the CPU time used by the current process in the system kernel space\n\
4742CUTIME is the CPU time used by the current and its children processs\n\
4743 in the user space,\n\
4744CSTIME is the CPU time used by the current and its children processs\n\
4745 in the system kernel space.")
4746 ()
4747{
4748 struct tms buf;
4749
4750 times (&buf);
4751 return list4 (make_number (buf.tms_utime),
4752 make_number (buf.tms_stime),
4753 make_number (buf.tms_cutime),
4754 make_number (buf.tms_cstime));
4755}
4726 4756
4727 4757
4728void 4758void
@@ -4867,6 +4897,7 @@ invoked by mouse clicks and mouse menu items.");
4867 defsubr (&Sbase64_decode_region); 4897 defsubr (&Sbase64_decode_region);
4868 defsubr (&Sbase64_encode_string); 4898 defsubr (&Sbase64_encode_string);
4869 defsubr (&Sbase64_decode_string); 4899 defsubr (&Sbase64_decode_string);
4900 defsubr (&Scpu_ticks);
4870} 4901}
4871 4902
4872 4903