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