source: src/libcfa/stdlib @ 58ed882

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 58ed882 was 8dc51c8, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

add void to empty parameter lists

  • Property mode set to 100644
File size: 4.7 KB
RevLine 
[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//
[bb82c03]7// stdlib --
[bd85400]8//
9// Author           : Peter A. Buhr
10// Created On       : Thu Jan 28 17:12:35 2016
11// Last Modified By : Peter A. Buhr
[8dc51c8]12// Last Modified On : Wed May 24 18:06:27 2017
13// Update Count     : 115
[bd85400]14//
15
[17e5e2b]16#ifndef STDLIB_H
17#define STDLIB_H
18
[bd85400]19//---------------------------------------
20
[3849857]21extern "C" {
[45161b4d]22#ifndef EXIT_FAILURE
23#define EXIT_FAILURE    1                                                               // failing exit status
24#define EXIT_SUCCESS    0                                                               // successful exit status
25#endif // ! EXIT_FAILURE
[3849857]26} // extern "C"
[45161b4d]27
28//---------------------------------------
29
[59239b8]30forall( dtype T | sized(T) ) T * malloc( void );
31forall( dtype T | sized(T) ) T * malloc( char fill );
32forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size );
33forall( dtype T | sized(T) ) T * malloc( T * ptr, size_t size, unsigned char fill );
[6e991d6]34extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void *
[59239b8]35forall( dtype T | sized(T) ) T * calloc( size_t nmemb );
[6e991d6]36extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void *
[59239b8]37forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size );
38forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size, unsigned char fill );
[bd85400]39
[59239b8]40forall( dtype T | sized(T) ) T * aligned_alloc( size_t alignment );
41forall( dtype T | sized(T) ) T * memalign( size_t alignment );          // deprecated
42forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment );
[bd85400]43
[59239b8]44forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
[627f585]45forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
[bf76eab]46forall( dtype T, ttype Params | { void ^?{}(T *); void delete(Params); } ) void delete( T * ptr, Params rest );
[627f585]47
[bd85400]48//---------------------------------------
49
50int ato( const char * ptr );
51unsigned int ato( const char * ptr );
52long int ato( const char * ptr );
53unsigned long int ato( const char * ptr );
54long long int ato( const char * ptr );
55unsigned long long int ato( const char * ptr );
56float ato( const char * ptr );
57double ato( const char * ptr );
58long double ato( const char * ptr );
59float _Complex ato( const char * ptr );
60double _Complex ato( const char * ptr );
61long double _Complex ato( const char * ptr );
62
63int strto( const char * sptr, char ** eptr, int base );
64unsigned int strto( const char * sptr, char ** eptr, int base );
65long int strto( const char * sptr, char ** eptr, int base );
66unsigned long int strto( const char * sptr, char ** eptr, int base );
67long long int strto( const char * sptr, char ** eptr, int base );
68unsigned long long int strto( const char * sptr, char ** eptr, int base );
69float strto( const char * sptr, char ** eptr );
70double strto( const char * sptr, char ** eptr );
71long double strto( const char * sptr, char ** eptr );
72float _Complex strto( const char * sptr, char ** eptr );
73double _Complex strto( const char * sptr, char ** eptr );
74long double _Complex strto( const char * sptr, char ** eptr );
75
76//---------------------------------------
77
[4040425]78forall( otype T | { int ?<?( T, T ); } )
[a797e2b1]79T * bsearch( T key, const T * arr, size_t dimension );
[f3ddc21]80
[707446a]81forall( otype T | { int ?<?( T, T ); } )
82unsigned int bsearch( T key, const T * arr, size_t dimension );
[bd85400]83
[f3ddc21]84
[4040425]85forall( otype T | { int ?<?( T, T ); } )
[bd85400]86void qsort( const T * arr, size_t dimension );
87
88//---------------------------------------
89
[4040425]90forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
[bd85400]91[ T, T ] div( T t1, T t2 );
92
93//---------------------------------------
94
[c3ebf37]95unsigned char abs( signed char );
[6e991d6]96extern "C" { int abs( int ); }                                                  // use default C routine for int
[c3ebf37]97unsigned long int abs( long int );
98unsigned long long int abs( long long int );
[bd85400]99float abs( float );
100double abs( double );
101long double abs( long double );
[6e991d6]102float abs( float _Complex );
103double abs( double _Complex );
104long double abs( long double _Complex );
[8dc51c8]105forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
[f3ddc21]106T abs( T );
[53ba273]107
108//---------------------------------------
109
[0438091]110void rand48seed( long int s );
[8dc51c8]111char rand48( void );
112int rand48( void );
113unsigned int rand48( void );
114long int rand48( void );
115unsigned long int rand48( void );
116float rand48( void );
117double rand48( void );
118float _Complex rand48( void );
119double _Complex rand48( void );
120long double _Complex rand48( void );
[bd85400]121
122//---------------------------------------
123
[4040425]124forall( otype T | { int ?<?( T, T ); } )
[a797e2b1]125T min( T t1, T t2 );
[bd85400]126
[4040425]127forall( otype T | { int ?>?( T, T ); } )
[a797e2b1]128T max( T t1, T t2 );
[bd85400]129
[a9f2c13]130forall( otype T | { T min( T, T ); T max( T, T ); } )
[a797e2b1]131T clamp( T value, T min_val, T max_val );
[a9f2c13]132
[4040425]133forall( otype T )
[bd85400]134void swap( T * t1, T * t2 );
135
[17e5e2b]136#endif // STDLIB_H
137
[bd85400]138// Local Variables: //
139// mode: c //
140// tab-width: 4 //
141// End: //
Note: See TracBrowser for help on using the repository browser.