/[m4]/m4/gnulib/m4/strtol.c
ViewVC logotype

Diff of /m4/gnulib/m4/strtol.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gary, Fri Sep 12 15:29:57 2003 UTC revision 1.3 by gary, Tue Oct 7 14:10:11 2003 UTC
# Line 1  Line 1 
1  /* Convert string representation of a number into an integer value.  /* Convert string representation of a number into an integer value.
2     Copyright (C) 1991, 92, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.  
3       Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003
4       Free Software Foundation, Inc.
5    
6     NOTE: The canonical source of this file is maintained with the GNU C     NOTE: The canonical source of this file is maintained with the GNU C
7     Library.  Bugs can be reported to bug-glibc@gnu.org.     Library.  Bugs can be reported to bug-glibc@gnu.org.
8    
# Line 23  Line 26 
26    
27  #ifdef _LIBC  #ifdef _LIBC
28  # define USE_NUMBER_GROUPING  # define USE_NUMBER_GROUPING
 # define STDC_HEADERS  
 # define HAVE_LIMITS_H  
29  #endif  #endif
30    
31  #include <ctype.h>  #include <ctype.h>
# Line 36  extern int errno; Line 37  extern int errno;
37  # define __set_errno(Val) errno = (Val)  # define __set_errno(Val) errno = (Val)
38  #endif  #endif
39    
40  #ifdef HAVE_LIMITS_H  #include <limits.h>
41  # include <limits.h>  #include <stddef.h>
42  #endif  #include <stdlib.h>
43    #include <string.h>
 #ifdef STDC_HEADERS  
 # include <stddef.h>  
 # include <stdlib.h>  
 # include <string.h>  
 #else  
 # ifndef NULL  
 #  define NULL 0  
 # endif  
 #endif  
44    
45  #ifdef USE_NUMBER_GROUPING  #ifdef USE_NUMBER_GROUPING
46  # include "../locale/localeinfo.h"  # include "../locale/localeinfo.h"
# Line 164  extern int errno; Line 156  extern int errno;
156  # endif  # endif
157  #else  #else
158  # define LONG long  # define LONG long
   
 # ifndef ULONG_MAX  
 #  define ULONG_MAX ((unsigned long) ~(unsigned long) 0)  
 # endif  
 # ifndef LONG_MAX  
 #  define LONG_MAX ((long int) (ULONG_MAX >> 1))  
 # endif  
159  # define STRTOL_LONG_MIN LONG_MIN  # define STRTOL_LONG_MIN LONG_MIN
160  # define STRTOL_LONG_MAX LONG_MAX  # define STRTOL_LONG_MAX LONG_MAX
161  # define STRTOL_ULONG_MAX ULONG_MAX  # define STRTOL_ULONG_MAX ULONG_MAX
# Line 186  extern int errno; Line 171  extern int errno;
171  # define _NL_CURRENT(category, item) \  # define _NL_CURRENT(category, item) \
172    (current->values[_NL_ITEM_INDEX (item)].string)    (current->values[_NL_ITEM_INDEX (item)].string)
173  # define LOCALE_PARAM , loc  # define LOCALE_PARAM , loc
174  # define LOCALE_PARAM_DECL __locale_t loc;  # define LOCALE_PARAM_PROTO , __locale_t loc
175  #else  #else
176  # define LOCALE_PARAM  # define LOCALE_PARAM
177  # define LOCALE_PARAM_DECL  # define LOCALE_PARAM_PROTO
178  #endif  #endif
179    
180  #if defined _LIBC || defined HAVE_WCHAR_H  #if defined _LIBC || defined HAVE_WCHAR_H
# Line 230  extern int errno; Line 215  extern int errno;
215  # endif  # endif
216  #endif  #endif
217    
218  /* For compilers which are ansi but don't define __STDC__, like SGI  #define INTERNAL(X) INTERNAL1(X)
219     Irix-4.0.5 cc, also check whether PROTOTYPES is defined. */  #define INTERNAL1(X) __##X##_internal
220  #if defined (__STDC__) || defined (PROTOTYPES)  #define WEAKNAME(X) WEAKNAME1(X)
 # define INTERNAL(X) INTERNAL1(X)  
 # define INTERNAL1(X) __##X##_internal  
 # define WEAKNAME(X) WEAKNAME1(X)  
 #else  
 # define INTERNAL(X) __/**/X/**/_internal  
 #endif  
221    
222  #ifdef USE_NUMBER_GROUPING  #ifdef USE_NUMBER_GROUPING
223  /* This file defines a function to check for correct grouping.  */  /* This file defines a function to check for correct grouping.  */
# Line 255  extern int errno; Line 234  extern int errno;
234     one converted is stored in *ENDPTR.  */     one converted is stored in *ENDPTR.  */
235    
236  INT  INT
237  INTERNAL (strtol) (nptr, endptr, base, group LOCALE_PARAM)  INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
238       const STRING_TYPE *nptr;                     int base, int group LOCALE_PARAM_PROTO)
      STRING_TYPE **endptr;  
      int base;  
      int group;  
      LOCALE_PARAM_DECL  
239  {  {
240    int negative;    int negative;
241    register unsigned LONG int cutoff;    register unsigned LONG int cutoff;
# Line 445  noconv: Line 420  noconv:
420    
421  /* External user entry point.  */  /* External user entry point.  */
422    
 #if _LIBC - 0 == 0  
 # undef PARAMS  
 # if defined (__STDC__) && __STDC__  
 #  define PARAMS(Args) Args  
 # else  
 #  define PARAMS(Args) ()  
 # endif  
   
 /* Prototype.  */  
 INT strtol PARAMS ((const STRING_TYPE *nptr, STRING_TYPE **endptr, int base));  
 #endif  
   
423    
424  INT  INT
425  #ifdef weak_function  #ifdef weak_function
426  weak_function  weak_function
427  #endif  #endif
428  strtol (nptr, endptr, base LOCALE_PARAM)  strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr,
429       const STRING_TYPE *nptr;          int base LOCALE_PARAM_PROTO)
      STRING_TYPE **endptr;  
      int base;  
      LOCALE_PARAM_DECL  
430  {  {
431    return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);    return INTERNAL (strtol) (nptr, endptr, base, 0 LOCALE_PARAM);
432  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26