[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 | //
|
---|
| 7 | // stdlib --
|
---|
| 8 | //
|
---|
| 9 | // Author : Peter A. Buhr
|
---|
| 10 | // Created On : Thu Jan 28 17:12:35 2016
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
[45161b4d] | 12 | // Last Modified On : Wed Apr 13 14:45:53 2016
|
---|
| 13 | // Update Count : 85
|
---|
[bd85400] | 14 | //
|
---|
| 15 |
|
---|
| 16 | //---------------------------------------
|
---|
| 17 |
|
---|
| 18 | extern "C" {
|
---|
| 19 | #include <stddef.h> // size_t
|
---|
| 20 | } // extern "C"
|
---|
| 21 |
|
---|
[45161b4d] | 22 | //---------------------------------------
|
---|
| 23 |
|
---|
[3849857] | 24 | extern "C" {
|
---|
[45161b4d] | 25 | #ifndef EXIT_FAILURE
|
---|
| 26 | #define EXIT_FAILURE 1 // failing exit status
|
---|
| 27 | #define EXIT_SUCCESS 0 // successful exit status
|
---|
| 28 | #endif // ! EXIT_FAILURE
|
---|
| 29 | void exit( int rc );
|
---|
[3849857] | 30 | } // extern "C"
|
---|
[45161b4d] | 31 |
|
---|
| 32 | //---------------------------------------
|
---|
| 33 |
|
---|
| 34 | extern "C" {
|
---|
| 35 | void * malloc( size_t ); // use default C routine for void *
|
---|
| 36 | } // extern "C"
|
---|
| 37 | forall( otype T ) T * malloc( void );
|
---|
[4040425] | 38 | forall( otype T ) T * malloc( char fill );
|
---|
| 39 | forall( otype T ) T * malloc( T * ptr, size_t size );
|
---|
| 40 | forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
|
---|
[45161b4d] | 41 | extern "C" {
|
---|
| 42 | void * calloc( size_t nmemb, size_t size ); // use default C routine for void *
|
---|
| 43 | } // extern "C"
|
---|
| 44 | forall( otype T ) T * calloc( size_t nmemb );
|
---|
| 45 | extern "C" {
|
---|
| 46 | void * realloc( void * ptr, size_t size ); // use default C routine for void *
|
---|
| 47 | } // extern "C"
|
---|
[4040425] | 48 | forall( otype T ) T * realloc( T * ptr, size_t size );
|
---|
| 49 | forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
|
---|
[bd85400] | 50 |
|
---|
[4040425] | 51 | forall( otype T ) T * aligned_alloc( size_t alignment );
|
---|
| 52 | forall( otype T ) T * memalign( size_t alignment ); // deprecated
|
---|
| 53 | forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
|
---|
[bd85400] | 54 |
|
---|
[0438091] | 55 | forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
|
---|
| 56 | forall( otype T ) T * memset( T * ptr ); // remove when default value available
|
---|
| 57 |
|
---|
[bd85400] | 58 | //---------------------------------------
|
---|
| 59 |
|
---|
| 60 | int ato( const char * ptr );
|
---|
| 61 | unsigned int ato( const char * ptr );
|
---|
| 62 | long int ato( const char * ptr );
|
---|
| 63 | unsigned long int ato( const char * ptr );
|
---|
| 64 | long long int ato( const char * ptr );
|
---|
| 65 | unsigned long long int ato( const char * ptr );
|
---|
| 66 | float ato( const char * ptr );
|
---|
| 67 | double ato( const char * ptr );
|
---|
| 68 | long double ato( const char * ptr );
|
---|
| 69 | float _Complex ato( const char * ptr );
|
---|
| 70 | double _Complex ato( const char * ptr );
|
---|
| 71 | long double _Complex ato( const char * ptr );
|
---|
| 72 |
|
---|
| 73 | int strto( const char * sptr, char ** eptr, int base );
|
---|
| 74 | unsigned int strto( const char * sptr, char ** eptr, int base );
|
---|
| 75 | long int strto( const char * sptr, char ** eptr, int base );
|
---|
| 76 | unsigned long int strto( const char * sptr, char ** eptr, int base );
|
---|
| 77 | long long int strto( const char * sptr, char ** eptr, int base );
|
---|
| 78 | unsigned long long int strto( const char * sptr, char ** eptr, int base );
|
---|
| 79 | float strto( const char * sptr, char ** eptr );
|
---|
| 80 | double strto( const char * sptr, char ** eptr );
|
---|
| 81 | long double strto( const char * sptr, char ** eptr );
|
---|
| 82 | float _Complex strto( const char * sptr, char ** eptr );
|
---|
| 83 | double _Complex strto( const char * sptr, char ** eptr );
|
---|
| 84 | long double _Complex strto( const char * sptr, char ** eptr );
|
---|
| 85 |
|
---|
| 86 | //---------------------------------------
|
---|
| 87 |
|
---|
[4040425] | 88 | forall( otype T | { int ?<?( T, T ); } )
|
---|
[bd85400] | 89 | T * bsearch( const T key, const T * arr, size_t dimension );
|
---|
| 90 |
|
---|
[4040425] | 91 | forall( otype T | { int ?<?( T, T ); } )
|
---|
[bd85400] | 92 | void qsort( const T * arr, size_t dimension );
|
---|
| 93 |
|
---|
| 94 | //---------------------------------------
|
---|
| 95 |
|
---|
[4040425] | 96 | forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
|
---|
[bd85400] | 97 | [ T, T ] div( T t1, T t2 );
|
---|
| 98 |
|
---|
| 99 | //---------------------------------------
|
---|
| 100 |
|
---|
| 101 | char abs( char );
|
---|
| 102 | extern "C" {
|
---|
[45161b4d] | 103 | int abs( int ); // use default C routine for int
|
---|
[53ba273] | 104 | } // extern "C"
|
---|
[bd85400] | 105 | long int abs( long int );
|
---|
| 106 | long long int abs( long long int );
|
---|
| 107 | float abs( float );
|
---|
| 108 | double abs( double );
|
---|
| 109 | long double abs( long double );
|
---|
| 110 | float _Complex abs( float _Complex );
|
---|
| 111 | double _Complex abs( double _Complex );
|
---|
| 112 | long double _Complex abs( long double _Complex );
|
---|
| 113 |
|
---|
| 114 | //---------------------------------------
|
---|
| 115 |
|
---|
[53ba273] | 116 | float floor( float );
|
---|
| 117 | extern "C" {
|
---|
[45161b4d] | 118 | double floor( double ); // use C routine for double
|
---|
[53ba273] | 119 | } // extern "C"
|
---|
| 120 | long double floor( long double );
|
---|
| 121 |
|
---|
| 122 | float ceil( float );
|
---|
| 123 | extern "C" {
|
---|
[45161b4d] | 124 | double ceil( double ); // use C routine for double
|
---|
[53ba273] | 125 | } // extern "C"
|
---|
| 126 | long double ceil( long double );
|
---|
| 127 |
|
---|
| 128 | //---------------------------------------
|
---|
| 129 |
|
---|
[0438091] | 130 | void rand48seed( long int s );
|
---|
| 131 | char rand48();
|
---|
| 132 | int rand48();
|
---|
| 133 | unsigned int rand48();
|
---|
| 134 | long int rand48();
|
---|
| 135 | unsigned long int rand48();
|
---|
| 136 | float rand48();
|
---|
| 137 | double rand48();
|
---|
| 138 | float _Complex rand48();
|
---|
| 139 | double _Complex rand48();
|
---|
| 140 | long double _Complex rand48();
|
---|
[bd85400] | 141 |
|
---|
| 142 | //---------------------------------------
|
---|
| 143 |
|
---|
[4040425] | 144 | forall( otype T | { int ?<?( T, T ); } )
|
---|
[bd85400] | 145 | T min( const T t1, const T t2 );
|
---|
| 146 |
|
---|
[4040425] | 147 | forall( otype T | { int ?>?( T, T ); } )
|
---|
[bd85400] | 148 | T max( const T t1, const T t2 );
|
---|
| 149 |
|
---|
[4040425] | 150 | forall( otype T )
|
---|
[bd85400] | 151 | void swap( T * t1, T * t2 );
|
---|
| 152 |
|
---|
| 153 | // Local Variables: //
|
---|
| 154 | // mode: c //
|
---|
| 155 | // tab-width: 4 //
|
---|
| 156 | // End: //
|
---|