source: src/libcfa/stdlib @ 9d7b3ea

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

remove offsetof keyword, parser 0/1 names as structure fields, update examples to new stdlib, rename algorithms to stdlib, extend stdlib, use correct type for box parameters

  • Property mode set to 100644
File size: 3.8 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 Feb  5 15:21:18 2016
13// Update Count     : 61
14//
15
16//---------------------------------------
17
18extern "C" {
19#include <stddef.h>                                                                             // size_t
20} // extern "C"
21
22forall( type T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
23forall( type T ) T * memset( T * ptr );                                 // remove when default value available
24
25forall( type T ) T * malloc( void );
26forall( type T ) T * malloc( char fill );
27forall( type T ) T * malloc( size_t size );
28forall( type T ) T * malloc( T * ptr, size_t size );
29forall( type T ) T * malloc( T * ptr, size_t size, unsigned char fill );
30forall( type T ) T * calloc( size_t size );
31forall( type T ) T * realloc( T * ptr, size_t size );
32forall( type T ) T * realloc( T * ptr, size_t size, unsigned char fill );
33
34forall( type T ) T * aligned_alloc( size_t alignment );
35forall( type T ) T * memalign( size_t alignment );              // deprecated
36forall( type T ) int posix_memalign( T ** ptr, size_t alignment );
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( type T | { int ?<?( T, T ); } )
69T * bsearch( const T key, const T * arr, size_t dimension );
70
71forall( type T | { int ?<?( T, T ); } )
72void qsort( const T * arr, size_t dimension );
73
74//---------------------------------------
75
76forall( type 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
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
96void randseed( long int s );
97char random();
98int random();
99unsigned int random();
100long int random();
101unsigned long int random();
102float random();
103double random();
104float _Complex random();
105double _Complex random();
106long double _Complex random();
107
108//---------------------------------------
109
110forall( type T | { int ?<?( T, T ); } )
111T min( const T t1, const T t2 );
112
113forall( type T | { int ?>?( T, T ); } )
114T max( const T t1, const T t2 );
115
116forall( type T )
117void swap( T * t1, T * t2 );
118
119// Local Variables: //
120// mode: c //
121// tab-width: 4 //
122// End: //
Note: See TracBrowser for help on using the repository browser.