Ignore:
Timestamp:
Mar 18, 2020, 3:41:01 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
778452d, d658183
Parents:
c4fd4ef (diff), 45f4147 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    rc4fd4ef rbbdb0c6  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  5 15:56:16 2020
    13 // Update Count     : 834
     12// Last Modified On : Wed Mar 11 14:35:35 2020
     13// Update Count     : 860
    1414//
    1515
     
    534534#define IntegralFMTImpl128( T, SIGNED, CODE, IFMTNP, IFMTP ) \
    535535forall( dtype ostype | ostream( ostype ) ) \
    536 static void base10_128( ostype & os, _Ostream_Manip(T) fmt ) { \
    537         if ( fmt.val > UINT64_MAX ) { \
    538                 base10_128( os, fmt.val / P10_UINT64 ); /* recursive */ \
    539                 _Ostream_Manip(unsigned long long int) fmt2 @= { (uint64_t)(fmt.val % P10_UINT64), 0, 19, 'u', { .all : 0 } }; \
    540                 fmt2.flags.nobsdp = true; \
    541                 printf( "fmt2 %c %lld %d\n", fmt2.base, fmt2.val, fmt2.all );   \
     536static void base10_128( ostype & os, _Ostream_Manip(T) f ) { \
     537        if ( f.val > UINT64_MAX ) { \
     538                unsigned long long int lsig = f.val % P10_UINT64; \
     539                f.val /= P10_UINT64; /* msig */ \
     540                base10_128( os, f ); /* recursion */ \
     541                _Ostream_Manip(unsigned long long int) fmt @= { lsig, 0, 19, 'u', { .all : 0 } }; \
     542                fmt.flags.nobsdp = true; \
     543                /* printf( "fmt1 %c %lld %d\n", fmt.base, fmt.val, fmt.all ); */ \
    542544                sepOff( os ); \
    543                 (ostype &)(os | fmt2); \
     545                (ostype &)(os | fmt); \
    544546        } else { \
    545                 printf( "fmt %c %lld %d\n", fmt.base, (unsigned long long int)fmt.val, fmt.all ); \
    546                 _Ostream_Manip(SIGNED long long int) x @= { (unsigned long long int)fmt.val, fmt.wd, fmt.pc, fmt.base, { .all : fmt.all } }; \
    547                 (ostype &)(os | x); \
     547                /* printf( "fmt2 %c %lld %d\n", f.base, (unsigned long long int)f.val, f.all ); */ \
     548                _Ostream_Manip(SIGNED long long int) fmt @= { (SIGNED long long int)f.val, f.wd, f.pc, f.base, { .all : f.all } }; \
     549                (ostype &)(os | fmt); \
    548550        } /* if */ \
    549 } /* base10_128 */                                                \
     551} /* base10_128 */ \
    550552forall( dtype ostype | ostream( ostype ) ) { \
    551553        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
     
    564566                                if ( f.base == 'b' | f.base == 'B' ) { \
    565567                                        if ( f.wd > 64 ) fmt.wd = f.wd - 64; \
     568                                        if ( f.flags.pc && f.pc > 64 ) fmt.pc = f.pc - 64; \
    566569                                        fmt2.wd = 64; \
    567570                                        (ostype &)(os | fmt | "" | fmt2); \
     
    569572                                        fmt.val = (unsigned long long int)fmt.val >> 2; \
    570573                                        if ( f.wd > 21 ) fmt.wd = f.wd - 21; \
     574                                        if ( f.flags.pc && f.pc > 21 ) fmt.pc = f.pc - 21; \
    571575                                        fmt2.wd = 1; \
    572576                                        fmt2.val = ((msig & 0x3) << 1) + 1; \
     
    578582                                } else { \
    579583                                        if ( f.flags.left ) { \
    580                                                 if ( f.wd > 16 ) fmt2.wd = f.wd - 16;   \
    581                                                 fmt.wd = 16;                                                    \
     584                                                if ( f.wd > 16 ) fmt2.wd = f.wd - 16; \
     585                                                fmt.wd = 16; \
    582586                                        } else { \
    583                                                 if ( f.wd > 16 ) fmt.wd = f.wd - 16;    \
    584                                                 fmt2.wd = 16;                                                   \
     587                                                if ( f.wd > 16 ) fmt.wd = f.wd - 16; \
     588                                                if ( f.flags.pc && f.pc > 16 ) fmt.pc = f.pc - 16; \
     589                                                fmt2.wd = 16; \
    585590                                        } /* if */ \
    586591                                        (ostype &)(os | fmt | "" | fmt2); \
     
    588593                        } /* if */ \
    589594                } else { \
     595                        if ( CODE == 'd' ) { \
     596                                if ( f.val < 0 )  { fmt( os, "-" ); sepOff( os ); f.val = -f.val; f.flags.sign = false; } \
     597                        } /* if */ \
    590598                        base10_128( os, f ); \
    591599                } /* if */ \
Note: See TracChangeset for help on using the changeset viewer.