mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-06 23:50:18 +02:00
* read.c (scm_lreadr): When reading a hash token, check for a
user-defined hash procedure first, so that overriding the builtin hash characters is possible (this was needed for implementing SRFI-4's read synax `f32(...)'). * num2integral.i.c: Use scm_t_signed_bits instead of scm_t_bits, because the latter is unsigned now and breaks comparisons like (n < (scm_t_signed_bits)MIN_VALUE).
This commit is contained in:
parent
dbfadc8588
commit
b858464a0a
3 changed files with 59 additions and 27 deletions
|
@ -1,3 +1,14 @@
|
|||
2001-06-27 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
|
||||
|
||||
* read.c (scm_lreadr): When reading a hash token, check for a
|
||||
user-defined hash procedure first, so that overriding the builtin
|
||||
hash characters is possible (this was needed for implementing
|
||||
SRFI-4's read synax `f32(...)').
|
||||
|
||||
* num2integral.i.c: Use scm_t_signed_bits instead of scm_t_bits,
|
||||
because the latter is unsigned now and breaks comparisons like
|
||||
(n < (scm_t_signed_bits)MIN_VALUE).
|
||||
|
||||
2001-06-26 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* eval.h, eval.c (scm_call_4): New function.
|
||||
|
|
|
@ -6,22 +6,22 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
|
|||
if (SCM_INUMP (num))
|
||||
{ /* immediate */
|
||||
|
||||
scm_t_bits n = SCM_INUM (num);
|
||||
scm_t_signed_bits n = SCM_INUM (num);
|
||||
|
||||
#ifdef UNSIGNED
|
||||
if (n < 0)
|
||||
scm_out_of_range (s_caller, num);
|
||||
#endif
|
||||
|
||||
if (sizeof (ITYPE) >= sizeof (scm_t_bits))
|
||||
if (sizeof (ITYPE) >= sizeof (scm_t_signed_bits))
|
||||
/* can't fit anything too big for this type in an inum
|
||||
anyway */
|
||||
return (ITYPE) n;
|
||||
else
|
||||
{ /* an inum can be out of range, so check */
|
||||
if (n > (scm_t_bits)MAX_VALUE
|
||||
if (n > (scm_t_signed_bits)MAX_VALUE
|
||||
#ifndef UNSIGNED
|
||||
|| n < (scm_t_bits)MIN_VALUE
|
||||
|| n < (scm_t_signed_bits)MIN_VALUE
|
||||
#endif
|
||||
)
|
||||
scm_out_of_range (s_caller, num);
|
||||
|
@ -84,7 +84,7 @@ NUM2INTEGRAL (SCM num, unsigned long int pos, const char *s_caller)
|
|||
SCM
|
||||
INTEGRAL2NUM (ITYPE n)
|
||||
{
|
||||
if (sizeof (ITYPE) < sizeof (scm_t_bits)
|
||||
if (sizeof (ITYPE) < sizeof (scm_t_signed_bits)
|
||||
||
|
||||
#ifndef UNSIGNED
|
||||
SCM_FIXABLE (n)
|
||||
|
|
|
@ -339,6 +339,27 @@ tryagain_no_flush_ws:
|
|||
return p;
|
||||
case '#':
|
||||
c = scm_getc (port);
|
||||
|
||||
{
|
||||
/* Check for user-defined hash procedure first, to allow
|
||||
overriding of builtin hash read syntaxes. */
|
||||
SCM sharp = scm_get_hash_procedure (c);
|
||||
if (!SCM_FALSEP (sharp))
|
||||
{
|
||||
int line = SCM_LINUM (port);
|
||||
int column = SCM_COL (port) - 2;
|
||||
SCM got;
|
||||
|
||||
got = scm_call_2 (sharp, SCM_MAKE_CHAR (c), port);
|
||||
if (SCM_EQ_P (got, SCM_UNSPECIFIED))
|
||||
goto unkshrp;
|
||||
if (SCM_RECORD_POSITIONS_P)
|
||||
return *copy = recsexpr (got, line, column,
|
||||
SCM_FILENAME (port));
|
||||
else
|
||||
return got;
|
||||
}
|
||||
}
|
||||
switch (c)
|
||||
{
|
||||
case '(':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue