source: src/libcfa/stdlib @ dd0c97b

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 dd0c97b was 627f585, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

moved new and delete to stdlib

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