Changeset 6e991d6 for src/libcfa
- Timestamp:
- Apr 21, 2016, 8:24:07 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 6812d89
- Parents:
- 6b6597c
- Location:
- src/libcfa
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/Makefile.am
r6b6597c r6e991d6 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Wed Apr 6 21:10:44201614 ## Update Count : 12 313 ## Last Modified On : Tue Apr 19 22:30:17 2016 14 ## Update Count : 124 15 15 ############################################################################### 16 16 … … 60 60 ${CC} ${CFLAGS} -c -o $@ $< 61 61 62 libs = limits stdlib iostream fstream iterator rational62 libs = limits stdlib math iostream fstream iterator rational 63 63 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c} 64 64 -
src/libcfa/Makefile.in
r6b6597c r6e991d6 83 83 libcfa_a_AR = $(AR) $(ARFLAGS) 84 84 libcfa_a_LIBADD = 85 am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) iostream.$(OBJEXT) \ 86 fstream.$(OBJEXT) iterator.$(OBJEXT) rational.$(OBJEXT) 85 am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) math.$(OBJEXT) \ 86 iostream.$(OBJEXT) fstream.$(OBJEXT) iterator.$(OBJEXT) \ 87 rational.$(OBJEXT) 87 88 am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1) 88 89 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS) … … 213 214 MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} \ 214 215 ${addprefix ${libdir}/,${lib_LIBRARIES}} ${includedir}/* 215 libs = limits stdlib iostream fstream iterator rational216 libs = limits stdlib math iostream fstream iterator rational 216 217 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c} 217 218 cheaders = # expat … … 298 299 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa-prelude.Po@am__quote@ 299 300 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@ 301 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/math.Po@am__quote@ 300 302 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rational.Po@am__quote@ 301 303 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@ -
src/libcfa/rational.c
r6b6597c r6e991d6 11 11 // Created On : Wed Apr 6 17:54:28 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : T ue Apr 12 21:26:42201614 // Update Count : 2 113 // Last Modified On : Thu Apr 21 07:33:03 2016 14 // Update Count : 22 15 15 // 16 16 … … 18 18 #include "fstream" 19 19 #include "stdlib" 20 #include "math" // floor 20 21 21 22 -
src/libcfa/stdlib
r6b6597c r6e991d6 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Apr 19 21:21:53201613 // Update Count : 9 312 // Last Modified On : Thu Apr 21 07:55:21 2016 13 // Update Count : 95 14 14 // 15 15 … … 33 33 //--------------------------------------- 34 34 35 extern "C" { 36 void * malloc( size_t ); // use default C routine for void * 37 } // extern "C" 35 extern "C" { void * malloc( size_t ); } // use default C routine for void * 38 36 forall( otype T ) T * malloc( void ); 39 37 forall( otype T ) T * malloc( char fill ); 40 38 forall( otype T ) T * malloc( T * ptr, size_t size ); 41 39 forall( otype T ) T * malloc( T * ptr, size_t size, unsigned char fill ); 42 extern "C" { 43 void * calloc( size_t nmemb, size_t size ); // use default C routine for void * 44 } // extern "C" 40 extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void * 45 41 forall( otype T ) T * calloc( size_t nmemb ); 46 extern "C" { 47 void * realloc( void * ptr, size_t size ); // use default C routine for void * 48 } // extern "C" 42 extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void * 49 43 forall( otype T ) T * realloc( T * ptr, size_t size ); 50 44 forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill ); … … 103 97 104 98 char abs( char ); 105 extern "C" { 106 int abs( int ); // use default C routine for int 107 } // extern "C" 99 extern "C" { int abs( int ); } // use default C routine for int 108 100 long int abs( long int ); 109 101 long long int abs( long long int ); … … 111 103 double abs( double ); 112 104 long double abs( long double ); 113 float _Complex abs( float _Complex ); 114 double _Complex abs( double _Complex ); 115 long double _Complex abs( long double _Complex ); 116 117 //--------------------------------------- 118 119 float floor( float ); 120 extern "C" { 121 double floor( double ); // use C routine for double 122 } // extern "C" 123 long double floor( long double ); 124 125 float ceil( float ); 126 extern "C" { 127 double ceil( double ); // use C routine for double 128 } // extern "C" 129 long double ceil( long double ); 105 float abs( float _Complex ); 106 double abs( double _Complex ); 107 long double abs( long double _Complex ); 130 108 131 109 //--------------------------------------- -
src/libcfa/stdlib.c
r6b6597c r6e991d6 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Apr 19 21:21:51201613 // Update Count : 1 5912 // Last Modified On : Thu Apr 21 07:58:29 2016 13 // Update Count : 165 14 14 // 15 15 … … 24 24 #include <malloc.h> // malloc_usable_size 25 25 #include <math.h> // fabsf, fabs, fabsl 26 #include <complex.h> // _Complex_I , cabsf, cabs, cabsl26 #include <complex.h> // _Complex_I 27 27 } // extern "C" 28 28 … … 82 82 int ato( const char * ptr ) { 83 83 int i; 84 if ( sscanf( ptr, "%d", &i ) == EOF ) {} // check return code84 if ( sscanf( ptr, "%d", &i ) == EOF ) {} 85 85 return i; 86 86 } 87 87 unsigned int ato( const char * ptr ) { 88 88 unsigned int ui; 89 if ( sscanf( ptr, "%u", &ui ) == EOF ) {} // check return code89 if ( sscanf( ptr, "%u", &ui ) == EOF ) {} 90 90 return ui; 91 91 } 92 92 long int ato( const char * ptr ) { 93 93 long int li; 94 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} // check return code94 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} 95 95 return li; 96 96 } 97 97 unsigned long int ato( const char * ptr ) { 98 98 unsigned long int uli; 99 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} // check return code99 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} 100 100 return uli; 101 101 } 102 102 long long int ato( const char * ptr ) { 103 103 long long int lli; 104 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} // check return code104 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} 105 105 return lli; 106 106 } 107 107 unsigned long long int ato( const char * ptr ) { 108 108 unsigned long long int ulli; 109 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} // check return code109 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} 110 110 return ulli; 111 111 } … … 113 113 float ato( const char * ptr ) { 114 114 float f; 115 if ( sscanf( ptr, "%f", &f ) == EOF ) {} // check return code115 if ( sscanf( ptr, "%f", &f ) == EOF ) {} 116 116 return f; 117 117 } 118 118 double ato( const char * ptr ) { 119 119 double d; 120 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} // check return code120 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} 121 121 return d; 122 122 } 123 123 long double ato( const char * ptr ) { 124 124 long double ld; 125 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} // check return code125 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} 126 126 return ld; 127 127 } … … 129 129 float _Complex ato( const char * ptr ) { 130 130 float re, im; 131 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} // check return code131 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} 132 132 return re + im * _Complex_I; 133 133 } 134 134 double _Complex ato( const char * ptr ) { 135 135 double re, im; 136 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} // check return code136 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} 137 137 return re + im * _Complex_I; 138 138 } 139 139 long double _Complex ato( const char * ptr ) { 140 140 long double re, im; 141 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} // check return code141 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} 142 142 return re + im * _Complex_I; 143 143 } … … 221 221 long int abs( long int v ) { return labs( v ); } 222 222 long long int abs( long long int v ) { return llabs( v ); } 223 float abs( float v ) { return fabsf( v ); } 224 double abs( double v ) { return fabs( v ); } 225 long double abs( long double v ) { return fabsl( v ); } 226 float _Complex abs( float _Complex v ) { return cabsf( v ); } 227 double _Complex abs( double _Complex v ) { return cabs( v ); } 228 long double _Complex abs( long double _Complex v ) { return cabsl( v ); } 229 230 //--------------------------------------- 231 232 float floor( float v ) { return floorf( v ); } 233 long double floor( long double v ) { return floorl( v ); } 234 235 float ceil( float v ) { return ceilf( v ); } 236 long double ceil( long double v ) { return ceill( v ); } 223 float abs( float x ) { return fabsf( x ); } 224 double abs( double x ) { return fabs( x ); } 225 long double abs( long double x ) { return fabsl( x ); } 226 float abs( float _Complex x ) { return cabsf( x ); } 227 double abs( double _Complex x ) { return cabs( x ); } 228 long double abs( long double _Complex x ) { return cabsl( x ); } 237 229 238 230 //---------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.