* device/include/pic16/pic18f*.h: add bit aliases in INTCONbits_t
[fw/sdcc] / device / include / pic16 / stdlib.h
1 /*-------------------------------------------------------------------------
2   stdlib.h - ANSI functions forward declarations
3
4    Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
5
6              Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
7
8    This program is free software; you can redistribute it and/or modify it
9    under the terms of the GNU General Public License as published by the
10    Free Software Foundation; either version 2, or (at your option) any
11    later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
22    In other words, you are welcome to use, share and improve this program.
23    You are forbidden to forbid anyone else to use, share and improve
24    what you give them.   Help stamp out software-hoarding!
25 -------------------------------------------------------------------------*/
26
27 /*
28 ** $Id$
29 */
30
31 #ifndef __STDLIB_H__
32 #define __STDLIB_H__ 1
33
34 #pragma library c
35
36 #include <stdint.h>
37
38
39 #ifndef NULL
40 # define NULL (void *)0
41 #endif
42
43 #define RAND_MAX        0x7fffffff
44
45 /* initialize random seed */
46 void srand(unsigned long seed);
47
48 /* return a random number between 0 and RAND_MAX */
49 long rand(void);
50
51 /* reentrant version of rand() */
52 long rand_r(unsigned long *ctx);
53
54
55 /* returns the CRC16 checksum of the data buffer, takes as
56  * last argument an old value of crc16 checksum */
57 uint16_t crc16(uint8_t *, uint32_t, uint16_t);
58
59
60 /* convert a ASCII string to float */
61 float atof (char *);
62
63 /* convert a ASCII string to integer */
64 int atoi (char *);
65
66 /* convert a ASCII string to long */
67 long atol (char *);
68
69 /* convert an unsigned/signed integer to ASCII string */
70 void uitoa(unsigned int, __data char *, unsigned char);
71 void itoa(int, __data char*, unsigned char);
72
73 /* convert an unsigned/signed long integer to ASCII string */
74 void ultoa(unsigned long, __data char *, unsigned char);
75 void ltoa(long, __data char*, unsigned char);
76
77 /* helper functions: convert a float to ASCII string */
78 extern char x_ftoa(float, __data char *, unsigned char, unsigned char);
79
80 /* George M. Gallant's version of ftoa() */
81 extern void g_ftoa(__data char *, float, char);
82
83
84 #endif  /* __STDLIB_H__ */