source: src/libcfa/stdlib @ 220ca4a

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

generate implicit typedef right after sue name appears, further fixes storage allocation routines and comments

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