00001 //& **************************************************************************** 00002 //& 00003 //& Written by Ingo Blank, August 2004 00004 //& Donated to the HP-GCC Development Team 00005 //& Copyright (C) 2004 The HP-GCC Development Team 00006 //& 00007 //& **************************************************************************** 00008 //& 00009 //& 00010 //& This file is part of HP-GCC. 00011 //& 00012 //& HP-GCC is free software; you can redistribute it and/or modify 00013 //& it under the terms of the GNU General Public License as published by 00014 //& the Free Software Foundation; either version 2, or (at your option) 00015 //& any later version. 00016 //& 00017 //& HP-GCC is distributed in the hope that it will be useful, 00018 //& but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 //& MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 //& GNU General Public License for more details. 00021 //& 00022 //& You should have received a copy of the GNU General Public License 00023 //& along with HP-GCC; see the file COPYING. 00024 //& 00025 //& As a special exception, you may use this file as part of a free software 00026 //& library without restriction. Specifically, if other files instantiate 00027 //& templates or use macros or inline functions from this file, or you compile 00028 //& this file and link it with other files to produce an executable, this 00029 //& file does not by itself cause the resulting executable to be covered by 00030 //& the GNU General Public License. This exception does not however 00031 //& invalidate any other reasons why the executable file might be covered by 00032 //& the GNU General Public License. 00033 //& 00034 //& **************************************************************************** 00035 00036 00041 #ifndef _HPSTDLIB_H 00042 #define _HPSTDLIB_H 00043 00044 00045 // LONG TYPE DEFINITION, ADDED BY CLAUDIO 01/14/05 00046 #ifndef _LONGLONG_DEF 00047 typedef unsigned long long ULONGLONG; 00048 typedef long long LONGLONG; 00049 #define _LONGLONG_DEF 00050 #endif 00051 00052 00053 00054 #include <hpsys.h> 00055 00056 // TODO: Doxygen (ibl) 00057 // abstract PRNG descriptor 00058 typedef unsigned (*RNDFUNC)(int); 00059 typedef void (*SRNDFUNC)(unsigned); 00060 00061 // dispatch pointer 00062 extern RNDFUNC rand_hook; 00063 extern SRNDFUNC srand_hook; 00064 00065 00069 void *malloc(size_t); 00070 00071 00075 void free(void *); 00076 00077 00081 void *calloc(size_t, size_t); 00082 00087 void * realloc(void *oldp, size_t size); 00088 00089 00090 00091 00092 // runtime 00093 00097 void exit(int); 00098 00099 00103 int atexit(void(*__func)(void)); 00104 00105 00106 00107 // misc 00108 00117 unsigned mwc(int bits); // multiply with carry 32 bit pseudo RNG 00118 00119 00120 // misc 00121 00129 unsigned int rand(void); 00130 unsigned int rand_bits(int bits); 00131 00132 00133 // misc 00134 00144 void srand(unsigned int seed); // multiply with carry 32 bit pseudo RNG 00145 00146 00147 int memcmp(const void *s1, const void *s2, size_t n); //Memory Compare 00148 //Al Nov '04 - TODO: Documentation? 00149 00155 void 00156 qsort(void *base, size_t n_elements, size_t width,int (*compar)(const void *, const void *)); 00157 00166 void * 00167 bsearch(register const void *key, register const void *base, 00168 register size_t n_elements, register size_t size, 00169 int (*compar)(const void *, const void *)); 00170 00171 00172 #endif