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