Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/iostream.hfa

    r94d2544 rf5d9c37  
    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
Note: See TracChangeset for help on using the changeset viewer.