comparison src/lread.c @ 347:7c94d56991e1 r21-1-3

Import from CVS: tag r21-1-3
author cvs
date Mon, 13 Aug 2007 10:53:48 +0200
parents d1b52dcaa789
children 8e84bee8ddd0
comparison
equal deleted inserted replaced
346:dd0986ffd2cf 347:7c94d56991e1
1543 /* Use this for recursive reads, in contexts where internal tokens 1543 /* Use this for recursive reads, in contexts where internal tokens
1544 are not allowed. See also read1(). */ 1544 are not allowed. See also read1(). */
1545 static Lisp_Object 1545 static Lisp_Object
1546 read0 (Lisp_Object readcharfun) 1546 read0 (Lisp_Object readcharfun)
1547 { 1547 {
1548 Lisp_Object val; 1548 Lisp_Object val = read1 (readcharfun);
1549 1549
1550 val = read1 (readcharfun);
1551 if (CONSP (val) && UNBOUNDP (XCAR (val))) 1550 if (CONSP (val) && UNBOUNDP (XCAR (val)))
1552 { 1551 {
1553 Emchar c = XCHAR (XCDR (val)); 1552 Emchar c = XCHAR (XCDR (val));
1554 free_cons (XCONS (val)); 1553 free_cons (XCONS (val));
1555 return Fsignal (Qinvalid_read_syntax, 1554 return Fsignal (Qinvalid_read_syntax,
1685 } 1684 }
1686 return i; 1685 return i;
1687 } 1686 }
1688 1687
1689 case 'x': 1688 case 'x':
1690 /* A hex escape, as in ANSI C. */ 1689 /* A hex escape, as in ANSI C, except that we only allow latin-1
1690 characters to be read this way. What is "\x4e03" supposed to
1691 mean, anyways, if the internal representation is hidden?
1692 This is also consistent with the treatment of octal escapes. */
1691 { 1693 {
1692 REGISTER Emchar i = 0; 1694 REGISTER Emchar i = 0;
1693 while (1) 1695 REGISTER int count = 0;
1696 while (++count <= 2)
1694 { 1697 {
1695 c = readchar (readcharfun); 1698 c = readchar (readcharfun);
1696 /* Remember, can't use isdigit(), isalpha() etc. on Emchars */ 1699 /* Remember, can't use isdigit(), isalpha() etc. on Emchars */
1697 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); 1700 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0');
1698 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; 1701 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10;