delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/12/01/04:51:36

Date: Sun, 01 Dec 2002 09:55:28 +0000
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: strtold is now a standard function (C99) [PATCH]
Message-Id: <E18IQl5-0000Vm-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

strtold is now a standard function. Below is a patch with instructions.
Basically the patch adds a stub strtold, which calls _strtold.

OK to commit?

Thanks, bye, Rich =]

Step 1: Rename src/libc/ansi/stdlib/strtold.c to _strtold.c.
Step 2: Apply the diff below.

Index: include/stdlib.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/stdlib.h,v
retrieving revision 1.14
diff -p -c -3 -r1.14 stdlib.h
*** include/stdlib.h	30 Nov 2002 09:50:29 -0000	1.14
--- include/stdlib.h	1 Dec 2002 09:48:35 -0000
*************** void *	realloc(void *_ptr, size_t _size)
*** 73,78 ****
--- 73,79 ----
  void	srand(unsigned _seed);
  double	strtod(const char *_s, char **_endptr);
  long	strtol(const char *_s, char **_endptr, int _base);
+ long double	strtold(const char *_s, char **_endptr);
  unsigned long	strtoul(const char *_s, char **_endptr, int _base);
  int	system(const char *_s);
  size_t	wcstombs(char *_s, const wchar_t *_wcs, size_t _n);
Index: src/libc/ansi/stdlib/makefile
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdlib/makefile,v
retrieving revision 1.6
diff -p -c -3 -r1.6 makefile
*** src/libc/ansi/stdlib/makefile	1 Dec 2002 09:45:26 -0000	1.6
--- src/libc/ansi/stdlib/makefile	1 Dec 2002 09:48:36 -0000
***************
*** 5,10 ****
--- 5,11 ----
  # Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
  TOP=../..
  
+ SRC += _strtold.c
  SRC += abort.c
  SRC += abs.c
  SRC += atexit.c
Index: src/libc/ansi/stdlib/strtold.txh
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/stdlib/strtold.txh,v
retrieving revision 1.2
diff -p -c -3 -r1.2 strtold.txh
*** src/libc/ansi/stdlib/strtold.txh	27 Sep 1998 15:20:54 -0000	1.2
--- src/libc/ansi/stdlib/strtold.txh	1 Dec 2002 09:48:38 -0000
***************
*** 1,10 ****
! @node _strtold, string
  @subheading Syntax
  
  @example
  #include <stdlib.h>
  
! long double _strtold(const char *s, char **endp);
  @end example
  
  @subheading Description
--- 1,10 ----
! @node strtold, string
  @subheading Syntax
  
  @example
  #include <stdlib.h>
  
! long double strtold(const char *s, char **endp);
  @end example
  
  @subheading Description
*************** The value the string represented. 
*** 19,31 ****
  
  @subheading Portability
  
! @portability !ansi, !posix
  
  @subheading Example
  
  @example
  char *buf = "123ret";
  char *bp;
! long double x = _strtold(buf, &bp);
  @end example
- 
--- 19,30 ----
  
  @subheading Portability
  
! @portability !ansi-c89, ansi-c99, !posix-1003.2-1992, posix-1003.1-2001
  
  @subheading Example
  
  @example
  char *buf = "123ret";
  char *bp;
! long double x = strtold(buf, &bp);
  @end example
Index: src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.123
diff -p -c -3 -r1.123 wc204.txi
*** src/docs/kb/wc204.txi	30 Nov 2002 09:49:47 -0000	1.123
--- src/docs/kb/wc204.txi	1 Dec 2002 09:48:48 -0000
*************** The function @code{_Exit} was added.
*** 788,790 ****
--- 788,793 ----
  
  @findex atoll
  The function @code{atoll} was added.
+ 
+ @findex strtold
+ The function @code{strtold} was added.
*** /dev/null	Sun Dec  1 09:52:52 2002
--- src/libc/ansi/stdlib/_strtold.txh	Sun Dec  1 09:35:30 2002
***************
*** 0 ****
--- 1,33 ----
+ @node _strtold, string
+ @subheading Syntax
+ 
+ @example
+ #include <stdlib.h>
+ 
+ long double _strtold(const char *s, char **endp);
+ @end example
+ 
+ @subheading Description
+ 
+ This function converts as many characters of @var{s} that look like a
+ floating point number into one, and sets @var{*endp} to point to the
+ first unused character. 
+ 
+ There is also a standardised version of this function:
+ @code{strtold} (@pxref{strtold}).
+ 
+ @subheading Return Value
+ 
+ The value the string represented. 
+ 
+ @subheading Portability
+ 
+ @portability !ansi, !posix
+ 
+ @subheading Example
+ 
+ @example
+ char *buf = "123ret";
+ char *bp;
+ long double x = _strtold(buf, &bp);
+ @end example
*** /dev/null	Sun Dec  1 09:52:57 2002
--- src/libc/ansi/stdlib/strtold.S	Sun Dec  1 09:26:24 2002
***************
*** 0 ****
--- 1,4 ----
+ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
+ 	.global	_strtold
+ _strtold:
+ 	jmp	__strtold

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019