source: src/libcfa/stdlib @ 0438091

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

modify stdlib random to not use C library routine

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