Changeset fbfde843 for src/libcfa


Ignore:
Timestamp:
May 2, 2016, 3:15:07 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, with_gc
Children:
d7903b1
Parents:
540de412 (diff), e945826 (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' into ctor

Conflicts:

src/libcfa/fstream.c
src/libcfa/iostream.c

Location:
src/libcfa
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/fstream

    r540de412 rfbfde843  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Apr 19 20:44:10 2016
    13 // Update Count     : 84
     12// Last Modified On : Thu Apr 28 08:08:04 2016
     13// Update Count     : 88
    1414//
    1515
     
    2222struct ofstream {
    2323        void *file;
    24         int sepDefault;
    25         int sepOnOff;
     24        _Bool sepDefault;
     25        int sepOnOff;                                                                           // FIX ME: type should be _Bool
    2626        char separator[separateSize];
    2727}; // ofstream
  • src/libcfa/fstream.c

    r540de412 rfbfde843  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Apr 14 17:04:24 2016
    13 // Update Count     : 176
     12// Last Modified On : Mon May 02 15:14:52 2016
     13// Update Count     : 187
    1414//
    1515
     
    9393int prtfmt( ofstream * os, const char fmt[], ... ) {
    9494    va_list args;
    95 
    9695    va_start( args, fmt );
    9796    int len = vfprintf( (FILE *)(os->file), fmt, args );
     
    103102        } // if
    104103    va_end( args );
     104
     105        sepReset( os );                                                                         // reset separator
    105106        return len;
    106107} // prtfmt
  • src/libcfa/iostream.c

    r540de412 rfbfde843  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Apr 14 16:02:09 2016
    13 // Update Count     : 278
     12// Last Modified On : Mon May 02 15:13:55 2016
     13// Update Count     : 302
    1414//
    1515
     
    3434ostype * ?|?( ostype *os, short int si ) {
    3535        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    36         sepReset( os );
    3736        prtfmt( os, "%hd", si );
    3837        return os;
     
    4241ostype * ?|?( ostype *os, unsigned short int usi ) {
    4342        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    44         sepReset( os );
    4543        prtfmt( os, "%hu", usi );
    4644        return os;
     
    5048ostype * ?|?( ostype *os, int i ) {
    5149        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    52         sepReset( os );
    5350        prtfmt( os, "%d", i );
    5451        return os;
     
    5855ostype * ?|?( ostype *os, unsigned int ui ) {
    5956        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    60         sepReset( os );
    6157        prtfmt( os, "%u", ui );
    6258        return os;
     
    6662ostype * ?|?( ostype *os, long int li ) {
    6763        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    68         sepReset( os );
    6964        prtfmt( os, "%ld", li );
    7065        return os;
     
    7469ostype * ?|?( ostype *os, unsigned long int uli ) {
    7570        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    76         sepReset( os );
    7771        prtfmt( os, "%lu", uli );
    7872        return os;
     
    8276ostype * ?|?( ostype *os, long long int lli ) {
    8377        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    84         sepReset( os );
    8578        prtfmt( os, "%lld", lli );
    8679        return os;
     
    9083ostype * ?|?( ostype *os, unsigned long long int ulli ) {
    9184        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    92         sepReset( os );
    9385        prtfmt( os, "%llu", ulli );
    9486        return os;
     
    9890ostype * ?|?( ostype *os, float f ) {
    9991        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    100         sepReset( os );
    10192        prtfmt( os, "%g", f );
    10293        return os;
     
    10697ostype * ?|?( ostype *os, double d ) {
    10798        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    108         sepReset( os );
    10999        prtfmt( os, "%.*lg", DBL_DIG, d );
    110100        return os;
     
    114104ostype * ?|?( ostype *os, long double ld ) {
    115105        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    116         sepReset( os );
    117106        prtfmt( os, "%.*Lg", LDBL_DIG, ld );
    118107        return os;
     
    155144                // opening delimiters
    156145                ['('] : Open, ['['] : Open, ['{'] : Open,
    157                 ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
     146                ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,
     147                [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
    158148                // closing delimiters
    159149                [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
     
    162152                // opening-closing delimiters
    163153                ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
    164                 ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
     154                [' '] : OpenClose, ['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
    165155        }; // mask
    166156
    167         int len = strlen( cp );
    168         // null string => no separator
    169   if ( len == 0 ) { sepOff( os ); return os; }
     157  if ( cp[0] == '\0' ) { sepOff( os ); return os; }             // null string => no separator
     158
    170159        // first character IS NOT spacing or closing punctuation => add left separator
    171160        unsigned char ch = cp[0];                                                       // must make unsigned
     
    173162                prtfmt( os, "%s", sepGet( os ) );
    174163        } // if
     164
     165        // if string starts line, must reset to determine open state because separator is off
     166        sepReset( os );                                                                         // reset separator
     167
    175168        // last character IS spacing or opening punctuation => turn off separator for next item
    176         unsigned int posn = len - 1;
     169        unsigned int len = strlen( cp ), posn = len - 1;
    177170        ch = cp[posn];                                                                          // must make unsigned
    178         if ( mask[ ch ] == Open || mask[ ch ] == OpenClose ) {
     171        if ( sepPrt( os ) && mask[ ch ] != Open && mask[ ch ] != OpenClose ) {
     172                sepOn( os );
     173        } else {
    179174                sepOff( os );
    180         } else {
    181                 sepOn( os );
    182175        } // if
    183176        return write( os, cp, len );
     
    187180ostype * ?|?( ostype *os, const void *p ) {
    188181        if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
    189         sepReset( os );
    190182        prtfmt( os, "%p", p );
    191183        return os;
  • src/libcfa/stdlib

    r540de412 rfbfde843  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 21 07:55:21 2016
    13 // Update Count     : 95
     12// Last Modified On : Wed Apr 27 22:03:29 2016
     13// Update Count     : 96
    1414//
    1515
     
    4545
    4646forall( otype T ) T * aligned_alloc( size_t alignment );
    47 forall( otype T ) T * memalign( size_t alignment );
     47forall( otype T ) T * memalign( size_t alignment );             // deprecated
    4848forall( otype T ) int posix_memalign( T ** ptr, size_t alignment );
    4949
  • src/libcfa/stdlib.c

    r540de412 rfbfde843  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 21 07:58:29 2016
    13 // Update Count     : 165
     12// Last Modified On : Thu Apr 28 07:54:21 2016
     13// Update Count     : 166
    1414//
    1515
     
    213213//---------------------------------------
    214214
    215 forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
    216 [ T, T ] div( T t1, T t2 ) { /* return [ t1 / t2, t1 % t2 ]; */ }
     215// forall( otype T | { T ?/?( T, T ); T ?%?( T, T ); } )
     216// [ T, T ] div( T t1, T t2 ) { return [ t1 / t2, t1 % t2 ]; }
    217217
    218218//---------------------------------------
Note: See TracChangeset for help on using the changeset viewer.