source: src/libcfa/stdlib @ 159c62e

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

add small set of library types/routines to prelude to reduce including larger library files

  • Property mode set to 100644
File size: 4.2 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//
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
[159c62e]12// Last Modified On : Tue Jul  5 09:56:31 2016
13// Update Count     : 98
[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
[bd85400]47//---------------------------------------
48
49int ato( const char * ptr );
50unsigned int ato( const char * ptr );
51long int ato( const char * ptr );
52unsigned long int ato( const char * ptr );
53long long int ato( const char * ptr );
54unsigned long long int ato( const char * ptr );
55float ato( const char * ptr );
56double ato( const char * ptr );
57long double ato( const char * ptr );
58float _Complex ato( const char * ptr );
59double _Complex ato( const char * ptr );
60long double _Complex ato( const char * ptr );
61
62int strto( const char * sptr, char ** eptr, int base );
63unsigned int strto( const char * sptr, char ** eptr, int base );
64long int strto( const char * sptr, char ** eptr, int base );
65unsigned long int strto( const char * sptr, char ** eptr, int base );
66long long int strto( const char * sptr, char ** eptr, int base );
67unsigned long long int strto( const char * sptr, char ** eptr, int base );
68float strto( const char * sptr, char ** eptr );
69double strto( const char * sptr, char ** eptr );
70long double strto( const char * sptr, char ** eptr );
71float _Complex strto( const char * sptr, char ** eptr );
72double _Complex strto( const char * sptr, char ** eptr );
73long double _Complex strto( const char * sptr, char ** eptr );
74
75//---------------------------------------
76
[4040425]77forall( otype T | { int ?<?( T, T ); } )
[bd85400]78T * bsearch( const T key, const T * arr, size_t dimension );
79
[4040425]80forall( otype T | { int ?<?( T, T ); } )
[bd85400]81void qsort( const T * arr, size_t dimension );
82
83//---------------------------------------
84
[4040425]85forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
[bd85400]86[ T, T ] div( T t1, T t2 );
87
88//---------------------------------------
89
90char abs( char );
[6e991d6]91extern "C" { int abs( int ); }                                                  // use default C routine for int
[bd85400]92long int abs( long int );
93long long int abs( long long int );
94float abs( float );
95double abs( double );
96long double abs( long double );
[6e991d6]97float abs( float _Complex );
98double abs( double _Complex );
99long double abs( long double _Complex );
[53ba273]100
101//---------------------------------------
102
[0438091]103void rand48seed( long int s );
104char rand48();
105int rand48();
106unsigned int rand48();
107long int rand48();
108unsigned long int rand48();
109float rand48();
110double rand48();
111float _Complex rand48();
112double _Complex rand48();
113long double _Complex rand48();
[bd85400]114
115//---------------------------------------
116
[4040425]117forall( otype T | { int ?<?( T, T ); } )
[bd85400]118T min( const T t1, const T t2 );
119
[4040425]120forall( otype T | { int ?>?( T, T ); } )
[bd85400]121T max( const T t1, const T t2 );
122
[a9f2c13]123forall( otype T | { T min( T, T ); T max( T, T ); } )
124T clamp( const T value, const T min_val, const T max_val );
125
[4040425]126forall( otype T )
[bd85400]127void swap( T * t1, T * t2 );
128
129// Local Variables: //
130// mode: c //
131// tab-width: 4 //
132// End: //
Note: See TracBrowser for help on using the repository browser.