1 /*****************************************************************************/
5 /* General utilities */
9 /* (C) 1998-2002 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
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. */
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: */
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 */
32 /*****************************************************************************/
45 /* Standard exit codes */
46 #define EXIT_SUCCESS 0
47 #define EXIT_FAILURE 1
49 /* Return type of the div function */
55 /* Memory management */
56 void* __fastcall__ malloc (size_t size);
57 void* __fastcall__ calloc (size_t count, size_t size);
58 void* __fastcall__ realloc (void* block, size_t size);
59 void __fastcall__ free (void* block);
61 /* Non standard memory management functions */
63 void __fastcall__ _heapadd (void* mem, size_t size);
64 /* Add a block to the heap */
66 size_t __fastcall__ _heapmemavail (void);
67 /* Return the total free heap space */
69 size_t __fastcall__ _heapmaxavail (void);
70 /* Return the size of the largest free block on the heap */
73 #define RAND_MAX 0x7FFF
75 void __fastcall__ srand (unsigned seed);
76 void _randomize (void); /* Non-standard */
78 /* Other standard stuff */
80 int __fastcall__ abs (int val);
81 long __fastcall__ labs (long val);
82 int __fastcall__ atoi (const char* s);
83 long __fastcall__ atol (const char* s);
84 int __fastcall__ atexit (void (*exitfunc) (void));
85 void* bsearch (const void* key, const void* base, size_t n,
86 size_t size, int (*cmp) (const void*, const void*));
87 div_t __fastcall__ div (int numer, int denom);
88 void __fastcall__ exit (int ret);
89 char* __fastcall__ getenv (const char* name);
90 void qsort (void* base, size_t count, size_t size,
91 int (*compare) (const void*, const void*));
93 /* Non-ANSI functions */
94 void __fastcall__ _swap (void* p, void* q, size_t size);
95 #ifndef __STRICT_ANSI__
96 char* __fastcall__ itoa (int val, char* buf, int radix);
97 char* __fastcall__ utoa (unsigned val, char* buf, int radix);
98 char* __fastcall__ ltoa (long val, char* buf, int radix);
99 char* __fastcall__ ultoa (unsigned long val, char* buf, int radix);
104 /* End of stdlib.h */