source: src/libcfa/stdlib @ 17e5e2b

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

Added proper include guards to cfa headers so they can be added to the c++ include path without issues

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