// // 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 Jul 6 14:28:55 2016 // Update Count : 99 // #ifndef STDLIB_H #define STDLIB_H //--------------------------------------- extern "C" { #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 // failing exit status #define EXIT_SUCCESS 0 // successful exit status #endif // ! EXIT_FAILURE } // extern "C" //--------------------------------------- extern "C" { void * malloc( size_t ); } // use default C routine for void * forall( dtype T | sized(T) ) T * malloc( void ); forall( dtype T | sized(T) ) T * malloc( char fill ); forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size ); forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill ); extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void * forall( dtype T | sized(T) ) T * calloc( size_t nmemb ); extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void * forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size ); forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill ); forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment ); forall( dtype T | sized(T) ) T * memalign( size_t alignment ); // deprecated forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment ); extern "C" { void * memset( void * ptr, int fill, size_t size ); void free( void * ptr ); } // extern "C" forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p ); forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr ); //--------------------------------------- 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 max( T t1, T t2 ); forall( otype T | { T min( T, T ); T max( T, T ); } ) T clamp( T value, T min_val, T max_val ); forall( otype T ) void swap( T * t1, T * t2 ); #endif // STDLIB_H // Local Variables: // // mode: c // // tab-width: 4 // // End: //