|
0
|
1 //=========================================================================== |
|
|
2 // |
|
|
3 // atof.cxx |
|
|
4 // |
|
|
5 // Real alternative for inline implementation of the ANSI standard |
|
|
6 // atof() utility function defined in section 7.10.1.1 of the standard |
|
|
7 // |
|
|
8 //=========================================================================== |
|
|
9 //####COPYRIGHTBEGIN#### |
|
|
10 // |
|
|
11 // ------------------------------------------- |
|
|
12 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
13 // Version 1.0 (the "License"); you may not use this file except in |
|
|
14 // compliance with the License. You may obtain a copy of the License at |
|
|
15 // http://sourceware.cygnus.com/ecos |
|
|
16 // |
|
|
17 // Software distributed under the License is distributed on an "AS IS" |
|
|
18 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
19 // License for the specific language governing rights and limitations under |
|
|
20 // the License. |
|
|
21 // |
|
|
22 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
23 // September 30, 1998. |
|
|
24 // |
|
|
25 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
2
|
26 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
|
0
|
27 // ------------------------------------------- |
|
|
28 // |
|
|
29 //####COPYRIGHTEND#### |
|
|
30 //=========================================================================== |
|
|
31 //#####DESCRIPTIONBEGIN#### |
|
|
32 // |
|
|
33 // Author(s): jlarmour |
|
2
|
34 // Contributors: jlarmour |
|
0
|
35 // Date: 1998-02-13 |
|
|
36 // Purpose: |
|
|
37 // Description: |
|
|
38 // Usage: |
|
|
39 // |
|
|
40 //####DESCRIPTIONEND#### |
|
|
41 // |
|
|
42 //=========================================================================== |
|
|
43 |
|
|
44 // CONFIGURATION |
|
|
45 |
|
|
46 #include <pkgconf/libc.h> // Configuration header |
|
|
47 |
|
|
48 // Include the C library? And strtod() which we use? |
|
|
49 #if defined(CYGPKG_LIBC) && defined(CYGFUN_LIBC_strtod) |
|
|
50 |
|
|
51 // INCLUDES |
|
|
52 |
|
|
53 #include <cyg/infra/cyg_type.h> // Common type definitions and support |
|
|
54 #include <cyg/infra/cyg_trac.h> // Tracing support |
|
|
55 #include <cyg/infra/cyg_ass.h> // Assertion support |
|
|
56 |
|
|
57 // We don't want the inline versions of stdlib functions defined here |
|
|
58 |
|
|
59 #ifdef CYGIMP_LIBC_STDLIB_INLINES |
|
|
60 #undef CYGIMP_LIBC_STDLIB_INLINES |
|
|
61 #endif |
|
|
62 |
|
|
63 #include <stddef.h> // NULL, wchar_t and size_t from compiler |
|
|
64 #include <stdlib.h> // Main header for stdlib functions |
|
|
65 #include "clibincl/stdlibsupp.hxx" // Support for stdlib functions |
|
|
66 |
|
|
67 |
|
|
68 // EXPORTED SYMBOLS |
|
|
69 |
|
|
70 externC double |
|
|
71 atof( const char * ) CYGPRI_LIBC_WEAK_ALIAS("_atof"); |
|
|
72 |
|
|
73 |
|
|
74 // FUNCTIONS |
|
|
75 |
|
|
76 double |
|
|
77 _atof( const char *nptr ) |
|
|
78 { |
|
|
79 double retval; |
|
|
80 |
|
|
81 CYG_REPORT_FUNCNAMETYPE( "_atof", "returning %f" ); |
|
|
82 |
|
|
83 CYG_CHECK_DATA_PTR( nptr, "nptr is an invalid pointer!" ); |
|
|
84 |
|
|
85 retval = _strtod( nptr, (char **)NULL ); |
|
|
86 |
|
|
87 CYG_REPORT_RETVAL( retval ); |
|
|
88 |
|
|
89 return retval; |
|
|
90 } // _atof() |
|
|
91 |
|
|
92 |
|
|
93 #endif // if defined(CYGPKG_LIBC) && defined(CYGFUN_LIBC_strtod) |
|
|
94 |
|
|
95 // EOF atof.cxx |