//
// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// stdlib -- 
//
// Author           : Peter A. Buhr
// Created On       : Thu Jan 28 17:12:35 2016
// Last Modified By : Peter A. Buhr
// Last Modified On : Wed Mar  2 17:38:21 2016
// Update Count     : 64
//

//---------------------------------------

extern "C" {
#include <stddef.h>										// size_t
} // extern "C"

forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
forall( otype T ) T * memset( T * ptr );					// remove when default value available

forall( otype T ) T * malloc( void );
forall( otype T ) T * malloc( char fill );
forall( otype T ) T * malloc( T * ptr, size_t size );
forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
forall( otype T ) T * calloc( size_t size );
forall( otype T ) T * realloc( T * ptr, size_t size );
forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );

forall( otype T ) T * aligned_alloc( size_t alignment );
forall( otype T ) T * memalign( size_t alignment );		// deprecated
forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );

//---------------------------------------

int ato( const char * ptr );
unsigned int ato( const char * ptr );
long int ato( const char * ptr );
unsigned long int ato( const char * ptr );
long long int ato( const char * ptr );
unsigned long long int ato( const char * ptr );
float ato( const char * ptr );
double ato( const char * ptr );
long double ato( const char * ptr );
float _Complex ato( const char * ptr );
double _Complex ato( const char * ptr );
long double _Complex ato( const char * ptr );

int strto( const char * sptr, char ** eptr, int base );
unsigned int strto( const char * sptr, char ** eptr, int base );
long int strto( const char * sptr, char ** eptr, int base );
unsigned long int strto( const char * sptr, char ** eptr, int base );
long long int strto( const char * sptr, char ** eptr, int base );
unsigned long long int strto( const char * sptr, char ** eptr, int base );
float strto( const char * sptr, char ** eptr );
double strto( const char * sptr, char ** eptr );
long double strto( const char * sptr, char ** eptr );
float _Complex strto( const char * sptr, char ** eptr );
double _Complex strto( const char * sptr, char ** eptr );
long double _Complex strto( const char * sptr, char ** eptr );

//---------------------------------------

forall( otype T | { int ?<?( T, T ); } )
T * bsearch( const T key, const T * arr, size_t dimension );

forall( otype T | { int ?<?( T, T ); } )
void qsort( const T * arr, size_t dimension );

//---------------------------------------

forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
[ T, T ] div( T t1, T t2 );

//---------------------------------------

char abs( char );
extern "C" {
int abs( int );		// use default C routine for int
} // extern
long int abs( long int );
long long int abs( long long int );
float abs( float );
double abs( double );
long double abs( long double );
float _Complex abs( float _Complex );
double _Complex abs( double _Complex );
long double _Complex abs( long double _Complex );

//---------------------------------------

void randseed( long int s );
char random();
int random();
unsigned int random();
long int random();
unsigned long int random();
float random();
double random();
float _Complex random();
double _Complex random();
long double _Complex random();

//---------------------------------------

forall( otype T | { int ?<?( T, T ); } )
T min( const T t1, const T t2 );

forall( otype T | { int ?>?( T, T ); } )
T max( const T t1, const T t2 );

forall( otype T )
void swap( T * t1, T * t2 );

// Local Variables: //
// mode: c //
// tab-width: 4 //
// End: //
