mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 23:00:22 +02:00
2006-03-21 Ludovic Courtès <ludovic.courtes@laas.fr>
* numbers.c (scm_i_mem2number): Renamed to scm_c_locale_stringn_to_number. * numbers.c, print.c, read.c: Updated callers.
This commit is contained in:
parent
d0a9429acc
commit
2d25ec1981
3 changed files with 10 additions and 8 deletions
|
@ -2937,7 +2937,8 @@ mem2complex (const char* mem, size_t len, unsigned int idx,
|
||||||
enum t_radix {NO_RADIX=0, DUAL=2, OCT=8, DEC=10, HEX=16};
|
enum t_radix {NO_RADIX=0, DUAL=2, OCT=8, DEC=10, HEX=16};
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_i_mem2number (const char* mem, size_t len, unsigned int default_radix)
|
scm_c_locale_stringn_to_number (const char* mem, size_t len,
|
||||||
|
unsigned int default_radix)
|
||||||
{
|
{
|
||||||
unsigned int idx = 0;
|
unsigned int idx = 0;
|
||||||
unsigned int radix = NO_RADIX;
|
unsigned int radix = NO_RADIX;
|
||||||
|
@ -3043,9 +3044,9 @@ SCM_DEFINE (scm_string_to_number, "string->number", 1, 1, 0,
|
||||||
else
|
else
|
||||||
base = scm_to_unsigned_integer (radix, 2, INT_MAX);
|
base = scm_to_unsigned_integer (radix, 2, INT_MAX);
|
||||||
|
|
||||||
answer = scm_i_mem2number (scm_i_string_chars (string),
|
answer = scm_c_locale_stringn_to_number (scm_i_string_chars (string),
|
||||||
scm_i_string_length (string),
|
scm_i_string_length (string),
|
||||||
base);
|
base);
|
||||||
scm_remember_upto_here_1 (string);
|
scm_remember_upto_here_1 (string);
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,7 @@ scm_print_symbol_name (const char *str, size_t len, SCM port)
|
||||||
if (len == 0 || str[0] == '\'' || str[0] == '`' || str[0] == ','
|
if (len == 0 || str[0] == '\'' || str[0] == '`' || str[0] == ','
|
||||||
|| quote_keywordish_symbol (str, len)
|
|| quote_keywordish_symbol (str, len)
|
||||||
|| (str[0] == '.' && len == 1)
|
|| (str[0] == '.' && len == 1)
|
||||||
|| scm_is_true (scm_i_mem2number(str, len, 10)))
|
|| scm_is_true (scm_c_locale_stringn_to_number (str, len, 10)))
|
||||||
{
|
{
|
||||||
scm_lfwrite ("#{", 2, port);
|
scm_lfwrite ("#{", 2, port);
|
||||||
weird = 1;
|
weird = 1;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1999,2000,2001,2003, 2004 Free Software
|
/* Copyright (C) 1995,1996,1997,1999,2000,2001,2003, 2004, 2006 Free Software
|
||||||
* Foundation, Inc.
|
* Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
|
@ -506,7 +506,8 @@ scm_lreadr (SCM *tok_buf, SCM port, SCM *copy)
|
||||||
* does only consist of octal digits. Finally, it should be
|
* does only consist of octal digits. Finally, it should be
|
||||||
* checked whether the resulting fixnum is in the range of
|
* checked whether the resulting fixnum is in the range of
|
||||||
* characters. */
|
* characters. */
|
||||||
p = scm_i_mem2number (scm_i_string_chars (*tok_buf), j, 8);
|
p = scm_c_locale_stringn_to_number (scm_i_string_chars (*tok_buf),
|
||||||
|
j, 8);
|
||||||
if (SCM_I_INUMP (p))
|
if (SCM_I_INUMP (p))
|
||||||
return SCM_MAKE_CHAR (SCM_I_INUM (p));
|
return SCM_MAKE_CHAR (SCM_I_INUM (p));
|
||||||
}
|
}
|
||||||
|
@ -644,7 +645,7 @@ scm_lreadr (SCM *tok_buf, SCM port, SCM *copy)
|
||||||
/* Shortcut: Detected symbol '+ or '- */
|
/* Shortcut: Detected symbol '+ or '- */
|
||||||
goto tok;
|
goto tok;
|
||||||
|
|
||||||
p = scm_i_mem2number (scm_i_string_chars (*tok_buf), j, 10);
|
p = scm_c_locale_stringn_to_number (scm_i_string_chars (*tok_buf), j, 10);
|
||||||
if (scm_is_true (p))
|
if (scm_is_true (p))
|
||||||
return p;
|
return p;
|
||||||
if (c == '#')
|
if (c == '#')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue