Changeset 78885b5 for src


Ignore:
Timestamp:
Apr 7, 2016, 1:05:12 PM (9 years ago)
Author:
Aaron Moss <a3moss@…>
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:
8a34677
Parents:
bc1ab61 (diff), 53ba273 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
6 added
1 deleted
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/driver/cfa.cc

    rbc1ab61 r78885b5  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 28 18:24:06 2016
    13 // Update Count     : 127
     12// Last Modified On : Wed Apr  6 14:04:22 2016
     13// Update Count     : 132
    1414//
    1515
     
    165165                                nargs += 1;
    166166                        } else if ( prefix( arg, "-std=" ) ) {
    167                                 std_flag = true;                                                // std=XX provided
     167                                std_flag = true;                                                // -std=XX provided
    168168                                args[nargs] = argv[i];                                  // pass the argument along
    169169                                nargs += 1;
     
    307307                nargs += 1;
    308308                if ( ! std_flag ) {                                                             // default c99, if none specified
    309                         args[nargs] = "-std=c99";
     309                        args[nargs] = "-std=gnu99";
    310310                        nargs += 1;
    311311                } // if
  • src/libcfa/Makefile.am

    rbc1ab61 r78885b5  
    1111## Created On       : Sun May 31 08:54:01 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Wed Mar  2 22:59:23 2016
    14 ## Update Count     : 119
     13## Last Modified On : Wed Apr  6 21:10:44 2016
     14## Update Count     : 123
    1515###############################################################################
    1616
     
    6060        ${CC} ${CFLAGS} -c -o $@ $<
    6161
    62 libs = stdlib iostream fstream iterator
     62libs = limits stdlib iostream fstream iterator rational
    6363libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
    6464
    65 cheaders = #  expat
    66 cfaheaders = limits
     65cheaders = # expat
     66cfaheaders = # limits
    6767include_HEADERS = ${cheaders:=.h} ${libs} ${cfaheaders}
    6868
  • src/libcfa/Makefile.in

    rbc1ab61 r78885b5  
    8383libcfa_a_AR = $(AR) $(ARFLAGS)
    8484libcfa_a_LIBADD =
    85 am__objects_1 = stdlib.$(OBJEXT) iostream.$(OBJEXT) fstream.$(OBJEXT) \
    86         iterator.$(OBJEXT)
     85am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) iostream.$(OBJEXT) \
     86        fstream.$(OBJEXT) iterator.$(OBJEXT) rational.$(OBJEXT)
    8787am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1)
    8888libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
     
    213213MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} \
    214214        ${addprefix ${libdir}/,${lib_LIBRARIES}} ${includedir}/*
    215 libs = stdlib iostream fstream iterator
     215libs = limits stdlib iostream fstream iterator rational
    216216libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
    217 cheaders = #  expat
    218 cfaheaders = limits
     217cheaders = # expat
     218cfaheaders = # limits
    219219include_HEADERS = ${cheaders:=.h} ${libs} ${cfaheaders}
    220220all: all-am
     
    297297@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Po@am__quote@
    298298@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa-prelude.Po@am__quote@
     299@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@
     300@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rational.Po@am__quote@
    299301@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@
    300302
  • src/libcfa/fstream

    rbc1ab61 r78885b5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 15:08:14 2016
    13 // Update Count     : 78
     12// Last Modified On : Tue Apr  5 22:37:12 2016
     13// Update Count     : 82
    1414//
    1515
     
    2020
    2121enum { separateSize = 16 };
    22 struct ofstream { void *file; int separate; char separator[separateSize]; };
     22struct ofstream {
     23        void *file;
     24        _Bool sepDefault;
     25        _Bool sepOnOff;
     26        char separator[separateSize];
     27}; // ofstream
    2328
    2429_Bool sepPrt( ofstream * );
    2530void sepOn( ofstream * );
    2631void sepOff( ofstream * );
     32void sepReset( ofstream * );
     33void sepReset( ofstream *, _Bool );
    2734void sepSet( ofstream *, const char * );
    2835const char * sepGet( ofstream * );
    29 void sepDisable( ofstream * );
    30 void sepEnable( ofstream * );
     36_Bool sepDisable( ofstream * );
     37_Bool sepEnable( ofstream * );
    3138int fail( ofstream * );
    3239int flush( ofstream * );
     
    3946
    4047// implement context istream
    41 struct ifstream { void *file; };
     48struct ifstream {
     49        void *file;
     50}; // ifstream
    4251
    4352int fail( ifstream * is );
  • src/libcfa/fstream.c

    rbc1ab61 r78885b5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Feb 29 18:41:10 2016
    13 // Update Count     : 162
     12// Last Modified On : Wed Apr  6 17:55:27 2016
     13// Update Count     : 176
    1414//
    1515
     
    2525}
    2626
    27 #define IO_MSG "I/O error "
     27#define IO_MSG "I/O error: "
    2828
    29 _Bool sepPrt( ofstream * os ) { return os->separate == 1; }
    30 void sepOn( ofstream * os ) { if ( os->separate != 2 ) os->separate = 1; }
    31 void sepOff( ofstream * os ) { if ( os->separate != 2 ) os->separate = 0; }
     29_Bool sepPrt( ofstream * os ) { return os->sepOnOff; }
     30void sepOn( ofstream * os ) { os->sepOnOff = 1; }
     31void sepOff( ofstream * os ) { os->sepOnOff = 0; }
     32void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
     33void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
    3234void sepSet( ofstream * os, const char * s ) {
    3335        strncpy( &(os->separator[0]), s, separateSize - 1 );
     
    3537} // sepSet
    3638const char * sepGet( ofstream * os ) { return &(os->separator[0]); }
    37 void sepDisable( ofstream *os ) { os->separate = 2; }
    38 void sepEnable( ofstream *os ) { os->separate = 0; }
     39_Bool sepDisable( ofstream *os ) {
     40        _Bool temp = os->sepDefault;
     41        os->sepDefault = 0;
     42        sepReset( os );
     43        return temp;
     44} // sepDisable
     45_Bool sepEnable( ofstream *os ) {
     46        _Bool temp = os->sepDefault;
     47        os->sepDefault = 1;
     48        sepReset( os );
     49        return temp;
     50} // sepEnable
    3951
    4052int fail( ofstream * os ) {
     
    4961        FILE *file = fopen( name, mode );
    5062        if ( file == 0 ) {                                                                      // do not change unless successful
    51                 perror( IO_MSG "open output" );
     63                fprintf( stderr, IO_MSG "open output file \"%s\", ", name );
     64                perror( 0 );
    5265                exit( EXIT_FAILURE );
    5366        } // if
     
    94107
    95108
    96 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 0, { ' ', '\0' } };
     109static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, { ' ', '\0' } };
    97110ofstream *sout = &soutFile;
    98 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 0, { ' ', '\0' } };
     111static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, { ' ', '\0' } };
    99112ofstream *serr = &serrFile;
    100113
     
    114127        FILE *t = fopen( name, mode );
    115128        if ( t == 0 ) {                                                                         // do not change unless successful
    116                 perror( IO_MSG "open input" );
     129                fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
     130                perror( 0 );
    117131                exit( EXIT_FAILURE );
    118132        } // if
     
    175189// Local Variables: //
    176190// tab-width: 4 //
    177 // compile-command: "cfa fstream.c" //
    178191// End: //
  • src/libcfa/iostream

    rbc1ab61 r78885b5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 18:05:27 2016
    13 // Update Count     : 85
     12// Last Modified On : Tue Apr  5 22:32:37 2016
     13// Update Count     : 90
    1414//
    1515
     
    2323        void sepOn( ostype * );
    2424        void sepOff( ostype * );
     25        void sepReset( ostype * );
     26        void sepReset( ostype *, _Bool );
    2527        void sepSet( ostype *, const char * );
    2628        const char * sepGet( ostype * );
    27         void sepDisable( ostype * );
    28         void sepEnable( ostype * );
     29        _Bool sepDisable( ostype * );
     30        _Bool sepEnable( ostype * );
    2931        int fail( ostype * );
    3032        int flush( ostype * );
     
    6769forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
    6870forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * );
     71forall( dtype ostype | ostream( ostype ) ) ostype * sepDisable( ostype * );
     72forall( dtype ostype | ostream( ostype ) ) ostype * sepEnable( ostype * );
    6973
    7074// writes the range [begin, end) to the given stream
     
    110114forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long double _Complex * );
    111115
    112 struct _Istream_str1 { char * s; };
    113 _Istream_str1 str( char * );
    114 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str1 );
     116struct _Istream_cstrUC { char * s; };
     117_Istream_cstrUC cstr( char * );
     118forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrUC );
    115119
    116 struct _Istream_str2 { char * s; int size; };
    117 _Istream_str2 str( char *, int size );
    118 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str2 );
     120struct _Istream_cstrC { char * s; int size; };
     121_Istream_cstrC cstr( char *, int size );
     122forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrC );
    119123
    120124#endif // __IOSTREAM_H__
  • src/libcfa/iostream.c

    rbc1ab61 r78885b5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Mar  7 13:51:23 2016
    13 // Update Count     : 227
     12// Last Modified On : Wed Apr  6 16:13:29 2016
     13// Update Count     : 278
    1414//
    1515
     
    2727ostype * ?|?( ostype *os, char c ) {
    2828        prtfmt( os, "%c", c );
     29        sepOff( os );
    2930        return os;
    3031} // ?|?
     
    3233forall( dtype ostype | ostream( ostype ) )
    3334ostype * ?|?( ostype *os, short int si ) {
    34         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     35        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     36        sepReset( os );
    3537        prtfmt( os, "%hd", si );
    3638        return os;
     
    3941forall( dtype ostype | ostream( ostype ) )
    4042ostype * ?|?( ostype *os, unsigned short int usi ) {
    41         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     43        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     44        sepReset( os );
    4245        prtfmt( os, "%hu", usi );
    4346        return os;
     
    4649forall( dtype ostype | ostream( ostype ) )
    4750ostype * ?|?( ostype *os, int i ) {
    48         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     51        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     52        sepReset( os );
    4953        prtfmt( os, "%d", i );
    5054        return os;
     
    5357forall( dtype ostype | ostream( ostype ) )
    5458ostype * ?|?( ostype *os, unsigned int ui ) {
    55         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     59        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     60        sepReset( os );
    5661        prtfmt( os, "%u", ui );
    5762        return os;
     
    6065forall( dtype ostype | ostream( ostype ) )
    6166ostype * ?|?( ostype *os, long int li ) {
    62         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     67        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     68        sepReset( os );
    6369        prtfmt( os, "%ld", li );
    6470        return os;
     
    6773forall( dtype ostype | ostream( ostype ) )
    6874ostype * ?|?( ostype *os, unsigned long int uli ) {
    69         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     75        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     76        sepReset( os );
    7077        prtfmt( os, "%lu", uli );
    7178        return os;
     
    7481forall( dtype ostype | ostream( ostype ) )
    7582ostype * ?|?( ostype *os, long long int lli ) {
    76         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     83        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     84        sepReset( os );
    7785        prtfmt( os, "%lld", lli );
    7886        return os;
     
    8189forall( dtype ostype | ostream( ostype ) )
    8290ostype * ?|?( ostype *os, unsigned long long int ulli ) {
    83         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     91        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     92        sepReset( os );
    8493        prtfmt( os, "%llu", ulli );
    8594        return os;
     
    8897forall( dtype ostype | ostream( ostype ) )
    8998ostype * ?|?( ostype *os, float f ) {
    90         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     99        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     100        sepReset( os );
    91101        prtfmt( os, "%g", f );
    92102        return os;
     
    95105forall( dtype ostype | ostream( ostype ) )
    96106ostype * ?|?( ostype *os, double d ) {
    97         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     107        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     108        sepReset( os );
    98109        prtfmt( os, "%.*lg", DBL_DIG, d );
    99110        return os;
     
    102113forall( dtype ostype | ostream( ostype ) )
    103114ostype * ?|?( ostype *os, long double ld ) {
    104         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     115        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     116        sepReset( os );
    105117        prtfmt( os, "%.*Lg", LDBL_DIG, ld );
    106118        return os;
     
    110122ostype * ?|?( ostype *os, float _Complex fc ) {
    111123        os | crealf( fc );
    112         if ( cimagf( fc ) >= 0 ) os | '+';
    113         os | "" | cimagf( fc ) | 'i';
     124        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     125        if ( cimagf( fc ) >= 0 ) os | '+';                                      // negative value prints '-'
     126        os | cimagf( fc ) | 'i';
     127        sepReset( os, temp );                                                           // reset separator
    114128        return os;
    115129} // ?|?
     
    118132ostype * ?|?( ostype *os, double _Complex dc ) {
    119133        os | creal( dc );
    120         if ( cimag( dc ) >= 0 ) os | '+';
    121         os | "" | cimag( dc ) | 'i';
     134        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     135        if ( cimag( dc ) >= 0 ) os | '+';                                       // negative value prints '-'
     136        os | cimag( dc ) | 'i';
     137        sepReset( os, temp );                                                           // reset separator
    122138        return os;
    123139} // ?|?
     
    126142ostype * ?|?( ostype *os, long double _Complex ldc ) {
    127143        os | creall( ldc );
    128         if ( cimagl( ldc ) >= 0 ) os | '+';
    129         os | "" | cimagl( ldc ) | 'i';
     144        _Bool temp = sepDisable( os );                                          // disable separators within complex value
     145        if ( cimagl( ldc ) >= 0 ) os | '+';                                     // negative value prints '-'
     146        os | cimagl( ldc ) | 'i';
     147        sepReset( os, temp );                                                           // reset separator
    130148        return os;
    131149} // ?|?
     
    134152ostype * ?|?( ostype *os, const char *cp ) {
    135153        enum { Open = 1, Close, OpenClose };
    136         static const char mask[256] = {
     154        static const unsigned char mask[256] = {
    137155                // opening delimiters
    138156                ['('] : Open, ['['] : Open, ['{'] : Open,
    139                 ['$'] : Open, [L'£'] : Open, [L'¥'] : Open, [L'¢'] : Open, [L'¿'] : Open, [L'«'] : Open,
     157                ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
    140158                // closing delimiters
    141159                [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
    142160                [')'] : Close, [']'] : Close, ['}'] : Close,
    143                 ['%'] : Close, [L'»'] : Close,
     161                ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
    144162                // opening-closing delimiters
    145163                ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
     164                ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
    146165        }; // mask
    147166
     
    149168        // null string => no separator
    150169  if ( len == 0 ) { sepOff( os ); return os; }
    151         // first character NOT spacing or closing punctuation => add left separator
    152         if ( sepPrt( os ) && isspace( cp[0] ) == 0 && mask[ cp[0] ] != Close && mask[ cp[0] ] != OpenClose ) {
     170        // first character IS NOT spacing or closing punctuation => add left separator
     171        unsigned char ch = cp[0];                                                       // must make unsigned
     172        if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
    153173                prtfmt( os, "%s", sepGet( os ) );
    154174        } // if
    155175        // last character IS spacing or opening punctuation => turn off separator for next item
    156176        unsigned int posn = len - 1;
    157         if ( isspace( cp[posn] ) || mask[ cp[posn] ] == Open || mask[ cp[posn] ] == OpenClose ) {
     177        ch = cp[posn];                                                                          // must make unsigned
     178        if ( mask[ ch ] == Open || mask[ ch ] == OpenClose ) {
    158179                sepOff( os );
    159180        } else {
     
    165186forall( dtype ostype | ostream( ostype ) )
    166187ostype * ?|?( ostype *os, const void *p ) {
    167         if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
     188        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
     189        sepReset( os );
    168190        prtfmt( os, "%p", p );
    169191        return os;
     
    196218} // sepOff
    197219
     220forall( dtype ostype | ostream( ostype ) )
     221ostype * sepEnable( ostype * os ) {
     222        sepEnable( os );
     223        return os;
     224} // sepEnable
     225
     226forall( dtype ostype | ostream( ostype ) )
     227ostype * sepDisable( ostype * os ) {
     228        sepDisable( os );
     229        return os;
     230} // sepDisable
     231
    198232//---------------------------------------
    199233
     
    310344} // ?|?
    311345
    312 _Istream_str1 str( char * s ) { _Istream_str1 s = { s }; return s; }
    313 forall( dtype istype | istream( istype ) )
    314 istype * ?|?( istype * is, _Istream_str1 str ) {
    315         scanfmt( is, "%s", str.s );
    316         return is;
    317 } // str
    318 
    319 _Istream_str2 str( char * s, int size ) { _Istream_str2 s = { s, size }; return s; }
    320 forall( dtype istype | istream( istype ) )
    321 istype * ?|?( istype * is, _Istream_str2 str ) {
     346_Istream_cstrUC cstr( char * s ) { _Istream_cstrUC s = { s }; return s; }
     347forall( dtype istype | istream( istype ) )
     348istype * ?|?( istype * is, _Istream_cstrUC cstr ) {
     349        scanfmt( is, "%s", cstr.s );
     350        return is;
     351} // cstr
     352
     353_Istream_cstrC cstr( char * s, int size ) { _Istream_cstrC s = { s, size }; return s; }
     354forall( dtype istype | istream( istype ) )
     355istype * ?|?( istype * is, _Istream_cstrC cstr ) {
    322356        char buf[16];
    323         sprintf( buf, "%%%ds", str.size );
    324         scanfmt( is, buf, str.s );
    325         return is;
    326 } // str
     357        sprintf( buf, "%%%ds", cstr.size );
     358        scanfmt( is, buf, cstr.s );
     359        return is;
     360} // cstr
    327361
    328362// Local Variables: //
  • src/libcfa/limits

    rbc1ab61 r78885b5  
     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// limits --
     8//
     9// Author           : Peter A. Buhr
     10// Created On       : Wed Apr  6 18:06:52 2016
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Apr  6 21:08:16 2016
     13// Update Count     : 6
     14//
     15
    116// Integral Constants
    217
    3 const short int MIN = -32768;
    4 const int MIN = -2147483648;
    5 const long int MIN = -9223372036854775807L - 1L;
    6 const long long int MIN = -9223372036854775807LL - 1LL;
     18extern const short int MIN;
     19extern const int MIN;
     20extern const long int MIN;
     21extern const long long int MIN;
    722
    8 const short int MAX = 32767;
    9 const unsigned short int MAX = 65535;
    10 const int MAX = 2147483647;
    11 const unsigned int MAX = 4294967295_U;
    12 const long int MAX = 9223372036854775807_L;
    13 const unsigned long int MAX = 4294967295_U;
    14 const long long int MAX = 9223372036854775807_LL;
    15 const unsigned long long int MAX = 18446744073709551615_ULL;
     23extern const short int MAX;
     24extern const unsigned short int MAX;
     25extern const int MAX;
     26extern const unsigned int MAX;
     27extern const long int MAX;
     28extern const unsigned long int MAX;
     29extern const long long int MAX;
     30extern const unsigned long long int MAX;
    1631
    1732// Floating-Point Constants
    1833
    19 const float PI = 3.141592_F;                            // pi
    20 const float PI_2 = 1.570796_F;                          // pi / 2
    21 const float PI_4 = 0.7853981_F;                         // pi / 4
    22 const float _1_PI = 0.3183098_F;                        // 1 / pi
    23 const float _2_PI = 0.6366197_F;                        // 2 / pi
    24 const float _2_SQRT_PI = 1.128379_F;                    // 2 / sqrt(pi)
     34extern const float PI;                                                                  // pi
     35extern const float PI_2;                                                                // pi / 2
     36extern const float PI_4;                                                                // pi / 4
     37extern const float _1_PI;                                                               // 1 / pi
     38extern const float _2_PI;                                                               // 2 / pi
     39extern const float _2_SQRT_PI;                                                  // 2 / sqrt(pi)
    2540
    26 const double PI = 3.14159265358979323846_D;             // pi
    27 const double PI_2 = 1.57079632679489661923_D;           // pi / 2
    28 const double PI_4 = 0.78539816339744830962_D;           // pi / 4
    29 const double _1_PI = 0.31830988618379067154_D;          // 1 / pi
    30 const double _2_PI = 0.63661977236758134308_D;          // 2 / pi
    31 const double _2_SQRT_PI = 1.12837916709551257390_D;     // 2 / sqrt(pi)
     41extern const double PI;                                                                 // pi
     42extern const double PI_2;                                                               // pi / 2
     43extern const double PI_4;                                                               // pi / 4
     44extern const double _1_PI;                                                              // 1 / pi
     45extern const double _2_PI;                                                              // 2 / pi
     46extern const double _2_SQRT_PI;                                                 // 2 / sqrt(pi)
    3247
    33 const long double PI = 3.1415926535897932384626433832795029_DL; // pi
    34 const long double PI_2 = 1.5707963267948966192313216916397514_DL; // pi / 2
    35 const long double PI_4 = 0.7853981633974483096156608458198757_DL; // pi / 4
    36 const long double _1_PI = 0.3183098861837906715377675267450287_DL; // 1 / pi
    37 const long double _2_PI = 0.6366197723675813430755350534900574_DL; // 2 / pi
    38 const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 2 / sqrt(pi)
     48extern const long double PI;                                                    // pi
     49extern const long double PI_2;                                                  // pi / 2
     50extern const long double PI_4;                                                  // pi / 4
     51extern const long double _1_PI;                                                 // 1 / pi
     52extern const long double _2_PI;                                                 // 2 / pi
     53extern const long double _2_SQRT_PI;                                    // 2 / sqrt(pi)
    3954
    40 const _Complex PI = 3.14159265358979323846_D+0.0_iD;    // pi
    41 const _Complex PI_2 = 1.57079632679489661923_D+0.0_iD;  // pi / 2
    42 const _Complex PI_4 = 0.78539816339744830962_D+0.0_iD;  // pi / 4
    43 const _Complex _1_PI = 0.31830988618379067154_D+0.0_iD; // 1 / pi
    44 const _Complex _2_PI = 0.63661977236758134308_D+0.0_iD; // 2 / pi
    45 const _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
     55extern const _Complex PI;                                                               // pi
     56extern const _Complex PI_2;                                                             // pi / 2
     57extern const _Complex PI_4;                                                             // pi / 4
     58extern const _Complex _1_PI;                                                    // 1 / pi
     59extern const _Complex _2_PI;                                                    // 2 / pi
     60extern const _Complex _2_SQRT_PI;                                               // 2 / sqrt(pi)
    4661
    47 const long _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
    48 const long _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
    49 const long _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
    50 const long _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
    51 const long _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
    52 const long _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
     62extern const long _Complex PI;                                                  // pi
     63extern const long _Complex PI_2;                                                // pi / 2
     64extern const long _Complex PI_4;                                                // pi / 4
     65extern const long _Complex _1_PI;                                               // 1 / pi
     66extern const long _Complex _2_PI;                                               // 2 / pi
     67extern const long _Complex _2_SQRT_PI;                                  // 2 / sqrt(pi)
    5368
    54 const float E = 2.718281;                               // e
    55 const float LOG2_E = 1.442695;                          // log_2(e)
    56 const float LOG10_E = 0.4342944;                        // log_10(e)
    57 const float LN_2 = 0.6931471;                           // log_e(2)
    58 const float LN_10 = 2.302585;                           // log_e(10)
    59 const float SQRT_2 = 1.414213;                          // sqrt(2)
    60 const float _1_SQRT_2 = 0.7071067;                      // 1 / sqrt(2)
     69extern const float E;                                                                   // e
     70extern const float LOG2_E;                                                              // log_2(e)
     71extern const float LOG10_E;                                                             // log_10(e)
     72extern const float LN_2;                                                                // log_e(2)
     73extern const float LN_10;                                                               // log_e(10)
     74extern const float SQRT_2;                                                              // sqrt(2)
     75extern const float _1_SQRT_2;                                                   // 1 / sqrt(2)
    6176
    62 const double E = 2.7182818284590452354_D;               // e
    63 const double LOG2_E = 1.4426950408889634074_D;          // log_2(e)
    64 const double LOG10_E = 0.43429448190325182765_D;        // log_10(e)
    65 const double LN_2 = 0.69314718055994530942_D;           // log_e(2)
    66 const double LN_10 = 2.30258509299404568402_D;          // log_e(10)
    67 const double SQRT_2 = 1.41421356237309504880_D;         // sqrt(2)
    68 const double _1_SQRT_2 = 0.70710678118654752440_D;      // 1 / sqrt(2)
     77extern const double E;                                                                  // e
     78extern const double LOG2_E;                                                             // log_2(e)
     79extern const double LOG10_E;                                                    // log_10(e)
     80extern const double LN_2;                                                               // log_e(2)
     81extern const double LN_10;                                                              // log_e(10)
     82extern const double SQRT_2;                                                             // sqrt(2)
     83extern const double _1_SQRT_2;                                                  // 1 / sqrt(2)
    6984
    70 const long double E = 2.7182818284590452353602874713526625_DL; // e
    71 const long double LOG2_E = 1.4426950408889634073599246810018921_DL; // log_2(e)
    72 const long double LOG10_E = 0.4342944819032518276511289189166051_DL; // log_10(e)
    73 const long double LN_2 = 0.6931471805599453094172321214581766_DL; // log_e(2)
    74 const long double LN_10 = 2.3025850929940456840179914546843642_DL; // log_e(10)
    75 const long double SQRT_2 = 1.4142135623730950488016887242096981_DL; // sqrt(2)
    76 const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 1/sqrt(2)
     85extern const long double E;                                                             // e
     86extern const long double LOG2_E;                                                // log_2(e)
     87extern const long double LOG10_E;                                               // log_10(e)
     88extern const long double LN_2;                                                  // log_e(2)
     89extern const long double LN_10;                                                 // log_e(10)
     90extern const long double SQRT_2;                                                // sqrt(2)
     91extern const long double _1_SQRT_2;                                             // 1/sqrt(2)
    7792
    78 const _Complex E = 2.7182818284590452354_D+0.0_iD;      // e
    79 const _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD; // log_2(e)
    80 const _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
    81 const _Complex LN_2 = 0.69314718055994530942_D+0.0_iD;  // log_e(2)
    82 const _Complex LN_10 = 2.30258509299404568402_D+0.0_iD; // log_e(10)
    83 const _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD;        // sqrt(2)
    84 const _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
     93extern const _Complex E;                                                                // e
     94extern const _Complex LOG2_E;                                                   // log_2(e)
     95extern const _Complex LOG10_E;                                                  // log_10(e)
     96extern const _Complex LN_2;                                                             // log_e(2)
     97extern const _Complex LN_10;                                                    // log_e(10)
     98extern const _Complex SQRT_2;                                                   // sqrt(2)
     99extern const _Complex _1_SQRT_2;                                                // 1 / sqrt(2)
    85100
    86 const long _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
    87 const long _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
    88 const long _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
    89 const long _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
    90 const long _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
    91 const long _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
    92 const long _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
     101extern const long _Complex E;                                                   // e
     102extern const long _Complex LOG2_E;                                              // log_2(e)
     103extern const long _Complex LOG10_E;                                             // log_10(e)
     104extern const long _Complex LN_2;                                                // log_e(2)
     105extern const long _Complex LN_10;                                               // log_e(10)
     106extern const long _Complex SQRT_2;                                              // sqrt(2)
     107extern const long _Complex _1_SQRT_2;                                   // 1 / sqrt(2)
     108
     109// Local Variables: //
     110// mode: c //
     111// tab-width: 4 //
     112// End: //
  • src/libcfa/stdlib

    rbc1ab61 r78885b5  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 22 22:34:24 2016
    13 // Update Count     : 69
     12// Last Modified On : Fri Apr  1 22:26:14 2016
     13// Update Count     : 73
    1414//
    1515
     
    1818extern "C" {
    1919#include <stddef.h>                                                                             // size_t
     20#include <math.h>                                                                               // floor
    2021} // extern "C"
    2122
     
    8081char abs( char );
    8182extern "C" {
    82 int abs( int );         // use default C routine for int
    83 } // extern
     83int abs( int );                         // use default C routine for int
     84} // extern "C"
    8485long int abs( long int );
    8586long long int abs( long long int );
     
    9091double _Complex abs( double _Complex );
    9192long double _Complex abs( long double _Complex );
     93
     94//---------------------------------------
     95
     96float floor( float );
     97extern "C" {
     98double floor( double );         // use C routine for double
     99} // extern "C"
     100long double floor( long double );
     101
     102float ceil( float );
     103extern "C" {
     104double ceil( double );          // use C routine for double
     105} // extern "C"
     106long double ceil( long double );
    92107
    93108//---------------------------------------
  • src/libcfa/stdlib.c

    rbc1ab61 r78885b5  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar 23 13:26:42 2016
    13 // Update Count     : 146
     12// Last Modified On : Wed Mar 30 10:48:41 2016
     13// Update Count     : 149
    1414//
    1515
     
    243243//---------------------------------------
    244244
     245float floor( float v ) { return floorf( v ); }
     246long double floor( long double v ) { return floorl( v ); }
     247
     248float ceil( float v ) { return ceilf( v ); }
     249long double ceil( long double v ) { return ceill( v ); }
     250
     251//---------------------------------------
     252
    245253void rand48seed( long int s ) { srand48( s ); }
    246254char rand48() { return mrand48(); }
Note: See TracChangeset for help on using the changeset viewer.