Changes in / [db94b5d:c44705c]


Ignore:
Location:
libcfa/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.cfa

    rdb94b5d rc44705c  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 18 10:42:51 2023
    13 // Update Count     : 1401
     12// Last Modified On : Thu Jun 29 10:12:39 2023
     13// Update Count     : 1380
    1414//
    1515
     
    3434#pragma GCC visibility push(default)
    3535
    36 
    3736// *********************************** ostream ***********************************
    3837
     
    4443                return os;
    4544        } // ?|?
    46         OSTYPE_VOID_IMPL( bool )
     45        void ?|?( ostype & os, bool b ) {
     46                (ostype &)(os | b); ends( os );
     47        } // ?|?
    4748
    4849        ostype & ?|?( ostype & os, char c ) {
     
    5152                return nosep( os );
    5253        } // ?|?
    53         OSTYPE_VOID_IMPL( char )
     54        void ?|?( ostype & os, char c ) {
     55                (ostype &)(os | c); ends( os );
     56        } // ?|?
    5457
    5558        ostype & ?|?( ostype & os, signed char sc ) {
     
    5861                return os;
    5962        } // ?|?
    60         OSTYPE_VOID_IMPL( signed char )
     63        void ?|?( ostype & os, signed char sc ) {
     64                (ostype &)(os | sc); ends( os );
     65        } // ?|?
    6166
    6267        ostype & ?|?( ostype & os, unsigned char usc ) {
     
    6570                return os;
    6671        } // ?|?
    67         OSTYPE_VOID_IMPL( unsigned char )
     72        void ?|?( ostype & os, unsigned char usc ) {
     73                (ostype &)(os | usc); ends( os );
     74        } // ?|?
    6875
    6976        ostype & ?|?( ostype & os, short int si ) {
     
    7279                return os;
    7380        } // ?|?
    74         OSTYPE_VOID_IMPL( short int )
     81        void & ?|?( ostype & os, short int si ) {
     82                (ostype &)(os | si); ends( os );
     83        } // ?|?
    7584
    7685        ostype & ?|?( ostype & os, unsigned short int usi ) {
     
    7988                return os;
    8089        } // ?|?
    81         OSTYPE_VOID_IMPL( unsigned short int )
     90        void & ?|?( ostype & os, unsigned short int usi ) {
     91                (ostype &)(os | usi); ends( os );
     92        } // ?|?
    8293
    8394        ostype & ?|?( ostype & os, int i ) {
     
    8697                return os;
    8798        } // ?|?
    88         OSTYPE_VOID_IMPL( int )
     99        void & ?|?( ostype & os, int i ) {
     100                (ostype &)(os | i); ends( os );
     101        } // ?|?
    89102
    90103        ostype & ?|?( ostype & os, unsigned int ui ) {
     
    93106                return os;
    94107        } // ?|?
    95         OSTYPE_VOID_IMPL( unsigned int )
     108        void & ?|?( ostype & os, unsigned int ui ) {
     109                (ostype &)(os | ui); ends( os );
     110        } // ?|?
    96111
    97112        ostype & ?|?( ostype & os, long int li ) {
     
    100115                return os;
    101116        } // ?|?
    102         OSTYPE_VOID_IMPL( long int )
     117        void & ?|?( ostype & os, long int li ) {
     118                (ostype &)(os | li); ends( os );
     119        } // ?|?
    103120
    104121        ostype & ?|?( ostype & os, unsigned long int uli ) {
     
    107124                return os;
    108125        } // ?|?
    109         OSTYPE_VOID_IMPL( unsigned long int )
     126        void & ?|?( ostype & os, unsigned long int uli ) {
     127                (ostype &)(os | uli); ends( os );
     128        } // ?|?
    110129
    111130        ostype & ?|?( ostype & os, long long int lli ) {
     
    114133                return os;
    115134        } // ?|?
    116         OSTYPE_VOID_IMPL( long long int )
     135        void & ?|?( ostype & os, long long int lli ) {
     136                (ostype &)(os | lli); ends( os );
     137        } // ?|?
    117138
    118139        ostype & ?|?( ostype & os, unsigned long long int ulli ) {
     
    121142                return os;
    122143        } // ?|?
    123         OSTYPE_VOID_IMPL( unsigned long long int )
     144        void & ?|?( ostype & os, unsigned long long int ulli ) {
     145                (ostype &)(os | ulli); ends( os );
     146        } // ?|?
    124147
    125148        #if defined( __SIZEOF_INT128__ )
     
    153176                return os;
    154177        } // ?|?
    155         OSTYPE_VOID_IMPL( int128 )
     178        void & ?|?( ostype & os, int128 llli ) {
     179                (ostype &)(os | llli); ends( os );
     180        } // ?|?
    156181
    157182        ostype & ?|?( ostype & os, unsigned int128 ullli ) {
     
    160185                return os;
    161186        } // ?|?
    162         OSTYPE_VOID_IMPL( unsigned int128 )
     187        void & ?|?( ostype & os, unsigned int128 ullli ) {
     188                (ostype &)(os | ullli); ends( os );
     189        } // ?|?
    163190        #endif // __SIZEOF_INT128__
    164191
    165         #define PRINT_WITH_DP( os, format, val, ... ) \
     192        #define PrintWithDP( os, format, val, ... ) \
    166193                { \
    167194                        enum { size = 48 }; \
     
    179206        ostype & ?|?( ostype & os, float f ) {
    180207                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    181                 PRINT_WITH_DP( os, "%'g", f );
    182                 return os;
    183         } // ?|?
    184         OSTYPE_VOID_IMPL( float )
     208                PrintWithDP( os, "%'g", f );
     209                return os;
     210        } // ?|?
     211        void & ?|?( ostype & os, float f ) {
     212                (ostype &)(os | f); ends( os );
     213        } // ?|?
    185214
    186215        ostype & ?|?( ostype & os, double d ) {
    187216                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    188                 PRINT_WITH_DP( os, "%'.*lg", d, DBL_DIG );
    189                 return os;
    190         } // ?|?
    191         OSTYPE_VOID_IMPL( double )
     217                PrintWithDP( os, "%'.*lg", d, DBL_DIG );
     218                return os;
     219        } // ?|?
     220        void & ?|?( ostype & os, double d ) {
     221                (ostype &)(os | d); ends( os );
     222        } // ?|?
    192223
    193224        ostype & ?|?( ostype & os, long double ld ) {
    194225                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    195                 PRINT_WITH_DP( os, "%'.*Lg", ld, LDBL_DIG );
    196                 return os;
    197         } // ?|?
    198         OSTYPE_VOID_IMPL( long double )
     226                PrintWithDP( os, "%'.*Lg", ld, LDBL_DIG );
     227                return os;
     228        } // ?|?
     229        void & ?|?( ostype & os, long double ld ) {
     230                (ostype &)(os | ld); ends( os );
     231        } // ?|?
    199232
    200233        ostype & ?|?( ostype & os, float _Complex fc ) {
    201234                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    202235//              os | crealf( fc ) | nonl;
    203                 PRINT_WITH_DP( os, "%'g", crealf( fc ) );
    204                 PRINT_WITH_DP( os, "%'+g", cimagf( fc ) );
     236                PrintWithDP( os, "%'g", crealf( fc ) );
     237                PrintWithDP( os, "%'+g", cimagf( fc ) );
    205238                fmt( os, "i" );
    206239                return os;
    207240        } // ?|?
    208         OSTYPE_VOID_IMPL( float _Complex )
     241        void & ?|?( ostype & os, float _Complex fc ) {
     242                (ostype &)(os | fc); ends( os );
     243        } // ?|?
    209244
    210245        ostype & ?|?( ostype & os, double _Complex dc ) {
    211246                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    212247//              os | creal( dc ) | nonl;
    213                 PRINT_WITH_DP( os, "%'.*lg", creal( dc ), DBL_DIG );
    214                 PRINT_WITH_DP( os, "%'+.*lg", cimag( dc ), DBL_DIG );
     248                PrintWithDP( os, "%'.*lg", creal( dc ), DBL_DIG );
     249                PrintWithDP( os, "%'+.*lg", cimag( dc ), DBL_DIG );
    215250                fmt( os, "i" );
    216251                return os;
    217252        } // ?|?
    218         OSTYPE_VOID_IMPL( double _Complex )
     253        void & ?|?( ostype & os, double _Complex dc ) {
     254                (ostype &)(os | dc); ends( os );
     255        } // ?|?
    219256
    220257        ostype & ?|?( ostype & os, long double _Complex ldc ) {
    221258                if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) );
    222259//              os | creall( ldc ) || nonl;
    223                 PRINT_WITH_DP( os, "%'.*Lg", creall( ldc ), LDBL_DIG );
    224                 PRINT_WITH_DP( os, "%'+.*Lg", cimagl( ldc ), LDBL_DIG );
     260                PrintWithDP( os, "%'.*Lg", creall( ldc ), LDBL_DIG );
     261                PrintWithDP( os, "%'+.*Lg", cimagl( ldc ), LDBL_DIG );
    225262                fmt( os, "i" );
    226263                return os;
    227264        } // ?|?
    228         OSTYPE_VOID_IMPL( long double _Complex )
     265        void & ?|?( ostype & os, long double _Complex ldc ) {
     266                (ostype &)(os | ldc); ends( os );
     267        } // ?|?
    229268
    230269        ostype & ?|?( ostype & os, const char s[] ) {
     
    269308//              return write( os, s, len );
    270309        } // ?|?
    271         OSTYPE_VOID_IMPL( const char * )
     310        void ?|?( ostype & os, const char s[] ) {
     311                (ostype &)(os | s); ends( os );
     312        } // ?|?
    272313
    273314//      ostype & ?|?( ostype & os, const char16_t * s ) {
     
    296337                return os;
    297338        } // ?|?
    298         OSTYPE_VOID_IMPL( const void * )
     339        void ?|?( ostype & os, const void * p ) {
     340                (ostype &)(os | p); ends( os );
     341        } // ?|?
    299342
    300343        // manipulators
     
    399442
    400443// Default prefix for non-decimal prints is 0b, 0, 0x.
    401 #define INTEGRAL_FMT_IMPL( T, IFMTNP, IFMTP ) \
     444#define IntegralFMTImpl( T, IFMTNP, IFMTP ) \
    402445forall( ostype & | basic_ostream( ostype ) ) { \
    403446        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
     
    476519                return os; \
    477520        } /* ?|? */ \
    478         OSTYPE_VOID_IMPL( _Ostream_Manip(T) ) \
     521        void ?|?( ostype & os, _Ostream_Manip(T) f ) { \
     522                (ostype &)(os | f); ends( os ); \
     523        } /* ?|? */ \
    479524} // distribution
    480525
    481 INTEGRAL_FMT_IMPL( signed char,            "      *hh ", "      *.*hh " )
    482 INTEGRAL_FMT_IMPL( unsigned char,          "      *hh ", "      *.*hh " )
    483 INTEGRAL_FMT_IMPL( signed short int,       "      *h ",  "      *.*h " )
    484 INTEGRAL_FMT_IMPL( unsigned short int,     "      *h ",  "      *.*h " )
    485 INTEGRAL_FMT_IMPL( signed int,             "      * ",   "      *.* " )
    486 INTEGRAL_FMT_IMPL( unsigned int,           "      * ",   "      *.* " )
    487 INTEGRAL_FMT_IMPL( signed long int,        "      *l ",  "      *.*l " )
    488 INTEGRAL_FMT_IMPL( unsigned long int,      "      *l ",  "      *.*l " )
    489 INTEGRAL_FMT_IMPL( signed long long int,   "      *ll ", "      *.*ll " )
    490 INTEGRAL_FMT_IMPL( unsigned long long int, "      *ll ", "      *.*ll " )
     526IntegralFMTImpl( signed char,            "      *hh ", "      *.*hh " )
     527IntegralFMTImpl( unsigned char,          "      *hh ", "      *.*hh " )
     528IntegralFMTImpl( signed short int,       "      *h ",  "      *.*h " )
     529IntegralFMTImpl( unsigned short int,     "      *h ",  "      *.*h " )
     530IntegralFMTImpl( signed int,             "      * ",   "      *.* " )
     531IntegralFMTImpl( unsigned int,           "      * ",   "      *.* " )
     532IntegralFMTImpl( signed long int,        "      *l ",  "      *.*l " )
     533IntegralFMTImpl( unsigned long int,      "      *l ",  "      *.*l " )
     534IntegralFMTImpl( signed long long int,   "      *ll ", "      *.*ll " )
     535IntegralFMTImpl( unsigned long long int, "      *ll ", "      *.*ll " )
    491536
    492537
     
    557602} // base_128
    558603
    559 #define INTEGRAL_FMT_IMPL128( T ) \
     604#define IntegralFMTImpl128( T ) \
    560605forall( ostype & | basic_ostream( ostype ) ) { \
    561606        ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \
     
    574619                return os; \
    575620        } /* ?|? */ \
    576         OSTYPE_VOID_IMPL( _Ostream_Manip(T) ) \
     621        void ?|?( ostype & os, _Ostream_Manip(T) f ) { (ostype &)(os | f); ends( os ); } \
    577622} // distribution
    578623
    579 INTEGRAL_FMT_IMPL128( int128 )
    580 INTEGRAL_FMT_IMPL128( unsigned int128 )
     624IntegralFMTImpl128( int128 )
     625IntegralFMTImpl128( unsigned int128 )
    581626#endif // __SIZEOF_INT128__
    582627
     
    590635#define SUFFIXES_END (SUFFIXES_START + (int)((sizeof(suffixes) / sizeof(char *) - 1) * 3))
    591636
    592 #define PRINT_WITH_DP2( os, format, ... ) \
     637#define PrintWithDP2( os, format, ... ) \
    593638        { \
    594639                if ( ! f.flags.eng ) { \
     
    631676        }
    632677
    633 #define FLOATING_POINT_FMT_IMPL( T, DFMTNP, DFMTP ) \
     678#define FloatingPointFMTImpl( T, DFMTNP, DFMTP ) \
    634679forall( ostype & | basic_ostream( ostype ) ) { \
    635680        static void eng( T &value, int & pc, int & exp10 ) { \
     
    662707                        fmtstr[sizeof(DFMTNP)-2] = f.base;                      /* sizeof includes '\0' */ \
    663708                        /* printf( "%g %d %s\n", f.val, f.wd, &fmtstr[star] ); */ \
    664                         PRINT_WITH_DP2( os, &fmtstr[star], f.wd, f.val ) \
     709                        PrintWithDP2( os, &fmtstr[star], f.wd, f.val ) \
    665710                } else {                                                                                /* precision */ \
    666711                        fmtstr[sizeof(DFMTP)-2] = f.base;                       /* sizeof includes '\0' */ \
    667712                        /* printf( "%g %d %d %s\n", f.val, f.wd, f.pc, &fmtstr[star] ); */ \
    668                         PRINT_WITH_DP2( os, &fmtstr[star], f.wd, f.pc, f.val ) \
     713                        PrintWithDP2( os, &fmtstr[star], f.wd, f.pc, f.val ) \
    669714                } /* if */ \
    670715                return os; \
    671716        } /* ?|? */ \
    672717\
    673         OSTYPE_VOID_IMPL( _Ostream_Manip(T) ) \
     718        void ?|?( ostype & os, _Ostream_Manip(T) f ) { (ostype &)(os | f); ends( os ); } \
    674719} // distribution
    675720
    676 FLOATING_POINT_FMT_IMPL( double,      "      * ",  "      *.* " )
    677 FLOATING_POINT_FMT_IMPL( long double, "      *L ", "      *.*L " )
     721FloatingPointFMTImpl( double,      "      * ",  "      *.* " )
     722FloatingPointFMTImpl( long double, "      *L ", "      *.*L " )
    678723
    679724// *********************************** character ***********************************
     
    706751                return os;
    707752        } // ?|?
    708         OSTYPE_VOID_IMPL( _Ostream_Manip(char) )
     753
     754        void ?|?( ostype & os, _Ostream_Manip(char) f ) { (ostype &)(os | f); ends( os ); }
    709755} // distribution
    710756
     
    753799                return os;
    754800        } // ?|?
    755         OSTYPE_VOID_IMPL( _Ostream_Manip(const char *) )
     801
     802        void ?|?( ostype & os, _Ostream_Manip(const char *) f ) { (ostype &)(os | f); ends( os ); }
    756803} // distribution
    757804
     
    759806// *********************************** istream ***********************************
    760807
    761 
    762 #define ISTYPE_VOID_VAL_IMPL( T ) \
    763         void ?|?( istype & is, T t ) { \
    764                 (istype &)(is | t); ends( is ); \
    765         } // ?|?
    766808
    767809forall( istype & | basic_istream( istype ) ) {
     
    777819                return is;
    778820        } // ?|?
    779         ISTYPE_VOID_IMPL( bool )
     821        void ?|?( istype & is, bool & b ) {
     822                (istype &)(is | b); ends( is );
     823        } // ?|?
    780824
    781825        istype & ?|?( istype & is, char & c ) {
     
    789833                return is;
    790834        } // ?|?
    791         ISTYPE_VOID_IMPL( char )
     835        void ?|?( istype & is, char & c ) {
     836                (istype &)(is | c); ends( is );
     837        } // ?|?
    792838
    793839        istype & ?|?( istype & is, signed char & sc ) {
     
    795841                return is;
    796842        } // ?|?
    797         ISTYPE_VOID_IMPL( signed char )
     843        void ?|?( istype & is, signed char & sc ) {
     844                (istype &)(is | sc); ends( is );
     845        } // ?|?
    798846
    799847        istype & ?|?( istype & is, unsigned char & usc ) {
     
    801849                return is;
    802850        } // ?|?
    803         ISTYPE_VOID_IMPL( unsigned char )
     851        void ?|?( istype & is, unsigned char & usc ) {
     852                (istype &)(is | usc); ends( is );
     853        } // ?|?
    804854
    805855        istype & ?|?( istype & is, short int & si ) {
     
    807857                return is;
    808858        } // ?|?
    809         ISTYPE_VOID_IMPL( short int )
     859        void ?|?( istype & is, short int & si ) {
     860                (istype &)(is | si); ends( is );
     861        } // ?|?
    810862
    811863        istype & ?|?( istype & is, unsigned short int & usi ) {
     
    813865                return is;
    814866        } // ?|?
    815         ISTYPE_VOID_IMPL( unsigned short int )
     867        void ?|?( istype & is, unsigned short int & usi ) {
     868                (istype &)(is | usi); ends( is );
     869        } // ?|?
    816870
    817871        istype & ?|?( istype & is, int & i ) {
     
    819873                return is;
    820874        } // ?|?
    821         ISTYPE_VOID_IMPL( int )
     875        void ?|?( istype & is, int & i ) {
     876                (istype &)(is | i); ends( is );
     877        } // ?|?
    822878
    823879        istype & ?|?( istype & is, unsigned int & ui ) {
     
    825881                return is;
    826882        } // ?|?
    827         ISTYPE_VOID_IMPL( unsigned int )
     883        void ?|?( istype & is, unsigned int & ui ) {
     884                (istype &)(is | ui); ends( is );
     885        } // ?|?
    828886
    829887        istype & ?|?( istype & is, long int & li ) {
     
    831889                return is;
    832890        } // ?|?
    833         ISTYPE_VOID_IMPL( long int )
     891        void ?|?( istype & is, long int & li ) {
     892                (istype &)(is | li); ends( is );
     893        } // ?|?
    834894
    835895        istype & ?|?( istype & is, unsigned long int & ulli ) {
     
    837897                return is;
    838898        } // ?|?
    839         ISTYPE_VOID_IMPL( unsigned long int )
     899        void ?|?( istype & is, unsigned long int & ulli ) {
     900                (istype &)(is | ulli); ends( is );
     901        } // ?|?
    840902
    841903        istype & ?|?( istype & is, long long int & lli ) {
     
    843905                return is;
    844906        } // ?|?
    845         ISTYPE_VOID_IMPL( long long int )
     907        void ?|?( istype & is, long long int & lli ) {
     908                (istype &)(is | lli); ends( is );
     909        } // ?|?
    846910
    847911        istype & ?|?( istype & is, unsigned long long int & ulli ) {
     
    849913                return is;
    850914        } // ?|?
    851         ISTYPE_VOID_IMPL( unsigned long long int )
     915        void & ?|?( istype & is, unsigned long long int & ulli ) {
     916                (istype &)(is | ulli); ends( is );
     917        } // ?|?
    852918
    853919        #if defined( __SIZEOF_INT128__ )
     
    855921                return (istype &)(is | (unsigned int128 &)llli);
    856922        } // ?|?
    857         ISTYPE_VOID_IMPL( int128 )
     923        void ?|?( istype & is, int128 & llli ) {
     924                (istype &)(is | llli); ends( is );
     925        } // ?|?
    858926
    859927        istype & ?|?( istype & is, unsigned int128 & ullli ) {
     
    872940                return is;
    873941        } // ?|?
    874         ISTYPE_VOID_IMPL( unsigned int128 )
     942        void ?|?( istype & is, unsigned int128 & ullli ) {
     943                (istype &)(is | ullli); ends( is );
     944        } // ?|?
    875945        #endif // __SIZEOF_INT128__
    876946
     
    879949                return is;
    880950        } // ?|?
    881         ISTYPE_VOID_IMPL( float )
     951        void ?|?( istype & is, float & f ) {
     952                (istype &)(is | f); ends( is );
     953        } // ?|?
    882954
    883955        istype & ?|?( istype & is, double & d ) {
     
    885957                return is;
    886958        } // ?|?
    887         ISTYPE_VOID_IMPL( double )
     959        void ?|?( istype & is, double & d ) {
     960                (istype &)(is | d); ends( is );
     961        } // ?|?
    888962
    889963        istype & ?|?( istype & is, long double & ld ) {
     
    891965                return is;
    892966        } // ?|?
    893         ISTYPE_VOID_IMPL( long double )
     967        void ?|?( istype & is, long double & ld ) {
     968                (istype &)(is | ld); ends( is );
     969        } // ?|?
    894970
    895971        istype & ?|?( istype & is, float _Complex & fc ) {
     
    899975                return is;
    900976        } // ?|?
    901         ISTYPE_VOID_IMPL( float _Complex )
     977        void ?|?( istype & is, float _Complex & fc ) {
     978                (istype &)(is | fc); ends( is );
     979        } // ?|?
    902980
    903981        istype & ?|?( istype & is, double _Complex & dc ) {
     
    907985                return is;
    908986        } // ?|?
    909         ISTYPE_VOID_IMPL( double _Complex )
     987        void ?|?( istype & is, double _Complex & dc ) {
     988                (istype &)(is | dc); ends( is );
     989        } // ?|?
    910990
    911991        istype & ?|?( istype & is, long double _Complex & ldc ) {
     
    915995                return is;
    916996        } // ?|?
    917         ISTYPE_VOID_IMPL( long double _Complex )
     997        void ?|?( istype & is, long double _Complex & ldc ) {
     998                (istype &)(is | ldc); ends( is );
     999        } // ?|?
    9181000
    9191001        // istype & ?|?( istype & is, const char fmt[] ) {
     
    9261008                return is;
    9271009        } // ?|?
    928         ISTYPE_VOID_VAL_IMPL( char * )
     1010        void ?|?( istype & is, char s[] ) {
     1011                (istype &)(is | s); ends( is );
     1012        } // ?|?
    9291013
    9301014        // manipulators
     
    9881072                return is;
    9891073        } // ?|?
    990         ISTYPE_VOID_VAL_IMPL( _Istream_Cstr )
     1074        void ?|?( istype & is, _Istream_Cstr f ) {
     1075                (istype &)(is | f); ends( is );
     1076        } // ?|?
    9911077
    9921078        istype & ?|?( istype & is, _Istream_Char f ) {
     
    9941080                return is;
    9951081        } // ?|?
    996         ISTYPE_VOID_VAL_IMPL( _Istream_Char )
     1082        void ?|?( istype & is, _Istream_Char f ) {
     1083                (istype &)(is | f); ends( is );
     1084        } // ?|?
    9971085} // distribution
    9981086
    999 #define INPUT_FMT_IMPL( T, CODE ) \
     1087#define InputFMTImpl( T, CODE ) \
    10001088forall( istype & | basic_istream( istype ) ) { \
    10011089        istype & ?|?( istype & is, _Istream_Manip(T) f ) { \
     
    10111099                return is; \
    10121100        } /* ?|? */ \
    1013         ISTYPE_VOID_VAL_IMPL( _Istream_Manip(T) ) \
     1101        void ?|?( istype & is, _Istream_Manip(T) f ) { \
     1102                (istype &)(is | f); ends( is ); \
     1103        } /* ?|? */ \
    10141104} // distribution
    10151105
    1016 INPUT_FMT_IMPL( signed char, "hhi" )
    1017 INPUT_FMT_IMPL( unsigned char, "hhi" )
    1018 INPUT_FMT_IMPL( signed short int, "hi" )
    1019 INPUT_FMT_IMPL( unsigned short int, "hi" )
    1020 INPUT_FMT_IMPL( signed int, "i" )
    1021 INPUT_FMT_IMPL( unsigned int, "i" )
    1022 INPUT_FMT_IMPL( signed long int, "li" )
    1023 INPUT_FMT_IMPL( unsigned long int, "li" )
    1024 INPUT_FMT_IMPL( signed long long int, "lli" )
    1025 INPUT_FMT_IMPL( unsigned long long int, "lli" )
    1026 
    1027 INPUT_FMT_IMPL( float, "f" )
    1028 INPUT_FMT_IMPL( double, "lf" )
    1029 INPUT_FMT_IMPL( long double, "Lf" )
     1106InputFMTImpl( signed char, "hhi" )
     1107InputFMTImpl( unsigned char, "hhi" )
     1108InputFMTImpl( signed short int, "hi" )
     1109InputFMTImpl( unsigned short int, "hi" )
     1110InputFMTImpl( signed int, "i" )
     1111InputFMTImpl( unsigned int, "i" )
     1112InputFMTImpl( signed long int, "li" )
     1113InputFMTImpl( unsigned long int, "li" )
     1114InputFMTImpl( signed long long int, "lli" )
     1115InputFMTImpl( unsigned long long int, "lli" )
     1116
     1117InputFMTImpl( float, "f" )
     1118InputFMTImpl( double, "lf" )
     1119InputFMTImpl( long double, "Lf" )
    10301120
    10311121forall( istype & | basic_istream( istype ) ) {
     
    10391129                return is;
    10401130        } // ?|?
    1041         ISTYPE_VOID_VAL_IMPL( _Istream_Manip(float _Complex) )
     1131        void ?|?( istype & is, _Istream_Manip(float _Complex) fc ) {
     1132                (istype &)(is | fc); ends( is );
     1133        } // ?|?
    10421134
    10431135        istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
     
    10501142                return is;
    10511143        } // ?|?
    1052         ISTYPE_VOID_VAL_IMPL( _Istream_Manip(double _Complex) )
     1144        void ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
     1145                (istype &)(is | dc); ends( is );
     1146        } // ?|?
    10531147
    10541148        istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
     
    10611155                return is;
    10621156        } // ?|?
    1063         ISTYPE_VOID_VAL_IMPL( _Istream_Manip(long double _Complex) )
     1157        void ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
     1158                (istype &)(is | ldc); ends( is );
     1159        } // ?|?
    10641160} // distribution
    10651161
  • libcfa/src/iostream.hfa

    rdb94b5d rc44705c  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 18 10:42:52 2023
    13 // Update Count     : 438
     12// Last Modified On : Thu Jun 29 11:07:25 2023
     13// Update Count     : 427
    1414//
    1515
     
    7474// implement writable for intrinsic types
    7575
    76 #define OSTYPE_VOID( T ) void ?|?( ostype &, T )
    77 #define OSTYPE_VOID_IMPL( T ) \
    78         void ?|?( ostype & os, T t ) { \
    79                 (ostype &)(os | t); ends( os ); \
    80         } // ?|?
    81 
    8276forall( ostype & | basic_ostream( ostype ) ) {
    8377        ostype & ?|?( ostype &, bool );
    84         OSTYPE_VOID( bool );
     78        void ?|?( ostype &, bool );
    8579
    8680        ostype & ?|?( ostype &, char );
    87         OSTYPE_VOID( char );
     81        void ?|?( ostype &, char );
    8882        ostype & ?|?( ostype &, signed char );
    89         OSTYPE_VOID( signed char );
     83        void ?|?( ostype &, signed char );
    9084        ostype & ?|?( ostype &, unsigned char );
    91         OSTYPE_VOID( unsigned char );
     85        void ?|?( ostype &, unsigned char );
    9286
    9387        ostype & ?|?( ostype &, short int );
    94         OSTYPE_VOID( short int );
     88        void ?|?( ostype &, short int );
    9589        ostype & ?|?( ostype &, unsigned short int );
    96         OSTYPE_VOID( unsigned short int );
     90        void ?|?( ostype &, unsigned short int );
    9791        ostype & ?|?( ostype &, int );
    98         OSTYPE_VOID( int );
     92        void ?|?( ostype &, int );
    9993        ostype & ?|?( ostype &, unsigned int );
    100         OSTYPE_VOID( unsigned int );
     94        void ?|?( ostype &, unsigned int );
    10195        ostype & ?|?( ostype &, long int );
    102         OSTYPE_VOID( long int );
     96        void ?|?( ostype &, long int );
    10397        ostype & ?|?( ostype &, long long int );
    104         OSTYPE_VOID( long long int );
     98        void ?|?( ostype &, long long int );
    10599        ostype & ?|?( ostype &, unsigned long int );
    106         OSTYPE_VOID( unsigned long int );
     100        void ?|?( ostype &, unsigned long int );
    107101        ostype & ?|?( ostype &, unsigned long long int );
    108         OSTYPE_VOID( unsigned long long int );
     102        void ?|?( ostype &, unsigned long long int );
    109103        #if defined( __SIZEOF_INT128__ )
    110104        ostype & ?|?( ostype &, int128 );
    111         OSTYPE_VOID( int128 );
     105        void ?|?( ostype &, int128 );
    112106        ostype & ?|?( ostype &, unsigned int128 );
    113         OSTYPE_VOID( unsigned int128 );
     107        void ?|?( ostype &, unsigned int128 );
    114108        #endif // __SIZEOF_INT128__
    115109
    116110        ostype & ?|?( ostype &, float );
    117         OSTYPE_VOID( float );
     111        void ?|?( ostype &, float );
    118112        ostype & ?|?( ostype &, double );
    119         OSTYPE_VOID( double );
     113        void ?|?( ostype &, double );
    120114        ostype & ?|?( ostype &, long double );
    121         OSTYPE_VOID( long double );
     115        void ?|?( ostype &, long double );
    122116
    123117        ostype & ?|?( ostype &, float _Complex );
    124         OSTYPE_VOID( float _Complex );
     118        void ?|?( ostype &, float _Complex );
    125119        ostype & ?|?( ostype &, double _Complex );
    126         OSTYPE_VOID( double _Complex );
     120        void ?|?( ostype &, double _Complex );
    127121        ostype & ?|?( ostype &, long double _Complex );
    128         OSTYPE_VOID( long double _Complex );
     122        void ?|?( ostype &, long double _Complex );
    129123
    130124        ostype & ?|?( ostype &, const char [] );
    131         OSTYPE_VOID( const char [] );
     125        void ?|?( ostype &, const char [] );
    132126        // ostype & ?|?( ostype &, const char16_t * );
    133127        #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous
     
    136130        // ostype & ?|?( ostype &, const wchar_t * );
    137131        ostype & ?|?( ostype &, const void * );
    138         OSTYPE_VOID( const void * );
     132        void ?|?( ostype &, const void * );
    139133
    140134        // manipulators
    141135        ostype & ?|?( ostype &, ostype & (*)( ostype & ) );
    142         OSTYPE_VOID( ostype & (*)( ostype & ) );
     136        void ?|?( ostype &, ostype & (*)( ostype & ) );
    143137
    144138        ostype & nl( ostype & );
     
    196190// initialized explicitly shall be initialized implicitly the same as objects that have static storage duration.***
    197191
    198 #define INTEGRAL_FMT_DECL( T, CODE ) \
     192#define IntegralFMTDecl( T, CODE ) \
    199193static inline { \
    200194        _Ostream_Manip(T) bin( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'b', { .all : 0 } }; } \
     
    217211} // ?|?
    218212
    219 INTEGRAL_FMT_DECL( signed char, 'd' )
    220 INTEGRAL_FMT_DECL( unsigned char, 'u' )
    221 INTEGRAL_FMT_DECL( signed short int, 'd' )
    222 INTEGRAL_FMT_DECL( unsigned short int, 'u' )
    223 INTEGRAL_FMT_DECL( signed int, 'd' )
    224 INTEGRAL_FMT_DECL( unsigned int, 'u' )
    225 INTEGRAL_FMT_DECL( signed long int, 'd' )
    226 INTEGRAL_FMT_DECL( unsigned long int, 'u' )
    227 INTEGRAL_FMT_DECL( signed long long int, 'd' )
    228 INTEGRAL_FMT_DECL( unsigned long long int, 'u' )
     213IntegralFMTDecl( signed char, 'd' )
     214IntegralFMTDecl( unsigned char, 'u' )
     215IntegralFMTDecl( signed short int, 'd' )
     216IntegralFMTDecl( unsigned short int, 'u' )
     217IntegralFMTDecl( signed int, 'd' )
     218IntegralFMTDecl( unsigned int, 'u' )
     219IntegralFMTDecl( signed long int, 'd' )
     220IntegralFMTDecl( unsigned long int, 'u' )
     221IntegralFMTDecl( signed long long int, 'd' )
     222IntegralFMTDecl( unsigned long long int, 'u' )
    229223#if defined( __SIZEOF_INT128__ )
    230 INTEGRAL_FMT_DECL( int128, 'd' )
    231 INTEGRAL_FMT_DECL( unsigned int128, 'u' )
     224IntegralFMTDecl( int128, 'd' )
     225IntegralFMTDecl( unsigned int128, 'u' )
    232226#endif // __SIZEOF_INT128__
    233227
     
    235229
    236230// Default suffix for values with no fraction is "."
    237 #define FLOATING_POINT_FMT_DECL( T ) \
     231#define FloatingPointFMTDecl( T ) \
    238232static inline { \
    239233        _Ostream_Manip(T) hex( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'a', { .all : 0 } }; } \
     
    262256} // ?|?
    263257
    264 FLOATING_POINT_FMT_DECL( double )
    265 FLOATING_POINT_FMT_DECL( long double )
     258FloatingPointFMTDecl( double )
     259FloatingPointFMTDecl( long double )
    266260
    267261// *********************************** character ***********************************
     
    303297// *********************************** istream ***********************************
    304298
    305 
    306 #define ISTYPE_VOID( T ) void ?|?( istype &, T )
    307 #define ISTYPE_VOID_IMPL( T ) \
    308         void ?|?( istype & is, T & t ) { \
    309                 (istype &)(is | t); ends( is ); \
    310         } // ?|?
    311299
    312300forall( istype & )
     
    339327forall( istype & | basic_istream( istype ) ) {
    340328        istype & ?|?( istype &, bool & );
    341         ISTYPE_VOID( bool & );
     329        void ?|?( istype &, bool & );
    342330
    343331        istype & ?|?( istype &, char & );
    344         ISTYPE_VOID( char & );
     332        void ?|?( istype &, char & );
    345333        istype & ?|?( istype &, signed char & );
    346         ISTYPE_VOID( signed char & );
     334        void ?|?( istype &, signed char & );
    347335        istype & ?|?( istype &, unsigned char & );
    348         ISTYPE_VOID( unsigned char & );
     336        void ?|?( istype &, unsigned char & );
    349337
    350338        istype & ?|?( istype &, short int & );
    351         ISTYPE_VOID( short int & );
     339        void ?|?( istype &, short int & );
    352340        istype & ?|?( istype &, unsigned short int & );
    353         ISTYPE_VOID( unsigned short int & );
     341        void ?|?( istype &, unsigned short int & );
    354342        istype & ?|?( istype &, int & );
    355         ISTYPE_VOID( int & );
     343        void ?|?( istype &, int & );
    356344        istype & ?|?( istype &, unsigned int & );
    357         ISTYPE_VOID( unsigned int & );
     345        void ?|?( istype &, unsigned int & );
    358346        istype & ?|?( istype &, long int & );
    359         ISTYPE_VOID( long int & );
     347        void ?|?( istype &, long int & );
    360348        istype & ?|?( istype &, unsigned long int & );
    361         ISTYPE_VOID( unsigned long int & );
     349        void ?|?( istype &, unsigned long int & );
    362350        istype & ?|?( istype &, long long int & );
    363         ISTYPE_VOID( long long int & );
     351        void ?|?( istype &, long long int & );
    364352        istype & ?|?( istype &, unsigned long long int & );
    365         ISTYPE_VOID( unsigned long long int & );
     353        void ?|?( istype &, unsigned long long int & );
    366354        #if defined( __SIZEOF_INT128__ )
    367355        istype & ?|?( istype &, int128 & );
    368         ISTYPE_VOID( int128 & );
     356        void ?|?( istype &, int128 & );
    369357        istype & ?|?( istype &, unsigned int128 & );
    370         ISTYPE_VOID( unsigned int128 & );
     358        void ?|?( istype &, unsigned int128 & );
    371359        #endif // __SIZEOF_INT128__
    372360
    373361        istype & ?|?( istype &, float & );
    374         ISTYPE_VOID( float & );
     362        void ?|?( istype &, float & );
    375363        istype & ?|?( istype &, double & );
    376         ISTYPE_VOID( double & );
     364        void ?|?( istype &, double & );
    377365        istype & ?|?( istype &, long double & );
    378         ISTYPE_VOID( long double & );
     366        void ?|?( istype &, long double & );
    379367
    380368        istype & ?|?( istype &, float _Complex & );
    381         ISTYPE_VOID( float _Complex & );
     369        void ?|?( istype &, float _Complex & );
    382370        istype & ?|?( istype &, double _Complex & );
    383         ISTYPE_VOID( double _Complex & );
     371        void ?|?( istype &, double _Complex & );
    384372        istype & ?|?( istype &, long double _Complex & );
    385         ISTYPE_VOID( long double _Complex & );
     373        void ?|?( istype &, long double _Complex & );
    386374
    387375//      istype & ?|?( istype &, const char [] );
     
    391379        // manipulators
    392380        istype & ?|?( istype &, istype & (*)( istype & ) );
    393         ISTYPE_VOID( istype & (*)( istype & ) );
     381        void ?|?( istype &, istype & (*)( istype & ) );
    394382        istype & nl( istype & is );
    395383        istype & nlOn( istype & );
     
    449437}; // _Istream_Manip
    450438
    451 #define INPUT_FMT_DECL( T ) \
     439#define InputFMTDecl( T ) \
    452440static inline { \
    453441        _Istream_Manip(T) ignore( const T & val ) { return (_Istream_Manip(T))@{ (T &)val, -1, true }; } \
     
    461449} // ?|?
    462450
    463 INPUT_FMT_DECL( signed char )
    464 INPUT_FMT_DECL( unsigned char )
    465 INPUT_FMT_DECL( signed short int )
    466 INPUT_FMT_DECL( unsigned short int )
    467 INPUT_FMT_DECL( signed int )
    468 INPUT_FMT_DECL( unsigned int )
    469 INPUT_FMT_DECL( signed long int )
    470 INPUT_FMT_DECL( unsigned long int )
    471 INPUT_FMT_DECL( signed long long int )
    472 INPUT_FMT_DECL( unsigned long long int )
    473 
    474 INPUT_FMT_DECL( float )
    475 INPUT_FMT_DECL( double )
    476 INPUT_FMT_DECL( long double )
    477 
    478 INPUT_FMT_DECL( float _Complex )
    479 INPUT_FMT_DECL( double _Complex )
    480 INPUT_FMT_DECL( long double _Complex )
     451InputFMTDecl( signed char )
     452InputFMTDecl( unsigned char )
     453InputFMTDecl( signed short int )
     454InputFMTDecl( unsigned short int )
     455InputFMTDecl( signed int )
     456InputFMTDecl( unsigned int )
     457InputFMTDecl( signed long int )
     458InputFMTDecl( unsigned long int )
     459InputFMTDecl( signed long long int )
     460InputFMTDecl( unsigned long long int )
     461
     462InputFMTDecl( float )
     463InputFMTDecl( double )
     464InputFMTDecl( long double )
     465
     466InputFMTDecl( float _Complex )
     467InputFMTDecl( double _Complex )
     468InputFMTDecl( long double _Complex )
    481469
    482470
  • libcfa/src/rational.cfa

    rdb94b5d rc44705c  
    1010// Created On       : Wed Apr  6 17:54:28 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 18 11:07:10 2023
    13 // Update Count     : 197
     12// Last Modified On : Mon Jun  5 22:49:06 2023
     13// Update Count     : 196
    1414//
    1515
     
    206206                        return os | r.numerator | '/' | r.denominator;
    207207                } // ?|?
    208                 OSTYPE_VOID_IMPL( rational(T) )
     208
     209                void ?|?( ostype & os, rational(T) r ) {
     210                        (ostype &)(os | r); ends( os );
     211                } // ?|?
    209212        } // distribution
    210213} // distribution
  • libcfa/src/rational.hfa

    rdb94b5d rc44705c  
    1212// Created On       : Wed Apr  6 17:56:25 2016
    1313// Last Modified By : Peter A. Buhr
    14 // Last Modified On : Tue Jul 18 11:08:24 2023
    15 // Update Count     : 121
     14// Last Modified On : Mon Jun  5 22:49:05 2023
     15// Update Count     : 119
    1616//
    1717
     
    7878        forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, T ); } ) {
    7979                ostype & ?|?( ostype &, rational(T) );
    80                 OSTYPE_VOID( rational(T) );
     80                void ?|?( ostype &, rational(T) );
    8181        } // distribution
    8282} // distribution
  • libcfa/src/time.cfa

    rdb94b5d rc44705c  
    1010// Created On       : Tue Mar 27 13:33:14 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 18 10:55:01 2023
    13 // Update Count     : 71
     12// Last Modified On : Tue Feb  4 08:24:18 2020
     13// Update Count     : 70
    1414//
    1515
     
    4343                return os;
    4444        } // ?|?
    45         OSTYPE_VOID_IMPL( Duration )
     45
     46        void ?|?( ostype & os, Duration dur ) with( dur ) {
     47                (ostype &)(os | dur); ends( os );
     48        } // ?|?
    4649} // distribution
    4750
     
    152155                return os;
    153156        } // ?|?
    154         OSTYPE_VOID_IMPL( Time )
     157
     158        void ?|?( ostype & os, Time time ) with( time ) {
     159                (ostype &)(os | time); ends( os );
     160        } // ?|?
    155161} // distribution
    156162
  • libcfa/src/vec/vec2.hfa

    rdb94b5d rc44705c  
    283283        return os | '<' | x | ',' | y | '>';
    284284    }
    285         OSTYPE_VOID_IMPL( vec2(T) )
     285    void ?|?(ostype & os, vec2(T) v ) with (v) {
     286        (ostype &)(os | v); ends(os);
     287    }
    286288}
  • libcfa/src/vec/vec3.hfa

    rdb94b5d rc44705c  
    292292        return os | '<' | x | ',' | y | ',' | z | '>';
    293293    }
    294         OSTYPE_VOID_IMPL( vec3(T) )
     294    void ?|?(ostype & os, vec3(T) v ) with (v) {
     295        (ostype &)(os | v); ends(os);
     296    }
    295297}
  • libcfa/src/vec/vec4.hfa

    rdb94b5d rc44705c  
    287287        return os | '<' | x | ',' | y | ',' | z | ',' | w | '>';
    288288    }
    289         OSTYPE_VOID_IMPL( vec4(T) )
     289    void ?|?(ostype & os, vec4(T) v ) with (v) {
     290        (ostype &)(os | v); ends(os);
     291    }
    290292}
    291293
Note: See TracChangeset for help on using the changeset viewer.