source: rtems/cpukit/libmisc/stringto/stringto.h @ 48751ab

4.104.115
Last change on this file since 48751ab was 48751ab, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 23, 2009 at 2:32:34 PM

2009-07-23 Joel Sherrill <joel.sherrill@…>

  • libmisc/Makefile.am, libmisc/shell/main_chmod.c, libmisc/shell/main_mdump.c, libmisc/shell/main_medit.c, libmisc/shell/main_mfill.c, libmisc/shell/main_mmove.c, libmisc/shell/main_msdosfmt.c, libmisc/shell/main_mwdump.c, libmisc/shell/main_sleep.c, libmisc/shell/main_umask.c, libmisc/shell/shell_script.c, libmisc/stringto/stringto.h, libmisc/stringto/stringto_template.h: Convert return type from bool to rtems_status_code and add rtems_string_to_pointer. Perform associated clean up and changes for return type change.
  • libmisc/stringto/stringtopointer.c: New file.
  • Property mode set to 100644
File size: 6.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#ifndef __STRING_TO_A_TYPE_h__
13#define __STRING_TO_A_TYPE_h__
14
15#include <rtems.h>
16
17/**
18 *  @brief Convert String to Pointer (with validation)
19 *
20 *  This method converts a string to a pointer (void *) with
21 *  basic numeric validation.
22 *
23 *  @param[in] s is the string to convert
24 *  @param[in] n points to the variable to place the converted output in
25 *  @param[in] endptr is used to keep track of the position in the string
26 *
27 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
28 *          and *n is filled in.  Otherwise, the status indicates the
29 *          source of the error.
30 */
31rtems_status_code rtems_string_to_pointer(
32  const char     *s,
33  void          **n,
34  char          **endptr
35);
36
37/**
38 *  @brief Convert String to Unsigned Character (with validation)
39 *
40 *  This method converts a string to an unsigned character with
41 *  range validation.
42 *
43 *  @param[in] s is the string to convert
44 *  @param[in] n points to the variable to place the converted output in
45 *  @param[in] endptr is used to keep track of the position in the string
46 *  @param[in] base is the expected base of the number
47 *
48 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
49 *          and *n is filled in.  Otherwise, the status indicates the
50 *          source of the error.
51 */
52rtems_status_code rtems_string_to_unsigned_char(
53  const char     *s,
54  unsigned char  *n,
55  char          **endptr,
56  int             base
57);
58
59/**
60 *  @brief Convert String to Int (with validation)
61 *
62 *  This method converts a string to an int with range validation.
63 *
64 *  @param[in] s is the string to convert
65 *  @param[in] n points to the variable to place the converted output in
66 *  @param[in] endptr is used to keep track of the position in the string
67 *  @param[in] base is the expected base of the number
68 *
69 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
70 *          and *n is filled in.  Otherwise, the status indicates the
71 *          source of the error.
72 */
73rtems_status_code rtems_string_to_int(
74  const char  *s,
75  int         *n,
76  char       **endptr,
77  int          base
78);
79
80/**
81 *  @brief Convert String to Long (with validation)
82 *
83 *  This method converts a string to a long with
84 *  range validation.
85 *
86 *  @param[in] s is the string to convert
87 *  @param[in] n points to the variable to place the converted output in
88 *  @param[in] endptr is used to keep track of the position in the string
89 *  @param[in] base is the expected base of the number
90 *
91 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
92 *          and *n is filled in.  Otherwise, the status indicates the
93 *          source of the error.
94 */
95rtems_status_code rtems_string_to_long(
96  const char  *s,
97  long        *n,
98  char       **endptr,
99  int          base
100);
101
102/**
103 *  @brief Convert String to Unsigned Long (with validation)
104 *
105 *  This method converts a string to an unsigned long with
106 *  range validation.
107 *
108 *  @param[in] s is the string to convert
109 *  @param[in] n points to the variable to place the converted output in
110 *  @param[in] endptr is used to keep track of the position in the string
111 *  @param[in] base is the expected base of the number
112 *
113 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
114 *          and *n is filled in.  Otherwise, the status indicates the
115 *          source of the error.
116 */
117rtems_status_code rtems_string_to_unsigned_long(
118  const char     *s,
119  unsigned long  *n,
120  char          **endptr,
121  int             base
122);
123
124/**
125 *  @brief Convert String to Long Long (with validation)
126 *
127 *  This method converts a string to a long long with
128 *  range validation.
129 *
130 *  @param[in] s is the string to convert
131 *  @param[in] n points to the variable to place the converted output in
132 *  @param[in] endptr is used to keep track of the position in the string
133 *  @param[in] base is the expected base of the number
134 *
135 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
136 *          and *n is filled in.  Otherwise, the status indicates the
137 *          source of the error.
138 */
139rtems_status_code rtems_string_to_long_long(
140  const char  *s,
141  long long   *n,
142  char       **endptr,
143  int          base
144);
145
146/**
147 *  @brief Convert String to Unsigned Long Long (with validation)
148 *
149 *  This method converts a string to an unsigned character with
150 *  range validation.
151 *
152 *  @param[in] s is the string to convert
153 *  @param[in] n points to the variable to place the converted output in
154 *  @param[in] endptr is used to keep track of the position in the string
155 *  @param[in] base is the expected base of the number
156 *
157 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
158 *          and *n is filled in.  Otherwise, the status indicates the
159 *          source of the error.
160 */
161rtems_status_code rtems_string_to_unsigned_long_long(
162  const char           *s,
163  unsigned long long   *n,
164  char                **endptr,
165  int                   base
166);
167
168/**
169 *  @brief Convert String to Float (with validation)
170 *
171 *  This method converts a string to a float with range validation.
172 *
173 *  @param[in] s is the string to convert
174 *  @param[in] n points to the variable to place the converted output in
175 *  @param[in] endptr is used to keep track of the position in the string
176 *
177 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
178 *          and *n is filled in.  Otherwise, the status indicates the
179 *          source of the error.
180 */
181rtems_status_code rtems_string_to_float(
182  const char   *s,
183  float        *n,
184  char        **endptr
185);
186
187/**
188 *  @brief Convert String to Double (with validation)
189 *
190 *  This method converts a string to a double with range validation.
191 *
192 *  @param[in] s is the string to convert
193 *  @param[in] n points to the variable to place the converted output in
194 *  @param[in] endptr is used to keep track of the position in the string
195 *
196 *  @return This method returns RTEMS_SUCCESSFUL on successful conversion
197 *          and *n is filled in.  Otherwise, the status indicates the
198 *          source of the error.
199 */
200rtems_status_code rtems_string_to_double(
201  const char   *s,
202  double       *n,
203  char        **endptr
204);
205
206#endif
Note: See TracBrowser for help on using the repository browser.