AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Library Reference FAQ Alphabetical Index Example Projects

stdlib.h
Go to the documentation of this file.
1 /* Copyright (c) 2002, Marek Michalkiewicz
2  Copyright (c) 2004,2007 Joerg Wunsch
3 
4  Portions of documentation Copyright (c) 1990, 1991, 1993, 1994
5  The Regents of the University of California.
6 
7  All rights reserved.
8 
9  Redistribution and use in source and binary forms, with or without
10  modification, are permitted provided that the following conditions are met:
11 
12  * Redistributions of source code must retain the above copyright
13  notice, this list of conditions and the following disclaimer.
14 
15  * Redistributions in binary form must reproduce the above copyright
16  notice, this list of conditions and the following disclaimer in
17  the documentation and/or other materials provided with the
18  distribution.
19 
20  * Neither the name of the copyright holders nor the names of
21  contributors may be used to endorse or promote products derived
22  from this software without specific prior written permission.
23 
24  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  POSSIBILITY OF SUCH DAMAGE.
35 
36  $Id: stdlib.h 2443 2014-08-11 21:50:59Z joerg_wunsch $
37 */
38 
39 #ifndef _STDLIB_H_
40 #define _STDLIB_H_ 1
41 
42 #ifndef __ASSEMBLER__
43 
44 #define __need_NULL
45 #define __need_size_t
46 #define __need_wchar_t
47 #include <stddef.h>
48 
49 #ifndef __ptr_t
50 #define __ptr_t void *
51 #endif
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /** \file */
58 
59 /** \defgroup avr_stdlib <stdlib.h>: General utilities
60  \code #include <stdlib.h> \endcode
61 
62  This file declares some basic C macros and functions as
63  defined by the ISO standard, plus some AVR-specific extensions.
64 */
65 
66 /*@{*/
67 /** Result type for function div(). */
68 typedef struct {
69  int quot; /**< The Quotient. */
70  int rem; /**< The Remainder. */
71 } div_t;
72 
73 /** Result type for function ldiv(). */
74 typedef struct {
75  long quot; /**< The Quotient. */
76  long rem; /**< The Remainder. */
77 } ldiv_t;
78 
79 /** Comparision function type for qsort(), just for convenience. */
80 typedef int (*__compar_fn_t)(const void *, const void *);
81 
82 #ifndef __DOXYGEN__
83 
84 #ifndef __ATTR_CONST__
85 # define __ATTR_CONST__ __attribute__((__const__))
86 #endif
87 
88 #ifndef __ATTR_MALLOC__
89 # define __ATTR_MALLOC__ __attribute__((__malloc__))
90 #endif
91 
92 #ifndef __ATTR_NORETURN__
93 # define __ATTR_NORETURN__ __attribute__((__noreturn__))
94 #endif
95 
96 #ifndef __ATTR_PURE__
97 # define __ATTR_PURE__ __attribute__((__pure__))
98 #endif
99 
100 #ifndef __ATTR_GNU_INLINE__
101 # ifdef __GNUC_STDC_INLINE__
102 # define __ATTR_GNU_INLINE__ __attribute__((__gnu_inline__))
103 # else
104 # define __ATTR_GNU_INLINE__
105 # endif
106 #endif
107 
108 #endif
109 
110 /** The abort() function causes abnormal program termination to occur.
111  This realization disables interrupts and jumps to _exit() function
112  with argument equal to 1. In the limited AVR environment, execution is
113  effectively halted by entering an infinite loop. */
114 extern void abort(void) __ATTR_NORETURN__;
115 
116 /** The abs() function computes the absolute value of the integer \c i.
117  \note The abs() and labs() functions are builtins of gcc.
118 */
119 extern int abs(int __i) __ATTR_CONST__;
120 #ifndef __DOXYGEN__
121 #define abs(__i) __builtin_abs(__i)
122 #endif
123 
124 /** The labs() function computes the absolute value of the long integer
125  \c i.
126  \note The abs() and labs() functions are builtins of gcc.
127 */
128 extern long labs(long __i) __ATTR_CONST__;
129 #ifndef __DOXYGEN__
130 #define labs(__i) __builtin_labs(__i)
131 #endif
132 
133 /**
134  The bsearch() function searches an array of \c nmemb objects, the
135  initial member of which is pointed to by \c base, for a member
136  that matches the object pointed to by \c key. The size of each
137  member of the array is specified by \c size.
138 
139  The contents of the array should be in ascending sorted order
140  according to the comparison function referenced by \c compar.
141  The \c compar routine is expected to have two arguments which
142  point to the key object and to an array member, in that order,
143  and should return an integer less than, equal to, or greater than
144  zero if the key object is found, respectively, to be less than,
145  to match, or be greater than the array member.
146 
147  The bsearch() function returns a pointer to a matching member of
148  the array, or a null pointer if no match is found. If two
149  members compare as equal, which member is matched is unspecified.
150 */
151 extern void *bsearch(const void *__key, const void *__base, size_t __nmemb,
152  size_t __size, int (*__compar)(const void *, const void *));
153 
154 /* __divmodhi4 and __divmodsi4 from libgcc.a */
155 /**
156  The div() function computes the value \c num/denom and returns
157  the quotient and remainder in a structure named \c div_t that
158  contains two int members named \c quot and \c rem.
159 */
160 extern div_t div(int __num, int __denom) __asm__("__divmodhi4") __ATTR_CONST__;
161 /**
162  The ldiv() function computes the value \c num/denom and returns
163  the quotient and remainder in a structure named \c ldiv_t that
164  contains two long integer members named \c quot and \c rem.
165 */
166 extern ldiv_t ldiv(long __num, long __denom) __asm__("__divmodsi4") __ATTR_CONST__;
167 
168 /**
169  The qsort() function is a modified partition-exchange sort, or
170  quicksort.
171 
172  The qsort() function sorts an array of \c nmemb objects, the
173  initial member of which is pointed to by \c base. The size of
174  each object is specified by \c size. The contents of the array
175  base are sorted in ascending order according to a comparison
176  function pointed to by \c compar, which requires two arguments
177  pointing to the objects being compared.
178 
179  The comparison function must return an integer less than, equal
180  to, or greater than zero if the first argument is considered to
181  be respectively less than, equal to, or greater than the second.
182 */
183 extern void qsort(void *__base, size_t __nmemb, size_t __size,
184  __compar_fn_t __compar);
185 
186 /**
187  The strtol() function converts the string in \c nptr to a long
188  value. The conversion is done according to the given base, which
189  must be between 2 and 36 inclusive, or be the special value 0.
190 
191  The string may begin with an arbitrary amount of white space (as
192  determined by isspace()) followed by a single optional \c '+' or \c '-'
193  sign. If \c base is zero or 16, the string may then include a
194  \c "0x" prefix, and the number will be read in base 16; otherwise,
195  a zero base is taken as 10 (decimal) unless the next character is
196  \c '0', in which case it is taken as 8 (octal).
197 
198  The remainder of the string is converted to a long value in the
199  obvious manner, stopping at the first character which is not a
200  valid digit in the given base. (In bases above 10, the letter \c 'A'
201  in either upper or lower case represents 10, \c 'B' represents 11,
202  and so forth, with \c 'Z' representing 35.)
203 
204  If \c endptr is not NULL, strtol() stores the address of the first
205  invalid character in \c *endptr. If there were no digits at all,
206  however, strtol() stores the original value of \c nptr in \c
207  *endptr. (Thus, if \c *nptr is not \c '\\0' but \c **endptr is \c '\\0'
208  on return, the entire string was valid.)
209 
210  The strtol() function returns the result of the conversion, unless
211  the value would underflow or overflow. If no conversion could be
212  performed, 0 is returned. If an overflow or underflow occurs, \c
213  errno is set to \ref avr_errno "ERANGE" and the function return value
214  is clamped to \c LONG_MIN or \c LONG_MAX, respectively.
215 */
216 extern long strtol(const char *__nptr, char **__endptr, int __base);
217 
218 /**
219  The strtoul() function converts the string in \c nptr to an
220  unsigned long value. The conversion is done according to the
221  given base, which must be between 2 and 36 inclusive, or be the
222  special value 0.
223 
224  The string may begin with an arbitrary amount of white space (as
225  determined by isspace()) followed by a single optional \c '+' or \c '-'
226  sign. If \c base is zero or 16, the string may then include a
227  \c "0x" prefix, and the number will be read in base 16; otherwise,
228  a zero base is taken as 10 (decimal) unless the next character is
229  \c '0', in which case it is taken as 8 (octal).
230 
231  The remainder of the string is converted to an unsigned long value
232  in the obvious manner, stopping at the first character which is
233  not a valid digit in the given base. (In bases above 10, the
234  letter \c 'A' in either upper or lower case represents 10, \c 'B'
235  represents 11, and so forth, with \c 'Z' representing 35.)
236 
237  If \c endptr is not NULL, strtoul() stores the address of the first
238  invalid character in \c *endptr. If there were no digits at all,
239  however, strtoul() stores the original value of \c nptr in \c
240  *endptr. (Thus, if \c *nptr is not \c '\\0' but \c **endptr is \c '\\0'
241  on return, the entire string was valid.)
242 
243  The strtoul() function return either the result of the conversion
244  or, if there was a leading minus sign, the negation of the result
245  of the conversion, unless the original (non-negated) value would
246  overflow; in the latter case, strtoul() returns ULONG_MAX, and \c
247  errno is set to \ref avr_errno "ERANGE". If no conversion could
248  be performed, 0 is returned.
249 */
250 extern unsigned long strtoul(const char *__nptr, char **__endptr, int __base);
251 
252 /**
253  The atol() function converts the initial portion of the string
254  pointed to by \p s to long integer representation. In contrast to
255 
256  \code strtol(s, (char **)NULL, 10); \endcode
257 
258  this function does not detect overflow (\c errno is not changed and
259  the result value is not predictable), uses smaller memory (flash and
260  stack) and works more quickly.
261 */
262 extern long atol(const char *__s) __ATTR_PURE__;
263 
264 /**
265  The atoi() function converts the initial portion of the string
266  pointed to by \p s to integer representation. In contrast to
267 
268  \code (int)strtol(s, (char **)NULL, 10); \endcode
269 
270  this function does not detect overflow (\c errno is not changed and
271  the result value is not predictable), uses smaller memory (flash and
272  stack) and works more quickly.
273 */
274 extern int atoi(const char *__s) __ATTR_PURE__;
275 
276 /**
277  The exit() function terminates the application. Since there is no
278  environment to return to, \c status is ignored, and code execution
279  will eventually reach an infinite loop, thereby effectively halting
280  all code processing. Before entering the infinite loop, interrupts
281  are globally disabled.
282 
283  In a C++ context, global destructors will be called before halting
284  execution.
285 */
286 extern void exit(int __status) __ATTR_NORETURN__;
287 
288 /**
289  The malloc() function allocates \c size bytes of memory.
290  If malloc() fails, a NULL pointer is returned.
291 
292  Note that malloc() does \e not initialize the returned memory to
293  zero bytes.
294 
295  See the chapter about \ref malloc "malloc() usage" for implementation
296  details.
297 */
298 extern void *malloc(size_t __size) __ATTR_MALLOC__;
299 
300 /**
301  The free() function causes the allocated memory referenced by \c
302  ptr to be made available for future allocations. If \c ptr is
303  NULL, no action occurs.
304 */
305 extern void free(void *__ptr);
306 
307 /**
308  \c malloc() \ref malloc_tunables "tunable".
309 */
310 extern size_t __malloc_margin;
311 
312 /**
313  \c malloc() \ref malloc_tunables "tunable".
314 */
315 extern char *__malloc_heap_start;
316 
317 /**
318  \c malloc() \ref malloc_tunables "tunable".
319 */
320 extern char *__malloc_heap_end;
321 
322 /**
323  Allocate \c nele elements of \c size each. Identical to calling
324  \c malloc() using <tt>nele * size</tt> as argument, except the
325  allocated memory will be cleared to zero.
326 */
327 extern void *calloc(size_t __nele, size_t __size) __ATTR_MALLOC__;
328 
329 /**
330  The realloc() function tries to change the size of the region
331  allocated at \c ptr to the new \c size value. It returns a
332  pointer to the new region. The returned pointer might be the
333  same as the old pointer, or a pointer to a completely different
334  region.
335 
336  The contents of the returned region up to either the old or the new
337  size value (whatever is less) will be identical to the contents of
338  the old region, even in case a new region had to be allocated.
339 
340  It is acceptable to pass \c ptr as NULL, in which case realloc()
341  will behave identical to malloc().
342 
343  If the new memory cannot be allocated, realloc() returns NULL, and
344  the region at \c ptr will not be changed.
345 */
346 extern void *realloc(void *__ptr, size_t __size) __ATTR_MALLOC__;
347 
348 extern double strtod(const char *__nptr, char **__endptr);
349 
350 extern double atof(const char *__nptr);
351 
352 /** Highest number that can be generated by rand(). */
353 #define RAND_MAX 0x7FFF
354 
355 /**
356  The rand() function computes a sequence of pseudo-random integers in the
357  range of 0 to \c RAND_MAX (as defined by the header file <stdlib.h>).
358 
359  The srand() function sets its argument \c seed as the seed for a new
360  sequence of pseudo-random numbers to be returned by rand(). These
361  sequences are repeatable by calling srand() with the same seed value.
362 
363  If no seed value is provided, the functions are automatically seeded with
364  a value of 1.
365 
366  In compliance with the C standard, these functions operate on
367  \c int arguments. Since the underlying algorithm already uses
368  32-bit calculations, this causes a loss of precision. See
369  \c random() for an alternate set of functions that retains full
370  32-bit precision.
371 */
372 extern int rand(void);
373 /**
374  Pseudo-random number generator seeding; see rand().
375 */
376 extern void srand(unsigned int __seed);
377 
378 /**
379  Variant of rand() that stores the context in the user-supplied
380  variable located at \c ctx instead of a static library variable
381  so the function becomes re-entrant.
382 */
383 extern int rand_r(unsigned long *__ctx);
384 /*@}*/
385 
386 /*@{*/
387 /** \name Non-standard (i.e. non-ISO C) functions.
388  \ingroup avr_stdlib
389 */
390 /**
391  \brief Convert an integer to a string.
392 
393  The function itoa() converts the integer value from \c val into an
394  ASCII representation that will be stored under \c s. The caller
395  is responsible for providing sufficient storage in \c s.
396 
397  \note The minimal size of the buffer \c s depends on the choice of
398  radix. For example, if the radix is 2 (binary), you need to supply a buffer
399  with a minimal length of 8 * sizeof (int) + 1 characters, i.e. one
400  character for each bit plus one for the string terminator. Using a larger
401  radix will require a smaller minimal buffer size.
402 
403  \warning If the buffer is too small, you risk a buffer overflow.
404 
405  Conversion is done using the \c radix as base, which may be a
406  number between 2 (binary conversion) and up to 36. If \c radix
407  is greater than 10, the next digit after \c '9' will be the letter
408  \c 'a'.
409 
410  If radix is 10 and val is negative, a minus sign will be prepended.
411 
412  The itoa() function returns the pointer passed as \c s.
413 */
414 #ifdef __DOXYGEN__
415 extern char *itoa(int val, char *s, int radix);
416 #else
417 extern __inline__ __ATTR_GNU_INLINE__
418 char *itoa (int __val, char *__s, int __radix)
419 {
420  if (!__builtin_constant_p (__radix)) {
421  extern char *__itoa (int, char *, int);
422  return __itoa (__val, __s, __radix);
423  } else if (__radix < 2 || __radix > 36) {
424  *__s = 0;
425  return __s;
426  } else {
427  extern char *__itoa_ncheck (int, char *, unsigned char);
428  return __itoa_ncheck (__val, __s, __radix);
429  }
430 }
431 #endif
432 
433 /**
434  \ingroup avr_stdlib
435 
436  \brief Convert a long integer to a string.
437 
438  The function ltoa() converts the long integer value from \c val into an
439  ASCII representation that will be stored under \c s. The caller
440  is responsible for providing sufficient storage in \c s.
441 
442  \note The minimal size of the buffer \c s depends on the choice of
443  radix. For example, if the radix is 2 (binary), you need to supply a buffer
444  with a minimal length of 8 * sizeof (long int) + 1 characters, i.e. one
445  character for each bit plus one for the string terminator. Using a larger
446  radix will require a smaller minimal buffer size.
447 
448  \warning If the buffer is too small, you risk a buffer overflow.
449 
450  Conversion is done using the \c radix as base, which may be a
451  number between 2 (binary conversion) and up to 36. If \c radix
452  is greater than 10, the next digit after \c '9' will be the letter
453  \c 'a'.
454 
455  If radix is 10 and val is negative, a minus sign will be prepended.
456 
457  The ltoa() function returns the pointer passed as \c s.
458 */
459 #ifdef __DOXYGEN__
460 extern char *ltoa(long val, char *s, int radix);
461 #else
462 extern __inline__ __ATTR_GNU_INLINE__
463 char *ltoa (long __val, char *__s, int __radix)
464 {
465  if (!__builtin_constant_p (__radix)) {
466  extern char *__ltoa (long, char *, int);
467  return __ltoa (__val, __s, __radix);
468  } else if (__radix < 2 || __radix > 36) {
469  *__s = 0;
470  return __s;
471  } else {
472  extern char *__ltoa_ncheck (long, char *, unsigned char);
473  return __ltoa_ncheck (__val, __s, __radix);
474  }
475 }
476 #endif
477 
478 /**
479  \ingroup avr_stdlib
480 
481  \brief Convert an unsigned integer to a string.
482 
483  The function utoa() converts the unsigned integer value from \c val into an
484  ASCII representation that will be stored under \c s. The caller
485  is responsible for providing sufficient storage in \c s.
486 
487  \note The minimal size of the buffer \c s depends on the choice of
488  radix. For example, if the radix is 2 (binary), you need to supply a buffer
489  with a minimal length of 8 * sizeof (unsigned int) + 1 characters, i.e. one
490  character for each bit plus one for the string terminator. Using a larger
491  radix will require a smaller minimal buffer size.
492 
493  \warning If the buffer is too small, you risk a buffer overflow.
494 
495  Conversion is done using the \c radix as base, which may be a
496  number between 2 (binary conversion) and up to 36. If \c radix
497  is greater than 10, the next digit after \c '9' will be the letter
498  \c 'a'.
499 
500  The utoa() function returns the pointer passed as \c s.
501 */
502 #ifdef __DOXYGEN__
503 extern char *utoa(unsigned int val, char *s, int radix);
504 #else
505 extern __inline__ __ATTR_GNU_INLINE__
506 char *utoa (unsigned int __val, char *__s, int __radix)
507 {
508  if (!__builtin_constant_p (__radix)) {
509  extern char *__utoa (unsigned int, char *, int);
510  return __utoa (__val, __s, __radix);
511  } else if (__radix < 2 || __radix > 36) {
512  *__s = 0;
513  return __s;
514  } else {
515  extern char *__utoa_ncheck (unsigned int, char *, unsigned char);
516  return __utoa_ncheck (__val, __s, __radix);
517  }
518 }
519 #endif
520 
521 /**
522  \ingroup avr_stdlib
523  \brief Convert an unsigned long integer to a string.
524 
525  The function ultoa() converts the unsigned long integer value from
526  \c val into an ASCII representation that will be stored under \c s.
527  The caller is responsible for providing sufficient storage in \c s.
528 
529  \note The minimal size of the buffer \c s depends on the choice of
530  radix. For example, if the radix is 2 (binary), you need to supply a buffer
531  with a minimal length of 8 * sizeof (unsigned long int) + 1 characters,
532  i.e. one character for each bit plus one for the string terminator. Using a
533  larger radix will require a smaller minimal buffer size.
534 
535  \warning If the buffer is too small, you risk a buffer overflow.
536 
537  Conversion is done using the \c radix as base, which may be a
538  number between 2 (binary conversion) and up to 36. If \c radix
539  is greater than 10, the next digit after \c '9' will be the letter
540  \c 'a'.
541 
542  The ultoa() function returns the pointer passed as \c s.
543 */
544 #ifdef __DOXYGEN__
545 extern char *ultoa(unsigned long val, char *s, int radix);
546 #else
547 extern __inline__ __ATTR_GNU_INLINE__
548 char *ultoa (unsigned long __val, char *__s, int __radix)
549 {
550  if (!__builtin_constant_p (__radix)) {
551  extern char *__ultoa (unsigned long, char *, int);
552  return __ultoa (__val, __s, __radix);
553  } else if (__radix < 2 || __radix > 36) {
554  *__s = 0;
555  return __s;
556  } else {
557  extern char *__ultoa_ncheck (unsigned long, char *, unsigned char);
558  return __ultoa_ncheck (__val, __s, __radix);
559  }
560 }
561 #endif
562 
563 /** \ingroup avr_stdlib
564 Highest number that can be generated by random(). */
565 #define RANDOM_MAX 0x7FFFFFFF
566 
567 /**
568  \ingroup avr_stdlib
569  The random() function computes a sequence of pseudo-random integers in the
570  range of 0 to \c RANDOM_MAX (as defined by the header file <stdlib.h>).
571 
572  The srandom() function sets its argument \c seed as the seed for a new
573  sequence of pseudo-random numbers to be returned by rand(). These
574  sequences are repeatable by calling srandom() with the same seed value.
575 
576  If no seed value is provided, the functions are automatically seeded with
577  a value of 1.
578 */
579 extern long random(void);
580 /**
581  \ingroup avr_stdlib
582  Pseudo-random number generator seeding; see random().
583 */
584 extern void srandom(unsigned long __seed);
585 
586 /**
587  \ingroup avr_stdlib
588  Variant of random() that stores the context in the user-supplied
589  variable located at \c ctx instead of a static library variable
590  so the function becomes re-entrant.
591 */
592 extern long random_r(unsigned long *__ctx);
593 #endif /* __ASSEMBLER */
594 /*@}*/
595 
596 /*@{*/
597 /** \name Conversion functions for double arguments.
598  \ingroup avr_stdlib
599  Note that these functions are not located in the default library,
600  <tt>libc.a</tt>, but in the mathematical library, <tt>libm.a</tt>.
601  So when linking the application, the \c -lm option needs to be
602  specified.
603 */
604 /** \ingroup avr_stdlib
605  Bit value that can be passed in \c flags to dtostre(). */
606 #define DTOSTR_ALWAYS_SIGN 0x01 /* put '+' or ' ' for positives */
607 /** \ingroup avr_stdlib
608  Bit value that can be passed in \c flags to dtostre(). */
609 #define DTOSTR_PLUS_SIGN 0x02 /* put '+' rather than ' ' */
610 /** \ingroup avr_stdlib
611  Bit value that can be passed in \c flags to dtostre(). */
612 #define DTOSTR_UPPERCASE 0x04 /* put 'E' rather 'e' */
613 
614 #ifndef __ASSEMBLER__
615 
616 /**
617  \ingroup avr_stdlib
618  The dtostre() function converts the double value passed in \c val into
619  an ASCII representation that will be stored under \c s. The caller
620  is responsible for providing sufficient storage in \c s.
621 
622  Conversion is done in the format \c "[-]d.ddde±dd" where there is
623  one digit before the decimal-point character and the number of
624  digits after it is equal to the precision \c prec; if the precision
625  is zero, no decimal-point character appears. If \c flags has the
626  DTOSTRE_UPPERCASE bit set, the letter \c 'E' (rather than \c 'e' ) will be
627  used to introduce the exponent. The exponent always contains two
628  digits; if the value is zero, the exponent is \c "00".
629 
630  If \c flags has the DTOSTRE_ALWAYS_SIGN bit set, a space character
631  will be placed into the leading position for positive numbers.
632 
633  If \c flags has the DTOSTRE_PLUS_SIGN bit set, a plus sign will be
634  used instead of a space character in this case.
635 
636  The dtostre() function returns the pointer to the converted string \c s.
637 */
638 extern char *dtostre(double __val, char *__s, unsigned char __prec,
639  unsigned char __flags);
640 
641 /**
642  \ingroup avr_stdlib
643  The dtostrf() function converts the double value passed in \c val into
644  an ASCII representationthat will be stored under \c s. The caller
645  is responsible for providing sufficient storage in \c s.
646 
647  Conversion is done in the format \c "[-]d.ddd". The minimum field
648  width of the output string (including the possible \c '.' and the possible
649  sign for negative values) is given in \c width, and \c prec determines
650  the number of digits after the decimal sign. \c width is signed value,
651  negative for left adjustment.
652 
653  The dtostrf() function returns the pointer to the converted string \c s.
654 */
655 extern char *dtostrf(double __val, signed char __width,
656  unsigned char __prec, char *__s);
657 
658 /**
659  \ingroup avr_stdlib
660  Successful termination for exit(); evaluates to 0.
661 */
662 #define EXIT_SUCCESS 0
663 
664 /**
665  \ingroup avr_stdlib
666  Unsuccessful termination for exit(); evaluates to a non-zero value.
667 */
668 #define EXIT_FAILURE 1
669 
670 /*@}*/
671 
672 extern int atexit(void (*)(void));
673 extern int system (const char *);
674 extern char *getenv (const char *);
675 
676 #ifdef __cplusplus
677 }
678 #endif
679 
680 #endif /* __ASSEMBLER */
681 
682 #endif /* _STDLIB_H_ */
int rand(void)
Definition: rand.c:91
div_t div(int __num, int __denom) __asm__("__divmodhi4")
double atof(const char *__nptr)
char * itoa(int val, char *s, int radix)
Convert an integer to a string.
char * __malloc_heap_end
Definition: malloc.c:61
void exit(int __status) __ATTR_NORETURN__
long quot
Definition: stdlib.h:75
int(* __compar_fn_t)(const void *, const void *)
Definition: stdlib.h:80
void qsort(void *__base, size_t __nmemb, size_t __size, __compar_fn_t __compar)
void free(void *__ptr)
Definition: malloc.c:190
void * malloc(size_t __size) __ATTR_MALLOC__
Definition: malloc.c:68
void * bsearch(const void *__key, const void *__base, size_t __nmemb, size_t __size, int(*__compar)(const void *, const void *))
void srand(unsigned int __seed)
Definition: rand.c:98
void * calloc(size_t __nele, size_t __size) __ATTR_MALLOC__
Definition: calloc.c:39
char * ultoa(unsigned long val, char *s, int radix)
Convert an unsigned long integer to a string.
long rem
Definition: stdlib.h:76
char * __malloc_heap_start
Definition: malloc.c:60
char * dtostre(double __val, char *__s, unsigned char __prec, unsigned char __flags)
Definition: dtostre.c:38
Definition: stdlib.h:74
int atoi(const char *__s) __ATTR_PURE__
Convert a string to an integer.
Definition: atoi.c:34
int abs(int __i)
Definition: abs.c:34
unsigned long strtoul(const char *__nptr, char **__endptr, int __base)
size_t __malloc_margin
Definition: malloc.c:59
Definition: stdlib.h:68
int quot
Definition: stdlib.h:69
long random(void)
Definition: random.c:81
char * utoa(unsigned int val, char *s, int radix)
Convert an unsigned integer to a string.
char * dtostrf(double __val, signed char __width, unsigned char __prec, char *__s)
Definition: dtostrf.c:50
char * ltoa(long val, char *s, int radix)
Convert a long integer to a string.
double strtod(const char *__nptr, char **__endptr)
Definition: strtod.c:89
void srandom(unsigned long __seed)
Definition: random.c:88
int rem
Definition: stdlib.h:70
long labs(long __i)
Definition: labs.c:34
long strtol(const char *__nptr, char **__endptr, int __base)
void * realloc(void *__ptr, size_t __size) __ATTR_MALLOC__
Definition: realloc.c:44
long atol(const char *__s) __ATTR_PURE__
Convert a string to a long integer.
Definition: atol.c:34
ldiv_t ldiv(long __num, long __denom) __asm__("__divmodsi4")
void abort(void) __ATTR_NORETURN__
Definition: abort.c:34
long random_r(unsigned long *__ctx)
Definition: random.c:71
int rand_r(unsigned long *__ctx)
Definition: rand.c:81

Automatically generated by Doxygen 1.8.7 on Tue Aug 12 2014.