[bd85400] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[627f585] | 7 | // stdlib -- |
---|
[bd85400] | 8 | // |
---|
| 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Thu Jan 28 17:12:35 2016 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[a797e2b1] | 12 | // Last Modified On : Wed Jul 6 14:28:55 2016 |
---|
| 13 | // Update Count : 99 |
---|
[bd85400] | 14 | // |
---|
| 15 | |
---|
| 16 | //--------------------------------------- |
---|
| 17 | |
---|
[3849857] | 18 | extern "C" { |
---|
[45161b4d] | 19 | #ifndef EXIT_FAILURE |
---|
| 20 | #define EXIT_FAILURE 1 // failing exit status |
---|
| 21 | #define EXIT_SUCCESS 0 // successful exit status |
---|
| 22 | #endif // ! EXIT_FAILURE |
---|
[3849857] | 23 | } // extern "C" |
---|
[45161b4d] | 24 | |
---|
| 25 | //--------------------------------------- |
---|
| 26 | |
---|
[6e991d6] | 27 | extern "C" { void * malloc( size_t ); } // use default C routine for void * |
---|
[45161b4d] | 28 | forall( otype T ) T * malloc( void ); |
---|
[4040425] | 29 | forall( otype T ) T * malloc( char fill ); |
---|
| 30 | forall( otype T ) T * malloc( T * ptr, size_t size ); |
---|
| 31 | forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ); |
---|
[6e991d6] | 32 | extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void * |
---|
[45161b4d] | 33 | forall( otype T ) T * calloc( size_t nmemb ); |
---|
[6e991d6] | 34 | extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void * |
---|
[4040425] | 35 | forall( otype T ) T * realloc( T * ptr, size_t size ); |
---|
| 36 | forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ); |
---|
[bd85400] | 37 | |
---|
[4040425] | 38 | forall( otype T ) T * aligned_alloc( size_t alignment ); |
---|
[b72bad4f] | 39 | forall( otype T ) T * memalign( size_t alignment ); // deprecated |
---|
[4040425] | 40 | forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ); |
---|
[bd85400] | 41 | |
---|
[6b6597c] | 42 | extern "C" { |
---|
| 43 | void * memset( void * ptr, int fill, size_t size ); |
---|
| 44 | void free( void * ptr ); |
---|
| 45 | } // extern "C" |
---|
[0438091] | 46 | |
---|
[627f585] | 47 | forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p ); |
---|
| 48 | forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr ); |
---|
| 49 | |
---|
| 50 | |
---|
[bd85400] | 51 | //--------------------------------------- |
---|
| 52 | |
---|
| 53 | int ato( const char * ptr ); |
---|
| 54 | unsigned int ato( const char * ptr ); |
---|
| 55 | long int ato( const char * ptr ); |
---|
| 56 | unsigned long int ato( const char * ptr ); |
---|
| 57 | long long int ato( const char * ptr ); |
---|
| 58 | unsigned long long int ato( const char * ptr ); |
---|
| 59 | float ato( const char * ptr ); |
---|
| 60 | double ato( const char * ptr ); |
---|
| 61 | long double ato( const char * ptr ); |
---|
| 62 | float _Complex ato( const char * ptr ); |
---|
| 63 | double _Complex ato( const char * ptr ); |
---|
| 64 | long double _Complex ato( const char * ptr ); |
---|
| 65 | |
---|
| 66 | int strto( const char * sptr, char ** eptr, int base ); |
---|
| 67 | unsigned int strto( const char * sptr, char ** eptr, int base ); |
---|
| 68 | long int strto( const char * sptr, char ** eptr, int base ); |
---|
| 69 | unsigned long int strto( const char * sptr, char ** eptr, int base ); |
---|
| 70 | long long int strto( const char * sptr, char ** eptr, int base ); |
---|
| 71 | unsigned long long int strto( const char * sptr, char ** eptr, int base ); |
---|
| 72 | float strto( const char * sptr, char ** eptr ); |
---|
| 73 | double strto( const char * sptr, char ** eptr ); |
---|
| 74 | long double strto( const char * sptr, char ** eptr ); |
---|
| 75 | float _Complex strto( const char * sptr, char ** eptr ); |
---|
| 76 | double _Complex strto( const char * sptr, char ** eptr ); |
---|
| 77 | long double _Complex strto( const char * sptr, char ** eptr ); |
---|
| 78 | |
---|
| 79 | //--------------------------------------- |
---|
| 80 | |
---|
[4040425] | 81 | forall( otype T | { int ?<?( T, T ); } ) |
---|
[a797e2b1] | 82 | T * bsearch( T key, const T * arr, size_t dimension ); |
---|
[bd85400] | 83 | |
---|
[4040425] | 84 | forall( otype T | { int ?<?( T, T ); } ) |
---|
[bd85400] | 85 | void qsort( const T * arr, size_t dimension ); |
---|
| 86 | |
---|
| 87 | //--------------------------------------- |
---|
| 88 | |
---|
[4040425] | 89 | forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } ) |
---|
[bd85400] | 90 | [ T, T ] div( T t1, T t2 ); |
---|
| 91 | |
---|
| 92 | //--------------------------------------- |
---|
| 93 | |
---|
| 94 | char abs( char ); |
---|
[6e991d6] | 95 | extern "C" { int abs( int ); } // use default C routine for int |
---|
[bd85400] | 96 | long int abs( long int ); |
---|
| 97 | long long int abs( long long int ); |
---|
| 98 | float abs( float ); |
---|
| 99 | double abs( double ); |
---|
| 100 | long double abs( long double ); |
---|
[6e991d6] | 101 | float abs( float _Complex ); |
---|
| 102 | double abs( double _Complex ); |
---|
| 103 | long double abs( long double _Complex ); |
---|
[53ba273] | 104 | |
---|
| 105 | //--------------------------------------- |
---|
| 106 | |
---|
[0438091] | 107 | void rand48seed( long int s ); |
---|
| 108 | char rand48(); |
---|
| 109 | int rand48(); |
---|
| 110 | unsigned int rand48(); |
---|
| 111 | long int rand48(); |
---|
| 112 | unsigned long int rand48(); |
---|
| 113 | float rand48(); |
---|
| 114 | double rand48(); |
---|
| 115 | float _Complex rand48(); |
---|
| 116 | double _Complex rand48(); |
---|
| 117 | long double _Complex rand48(); |
---|
[bd85400] | 118 | |
---|
| 119 | //--------------------------------------- |
---|
| 120 | |
---|
[4040425] | 121 | forall( otype T | { int ?<?( T, T ); } ) |
---|
[a797e2b1] | 122 | T min( T t1, T t2 ); |
---|
[bd85400] | 123 | |
---|
[4040425] | 124 | forall( otype T | { int ?>?( T, T ); } ) |
---|
[a797e2b1] | 125 | T max( T t1, T t2 ); |
---|
[bd85400] | 126 | |
---|
[a9f2c13] | 127 | forall( otype T | { T min( T, T ); T max( T, T ); } ) |
---|
[a797e2b1] | 128 | T clamp( T value, T min_val, T max_val ); |
---|
[a9f2c13] | 129 | |
---|
[4040425] | 130 | forall( otype T ) |
---|
[bd85400] | 131 | void swap( T * t1, T * t2 ); |
---|
| 132 | |
---|
| 133 | // Local Variables: // |
---|
| 134 | // mode: c // |
---|
| 135 | // tab-width: 4 // |
---|
| 136 | // End: // |
---|