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 Mar 2 17:38:21 2016
|
---|
13 | // Update Count : 64
|
---|
14 | //
|
---|
15 |
|
---|
16 | //---------------------------------------
|
---|
17 |
|
---|
18 | extern "C" {
|
---|
19 | #include <stddef.h> // size_t
|
---|
20 | } // extern "C"
|
---|
21 |
|
---|
22 | forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
|
---|
23 | forall( otype T ) T * memset( T * ptr ); // remove when default value available
|
---|
24 |
|
---|
25 | forall( otype T ) T * malloc( void );
|
---|
26 | forall( otype T ) T * malloc( char fill );
|
---|
27 | forall( otype T ) T * malloc( T * ptr, size_t size );
|
---|
28 | forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
|
---|
29 | forall( otype T ) T * calloc( size_t size );
|
---|
30 | forall( otype T ) T * realloc( T * ptr, size_t size );
|
---|
31 | forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
|
---|
32 |
|
---|
33 | forall( otype T ) T * aligned_alloc( size_t alignment );
|
---|
34 | forall( otype T ) T * memalign( size_t alignment ); // deprecated
|
---|
35 | forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
|
---|
36 |
|
---|
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 |
|
---|
67 | forall( otype T | { int ?<?( T, T ); } )
|
---|
68 | T * bsearch( const T key, const T * arr, size_t dimension );
|
---|
69 |
|
---|
70 | forall( otype T | { int ?<?( T, T ); } )
|
---|
71 | void qsort( const T * arr, size_t dimension );
|
---|
72 |
|
---|
73 | //---------------------------------------
|
---|
74 |
|
---|
75 | forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
|
---|
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 |
|
---|
95 | void randseed( long int s );
|
---|
96 | char random();
|
---|
97 | int random();
|
---|
98 | unsigned int random();
|
---|
99 | long int random();
|
---|
100 | unsigned long int random();
|
---|
101 | float random();
|
---|
102 | double random();
|
---|
103 | float _Complex random();
|
---|
104 | double _Complex random();
|
---|
105 | long double _Complex random();
|
---|
106 |
|
---|
107 | //---------------------------------------
|
---|
108 |
|
---|
109 | forall( otype T | { int ?<?( T, T ); } )
|
---|
110 | T min( const T t1, const T t2 );
|
---|
111 |
|
---|
112 | forall( otype T | { int ?>?( T, T ); } )
|
---|
113 | T max( const T t1, const T t2 );
|
---|
114 |
|
---|
115 | forall( otype T )
|
---|
116 | void swap( T * t1, T * t2 );
|
---|
117 |
|
---|
118 | // Local Variables: //
|
---|
119 | // mode: c //
|
---|
120 | // tab-width: 4 //
|
---|
121 | // End: //
|
---|