OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [language/] [c/] [libc/] [stdlib/] [v2_0/] [include/] [atox.inl] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_LIBC_STDLIB_ATOX_INL
2
#define CYGONCE_LIBC_STDLIB_ATOX_INL
3
/*===========================================================================
4
//
5
//      atox.inl
6
//
7
//      Inline implementations for the ISO standard utility functions
8
//      atoi(), atol() and atof() defined in section 7.10 of the standard
9
//
10
//===========================================================================
11
//####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License along
26
// with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
//
29
// As a special exception, if other files instantiate templates or use macros
30
// or inline functions from this file, or you compile this file and link it
31
// with other works to produce a work based on this file, this file does not
32
// by itself cause the resulting work to be covered by the GNU General Public
33
// License. However the source code for this file must still be made available
34
// in accordance with section (3) of the GNU General Public License.
35
//
36
// This exception does not invalidate any other reasons why a work based on
37
// this file might be covered by the GNU General Public License.
38
//
39
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
// at http://sources.redhat.com/ecos/ecos-license/
41
// -------------------------------------------
42
//####ECOSGPLCOPYRIGHTEND####
43
//===========================================================================
44
//#####DESCRIPTIONBEGIN####
45
//
46
// Author(s):    jlarmour
47
// Contributors:
48
// Date:         2000-04-28
49
// Purpose:
50
// Description:
51
// Usage:        Do not include this file directly - include  instead
52
//
53
//####DESCRIPTIONEND####
54
//
55
//=========================================================================*/
56
 
57
/* CONFIGURATION */
58
 
59
#include     /* Configuration header */
60
 
61
/* INCLUDES */
62
 
63
#include                  /* NULL */
64
#include      /* Tracing support */
65
 
66
/* FUNCTION PROTOTYPES */
67
 
68
#ifdef __cplusplus
69
extern "C" {
70
#endif
71
 
72
#ifdef CYGFUN_LIBC_strtod
73
extern double
74
atof( const char * /* double_str */ );
75
#endif
76
 
77
extern int
78
atoi( const char * /* int_str */ );
79
 
80
extern long
81
atol( const char * /* long_str */ );
82
 
83
#ifdef CYGFUN_LIBC_strtod
84
extern double
85
strtod( const char * /* double_str */, char ** /* endptr */ );
86
#endif
87
 
88
extern long
89
strtol( const char * /* long_str */, char ** /* endptr */,
90
        int /* base */ );
91
 
92
extern unsigned long
93
strtoul( const char * /* ulong_str */, char ** /* endptr */,
94
         int /* base */ );
95
 
96
#ifdef __cplusplus
97
} /* extern "C" */
98
#endif
99
 
100
/* INLINE FUNCTIONS */
101
 
102
/* 7.10.1 String conversion functions */
103
 
104
#ifndef CYGPRI_LIBC_STDLIB_ATOX_INLINE
105
# define CYGPRI_LIBC_STDLIB_ATOX_INLINE extern __inline__
106
#endif
107
 
108
 
109
#ifdef CYGFUN_LIBC_strtod
110
CYGPRI_LIBC_STDLIB_ATOX_INLINE double
111
atof( const char *__nptr )
112
{
113
    double __retval;
114
 
115
    CYG_REPORT_FUNCNAMETYPE( "atof", "returning %f" );
116
 
117
    CYG_CHECK_DATA_PTR( __nptr, "__nptr is an invalid pointer!" );
118
 
119
    __retval = strtod( __nptr, (char **)NULL );
120
 
121
    CYG_REPORT_RETVAL( __retval );
122
 
123
    return __retval;
124
} /* atof() */
125
#endif
126
 
127
CYGPRI_LIBC_STDLIB_ATOX_INLINE int
128
atoi( const char *__nptr )
129
{
130
    int __retval;
131
 
132
    CYG_REPORT_FUNCNAMETYPE( "atoi", "returning %d" );
133
 
134
    CYG_CHECK_DATA_PTR( __nptr, "__nptr is an invalid pointer!" );
135
 
136
    __retval = (int)strtol( __nptr, (char **)NULL, 10 );
137
 
138
    CYG_REPORT_RETVAL( __retval );
139
 
140
    return __retval;
141
} /* atoi() */
142
 
143
 
144
CYGPRI_LIBC_STDLIB_ATOX_INLINE long
145
atol( const char *__nptr )
146
{
147
    long __retval;
148
 
149
    CYG_REPORT_FUNCNAMETYPE( "atol", "returning %ld" );
150
 
151
    CYG_CHECK_DATA_PTR( __nptr, "__nptr is an invalid pointer!" );
152
 
153
    __retval = strtol( __nptr, (char **)NULL, 10 );
154
 
155
    CYG_REPORT_RETVAL( __retval );
156
 
157
    return __retval;
158
} /* atol() */
159
 
160
#endif /* CYGONCE_LIBC_STDLIB_ATOX_INL multiple inclusion protection */
161
 
162
/* EOF atox.inl */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.