Changeset 6e991d6 for src/libcfa


Ignore:
Timestamp:
Apr 21, 2016, 8:24:07 AM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

add -fgnu89-inline flag to compile, cleanup swap example I/O, stdlib fixes, start math library

Location:
src/libcfa
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/Makefile.am

    r6b6597c r6e991d6  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Wed Apr  6 21:10:44 2016
    14 ## Update Count     : 123
     13## Last Modified On : Tue Apr 19 22:30:17 2016
     14## Update Count     : 124
    1515###############################################################################
    1616
     
    6060        ${CC} ${CFLAGS} -c -o $@ $<
    6161
    62 libs = limits stdlib iostream fstream iterator rational
     62libs = limits stdlib math iostream fstream iterator rational
    6363libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
    6464
  • src/libcfa/Makefile.in

    r6b6597c r6e991d6  
    8383libcfa_a_AR = $(AR) $(ARFLAGS)
    8484libcfa_a_LIBADD =
    85 am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) iostream.$(OBJEXT) \
    86         fstream.$(OBJEXT) iterator.$(OBJEXT) rational.$(OBJEXT)
     85am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) math.$(OBJEXT) \
     86        iostream.$(OBJEXT) fstream.$(OBJEXT) iterator.$(OBJEXT) \
     87        rational.$(OBJEXT)
    8788am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1)
    8889libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
     
    213214MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} \
    214215        ${addprefix ${libdir}/,${lib_LIBRARIES}} ${includedir}/*
    215 libs = limits stdlib iostream fstream iterator rational
     216libs = limits stdlib math iostream fstream iterator rational
    216217libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
    217218cheaders = # expat
     
    298299@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa-prelude.Po@am__quote@
    299300@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@
     301@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/math.Po@am__quote@
    300302@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rational.Po@am__quote@
    301303@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@
  • src/libcfa/rational.c

    r6b6597c r6e991d6  
    1111// Created On       : Wed Apr  6 17:54:28 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Apr 12 21:26:42 2016
    14 // Update Count     : 21
     13// Last Modified On : Thu Apr 21 07:33:03 2016
     14// Update Count     : 22
    1515//
    1616
     
    1818#include "fstream"
    1919#include "stdlib"
     20#include "math"                                                                                 // floor
    2021
    2122
  • src/libcfa/stdlib

    r6b6597c r6e991d6  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 19 21:21:53 2016
    13 // Update Count     : 93
     12// Last Modified On : Thu Apr 21 07:55:21 2016
     13// Update Count     : 95
    1414//
    1515
     
    3333//---------------------------------------
    3434
    35 extern "C" {
    36 void * malloc( size_t );                                                                // use default C routine for void *
    37 } // extern "C"
     35extern "C" { void * malloc( size_t ); }                                 // use default C routine for void *
    3836forall( otype T ) T * malloc( void );
    3937forall( otype T ) T * malloc( char fill );
    4038forall( otype T ) T * malloc( T * ptr, size_t size );
    4139forall( 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"
     40extern "C" { void * calloc( size_t nmemb, size_t size ); } // use default C routine for void *
    4541forall( 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"
     42extern "C" { void * realloc( void * ptr, size_t size ); } // use default C routine for void *
    4943forall( otype T ) T * realloc( T * ptr, size_t size );
    5044forall( otype T ) T * realloc( T * ptr, size_t size, unsigned char fill );
     
    10397
    10498char abs( char );
    105 extern "C" {
    106 int abs( int );                                                                                 // use default C routine for int
    107 } // extern "C"
     99extern "C" { int abs( int ); }                                                  // use default C routine for int
    108100long int abs( long int );
    109101long long int abs( long long int );
     
    111103double abs( double );
    112104long 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 );
     105float abs( float _Complex );
     106double abs( double _Complex );
     107long double abs( long double _Complex );
    130108
    131109//---------------------------------------
  • src/libcfa/stdlib.c

    r6b6597c r6e991d6  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 19 21:21:51 2016
    13 // Update Count     : 159
     12// Last Modified On : Thu Apr 21 07:58:29 2016
     13// Update Count     : 165
    1414//
    1515
     
    2424#include <malloc.h>                                                                             // malloc_usable_size
    2525#include <math.h>                                                                               // fabsf, fabs, fabsl
    26 #include <complex.h>                                                                    // _Complex_I, cabsf, cabs, cabsl
     26#include <complex.h>                                                                    // _Complex_I
    2727} // extern "C"
    2828
     
    8282int ato( const char * ptr ) {
    8383        int i;
    84         if ( sscanf( ptr, "%d", &i ) == EOF ) {}                        // check return code
     84        if ( sscanf( ptr, "%d", &i ) == EOF ) {}
    8585        return i;
    8686}
    8787unsigned int ato( const char * ptr ) {
    8888        unsigned int ui;
    89         if ( sscanf( ptr, "%u", &ui ) == EOF ) {}                       // check return code
     89        if ( sscanf( ptr, "%u", &ui ) == EOF ) {}
    9090        return ui;
    9191}
    9292long int ato( const char * ptr ) {
    9393        long int li;
    94         if ( sscanf( ptr, "%ld", &li ) == EOF ) {}                      // check return code
     94        if ( sscanf( ptr, "%ld", &li ) == EOF ) {}
    9595        return li;
    9696}
    9797unsigned long int ato( const char * ptr ) {
    9898        unsigned long int uli;
    99         if ( sscanf( ptr, "%lu", &uli ) == EOF ) {}                     // check return code
     99        if ( sscanf( ptr, "%lu", &uli ) == EOF ) {}
    100100        return uli;
    101101}
    102102long long int ato( const char * ptr ) {
    103103        long long int lli;
    104         if ( sscanf( ptr, "%lld", &lli ) == EOF ) {}            // check return code
     104        if ( sscanf( ptr, "%lld", &lli ) == EOF ) {}
    105105        return lli;
    106106}
    107107unsigned long long int ato( const char * ptr ) {
    108108        unsigned long long int ulli;
    109         if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {}           // check return code
     109        if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {}
    110110        return ulli;
    111111}
     
    113113float ato( const char * ptr ) {
    114114        float f;
    115         if ( sscanf( ptr, "%f", &f ) == EOF ) {}                        // check return code
     115        if ( sscanf( ptr, "%f", &f ) == EOF ) {}
    116116        return f;
    117117}
    118118double ato( const char * ptr ) {
    119119        double d;
    120         if ( sscanf( ptr, "%lf", &d ) == EOF ) {}                       // check return code
     120        if ( sscanf( ptr, "%lf", &d ) == EOF ) {}
    121121        return d;
    122122}
    123123long double ato( const char * ptr ) {
    124124        long double ld;
    125         if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {}                      // check return code
     125        if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {}
    126126        return ld;
    127127}
     
    129129float _Complex ato( const char * ptr ) {
    130130        float re, im;
    131         if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {}       // check return code
     131        if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {}
    132132        return re + im * _Complex_I;
    133133}
    134134double _Complex ato( const char * ptr ) {
    135135        double re, im;
    136         if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} // check return code
     136        if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {}
    137137        return re + im * _Complex_I;
    138138}
    139139long double _Complex ato( const char * ptr ) {
    140140        long double re, im;
    141         if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {}     // check return code
     141        if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {}
    142142        return re + im * _Complex_I;
    143143}       
     
    221221long int abs( long int v ) { return labs( v ); }
    222222long 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 ); }
     223float abs( float x ) { return fabsf( x ); }
     224double abs( double x ) { return fabs( x ); }
     225long double abs( long double x ) { return fabsl( x ); }
     226float abs( float _Complex x ) { return cabsf( x ); }
     227double abs( double _Complex x ) { return cabs( x ); }
     228long double abs( long double _Complex x ) { return cabsl( x ); }
    237229
    238230//---------------------------------------
Note: See TracChangeset for help on using the changeset viewer.