Changeset 0fc52b6
- Timestamp:
- Jul 12, 2018, 9:14:07 AM (5 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 3007c0b, 8f91c9ae
- Parents:
- 777ed2b
- Location:
- src/libcfa
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/Makefile.am
r777ed2b r0fc52b6 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Thu Apr 12 14:38:34201814 ## Update Count : 23 113 ## Last Modified On : Thu Jul 12 08:04:35 2018 14 ## Update Count : 234 15 15 ############################################################################### 16 16 … … 46 46 CC = ${abs_top_srcdir}/src/driver/cfa 47 47 48 headers = fstream iostream iterator limits rational time stdlib \48 headers = fstream iostream iterator limits rational time stdlib common \ 49 49 containers/maybe containers/pair containers/result containers/vector 50 50 … … 96 96 cfa_includedir = $(CFA_INCDIR) 97 97 nobase_cfa_include_HEADERS = \ 98 ${headers} \ 99 ${stdhdr} \ 100 math \ 101 gmp \ 102 time_t.h \ 103 clock \ 98 ${headers} \ 99 ${stdhdr} \ 100 math \ 101 gmp \ 102 time_t.h \ 104 103 bits/align.h \ 105 bits/containers.h 104 bits/containers.h \ 106 105 bits/defs.h \ 107 106 bits/debug.h \ -
src/libcfa/Makefile.in
r777ed2b r0fc52b6 150 150 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 151 151 bits/debug.c fstream.c iostream.c iterator.c limits.c \ 152 rational.c time.c stdlib.c co ntainers/maybe.c \152 rational.c time.c stdlib.c common.c containers/maybe.c \ 153 153 containers/pair.c containers/result.c containers/vector.c \ 154 154 concurrency/coroutine.c concurrency/thread.c \ … … 167 167 libcfa_d_a-limits.$(OBJEXT) libcfa_d_a-rational.$(OBJEXT) \ 168 168 libcfa_d_a-time.$(OBJEXT) libcfa_d_a-stdlib.$(OBJEXT) \ 169 libcfa_d_a-common.$(OBJEXT) \ 169 170 containers/libcfa_d_a-maybe.$(OBJEXT) \ 170 171 containers/libcfa_d_a-pair.$(OBJEXT) \ … … 186 187 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c bits/debug.c \ 187 188 fstream.c iostream.c iterator.c limits.c rational.c time.c \ 188 stdlib.c co ntainers/maybe.c containers/pair.c \189 stdlib.c common.c containers/maybe.c containers/pair.c \ 189 190 containers/result.c containers/vector.c \ 190 191 concurrency/coroutine.c concurrency/thread.c \ … … 201 202 libcfa_a-iterator.$(OBJEXT) libcfa_a-limits.$(OBJEXT) \ 202 203 libcfa_a-rational.$(OBJEXT) libcfa_a-time.$(OBJEXT) \ 203 libcfa_a-stdlib.$(OBJEXT) containers/libcfa_a-maybe.$(OBJEXT) \ 204 libcfa_a-stdlib.$(OBJEXT) libcfa_a-common.$(OBJEXT) \ 205 containers/libcfa_a-maybe.$(OBJEXT) \ 204 206 containers/libcfa_a-pair.$(OBJEXT) \ 205 207 containers/libcfa_a-result.$(OBJEXT) \ … … 263 265 esac 264 266 am__nobase_cfa_include_HEADERS_DIST = fstream iostream iterator limits \ 265 rational time stdlib co ntainers/maybe containers/pair \267 rational time stdlib common containers/maybe containers/pair \ 266 268 containers/result containers/vector concurrency/coroutine \ 267 269 concurrency/thread concurrency/kernel concurrency/monitor \ 268 270 concurrency/mutex ${shell find stdhdr -type f -printf "%p "} \ 269 math gmp time_t.h clock bits/align.h bits/containers.h \270 bits/de fs.h bits/debug.h bits/locks.h concurrency/invoke.h271 math gmp time_t.h bits/align.h bits/containers.h bits/defs.h \ 272 bits/debug.h bits/locks.h concurrency/invoke.h 271 273 HEADERS = $(nobase_cfa_include_HEADERS) 272 274 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) … … 422 424 EXTRA_FLAGS = -g -Wall -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@ 423 425 AM_CCASFLAGS = @CFA_FLAGS@ 424 headers = fstream iostream iterator limits rational time stdlib \426 headers = fstream iostream iterator limits rational time stdlib common \ 425 427 containers/maybe containers/pair containers/result \ 426 428 containers/vector $(am__append_3) … … 435 437 cfa_includedir = $(CFA_INCDIR) 436 438 nobase_cfa_include_HEADERS = \ 437 ${headers} \ 438 ${stdhdr} \ 439 math \ 440 gmp \ 441 time_t.h \ 442 clock \ 439 ${headers} \ 440 ${stdhdr} \ 441 math \ 442 gmp \ 443 time_t.h \ 443 444 bits/align.h \ 444 bits/containers.h 445 bits/containers.h \ 445 446 bits/defs.h \ 446 447 bits/debug.h \ … … 610 611 611 612 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-assert.Po@am__quote@ 613 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-common.Po@am__quote@ 612 614 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-exception.Po@am__quote@ 613 615 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-fstream.Po@am__quote@ … … 622 624 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_a-virtual.Po@am__quote@ 623 625 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-assert.Po@am__quote@ 626 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-common.Po@am__quote@ 624 627 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-exception.Po@am__quote@ 625 628 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-fstream.Po@am__quote@ … … 826 829 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-stdlib.obj `if test -f 'stdlib.c'; then $(CYGPATH_W) 'stdlib.c'; else $(CYGPATH_W) '$(srcdir)/stdlib.c'; fi` 827 830 831 libcfa_d_a-common.o: common.c 832 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-common.o -MD -MP -MF $(DEPDIR)/libcfa_d_a-common.Tpo -c -o libcfa_d_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c 833 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-common.Tpo $(DEPDIR)/libcfa_d_a-common.Po 834 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='libcfa_d_a-common.o' libtool=no @AMDEPBACKSLASH@ 835 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 836 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c 837 838 libcfa_d_a-common.obj: common.c 839 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libcfa_d_a-common.obj -MD -MP -MF $(DEPDIR)/libcfa_d_a-common.Tpo -c -o libcfa_d_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` 840 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_d_a-common.Tpo $(DEPDIR)/libcfa_d_a-common.Po 841 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='libcfa_d_a-common.obj' libtool=no @AMDEPBACKSLASH@ 842 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 843 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` 844 828 845 containers/libcfa_d_a-maybe.o: containers/maybe.c 829 846 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT containers/libcfa_d_a-maybe.o -MD -MP -MF containers/$(DEPDIR)/libcfa_d_a-maybe.Tpo -c -o containers/libcfa_d_a-maybe.o `test -f 'containers/maybe.c' || echo '$(srcdir)/'`containers/maybe.c … … 1147 1164 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1148 1165 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-stdlib.obj `if test -f 'stdlib.c'; then $(CYGPATH_W) 'stdlib.c'; else $(CYGPATH_W) '$(srcdir)/stdlib.c'; fi` 1166 1167 libcfa_a-common.o: common.c 1168 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-common.o -MD -MP -MF $(DEPDIR)/libcfa_a-common.Tpo -c -o libcfa_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c 1169 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-common.Tpo $(DEPDIR)/libcfa_a-common.Po 1170 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='libcfa_a-common.o' libtool=no @AMDEPBACKSLASH@ 1171 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1172 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c 1173 1174 libcfa_a-common.obj: common.c 1175 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libcfa_a-common.obj -MD -MP -MF $(DEPDIR)/libcfa_a-common.Tpo -c -o libcfa_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` 1176 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcfa_a-common.Tpo $(DEPDIR)/libcfa_a-common.Po 1177 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='libcfa_a-common.obj' libtool=no @AMDEPBACKSLASH@ 1178 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1179 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` 1149 1180 1150 1181 containers/libcfa_a-maybe.o: containers/maybe.c -
src/libcfa/math
r777ed2b r0fc52b6 10 10 // Created On : Mon Apr 18 23:37:04 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 7 07:51:15 201713 // Update Count : 10 812 // Last Modified On : Wed Jul 11 21:12:54 2018 13 // Update Count : 109 14 14 // 15 15 … … 348 348 static inline long double scalbln( long double x, long int exp ) { return scalblnl( x, exp ); } 349 349 350 //--------------------------------------- 351 352 #include "common" 353 350 354 // Local Variables: // 351 355 // mode: c // -
src/libcfa/stdlib
r777ed2b r0fc52b6 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 5 07:41:03201813 // Update Count : 33 212 // Last Modified On : Thu Jul 12 08:03:58 2018 13 // Update Count : 337 14 14 // 15 15 16 16 #pragma once 17 17 18 #include <stdlib.h> // allocation, strto*, *abs18 #include <stdlib.h> // allocation, strto*, ato* 19 19 extern "C" { 20 20 void * memalign( size_t align, size_t size ); // malloc.h … … 227 227 size_t bsearchu( K key, const E * vals, size_t dim ); 228 228 } // distribution 229 230 //---------------------------------------231 232 [ int, int ] div( int num, int denom );233 [ long int, long int ] div( long int num, long int denom );234 [ long long int, long long int ] div( long long int num, long long int denom );235 forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )236 [ T, T ] div( T num, T demon );237 238 //---------------------------------------239 240 extern "C" { int abs( int ); } // use default C routine for int241 static inline {242 unsigned char abs( signed char v ) { return abs( (int)v ); }243 unsigned long int abs( long int v ) { return labs( v ); }244 unsigned long long int abs( long long int v ) { return llabs( v ); }245 } // distribution246 247 extern "C" { // use default C routine for int248 double fabs( double );249 float fabsf( float );250 long double fabsl( long double );251 } // extern "C"252 static inline {253 float abs( float x ) { return fabsf( x ); }254 double abs( double x ) { return fabs( x ); }255 long double abs( long double x ) { return fabsl( x ); }256 } // distribution257 258 extern "C" { // use default C routine for int259 double cabs( double _Complex );260 float cabsf( float _Complex );261 long double cabsl( long double _Complex );262 } // extern "C"263 static inline {264 float abs( float _Complex x ) { return cabsf( x ); }265 double abs( double _Complex x ) { return cabs( x ); }266 long double abs( long double _Complex x ) { return cabsl( x ); }267 } // distribution268 269 forall( otype T | { void ?{}( T &, zero_t ); int ?<?( T, T ); T -?( T ); } )270 T abs( T );271 229 272 230 //--------------------------------------- … … 303 261 //--------------------------------------- 304 262 305 static inline { 306 forall( otype T | { int ?<?( T, T ); } ) 307 T min( T t1, T t2 ) { return t1 < t2 ? t1 : t2; } 308 309 forall( otype T | { int ?>?( T, T ); } ) 310 T max( T t1, T t2 ) { return t1 > t2 ? t1 : t2; } 311 312 forall( otype T | { T min( T, T ); T max( T, T ); } ) 313 T clamp( T value, T min_val, T max_val ) { return max( min_val, min( value, max_val ) ); } 314 315 forall( otype T ) 316 void swap( T & v1, T & v2 ) { T temp = v1; v1 = v2; v2 = temp; } 317 } // distribution 263 #include "common" 318 264 319 265 // Local Variables: // -
src/libcfa/stdlib.c
r777ed2b r0fc52b6 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 Jul 3 08:17:30201813 // Update Count : 45 712 // Last Modified On : Thu Jul 12 08:03:59 2018 13 // Update Count : 458 14 14 // 15 15 … … 241 241 //--------------------------------------- 242 242 243 [ int, int ] div( int num, int denom ) { div_t qr = div( num, denom ); return [ qr.quot, qr.rem ]; }244 [ long int, long int ] div( long int num, long int denom ) { ldiv_t qr = ldiv( num, denom ); return [ qr.quot, qr.rem ]; }245 [ long long int, long long int ] div( long long int num, long long int denom ) { lldiv_t qr = lldiv( num, denom ); return [ qr.quot, qr.rem ]; }246 forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )247 [ T, T ] div( T num, T denom ) { return [ num / denom, num % denom ]; }248 249 //---------------------------------------250 251 243 extern "C" { // override C version 252 244 void srandom( unsigned int seed ) { srand48( (long int)seed ); }
Note: See TracChangeset
for help on using the changeset viewer.