source: src/libcfa/stdlib @ 53ba273

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 53ba273 was 53ba273, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

switch from std=c99 to std=gnu99, update latex macros, refrat and extend user manual, update limits/iostream/fstream, add rational numbers

  • Property mode set to 100644
File size: 4.1 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 : Fri Apr  1 22:26:14 2016
13// Update Count     : 73
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 );
24forall( otype T ) T * malloc( char fill );
25forall( otype T ) T * malloc( T * ptr, size_t size );
26forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill );
27forall( otype T ) T * calloc( size_t size );
28forall( otype T ) T * realloc( T * ptr, size_t size );
29forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
30
31forall( otype T ) T * aligned_alloc( size_t alignment );
32forall( otype T ) T * memalign( size_t alignment );             // deprecated
33forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
34
35forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
36forall( otype T ) T * memset( T * ptr );                                // remove when default value available
37
38//---------------------------------------
39
40int ato( const char * ptr );
41unsigned int ato( const char * ptr );
42long int ato( const char * ptr );
43unsigned long int ato( const char * ptr );
44long long int ato( const char * ptr );
45unsigned long long int ato( const char * ptr );
46float ato( const char * ptr );
47double ato( const char * ptr );
48long double ato( const char * ptr );
49float _Complex ato( const char * ptr );
50double _Complex ato( const char * ptr );
51long double _Complex ato( const char * ptr );
52
53int strto( const char * sptr, char ** eptr, int base );
54unsigned int strto( const char * sptr, char ** eptr, int base );
55long int strto( const char * sptr, char ** eptr, int base );
56unsigned long int strto( const char * sptr, char ** eptr, int base );
57long long int strto( const char * sptr, char ** eptr, int base );
58unsigned long long int strto( const char * sptr, char ** eptr, int base );
59float strto( const char * sptr, char ** eptr );
60double strto( const char * sptr, char ** eptr );
61long double strto( const char * sptr, char ** eptr );
62float _Complex strto( const char * sptr, char ** eptr );
63double _Complex strto( const char * sptr, char ** eptr );
64long double _Complex strto( const char * sptr, char ** eptr );
65
66//---------------------------------------
67
68forall( otype T | { int ?<?( T, T ); } )
69T * bsearch( const T key, const T * arr, size_t dimension );
70
71forall( otype T | { int ?<?( T, T ); } )
72void qsort( const T * arr, size_t dimension );
73
74//---------------------------------------
75
76forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
77[ T, T ] div( T t1, T t2 );
78
79//---------------------------------------
80
81char abs( char );
82extern "C" {
83int abs( int );                         // use default C routine for int
84} // extern "C"
85long int abs( long int );
86long long int abs( long long int );
87float abs( float );
88double abs( double );
89long double abs( long double );
90float _Complex abs( float _Complex );
91double _Complex abs( double _Complex );
92long double _Complex abs( long double _Complex );
93
94//---------------------------------------
95
96float floor( float );
97extern "C" {
98double floor( double );         // use C routine for double
99} // extern "C"
100long double floor( long double );
101
102float ceil( float );
103extern "C" {
104double ceil( double );          // use C routine for double
105} // extern "C"
106long double ceil( long double );
107
108//---------------------------------------
109
110void rand48seed( long int s );
111char rand48();
112int rand48();
113unsigned int rand48();
114long int rand48();
115unsigned long int rand48();
116float rand48();
117double rand48();
118float _Complex rand48();
119double _Complex rand48();
120long double _Complex rand48();
121
122//---------------------------------------
123
124forall( otype T | { int ?<?( T, T ); } )
125T min( const T t1, const T t2 );
126
127forall( otype T | { int ?>?( T, T ); } )
128T max( const T t1, const T t2 );
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.