source: src/libcfa/stdlib @ 02ad3f5

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

fix stdlib memory allocation, iostream documentation

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