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