stdlib.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*-------------------------------------------------------------------------
  2. stdlib.h - ANSI functions forward declarations
  3. Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
  4. Ported to PIC16 port by Vangelis Rokas, 2004 <vrokas AT otenet.gr>
  5. This library is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by the
  7. Free Software Foundation; either version 2, or (at your option) any
  8. later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this library; see the file COPYING. If not, write to the
  15. Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
  16. MA 02110-1301, USA.
  17. As a special exception, if you link this library with other files,
  18. some of which are compiled with SDCC, to produce an executable,
  19. this library does not by itself cause the resulting executable to
  20. be covered by the GNU General Public License. This exception does
  21. not however invalidate any other reasons why the executable file
  22. might be covered by the GNU General Public License.
  23. -------------------------------------------------------------------------*/
  24. #ifndef __STDLIB_H__
  25. #define __STDLIB_H__ 1
  26. #pragma library c
  27. #include <stdint.h>
  28. #ifndef NULL
  29. # define NULL (void *)0
  30. #endif
  31. #define RAND_MAX 0x7fffffff
  32. /* absolute value */
  33. int abs (int j);
  34. long int labs (long int j);
  35. /* initialize random seed */
  36. void srand (unsigned long seed);
  37. /* return a random number between 0 and RAND_MAX */
  38. long rand (void);
  39. /* reentrant version of rand() */
  40. long rand_r (unsigned long *ctx);
  41. /* returns the CRC16 checksum of the data buffer, takes as
  42. * last argument an old value of crc16 checksum */
  43. uint16_t crc16 (uint8_t *, uint32_t, uint16_t);
  44. /* convert a ASCII string to float */
  45. float atof (char *);
  46. /* convert a ASCII string to integer */
  47. int atoi (char *);
  48. /* convert a ASCII string to long */
  49. long atol (char *);
  50. /* convert an unsigned/signed integer to ASCII string */
  51. void uitoa (unsigned int, __data char *, unsigned char);
  52. void itoa (int, __data char*, unsigned char);
  53. /* convert an unsigned/signed long integer to ASCII string */
  54. void ultoa (unsigned long, __data char *, unsigned char);
  55. void ltoa (long, __data char*, unsigned char);
  56. /* helper functions: convert a float to ASCII string */
  57. extern char x_ftoa (float, __data char *, unsigned char, unsigned char);
  58. /* George M. Gallant's version of ftoa() */
  59. extern void g_ftoa (__data char *, float, char);
  60. #endif /* __STDLIB_H__ */