]> git.sur5r.net Git - cc65/blob - include/stdlib.h
calloc is now written in assembler and a fastcall function
[cc65] / include / stdlib.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                 stdlib.h                                  */
4 /*                                                                           */
5 /*                             General utilities                             */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2000 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef _STDLIB_H
37 #define _STDLIB_H
38
39
40
41 #include <stddef.h>
42
43
44
45 /* Standard exit codes */
46 #define EXIT_SUCCESS    0
47 #define EXIT_FAILURE    1
48
49
50
51 /* Memory management */
52 void* __fastcall__ malloc (size_t size);
53 void* __fastcall__ calloc (size_t count, size_t size);
54 void* realloc (void* block, size_t size);
55 void __fastcall__ free (void* block);
56 #ifndef __STRICT_ANSI__
57 void __fastcall__ _hadd (void* mem, size_t size);       /* Non-standard */
58 #endif
59
60 /* Random numbers */
61 #define RAND_MAX        0x7FFF
62 int rand (void);
63 void __fastcall__ srand (unsigned seed);
64
65 /* Other standard stuff */
66 void abort (void);
67 int __fastcall__ abs (int val);
68 long __fastcall__ labs (long val);
69 int __fastcall__ atoi (char* s);
70 long __fastcall__ atol (char* s);
71 int __fastcall__ atexit (void (*exitfunc) (void));
72 void* bsearch (const void* key, const void* base, size_t n,
73                size_t size, int (*cmp) (const void*, const void*));
74 void exit (int ret);
75 char* __fastcall__ getenv (const char* name);
76 void qsort (void* base, size_t count, size_t size,
77             int (*compare) (const void*, const void*));
78
79 /* Non-ANSI functions */
80 #ifndef __STRICT_ANSI__
81 void __fastcall__ _swap (void* p, void* q, size_t size);
82 char* __fastcall__ itoa (int val, char* buf, int radix);
83 char* __fastcall__ utoa (unsigned val, char* buf, int radix);
84 char* __fastcall__ ltoa (long val, char* buf, int radix);
85 char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);
86 #endif
87
88
89
90 /* End of stdlib.h */
91 #endif
92
93
94