HPGCC3 Documentation 3.0 R003

stdlib.h File Reference

Standard library. More...

#include <sys.h>

Go to the source code of this file.

Defines

#define _LONGLONG_DEF
#define INVALID_PTR   0
 Constant to use with getheapblockinfo()
#define BLOCK_USED   1
 Constant to use with getheapblockinfo()
#define BLOCK_FREE   -1
 Constant to use with getheapblockinfo()
#define RAND_MAX   0x7FFFFFFF

Typedefs

typedef unsigned long long ULONGLONG
typedef long long LONGLONG
typedef unsigned(* RNDFUNC )(int)
typedef void(* SRNDFUNC )(unsigned)

Functions

void * malloc (size_t)
 Standard C library function.
void free (void *)
 Standard C library function.
int freemem ()
 Return available free memory in bytes.
void * calloc (size_t, size_t)
 Standard C library function.
void * realloc (void *oldp, size_t size)
 Standard C library function.
int getheapblockinfo (void *ptr, void **blkstart, size_t *blksize)
 Get information about a heap pointer.
void exit (int)
 Standard C library function.
int atexit (void(*__func)(void))
 Standard C library function.
unsigned mwc (int bits)
 32 bit multiply with carry pseudo RNG
int rand (void)
 wrapper for concrete PRNG implementation If srand() has not been called before the first invocation, srand(1) is being called implicitly.
unsigned int rand_bits (int bits)
void srand (unsigned int seed)
 seeds the random sequence with seed. If seed == 0, use entropic seeding based on current time. In this case, the sequence should be nearly unreproduceable, given a sufficient long cycle length of the RNG, which is the case for mwc().
int memcmp (const void *s1, const void *s2, size_t n)
void qsort (void *base, size_t n_elements, size_t width, int(*compar)(const void *, const void *))
 Standard C library function.
void * bsearch (register const void *key, register const void *base, register size_t n_elements, register size_t size, int(*compar)(const void *, const void *))
 Standard C library function.

Variables

RNDFUNC rand_hook
SRNDFUNC srand_hook

Detailed Description

Standard library.

Definition in file stdlib.h.


Define Documentation

#define _LONGLONG_DEF

Definition at line 22 of file stdlib.h.

#define BLOCK_FREE   -1

Constant to use with getheapblockinfo()

See also:
getheapblockinfo

Definition at line 49 of file stdlib.h.

#define BLOCK_USED   1

Constant to use with getheapblockinfo()

See also:
getheapblockinfo

Definition at line 45 of file stdlib.h.

#define INVALID_PTR   0

Constant to use with getheapblockinfo()

See also:
getheapblockinfo

Definition at line 41 of file stdlib.h.

#define RAND_MAX   0x7FFFFFFF

Definition at line 145 of file stdlib.h.


Typedef Documentation

typedef long long LONGLONG

Definition at line 21 of file stdlib.h.

typedef unsigned(* RNDFUNC)(int)

Definition at line 31 of file stdlib.h.

typedef void(* SRNDFUNC)(unsigned)

Definition at line 32 of file stdlib.h.

typedef unsigned long long ULONGLONG

Definition at line 20 of file stdlib.h.


Function Documentation

int atexit ( void(*)(void)  __func)

Standard C library function.

void * bsearch ( register const void *  key,
register const void *  base,
register size_t  n_elements,
register size_t  size,
int(*)(const void *, const void *)  compar 
)

Standard C library function.

void * calloc ( size_t  nelem,
size_t  elsize 
)

Standard C library function.

void exit ( int  )

Standard C library function.

void free ( void *  )

Standard C library function.

int freemem ( )

Return available free memory in bytes.

int getheapblockinfo ( void *  ptr,
void **  blkstart,
size_t *  blksize 
)

Get information about a heap pointer.

Obtain heap block information, given an arbitrary pointer.

Parameters:
ptrAny pointer to get information, does not necessarily need to be pointing to the start of a heap block, pointers within a block are acceptable.
blkstartAddress of a pointer to fill the block start information. If ptr falls within a block, its start address will be stored in *blkstart
blksizeAddress of a pointer to fill the block size information. If ptr falls within a block, its size will be stored in *blksize
Returns:
Status information about the block. Can be one of the following: INVALID_PTR = ptr does not fall within a block in the C-heap BLOCK_USED = ptr falls within a used block in the C heap, *blkstart and *blksize contain a valid address and size respectively. BLOCK_FREE = ptr falls within a previously free'd block, *blkstart and *blksize contain a valid address and size respectively.
See also:
malloc realloc free
void * malloc ( size_t  )

Standard C library function.

int memcmp ( const void *  s1,
const void *  s2,
size_t  n 
)
unsigned mwc ( int  bits)

32 bit multiply with carry pseudo RNG

Return values:
bitsbit pseudo random number.

Very fast PRNG with extreme cycle length.

Warning:
Don't use for cryptography.
void qsort ( void *  base,
size_t  n_elements,
size_t  width,
int(*)(const void *, const void *)  compar 
)

Standard C library function.

int rand ( void  )

wrapper for concrete PRNG implementation If srand() has not been called before the first invocation, srand(1) is being called implicitly.

Return values:
31bit pseudo random number.
Warning:
Don't use for cryptography. Use srand() first!
unsigned int rand_bits ( int  bits)
void * realloc ( void *  oldp,
size_t  size 
)

Standard C library function.

void srand ( unsigned int  seed)

seeds the random sequence with seed. If seed == 0, use entropic seeding based on current time. In this case, the sequence should be nearly unreproduceable, given a sufficient long cycle length of the RNG, which is the case for mwc().

Parameters:
seedThe seed value or 0 (zero) for a system time based value.
Warning:
Don't use for cryptography.

Variable Documentation