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 : Tue Apr 19 21:21:53 2016
|
---|
13 | // Update Count : 93
|
---|
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" {
|
---|
36 | void * malloc( size_t ); // use default C routine for void *
|
---|
37 | } // extern "C"
|
---|
38 | forall( otype T ) T * malloc( void );
|
---|
39 | forall( otype T ) T * malloc( char fill );
|
---|
40 | forall( otype T ) T * malloc( T * ptr, size_t size );
|
---|
41 | forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
|
---|
42 | extern "C" {
|
---|
43 | void * calloc( size_t nmemb, size_t size ); // use default C routine for void *
|
---|
44 | } // extern "C"
|
---|
45 | forall( otype T ) T * calloc( size_t nmemb );
|
---|
46 | extern "C" {
|
---|
47 | void * realloc( void * ptr, size_t size ); // use default C routine for void *
|
---|
48 | } // extern "C"
|
---|
49 | forall( otype T ) T * realloc( T * ptr, size_t size );
|
---|
50 | forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
|
---|
51 |
|
---|
52 | forall( otype T ) T * aligned_alloc( size_t alignment );
|
---|
53 | forall( otype T ) T * memalign( size_t alignment );
|
---|
54 | forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
|
---|
55 |
|
---|
56 | extern "C" {
|
---|
57 | void * memset( void * ptr, int fill, size_t size );
|
---|
58 | void free( void * ptr );
|
---|
59 | } // extern "C"
|
---|
60 |
|
---|
61 | //---------------------------------------
|
---|
62 |
|
---|
63 | int ato( const char * ptr );
|
---|
64 | unsigned int ato( const char * ptr );
|
---|
65 | long int ato( const char * ptr );
|
---|
66 | unsigned long int ato( const char * ptr );
|
---|
67 | long long int ato( const char * ptr );
|
---|
68 | unsigned long long int ato( const char * ptr );
|
---|
69 | float ato( const char * ptr );
|
---|
70 | double ato( const char * ptr );
|
---|
71 | long double ato( const char * ptr );
|
---|
72 | float _Complex ato( const char * ptr );
|
---|
73 | double _Complex ato( const char * ptr );
|
---|
74 | long double _Complex ato( const char * ptr );
|
---|
75 |
|
---|
76 | int strto( const char * sptr, char ** eptr, int base );
|
---|
77 | unsigned int strto( const char * sptr, char ** eptr, int base );
|
---|
78 | long int strto( const char * sptr, char ** eptr, int base );
|
---|
79 | unsigned long int strto( const char * sptr, char ** eptr, int base );
|
---|
80 | long long int strto( const char * sptr, char ** eptr, int base );
|
---|
81 | unsigned long long int strto( const char * sptr, char ** eptr, int base );
|
---|
82 | float strto( const char * sptr, char ** eptr );
|
---|
83 | double strto( const char * sptr, char ** eptr );
|
---|
84 | long double strto( const char * sptr, char ** eptr );
|
---|
85 | float _Complex strto( const char * sptr, char ** eptr );
|
---|
86 | double _Complex strto( const char * sptr, char ** eptr );
|
---|
87 | long double _Complex strto( const char * sptr, char ** eptr );
|
---|
88 |
|
---|
89 | //---------------------------------------
|
---|
90 |
|
---|
91 | forall( otype T | { int ?<?( T, T ); } )
|
---|
92 | T * bsearch( const T key, const T * arr, size_t dimension );
|
---|
93 |
|
---|
94 | forall( otype T | { int ?<?( T, T ); } )
|
---|
95 | void qsort( const T * arr, size_t dimension );
|
---|
96 |
|
---|
97 | //---------------------------------------
|
---|
98 |
|
---|
99 | forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
|
---|
100 | [ T, T ] div( T t1, T t2 );
|
---|
101 |
|
---|
102 | //---------------------------------------
|
---|
103 |
|
---|
104 | char abs( char );
|
---|
105 | extern "C" {
|
---|
106 | int abs( int ); // use default C routine for int
|
---|
107 | } // extern "C"
|
---|
108 | long int abs( long int );
|
---|
109 | long long int abs( long long int );
|
---|
110 | float abs( float );
|
---|
111 | double abs( double );
|
---|
112 | long double abs( long double );
|
---|
113 | float _Complex abs( float _Complex );
|
---|
114 | double _Complex abs( double _Complex );
|
---|
115 | long double _Complex abs( long double _Complex );
|
---|
116 |
|
---|
117 | //---------------------------------------
|
---|
118 |
|
---|
119 | float floor( float );
|
---|
120 | extern "C" {
|
---|
121 | double floor( double ); // use C routine for double
|
---|
122 | } // extern "C"
|
---|
123 | long double floor( long double );
|
---|
124 |
|
---|
125 | float ceil( float );
|
---|
126 | extern "C" {
|
---|
127 | double ceil( double ); // use C routine for double
|
---|
128 | } // extern "C"
|
---|
129 | long double ceil( long double );
|
---|
130 |
|
---|
131 | //---------------------------------------
|
---|
132 |
|
---|
133 | void rand48seed( long int s );
|
---|
134 | char rand48();
|
---|
135 | int rand48();
|
---|
136 | unsigned int rand48();
|
---|
137 | long int rand48();
|
---|
138 | unsigned long int rand48();
|
---|
139 | float rand48();
|
---|
140 | double rand48();
|
---|
141 | float _Complex rand48();
|
---|
142 | double _Complex rand48();
|
---|
143 | long double _Complex rand48();
|
---|
144 |
|
---|
145 | //---------------------------------------
|
---|
146 |
|
---|
147 | forall( otype T | { int ?<?( T, T ); } )
|
---|
148 | T min( const T t1, const T t2 );
|
---|
149 |
|
---|
150 | forall( otype T | { int ?>?( T, T ); } )
|
---|
151 | T max( const T t1, const T t2 );
|
---|
152 |
|
---|
153 | forall( otype T )
|
---|
154 | void swap( T * t1, T * t2 );
|
---|
155 |
|
---|
156 | // Local Variables: //
|
---|
157 | // mode: c //
|
---|
158 | // tab-width: 4 //
|
---|
159 | // End: //
|
---|