unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Exposing `scm_i_mem2number ()'
@ 2006-02-15 15:57 Ludovic Courtès
  2006-02-15 21:57 ` Marius Vollmer
  2006-02-15 22:11 ` Kevin Ryde
  0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2006-02-15 15:57 UTC (permalink / raw)


Hi,

I think it'd be nice to export `scm_i_mem2number ()'.  My initial plan
was to just rename it `scm_c_string_to_number ()' and document it.

However, due to the eventual support for various encodings, we'd rather
need to have something like `scm_c_locale_string_to_number ()'.  The
problem is: how do we handle the LEN argument for arbitrary encodings?
Should it be documented as the number of chars (not octets) that compose
the string?

Suggestions?

Thanks,
Ludovic.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-02-15 15:57 Exposing `scm_i_mem2number ()' Ludovic Courtès
@ 2006-02-15 21:57 ` Marius Vollmer
  2006-02-16 12:17   ` Tomas Zerolo
  2006-02-16 13:35   ` Ludovic Courtès
  2006-02-15 22:11 ` Kevin Ryde
  1 sibling, 2 replies; 10+ messages in thread
From: Marius Vollmer @ 2006-02-15 21:57 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> I think it'd be nice to export `scm_i_mem2number ()'.  My initial plan
> was to just rename it `scm_c_string_to_number ()' and document it.
>
> However, due to the eventual support for various encodings, we'd rather
> need to have something like `scm_c_locale_string_to_number ()'.  The
> problem is: how do we handle the LEN argument for arbitrary encodings?
> Should it be documented as the number of chars (not octets) that compose
> the string?

I'd make it the number of octets, to remain in sync with
scm_from_locale_stringn, etc.

> Suggestions?

But, what about scm_string_to_number (scm_from_locale_string (...))?
Isn't that good enough?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-02-15 15:57 Exposing `scm_i_mem2number ()' Ludovic Courtès
  2006-02-15 21:57 ` Marius Vollmer
@ 2006-02-15 22:11 ` Kevin Ryde
  1 sibling, 0 replies; 10+ messages in thread
From: Kevin Ryde @ 2006-02-15 22:11 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> However, due to the eventual support for various encodings, we'd rather
> need to have something like `scm_c_locale_string_to_number ()'.

That could be more relaxed than specifically the "locale" encoding.
If all valid numbers are ascii then it doesn't matter what the
extended characters are, they're all invalid.  (For ascii-compatible
encodings, of course.)  Maybe scm_c_ascii_string_to_number.

> Should it be documented as the number of chars (not octets) that compose
> the string?

I think bytes is usual.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-02-15 21:57 ` Marius Vollmer
@ 2006-02-16 12:17   ` Tomas Zerolo
  2006-02-16 13:35   ` Ludovic Courtès
  1 sibling, 0 replies; 10+ messages in thread
From: Tomas Zerolo @ 2006-02-16 12:17 UTC (permalink / raw)
  Cc: guile-devel


[-- Attachment #1.1: Type: text/plain, Size: 348 bytes --]

On Wed, Feb 15, 2006 at 11:57:12PM +0200, Marius Vollmer wrote:
[...]
> But, what about scm_string_to_number (scm_from_locale_string (...))?
> Isn't that good enough?

Alas, attractive as it is it won't work: number representations vary
across locale settings (basically, it's decimal point and thousands
separator :-(

Regards
-- tomás

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-02-15 21:57 ` Marius Vollmer
  2006-02-16 12:17   ` Tomas Zerolo
@ 2006-02-16 13:35   ` Ludovic Courtès
  2006-03-08  9:33     ` Ludovic Courtès
  1 sibling, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2006-02-16 13:35 UTC (permalink / raw)
  Cc: guile-devel

Hello,

Marius Vollmer <mvo@zagadka.de> writes:

> I'd make it the number of octets, to remain in sync with
> scm_from_locale_stringn, etc.

Right.  Below is a patch that does this.

> But, what about scm_string_to_number (scm_from_locale_string (...))?
> Isn't that good enough?

Using the C variant, you can save the creation and bookkeeping of two
Scheme objects[*].  Since we do have the C variant anyway, I think it's
better to expose it if doing so does not preclude future changes in the
implementation.

Thanks,
Ludovic.

[*] On that topic, see also:
    http://lists.gnu.org/archive/html/guile-devel/2005-12/msg00093.html .


libguile/

2006-02-16  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* numbers.c (scm_i_mem2number): Renamed to
	`scm_c_locale_string_to_number ()'.
	Updated callers.
    
	* numbers.h: Updated function declaration.

	* print.c: Updated callers.

	* read.c: Likewise.


doc/ref/

2006-02-16  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* api-data.texi (Conversion): Documented
	`scm_c_locale_string_to_number ()'.


--- orig/doc/ref/api-data.texi
+++ mod/doc/ref/api-data.texi
@@ -1031,6 +1031,12 @@
 @code{string->number} returns @code{#f}.
 @end deffn
 
+@deffn {C Function} scm_c_locale_string_to_number (string, len, radix)
+Like @code{scm_string_to_number ()}, return a number (a Scheme object)
+whose representation is expressed by the given C string @var{string}
+of size @var{len} octets (@var{string} does not need to be
+null-terminated).  @var{radix} must be of type @code{unsigned int}.
+@end deffn
 
 @node Complex
 @subsubsection Complex Number Operations


--- orig/libguile/numbers.c
+++ mod/libguile/numbers.c
@@ -2937,7 +2937,8 @@
 enum t_radix {NO_RADIX=0, DUAL=2, OCT=8, DEC=10, HEX=16};
 
 SCM
-scm_i_mem2number (const char* mem, size_t len, unsigned int default_radix)
+scm_c_locale_string_to_number (const char* mem, size_t len,
+			       unsigned int default_radix)
 {
   unsigned int idx = 0;
   unsigned int radix = NO_RADIX;
@@ -3043,9 +3044,9 @@
   else
     base = scm_to_unsigned_integer (radix, 2, INT_MAX);
 
-  answer = scm_i_mem2number (scm_i_string_chars (string),
-			     scm_i_string_length (string),
-			     base);
+  answer = scm_c_locale_string_to_number (scm_i_string_chars (string),
+					  scm_i_string_length (string),
+					  base);
   scm_remember_upto_here_1 (string);
   return answer;
 }


--- orig/libguile/numbers.h
+++ mod/libguile/numbers.h
@@ -215,7 +215,8 @@
 SCM_API int scm_print_real (SCM sexp, SCM port, scm_print_state *pstate);
 SCM_API int scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate);
 SCM_API int scm_bigprint (SCM exp, SCM port, scm_print_state *pstate);
-SCM_API SCM scm_i_mem2number (const char *mem, size_t len, unsigned int radix);
+SCM_API SCM scm_c_locale_string_to_number (const char *mem, size_t len,
+					   unsigned int radix);
 SCM_API SCM scm_string_to_number (SCM str, SCM radix);
 SCM_API SCM scm_bigequal (SCM x, SCM y);
 SCM_API SCM scm_real_equalp (SCM x, SCM y);


--- orig/libguile/print.c
+++ mod/libguile/print.c
@@ -327,7 +327,7 @@
   if (len == 0 || str[0] == '\'' || str[0] == '`' || str[0] == ','
       || quote_keywordish_symbol (str, len)
       || (str[0] == '.' && len == 1)
-      || scm_is_true (scm_i_mem2number(str, len, 10)))
+      || scm_is_true (scm_c_locale_string_to_number (str, len, 10)))
     {
       scm_lfwrite ("#{", 2, port);
       weird = 1;


--- orig/libguile/read.c
+++ mod/libguile/read.c
@@ -506,7 +506,8 @@
 	       * does only consist of octal digits.  Finally, it should be
 	       * checked whether the resulting fixnum is in the range of
 	       * characters.  */
-	      p = scm_i_mem2number (scm_i_string_chars (*tok_buf), j, 8);
+	      p = scm_c_locale_string_to_number (scm_i_string_chars (*tok_buf),
+						 j, 8);
 	      if (SCM_I_INUMP (p))
 		return SCM_MAKE_CHAR (SCM_I_INUM (p));
 	    }
@@ -644,7 +645,7 @@
 	/* Shortcut:  Detected symbol '+ or '- */
 	goto tok;
 
-      p = scm_i_mem2number (scm_i_string_chars (*tok_buf), j, 10);
+      p = scm_c_locale_string_to_number (scm_i_string_chars (*tok_buf), j, 10);
       if (scm_is_true (p))
 	return p;
       if (c == '#')





_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-02-16 13:35   ` Ludovic Courtès
@ 2006-03-08  9:33     ` Ludovic Courtès
  2006-03-16 10:07       ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2006-03-08  9:33 UTC (permalink / raw)
  Cc: guile-devel

Hi,

ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> libguile/
>
> 2006-02-16  Ludovic Courtès  <ludovic.courtes@laas.fr>
>
> 	* numbers.c (scm_i_mem2number): Renamed to
> 	`scm_c_locale_string_to_number ()'.
> 	Updated callers.
>     
> 	* numbers.h: Updated function declaration.
>
> 	* print.c: Updated callers.
>
> 	* read.c: Likewise.
>
>
> doc/ref/
>
> 2006-02-16  Ludovic Courtès  <ludovic.courtes@laas.fr>
>
> 	* api-data.texi (Conversion): Documented
> 	`scm_c_locale_string_to_number ()'.

Below is an updated version of this patch.  It basically augments the
documentation of `scm_c_locale_string_to_number ()' to make it clear
that the word `locale' is about encoding, _not_ number representation.

While writing it, it occurred to me that R5RS does not make it clear
whether `string->number' converts from a number's external
representation or not.  I.e., it is not clear whether the two following
forms are equivalent:

  1.  (string->number str)

  2.  (with-input-from-string str read)

I believe most implementations and users assume that they are but I
couldn't find any evidence about it.  Opinions?

Thanks,
Ludovic.


--- orig/doc/ref/api-data.texi
+++ mod/doc/ref/api-data.texi
@@ -1031,6 +1031,18 @@
 @code{string->number} returns @code{#f}.
 @end deffn
 
+@deffn {C Function} scm_c_locale_string_to_number (string, len, radix)
+Like @code{scm_string_to_number ()}, return a number (a Scheme object)
+whose representation is expressed by the given C string @var{string}
+of size @var{len} octets (@var{string} does not need to be
+null-terminated).  @var{radix} must be of type @code{unsigned int}.
+
+Note that the word @code{locale} in the function name only means that
+@var{string} is encoded using the current locale encoding.  The number
+representation itself, as a string, is locale-independent: it is the
+@emph{external representation} of a number, as defined by R5RS
+@inforef{External representation, , r5rs}.
+@end deffn
 
 @node Complex
 @subsubsection Complex Number Operations


--- orig/libguile/numbers.c
+++ mod/libguile/numbers.c
@@ -2937,7 +2937,8 @@
 enum t_radix {NO_RADIX=0, DUAL=2, OCT=8, DEC=10, HEX=16};
 
 SCM
-scm_i_mem2number (const char* mem, size_t len, unsigned int default_radix)
+scm_c_locale_string_to_number (const char* mem, size_t len,
+			       unsigned int default_radix)
 {
   unsigned int idx = 0;
   unsigned int radix = NO_RADIX;
@@ -3043,9 +3044,9 @@
   else
     base = scm_to_unsigned_integer (radix, 2, INT_MAX);
 
-  answer = scm_i_mem2number (scm_i_string_chars (string),
-			     scm_i_string_length (string),
-			     base);
+  answer = scm_c_locale_string_to_number (scm_i_string_chars (string),
+					  scm_i_string_length (string),
+					  base);
   scm_remember_upto_here_1 (string);
   return answer;
 }


--- orig/libguile/numbers.h
+++ mod/libguile/numbers.h
@@ -215,7 +215,8 @@
 SCM_API int scm_print_real (SCM sexp, SCM port, scm_print_state *pstate);
 SCM_API int scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate);
 SCM_API int scm_bigprint (SCM exp, SCM port, scm_print_state *pstate);
-SCM_API SCM scm_i_mem2number (const char *mem, size_t len, unsigned int radix);
+SCM_API SCM scm_c_locale_string_to_number (const char *mem, size_t len,
+					   unsigned int radix);
 SCM_API SCM scm_string_to_number (SCM str, SCM radix);
 SCM_API SCM scm_bigequal (SCM x, SCM y);
 SCM_API SCM scm_real_equalp (SCM x, SCM y);


--- orig/libguile/print.c
+++ mod/libguile/print.c
@@ -153,8 +153,8 @@
 
 #ifdef GUILE_DEBUG /* Used for debugging purposes */
 
-SCM_DEFINE (scm_current_pstate, "current-pstate", 0, 0, 0, 
-           (),
+SCM_DEFINE (scm_current_pstate, "current-pstate", 0, 0, 0,
+	    (void),
 	    "Return the current-pstate -- the car of the\n"
 	    "@code{print_state_pool}.  @code{current-pstate} is only\n"
 	    "included in @code{--enable-guile-debug} builds.")
@@ -327,7 +327,7 @@
   if (len == 0 || str[0] == '\'' || str[0] == '`' || str[0] == ','
       || quote_keywordish_symbol (str, len)
       || (str[0] == '.' && len == 1)
-      || scm_is_true (scm_i_mem2number(str, len, 10)))
+      || scm_is_true (scm_c_locale_string_to_number (str, len, 10)))
     {
       scm_lfwrite ("#{", 2, port);
       weird = 1;


--- orig/libguile/read.c
+++ mod/libguile/read.c
@@ -506,7 +506,8 @@
 	       * does only consist of octal digits.  Finally, it should be
 	       * checked whether the resulting fixnum is in the range of
 	       * characters.  */
-	      p = scm_i_mem2number (scm_i_string_chars (*tok_buf), j, 8);
+	      p = scm_c_locale_string_to_number (scm_i_string_chars (*tok_buf),
+						 j, 8);
 	      if (SCM_I_INUMP (p))
 		return SCM_MAKE_CHAR (SCM_I_INUM (p));
 	    }
@@ -644,7 +645,7 @@
 	/* Shortcut:  Detected symbol '+ or '- */
 	goto tok;
 
-      p = scm_i_mem2number (scm_i_string_chars (*tok_buf), j, 10);
+      p = scm_c_locale_string_to_number (scm_i_string_chars (*tok_buf), j, 10);
       if (scm_is_true (p))
 	return p;
       if (c == '#')



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-03-08  9:33     ` Ludovic Courtès
@ 2006-03-16 10:07       ` Ludovic Courtès
  2006-03-17  0:58         ` Kevin Ryde
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2006-03-16 10:07 UTC (permalink / raw)
  Cc: guile-devel

Hi,

About `scm_c_locale_string_to_number ()'...

ludovic.courtes@laas.fr (Ludovic Courtès) writes:

> While writing it, it occurred to me that R5RS does not make it clear
> whether `string->number' converts from a number's external
> representation or not.

As discussed in [0], while R5RS does not explicitly state that
`string->number' converts from a number's external representation, it
makes a connection with `number->string' which in turn explicitly
converts to a number's external representation:

  - procedure: number->string z
  - procedure: number->string z radix
      RADIX must be an exact integer, either 2, 8, 10, or 16.  If
      omitted, RADIX defaults to 10.  The procedure `number->string'
      takes a number and a radix and returns as a string an external
      representation of the given number in the given radix such that

      (let ((number NUMBER)
            (radix RADIX))
        (eqv? number
              (string->number (number->string number
                                              radix)
                              radix)))

      is true.  It is an error if no possible result makes this
      expression true.

So the additional bit of documentation I suggested in my previous post
(stating that `locale' in `scm_c_locale_string_to_number ()' has nothing
to do with the number representation) is acceptable.

Can someone comment on it or commit it?

Thanks,
Ludovic.

[0] http://groups.google.com/group/comp.lang.scheme/tree/browse_frm/thread/dc6a98bbc7cda398/7490c0724e5eb305?rnum=1&hl=eo&q=string-%3Enumber+group%3Acomp.lang.scheme&_done=%2Fgroup%2Fcomp.lang.scheme%2Fbrowse_frm%2Fthread%2Fdc6a98bbc7cda398%2F5de6eb2de0105bdb%3Flnk%3Dst%26q%3Dstring-%3Enumber+group%3Acomp.lang.scheme%26rnum%3D1%26hl%3Deo%26#doc_13b48a9567f63165


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-03-16 10:07       ` Ludovic Courtès
@ 2006-03-17  0:58         ` Kevin Ryde
  2006-03-17  9:01           ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Ryde @ 2006-03-17  0:58 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> Can someone comment on it or commit it?

Sound's reasonable, though I still don't know what "locale" is doing
in the name if it's only ascii which will work.

Should the name be scm_c_locale_stringn_to_number ?
                                      ^---- n for length not
                                      null-terminated


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-03-17  0:58         ` Kevin Ryde
@ 2006-03-17  9:01           ` Ludovic Courtès
  2006-03-21  0:53             ` Kevin Ryde
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2006-03-17  9:01 UTC (permalink / raw)


Hi Kevin,

Kevin Ryde <user42@zip.com.au> writes:

> Sound's reasonable, though I still don't know what "locale" is doing
> in the name if it's only ascii which will work.

The documentation (below) should make it clear.  ;-)

> Should the name be scm_c_locale_stringn_to_number ?
>                                       ^---- n for length not
>                                       null-terminated

Good point!  Below is an updated patch.

Thanks!

Ludovic.


libguile/

2006-03-17  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* numbers.c (scm_i_mem2number): Renamed to
	`scm_c_locale_stringn_to_number ()'.
	Updated callers.
    
	* numbers.h: Updated function declaration.

	* print.c: Updated callers.

	* read.c: Likewise.


doc/ref/

2006-03-17  Ludovic Courtès  <ludovic.courtes@laas.fr>

	* api-data.texi (Conversion): Documented
	`scm_c_locale_stringn_to_number ()'.



--- orig/doc/ref/api-data.texi
+++ mod/doc/ref/api-data.texi
@@ -1031,6 +1031,19 @@
 @code{string->number} returns @code{#f}.
 @end deffn
 
+@deffn {C Function} scm_c_locale_stringn_to_number (string, len, radix)
+Like @code{scm_string_to_number ()}, return a number (a Scheme object)
+whose representation is expressed by the given C string @var{string}
+of size @var{len} octets (@var{string} does not need to be
+null-terminated).  @var{radix} must be of type @code{unsigned int}.
+
+Note that the word @code{locale} in the function name only means that
+@var{string} is encoded using the current locale encoding.  The number
+representation itself, as a string, is locale-independent: it is the
+@emph{external representation} of a number, as defined by R5RS
+@xref{External representation, , External Representation, r5rs,
+Revised^5 Report on the Algorithmic Language Scheme}.
+@end deffn
 
 @node Complex
 @subsubsection Complex Number Operations


--- orig/libguile/numbers.c
+++ mod/libguile/numbers.c
@@ -2937,7 +2937,8 @@
 enum t_radix {NO_RADIX=0, DUAL=2, OCT=8, DEC=10, HEX=16};
 
 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 radix = NO_RADIX;
@@ -3043,9 +3044,9 @@
   else
     base = scm_to_unsigned_integer (radix, 2, INT_MAX);
 
-  answer = scm_i_mem2number (scm_i_string_chars (string),
-			     scm_i_string_length (string),
-			     base);
+  answer = scm_c_locale_stringn_to_number (scm_i_string_chars (string),
+					   scm_i_string_length (string),
+					   base);
   scm_remember_upto_here_1 (string);
   return answer;
 }


--- orig/libguile/numbers.h
+++ mod/libguile/numbers.h
@@ -215,7 +215,8 @@
 SCM_API int scm_print_real (SCM sexp, SCM port, scm_print_state *pstate);
 SCM_API int scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate);
 SCM_API int scm_bigprint (SCM exp, SCM port, scm_print_state *pstate);
-SCM_API SCM scm_i_mem2number (const char *mem, size_t len, unsigned int radix);
+SCM_API SCM scm_c_locale_stringn_to_number (const char *mem, size_t len,
+					    unsigned int radix);
 SCM_API SCM scm_string_to_number (SCM str, SCM radix);
 SCM_API SCM scm_bigequal (SCM x, SCM y);
 SCM_API SCM scm_real_equalp (SCM x, SCM y);


--- orig/libguile/print.c
+++ mod/libguile/print.c
@@ -327,7 +327,7 @@
   if (len == 0 || str[0] == '\'' || str[0] == '`' || str[0] == ','
       || quote_keywordish_symbol (str, len)
       || (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);
       weird = 1;


--- orig/libguile/read.c
+++ mod/libguile/read.c
@@ -506,7 +506,8 @@
 	       * does only consist of octal digits.  Finally, it should be
 	       * checked whether the resulting fixnum is in the range of
 	       * 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))
 		return SCM_MAKE_CHAR (SCM_I_INUM (p));
 	    }
@@ -644,7 +645,7 @@
 	/* Shortcut:  Detected symbol '+ or '- */
 	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))
 	return p;
       if (c == '#')




_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Exposing `scm_i_mem2number ()'
  2006-03-17  9:01           ` Ludovic Courtès
@ 2006-03-21  0:53             ` Kevin Ryde
  0 siblings, 0 replies; 10+ messages in thread
From: Kevin Ryde @ 2006-03-21  0:53 UTC (permalink / raw)


ludovic.courtes@laas.fr (Ludovic Courtès) writes:
>
> Below is an updated patch.

Looks good, I checked it into the 1.8 branch.  (A merge onto the head
is coming soon ... of course so is Christmas ... :-)


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-03-21  0:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-15 15:57 Exposing `scm_i_mem2number ()' Ludovic Courtès
2006-02-15 21:57 ` Marius Vollmer
2006-02-16 12:17   ` Tomas Zerolo
2006-02-16 13:35   ` Ludovic Courtès
2006-03-08  9:33     ` Ludovic Courtès
2006-03-16 10:07       ` Ludovic Courtès
2006-03-17  0:58         ` Kevin Ryde
2006-03-17  9:01           ` Ludovic Courtès
2006-03-21  0:53             ` Kevin Ryde
2006-02-15 22:11 ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).