source: src/libcfa/stdlib @ bb82c03

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since bb82c03 was bb82c03, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Removed #ifdef for CFORALL in libcfa headers

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