| 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 | 
|---|
| 12 | // Last Modified On : Wed Apr 27 22:03:29 2016 | 
|---|
| 13 | // Update Count     : 96 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | //--------------------------------------- | 
|---|
| 17 |  | 
|---|
| 18 | extern "C" { | 
|---|
| 19 | #include <stddef.h>                                                                             // size_t | 
|---|
| 20 | } // extern "C" | 
|---|
| 21 |  | 
|---|
| 22 | //--------------------------------------- | 
|---|
| 23 |  | 
|---|
| 24 | extern "C" { | 
|---|
| 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 ); | 
|---|
| 30 | void abort( void ); | 
|---|
| 31 | } // extern "C" | 
|---|
| 32 |  | 
|---|
| 33 | //--------------------------------------- | 
|---|
| 34 |  | 
|---|
| 35 | extern "C" { void * malloc( size_t ); }                                 // use default C routine for void * | 
|---|
| 36 | forall( otype T ) T * malloc( void ); | 
|---|
| 37 | forall( otype T ) T * malloc( char fill ); | 
|---|
| 38 | forall( otype T ) T * malloc( T * ptr, size_t size ); | 
|---|
| 39 | forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ); | 
|---|
| 40 | extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void * | 
|---|
| 41 | forall( otype T ) T * calloc( size_t nmemb ); | 
|---|
| 42 | extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void * | 
|---|
| 43 | forall( otype T ) T * realloc( T * ptr, size_t size ); | 
|---|
| 44 | forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ); | 
|---|
| 45 |  | 
|---|
| 46 | forall( otype T ) T * aligned_alloc( size_t alignment ); | 
|---|
| 47 | forall( otype T ) T * memalign( size_t alignment );             // deprecated | 
|---|
| 48 | forall( otype T ) int posix_memalign( T ** ptr, size_t alignment ); | 
|---|
| 49 |  | 
|---|
| 50 | extern "C" { | 
|---|
| 51 | void * memset( void * ptr, int fill, size_t size ); | 
|---|
| 52 | void free( void * ptr ); | 
|---|
| 53 | } // extern "C" | 
|---|
| 54 |  | 
|---|
| 55 | //--------------------------------------- | 
|---|
| 56 |  | 
|---|
| 57 | int ato( const char * ptr ); | 
|---|
| 58 | unsigned int ato( const char * ptr ); | 
|---|
| 59 | long int ato( const char * ptr ); | 
|---|
| 60 | unsigned long int ato( const char * ptr ); | 
|---|
| 61 | long long int ato( const char * ptr ); | 
|---|
| 62 | unsigned long long int ato( const char * ptr ); | 
|---|
| 63 | float ato( const char * ptr ); | 
|---|
| 64 | double ato( const char * ptr ); | 
|---|
| 65 | long double ato( const char * ptr ); | 
|---|
| 66 | float _Complex ato( const char * ptr ); | 
|---|
| 67 | double _Complex ato( const char * ptr ); | 
|---|
| 68 | long double _Complex ato( const char * ptr ); | 
|---|
| 69 |  | 
|---|
| 70 | int strto( const char * sptr, char ** eptr, int base ); | 
|---|
| 71 | unsigned int strto( const char * sptr, char ** eptr, int base ); | 
|---|
| 72 | long int strto( const char * sptr, char ** eptr, int base ); | 
|---|
| 73 | unsigned long int strto( const char * sptr, char ** eptr, int base ); | 
|---|
| 74 | long long int strto( const char * sptr, char ** eptr, int base ); | 
|---|
| 75 | unsigned long long int strto( const char * sptr, char ** eptr, int base ); | 
|---|
| 76 | float strto( const char * sptr, char ** eptr ); | 
|---|
| 77 | double strto( const char * sptr, char ** eptr ); | 
|---|
| 78 | long double strto( const char * sptr, char ** eptr ); | 
|---|
| 79 | float _Complex strto( const char * sptr, char ** eptr ); | 
|---|
| 80 | double _Complex strto( const char * sptr, char ** eptr ); | 
|---|
| 81 | long double _Complex strto( const char * sptr, char ** eptr ); | 
|---|
| 82 |  | 
|---|
| 83 | //--------------------------------------- | 
|---|
| 84 |  | 
|---|
| 85 | forall( otype T | { int ?<?( T, T ); } ) | 
|---|
| 86 | T * bsearch( const T key, const T * arr, size_t dimension ); | 
|---|
| 87 |  | 
|---|
| 88 | forall( otype T | { int ?<?( T, T ); } ) | 
|---|
| 89 | void qsort( const T * arr, size_t dimension ); | 
|---|
| 90 |  | 
|---|
| 91 | //--------------------------------------- | 
|---|
| 92 |  | 
|---|
| 93 | forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } ) | 
|---|
| 94 | [ T, T ] div( T t1, T t2 ); | 
|---|
| 95 |  | 
|---|
| 96 | //--------------------------------------- | 
|---|
| 97 |  | 
|---|
| 98 | char abs( char ); | 
|---|
| 99 | extern "C" { int abs( int ); }                                                  // use default C routine for int | 
|---|
| 100 | long int abs( long int ); | 
|---|
| 101 | long long int abs( long long int ); | 
|---|
| 102 | float abs( float ); | 
|---|
| 103 | double abs( double ); | 
|---|
| 104 | long double abs( long double ); | 
|---|
| 105 | float abs( float _Complex ); | 
|---|
| 106 | double abs( double _Complex ); | 
|---|
| 107 | long double abs( long double _Complex ); | 
|---|
| 108 |  | 
|---|
| 109 | //--------------------------------------- | 
|---|
| 110 |  | 
|---|
| 111 | void rand48seed( long int s ); | 
|---|
| 112 | char rand48(); | 
|---|
| 113 | int rand48(); | 
|---|
| 114 | unsigned int rand48(); | 
|---|
| 115 | long int rand48(); | 
|---|
| 116 | unsigned long int rand48(); | 
|---|
| 117 | float rand48(); | 
|---|
| 118 | double rand48(); | 
|---|
| 119 | float _Complex rand48(); | 
|---|
| 120 | double _Complex rand48(); | 
|---|
| 121 | long double _Complex rand48(); | 
|---|
| 122 |  | 
|---|
| 123 | //--------------------------------------- | 
|---|
| 124 |  | 
|---|
| 125 | forall( otype T | { int ?<?( T, T ); } ) | 
|---|
| 126 | T min( const T t1, const T t2 ); | 
|---|
| 127 |  | 
|---|
| 128 | forall( otype T | { int ?>?( T, T ); } ) | 
|---|
| 129 | T max( const T t1, const T t2 ); | 
|---|
| 130 |  | 
|---|
| 131 | forall( otype T ) | 
|---|
| 132 | void swap( T * t1, T * t2 ); | 
|---|
| 133 |  | 
|---|
| 134 | // Local Variables: // | 
|---|
| 135 | // mode: c // | 
|---|
| 136 | // tab-width: 4 // | 
|---|
| 137 | // End: // | 
|---|