aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog4
-rw-r--r--src/charset.c92
2 files changed, 67 insertions, 29 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5b1d13d05e7..0a72d657669 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12002-05-14 Kenichi Handa <handa@etl.go.jp>
2
3 * charset.c (Fmake_char): Make it more backward compatible.
4
12002-05-13 Dave Love <fx@gnu.org> 52002-05-13 Dave Love <fx@gnu.org>
2 6
3 * coding.c: Doc fixes. 7 * coding.c: Doc fixes.
diff --git a/src/charset.c b/src/charset.c
index 1e139fb3630..129d429432a 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1472,50 +1472,84 @@ code-point in CCS. Currently not supported and just ignored. */)
1472} 1472}
1473 1473
1474 1474
1475DEFUN ("make-char", Fmake_char, Smake_char, 1, 4, 0, 1475DEFUN ("make-char", Fmake_char, Smake_char, 1, 5, 0,
1476 doc: /* Return a character of CHARSET whose position code is CODE. 1476 doc:
1477 1477 /* Return a character of CHARSET whose position codes are CODEn.
1478If dimension of CHARSET is two, and the third optional arg CODE2 is 1478
1479non-nil, CODE actually specifies the first byte of the position code, 1479CODE1 through CODE4 are optional, but if you don't supply sufficient
1480and CODE2 specifies the second byte. 1480position codes, it is assumed that the minimum code in each dimension
1481 1481are specified. */)
1482If dimension of CHARSET is three, and the third optional arg CODE2 and 1482 (charset, code1, code2, code3, code4)
1483the fourth optional arg CODE3 are both non-nil, CODE actually 1483 Lisp_Object charset, code1, code2, code3, code4;
1484specifies the first byte of the position code, CODE2 the second byte,
1485and CODE3 the third byte. */)
1486 (charset, code, code2, code3)
1487 Lisp_Object charset, code, code2, code3;
1488{ 1484{
1489 int id, dimension; 1485 int id, dimension;
1490 struct charset *charsetp; 1486 struct charset *charsetp;
1491 unsigned c; 1487 unsigned code;
1488 int c;
1492 1489
1493 CHECK_CHARSET_GET_ID (charset, id); 1490 CHECK_CHARSET_GET_ID (charset, id);
1494 charsetp = CHARSET_FROM_ID (id); 1491 charsetp = CHARSET_FROM_ID (id);
1495 1492
1496 if (NILP (code)) 1493 if (NILP (code))
1497 code = make_number (CHARSET_MIN_CODE (charsetp)); 1494 return make_number (CHARSET_MIN_CHAR (charsetp));
1495
1496 dimension = CHARSET_DIMENSION (charsetp);
1497 if (NILP (code1))
1498 code = charsetp->code_space[(dimension - 1) * 4];
1498 else 1499 else
1499 { 1500 {
1500 CHECK_NATNUM (code); 1501 CHECK_NATNUM (code1);
1501 dimension = CHARSET_DIMENSION (charsetp); 1502 if (XFASTINT (code1) >= 0x100)
1502 1503 args_out_of_range (make_number (0xFF), code1);
1503 if (!NILP (code2)) 1504 code = XFASTINT (code1);
1505 }
1506 if (dimension > 1)
1507 {
1508 code <<= 8;
1509 if (NILP (code2))
1510 code |= charsetp->code_space[(dimension - 2) * 4];
1511 else
1504 { 1512 {
1505 CHECK_NATNUM (code2); 1513 CHECK_NATNUM (code2);
1506 if (dimension == 3) 1514 if (XFASTINT (code2) >= 0x100)
1507 CHECK_NATNUM (code3); 1515 args_out_of_range (make_number (0xFF), code2);
1516 code |= XFASTINT (code2);
1508 } 1517 }
1509 }
1510 1518
1511 if (dimension == 1 || NILP (code2)) 1519 if (dimension > 2)
1512 c = XFASTINT (code); 1520 {
1513 else if (dimension == 2) 1521 code <<= 8;
1514 c = (XFASTINT (code) << 8) | XFASTINT (code2); 1522 if (NILP (code3))
1515 else if (dimension == 3) 1523 code |= charsetp->code_space[(dimension - 3) * 4];
1516 c = (XFASTINT (code) << 16) | (XFASTINT (code2) << 8) | XFASTINT (code3); 1524 else
1525 {
1526 CHECK_NATNUM (code3);
1527 if (XFASTINT (code3) >= 0x100)
1528 args_out_of_range (make_number (0xFF), code3);
1529 code |= XFASTINT (code3);
1530 }
1531
1532 if (dimension > 3)
1533 {
1534 code <<= 8;
1535 if (NILP (code4))
1536 code |= charsetp->code_space[0];
1537 else
1538 {
1539 CHECK_NATNUM (code4);
1540 if (XFASTINT (code4) >= 0x100)
1541 args_out_of_range (make_number (0xFF), code4);
1542 code |= XFASTINT (code4);
1543 }
1544 }
1545 }
1546 }
1517 1547
1518 c = DECODE_CHAR (charsetp, c); 1548 if (CHARSET_ISO_FINAL (charsetp) >= 0)
1549 code &= 0x7F7F7F7F;
1550 c = DECODE_CHAR (charsetp, code);
1551 if (c < 0)
1552 error ("Invalid code(s)");
1519 return make_number (c); 1553 return make_number (c);
1520} 1554}
1521 1555