source: src/libcfa/stdlib @ 627f585

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 627f585 was 627f585, checked in by Rob Schluntz <rschlunt@…>, 5 years ago

moved new and delete to stdlib

  • 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 : Wed Jul  6 14:28:55 2016
13// Update Count     : 99
14//
15
16//---------------------------------------
17
18extern "C" {
19#ifndef EXIT_FAILURE
20#define EXIT_FAILURE    1                                                               // failing exit status
21#define EXIT_SUCCESS    0                                                               // successful exit status
22#endif // ! EXIT_FAILURE
23} // extern "C"
24
25//---------------------------------------
26
27extern "C" { void * malloc( size_t ); }                                 // use default C routine for void *
28forall( otype T ) T * malloc( void );
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 );
32extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void *
33forall( otype T ) T * calloc( size_t nmemb );
34extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void *
35forall( otype T ) T * realloc( T * ptr, size_t size );
36forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
37
38forall( otype T ) T * aligned_alloc( size_t alignment );
39forall( otype T ) T * memalign( size_t alignment );             // deprecated
40forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
41
42extern "C" {
43void * memset( void * ptr, int fill, size_t size );
44void free( void * ptr );
45} // extern "C"
46
47forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p );
48forall( dtype T | { void ^?{}(T *); } ) void delete( T * ptr );
49
50
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
81forall( otype T | { int ?<?( T, T ); } )
82T * bsearch( T key, const T * arr, size_t dimension );
83
84forall( otype T | { int ?<?( T, T ); } )
85void qsort( const T * arr, size_t dimension );
86
87//---------------------------------------
88
89forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
90[ T, T ] div( T t1, T t2 );
91
92//---------------------------------------
93
94char abs( char );
95extern "C" { int abs( int ); }                                                  // use default C routine for int
96long int abs( long int );
97long long int abs( long long int );
98float abs( float );
99double abs( double );
100long double abs( long double );
101float abs( float _Complex );
102double abs( double _Complex );
103long double abs( long double _Complex );
104
105//---------------------------------------
106
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();
118
119//---------------------------------------
120
121forall( otype T | { int ?<?( T, T ); } )
122T min( T t1, T t2 );
123
124forall( otype T | { int ?>?( T, T ); } )
125T max( T t1, T t2 );
126
127forall( otype T | { T min( T, T ); T max( T, T ); } )
128T clamp( T value, T min_val, T max_val );
129
130forall( otype T )
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.