comparison src/fns.c @ 17826:961399e23170

(copy_sub_char_table): Declare the argument ARG as Lisp_Object. (Fset_char_table_default): New function.
author Kenichi Handa <handa@m17n.org>
date Fri, 16 May 1997 00:43:05 +0000
parents 6fd66459ec9a
children 7e6a77408020
comparison
equal deleted inserted replaced
17825:281d99590839 17826:961399e23170
295 295
296 /* Retrun a copy of a sub char table ARG. The elements except for a 296 /* Retrun a copy of a sub char table ARG. The elements except for a
297 nested sub char table are not copied. */ 297 nested sub char table are not copied. */
298 static Lisp_Object 298 static Lisp_Object
299 copy_sub_char_table (arg) 299 copy_sub_char_table (arg)
300 Lisp_Object arg;
300 { 301 {
301 Lisp_Object copy = make_sub_char_table (XCHAR_TABLE (arg)->defalt); 302 Lisp_Object copy = make_sub_char_table (XCHAR_TABLE (arg)->defalt);
302 int i; 303 int i;
303 304
304 /* Copy all the contents. */ 305 /* Copy all the contents. */
1364 else 1365 else
1365 error ("Invalid RANGE argument to `set-char-table-range'"); 1366 error ("Invalid RANGE argument to `set-char-table-range'");
1366 1367
1367 return value; 1368 return value;
1368 } 1369 }
1370
1371 DEFUN ("set-char-table-default", Fset_char_table_default,
1372 Sset_char_table_default, 3, 3, 0,
1373 "Set the default value in CHAR-TABLE for a generic character CHAR to VALUE.\n\
1374 The generic character specifies the group of characters.\n\
1375 See also the documentation of make-char.")
1376 (char_table, ch, value)
1377 Lisp_Object char_table, ch, value;
1378 {
1379 int c, i, charset, code1, code2;
1380 Lisp_Object temp;
1381
1382 CHECK_CHAR_TABLE (char_table, 0);
1383 CHECK_NUMBER (ch, 1);
1384
1385 c = XINT (ch);
1386 SPLIT_NON_ASCII_CHAR (c, charset, code1, code2);
1387 if (! CHARSET_DEFINED_P (charset))
1388 error ("Invalid character: %d", c);
1389
1390 if (charset == CHARSET_ASCII)
1391 return (XCHAR_TABLE (char_table)->defalt = value);
1392
1393 /* Even if C is not a generic char, we had better behave as if a
1394 generic char is specified. */
1395 if (CHARSET_DIMENSION (charset) == 1)
1396 code1 = 0;
1397 temp = XCHAR_TABLE (char_table)->contents[charset + 128];
1398 if (!code1)
1399 {
1400 if (SUB_CHAR_TABLE_P (temp))
1401 XCHAR_TABLE (temp)->defalt = value;
1402 else
1403 XCHAR_TABLE (char_table)->contents[charset + 128] = value;
1404 return value;
1405 }
1406 char_table = temp;
1407 if (! SUB_CHAR_TABLE_P (char_table))
1408 char_table = (XCHAR_TABLE (char_table)->contents[charset + 128]
1409 = make_sub_char_table (temp));
1410 temp = XCHAR_TABLE (char_table)->contents[code1];
1411 if (SUB_CHAR_TABLE_P (temp))
1412 XCHAR_TABLE (temp)->defalt = value;
1413 else
1414 XCHAR_TABLE (char_table)->contents[code1] = value;
1415 return value;
1416 }
1417
1369 1418
1370 /* Map C_FUNCTION or FUNCTION over SUBTABLE, calling it for each 1419 /* Map C_FUNCTION or FUNCTION over SUBTABLE, calling it for each
1371 character or group of characters that share a value. 1420 character or group of characters that share a value.
1372 DEPTH is the current depth in the originally specified 1421 DEPTH is the current depth in the originally specified
1373 chartable, and INDICES contains the vector indices 1422 chartable, and INDICES contains the vector indices
1953 defsubr (&Sset_char_table_parent); 2002 defsubr (&Sset_char_table_parent);
1954 defsubr (&Schar_table_extra_slot); 2003 defsubr (&Schar_table_extra_slot);
1955 defsubr (&Sset_char_table_extra_slot); 2004 defsubr (&Sset_char_table_extra_slot);
1956 defsubr (&Schar_table_range); 2005 defsubr (&Schar_table_range);
1957 defsubr (&Sset_char_table_range); 2006 defsubr (&Sset_char_table_range);
2007 defsubr (&Sset_char_table_default);
1958 defsubr (&Smap_char_table); 2008 defsubr (&Smap_char_table);
1959 defsubr (&Snconc); 2009 defsubr (&Snconc);
1960 defsubr (&Smapcar); 2010 defsubr (&Smapcar);
1961 defsubr (&Smapconcat); 2011 defsubr (&Smapconcat);
1962 defsubr (&Sy_or_n_p); 2012 defsubr (&Sy_or_n_p);