Changes in / [db94b5d:c44705c]
- Location:
- libcfa/src
- Files:
-
- 8 edited
-
iostream.cfa (modified) (56 diffs)
-
iostream.hfa (modified) (12 diffs)
-
rational.cfa (modified) (2 diffs)
-
rational.hfa (modified) (2 diffs)
-
time.cfa (modified) (3 diffs)
-
vec/vec2.hfa (modified) (1 diff)
-
vec/vec3.hfa (modified) (1 diff)
-
vec/vec4.hfa (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
rdb94b5d rc44705c 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 18 10:42:51202313 // Update Count : 1 40112 // Last Modified On : Thu Jun 29 10:12:39 2023 13 // Update Count : 1380 14 14 // 15 15 … … 34 34 #pragma GCC visibility push(default) 35 35 36 37 36 // *********************************** ostream *********************************** 38 37 … … 44 43 return os; 45 44 } // ?|? 46 OSTYPE_VOID_IMPL( bool ) 45 void ?|?( ostype & os, bool b ) { 46 (ostype &)(os | b); ends( os ); 47 } // ?|? 47 48 48 49 ostype & ?|?( ostype & os, char c ) { … … 51 52 return nosep( os ); 52 53 } // ?|? 53 OSTYPE_VOID_IMPL( char ) 54 void ?|?( ostype & os, char c ) { 55 (ostype &)(os | c); ends( os ); 56 } // ?|? 54 57 55 58 ostype & ?|?( ostype & os, signed char sc ) { … … 58 61 return os; 59 62 } // ?|? 60 OSTYPE_VOID_IMPL( signed char ) 63 void ?|?( ostype & os, signed char sc ) { 64 (ostype &)(os | sc); ends( os ); 65 } // ?|? 61 66 62 67 ostype & ?|?( ostype & os, unsigned char usc ) { … … 65 70 return os; 66 71 } // ?|? 67 OSTYPE_VOID_IMPL( unsigned char ) 72 void ?|?( ostype & os, unsigned char usc ) { 73 (ostype &)(os | usc); ends( os ); 74 } // ?|? 68 75 69 76 ostype & ?|?( ostype & os, short int si ) { … … 72 79 return os; 73 80 } // ?|? 74 OSTYPE_VOID_IMPL( short int ) 81 void & ?|?( ostype & os, short int si ) { 82 (ostype &)(os | si); ends( os ); 83 } // ?|? 75 84 76 85 ostype & ?|?( ostype & os, unsigned short int usi ) { … … 79 88 return os; 80 89 } // ?|? 81 OSTYPE_VOID_IMPL( unsigned short int ) 90 void & ?|?( ostype & os, unsigned short int usi ) { 91 (ostype &)(os | usi); ends( os ); 92 } // ?|? 82 93 83 94 ostype & ?|?( ostype & os, int i ) { … … 86 97 return os; 87 98 } // ?|? 88 OSTYPE_VOID_IMPL( int ) 99 void & ?|?( ostype & os, int i ) { 100 (ostype &)(os | i); ends( os ); 101 } // ?|? 89 102 90 103 ostype & ?|?( ostype & os, unsigned int ui ) { … … 93 106 return os; 94 107 } // ?|? 95 OSTYPE_VOID_IMPL( unsigned int ) 108 void & ?|?( ostype & os, unsigned int ui ) { 109 (ostype &)(os | ui); ends( os ); 110 } // ?|? 96 111 97 112 ostype & ?|?( ostype & os, long int li ) { … … 100 115 return os; 101 116 } // ?|? 102 OSTYPE_VOID_IMPL( long int ) 117 void & ?|?( ostype & os, long int li ) { 118 (ostype &)(os | li); ends( os ); 119 } // ?|? 103 120 104 121 ostype & ?|?( ostype & os, unsigned long int uli ) { … … 107 124 return os; 108 125 } // ?|? 109 OSTYPE_VOID_IMPL( unsigned long int ) 126 void & ?|?( ostype & os, unsigned long int uli ) { 127 (ostype &)(os | uli); ends( os ); 128 } // ?|? 110 129 111 130 ostype & ?|?( ostype & os, long long int lli ) { … … 114 133 return os; 115 134 } // ?|? 116 OSTYPE_VOID_IMPL( long long int ) 135 void & ?|?( ostype & os, long long int lli ) { 136 (ostype &)(os | lli); ends( os ); 137 } // ?|? 117 138 118 139 ostype & ?|?( ostype & os, unsigned long long int ulli ) { … … 121 142 return os; 122 143 } // ?|? 123 OSTYPE_VOID_IMPL( unsigned long long int ) 144 void & ?|?( ostype & os, unsigned long long int ulli ) { 145 (ostype &)(os | ulli); ends( os ); 146 } // ?|? 124 147 125 148 #if defined( __SIZEOF_INT128__ ) … … 153 176 return os; 154 177 } // ?|? 155 OSTYPE_VOID_IMPL( int128 ) 178 void & ?|?( ostype & os, int128 llli ) { 179 (ostype &)(os | llli); ends( os ); 180 } // ?|? 156 181 157 182 ostype & ?|?( ostype & os, unsigned int128 ullli ) { … … 160 185 return os; 161 186 } // ?|? 162 OSTYPE_VOID_IMPL( unsigned int128 ) 187 void & ?|?( ostype & os, unsigned int128 ullli ) { 188 (ostype &)(os | ullli); ends( os ); 189 } // ?|? 163 190 #endif // __SIZEOF_INT128__ 164 191 165 #define P RINT_WITH_DP( os, format, val, ... ) \192 #define PrintWithDP( os, format, val, ... ) \ 166 193 { \ 167 194 enum { size = 48 }; \ … … 179 206 ostype & ?|?( ostype & os, float f ) { 180 207 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 } // ?|? 185 214 186 215 ostype & ?|?( ostype & os, double d ) { 187 216 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 } // ?|? 192 223 193 224 ostype & ?|?( ostype & os, long double ld ) { 194 225 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 } // ?|? 199 232 200 233 ostype & ?|?( ostype & os, float _Complex fc ) { 201 234 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 202 235 // os | crealf( fc ) | nonl; 203 P RINT_WITH_DP( os, "%'g", crealf( fc ) );204 P RINT_WITH_DP( os, "%'+g", cimagf( fc ) );236 PrintWithDP( os, "%'g", crealf( fc ) ); 237 PrintWithDP( os, "%'+g", cimagf( fc ) ); 205 238 fmt( os, "i" ); 206 239 return os; 207 240 } // ?|? 208 OSTYPE_VOID_IMPL( float _Complex ) 241 void & ?|?( ostype & os, float _Complex fc ) { 242 (ostype &)(os | fc); ends( os ); 243 } // ?|? 209 244 210 245 ostype & ?|?( ostype & os, double _Complex dc ) { 211 246 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 212 247 // os | creal( dc ) | nonl; 213 P RINT_WITH_DP( os, "%'.*lg", creal( dc ), DBL_DIG );214 P RINT_WITH_DP( os, "%'+.*lg", cimag( dc ), DBL_DIG );248 PrintWithDP( os, "%'.*lg", creal( dc ), DBL_DIG ); 249 PrintWithDP( os, "%'+.*lg", cimag( dc ), DBL_DIG ); 215 250 fmt( os, "i" ); 216 251 return os; 217 252 } // ?|? 218 OSTYPE_VOID_IMPL( double _Complex ) 253 void & ?|?( ostype & os, double _Complex dc ) { 254 (ostype &)(os | dc); ends( os ); 255 } // ?|? 219 256 220 257 ostype & ?|?( ostype & os, long double _Complex ldc ) { 221 258 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 222 259 // os | creall( ldc ) || nonl; 223 P RINT_WITH_DP( os, "%'.*Lg", creall( ldc ), LDBL_DIG );224 P RINT_WITH_DP( os, "%'+.*Lg", cimagl( ldc ), LDBL_DIG );260 PrintWithDP( os, "%'.*Lg", creall( ldc ), LDBL_DIG ); 261 PrintWithDP( os, "%'+.*Lg", cimagl( ldc ), LDBL_DIG ); 225 262 fmt( os, "i" ); 226 263 return os; 227 264 } // ?|? 228 OSTYPE_VOID_IMPL( long double _Complex ) 265 void & ?|?( ostype & os, long double _Complex ldc ) { 266 (ostype &)(os | ldc); ends( os ); 267 } // ?|? 229 268 230 269 ostype & ?|?( ostype & os, const char s[] ) { … … 269 308 // return write( os, s, len ); 270 309 } // ?|? 271 OSTYPE_VOID_IMPL( const char * ) 310 void ?|?( ostype & os, const char s[] ) { 311 (ostype &)(os | s); ends( os ); 312 } // ?|? 272 313 273 314 // ostype & ?|?( ostype & os, const char16_t * s ) { … … 296 337 return os; 297 338 } // ?|? 298 OSTYPE_VOID_IMPL( const void * ) 339 void ?|?( ostype & os, const void * p ) { 340 (ostype &)(os | p); ends( os ); 341 } // ?|? 299 342 300 343 // manipulators … … 399 442 400 443 // Default prefix for non-decimal prints is 0b, 0, 0x. 401 #define I NTEGRAL_FMT_IMPL( T, IFMTNP, IFMTP ) \444 #define IntegralFMTImpl( T, IFMTNP, IFMTP ) \ 402 445 forall( ostype & | basic_ostream( ostype ) ) { \ 403 446 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ … … 476 519 return os; \ 477 520 } /* ?|? */ \ 478 OSTYPE_VOID_IMPL( _Ostream_Manip(T) ) \ 521 void ?|?( ostype & os, _Ostream_Manip(T) f ) { \ 522 (ostype &)(os | f); ends( os ); \ 523 } /* ?|? */ \ 479 524 } // distribution 480 525 481 I NTEGRAL_FMT_IMPL( signed char, " *hh ", " *.*hh " )482 I NTEGRAL_FMT_IMPL( unsigned char, " *hh ", " *.*hh " )483 I NTEGRAL_FMT_IMPL( signed short int, " *h ", " *.*h " )484 I NTEGRAL_FMT_IMPL( unsigned short int, " *h ", " *.*h " )485 I NTEGRAL_FMT_IMPL( signed int, " * ", " *.* " )486 I NTEGRAL_FMT_IMPL( unsigned int, " * ", " *.* " )487 I NTEGRAL_FMT_IMPL( signed long int, " *l ", " *.*l " )488 I NTEGRAL_FMT_IMPL( unsigned long int, " *l ", " *.*l " )489 I NTEGRAL_FMT_IMPL( signed long long int, " *ll ", " *.*ll " )490 I NTEGRAL_FMT_IMPL( unsigned long long int, " *ll ", " *.*ll " )526 IntegralFMTImpl( signed char, " *hh ", " *.*hh " ) 527 IntegralFMTImpl( unsigned char, " *hh ", " *.*hh " ) 528 IntegralFMTImpl( signed short int, " *h ", " *.*h " ) 529 IntegralFMTImpl( unsigned short int, " *h ", " *.*h " ) 530 IntegralFMTImpl( signed int, " * ", " *.* " ) 531 IntegralFMTImpl( unsigned int, " * ", " *.* " ) 532 IntegralFMTImpl( signed long int, " *l ", " *.*l " ) 533 IntegralFMTImpl( unsigned long int, " *l ", " *.*l " ) 534 IntegralFMTImpl( signed long long int, " *ll ", " *.*ll " ) 535 IntegralFMTImpl( unsigned long long int, " *ll ", " *.*ll " ) 491 536 492 537 … … 557 602 } // base_128 558 603 559 #define I NTEGRAL_FMT_IMPL128( T ) \604 #define IntegralFMTImpl128( T ) \ 560 605 forall( ostype & | basic_ostream( ostype ) ) { \ 561 606 ostype & ?|?( ostype & os, _Ostream_Manip(T) f ) { \ … … 574 619 return os; \ 575 620 } /* ?|? */ \ 576 OSTYPE_VOID_IMPL( _Ostream_Manip(T) )\621 void ?|?( ostype & os, _Ostream_Manip(T) f ) { (ostype &)(os | f); ends( os ); } \ 577 622 } // distribution 578 623 579 I NTEGRAL_FMT_IMPL128( int128 )580 I NTEGRAL_FMT_IMPL128( unsigned int128 )624 IntegralFMTImpl128( int128 ) 625 IntegralFMTImpl128( unsigned int128 ) 581 626 #endif // __SIZEOF_INT128__ 582 627 … … 590 635 #define SUFFIXES_END (SUFFIXES_START + (int)((sizeof(suffixes) / sizeof(char *) - 1) * 3)) 591 636 592 #define P RINT_WITH_DP2( os, format, ... ) \637 #define PrintWithDP2( os, format, ... ) \ 593 638 { \ 594 639 if ( ! f.flags.eng ) { \ … … 631 676 } 632 677 633 #define F LOATING_POINT_FMT_IMPL( T, DFMTNP, DFMTP ) \678 #define FloatingPointFMTImpl( T, DFMTNP, DFMTP ) \ 634 679 forall( ostype & | basic_ostream( ostype ) ) { \ 635 680 static void eng( T &value, int & pc, int & exp10 ) { \ … … 662 707 fmtstr[sizeof(DFMTNP)-2] = f.base; /* sizeof includes '\0' */ \ 663 708 /* printf( "%g %d %s\n", f.val, f.wd, &fmtstr[star] ); */ \ 664 P RINT_WITH_DP2( os, &fmtstr[star], f.wd, f.val ) \709 PrintWithDP2( os, &fmtstr[star], f.wd, f.val ) \ 665 710 } else { /* precision */ \ 666 711 fmtstr[sizeof(DFMTP)-2] = f.base; /* sizeof includes '\0' */ \ 667 712 /* printf( "%g %d %d %s\n", f.val, f.wd, f.pc, &fmtstr[star] ); */ \ 668 P RINT_WITH_DP2( os, &fmtstr[star], f.wd, f.pc, f.val ) \713 PrintWithDP2( os, &fmtstr[star], f.wd, f.pc, f.val ) \ 669 714 } /* if */ \ 670 715 return os; \ 671 716 } /* ?|? */ \ 672 717 \ 673 OSTYPE_VOID_IMPL( _Ostream_Manip(T) )\718 void ?|?( ostype & os, _Ostream_Manip(T) f ) { (ostype &)(os | f); ends( os ); } \ 674 719 } // distribution 675 720 676 F LOATING_POINT_FMT_IMPL( double, " * ", " *.* " )677 F LOATING_POINT_FMT_IMPL( long double, " *L ", " *.*L " )721 FloatingPointFMTImpl( double, " * ", " *.* " ) 722 FloatingPointFMTImpl( long double, " *L ", " *.*L " ) 678 723 679 724 // *********************************** character *********************************** … … 706 751 return os; 707 752 } // ?|? 708 OSTYPE_VOID_IMPL( _Ostream_Manip(char) ) 753 754 void ?|?( ostype & os, _Ostream_Manip(char) f ) { (ostype &)(os | f); ends( os ); } 709 755 } // distribution 710 756 … … 753 799 return os; 754 800 } // ?|? 755 OSTYPE_VOID_IMPL( _Ostream_Manip(const char *) ) 801 802 void ?|?( ostype & os, _Ostream_Manip(const char *) f ) { (ostype &)(os | f); ends( os ); } 756 803 } // distribution 757 804 … … 759 806 // *********************************** istream *********************************** 760 807 761 762 #define ISTYPE_VOID_VAL_IMPL( T ) \763 void ?|?( istype & is, T t ) { \764 (istype &)(is | t); ends( is ); \765 } // ?|?766 808 767 809 forall( istype & | basic_istream( istype ) ) { … … 777 819 return is; 778 820 } // ?|? 779 ISTYPE_VOID_IMPL( bool ) 821 void ?|?( istype & is, bool & b ) { 822 (istype &)(is | b); ends( is ); 823 } // ?|? 780 824 781 825 istype & ?|?( istype & is, char & c ) { … … 789 833 return is; 790 834 } // ?|? 791 ISTYPE_VOID_IMPL( char ) 835 void ?|?( istype & is, char & c ) { 836 (istype &)(is | c); ends( is ); 837 } // ?|? 792 838 793 839 istype & ?|?( istype & is, signed char & sc ) { … … 795 841 return is; 796 842 } // ?|? 797 ISTYPE_VOID_IMPL( signed char ) 843 void ?|?( istype & is, signed char & sc ) { 844 (istype &)(is | sc); ends( is ); 845 } // ?|? 798 846 799 847 istype & ?|?( istype & is, unsigned char & usc ) { … … 801 849 return is; 802 850 } // ?|? 803 ISTYPE_VOID_IMPL( unsigned char ) 851 void ?|?( istype & is, unsigned char & usc ) { 852 (istype &)(is | usc); ends( is ); 853 } // ?|? 804 854 805 855 istype & ?|?( istype & is, short int & si ) { … … 807 857 return is; 808 858 } // ?|? 809 ISTYPE_VOID_IMPL( short int ) 859 void ?|?( istype & is, short int & si ) { 860 (istype &)(is | si); ends( is ); 861 } // ?|? 810 862 811 863 istype & ?|?( istype & is, unsigned short int & usi ) { … … 813 865 return is; 814 866 } // ?|? 815 ISTYPE_VOID_IMPL( unsigned short int ) 867 void ?|?( istype & is, unsigned short int & usi ) { 868 (istype &)(is | usi); ends( is ); 869 } // ?|? 816 870 817 871 istype & ?|?( istype & is, int & i ) { … … 819 873 return is; 820 874 } // ?|? 821 ISTYPE_VOID_IMPL( int ) 875 void ?|?( istype & is, int & i ) { 876 (istype &)(is | i); ends( is ); 877 } // ?|? 822 878 823 879 istype & ?|?( istype & is, unsigned int & ui ) { … … 825 881 return is; 826 882 } // ?|? 827 ISTYPE_VOID_IMPL( unsigned int ) 883 void ?|?( istype & is, unsigned int & ui ) { 884 (istype &)(is | ui); ends( is ); 885 } // ?|? 828 886 829 887 istype & ?|?( istype & is, long int & li ) { … … 831 889 return is; 832 890 } // ?|? 833 ISTYPE_VOID_IMPL( long int ) 891 void ?|?( istype & is, long int & li ) { 892 (istype &)(is | li); ends( is ); 893 } // ?|? 834 894 835 895 istype & ?|?( istype & is, unsigned long int & ulli ) { … … 837 897 return is; 838 898 } // ?|? 839 ISTYPE_VOID_IMPL( unsigned long int ) 899 void ?|?( istype & is, unsigned long int & ulli ) { 900 (istype &)(is | ulli); ends( is ); 901 } // ?|? 840 902 841 903 istype & ?|?( istype & is, long long int & lli ) { … … 843 905 return is; 844 906 } // ?|? 845 ISTYPE_VOID_IMPL( long long int ) 907 void ?|?( istype & is, long long int & lli ) { 908 (istype &)(is | lli); ends( is ); 909 } // ?|? 846 910 847 911 istype & ?|?( istype & is, unsigned long long int & ulli ) { … … 849 913 return is; 850 914 } // ?|? 851 ISTYPE_VOID_IMPL( unsigned long long int ) 915 void & ?|?( istype & is, unsigned long long int & ulli ) { 916 (istype &)(is | ulli); ends( is ); 917 } // ?|? 852 918 853 919 #if defined( __SIZEOF_INT128__ ) … … 855 921 return (istype &)(is | (unsigned int128 &)llli); 856 922 } // ?|? 857 ISTYPE_VOID_IMPL( int128 ) 923 void ?|?( istype & is, int128 & llli ) { 924 (istype &)(is | llli); ends( is ); 925 } // ?|? 858 926 859 927 istype & ?|?( istype & is, unsigned int128 & ullli ) { … … 872 940 return is; 873 941 } // ?|? 874 ISTYPE_VOID_IMPL( unsigned int128 ) 942 void ?|?( istype & is, unsigned int128 & ullli ) { 943 (istype &)(is | ullli); ends( is ); 944 } // ?|? 875 945 #endif // __SIZEOF_INT128__ 876 946 … … 879 949 return is; 880 950 } // ?|? 881 ISTYPE_VOID_IMPL( float ) 951 void ?|?( istype & is, float & f ) { 952 (istype &)(is | f); ends( is ); 953 } // ?|? 882 954 883 955 istype & ?|?( istype & is, double & d ) { … … 885 957 return is; 886 958 } // ?|? 887 ISTYPE_VOID_IMPL( double ) 959 void ?|?( istype & is, double & d ) { 960 (istype &)(is | d); ends( is ); 961 } // ?|? 888 962 889 963 istype & ?|?( istype & is, long double & ld ) { … … 891 965 return is; 892 966 } // ?|? 893 ISTYPE_VOID_IMPL( long double ) 967 void ?|?( istype & is, long double & ld ) { 968 (istype &)(is | ld); ends( is ); 969 } // ?|? 894 970 895 971 istype & ?|?( istype & is, float _Complex & fc ) { … … 899 975 return is; 900 976 } // ?|? 901 ISTYPE_VOID_IMPL( float _Complex ) 977 void ?|?( istype & is, float _Complex & fc ) { 978 (istype &)(is | fc); ends( is ); 979 } // ?|? 902 980 903 981 istype & ?|?( istype & is, double _Complex & dc ) { … … 907 985 return is; 908 986 } // ?|? 909 ISTYPE_VOID_IMPL( double _Complex ) 987 void ?|?( istype & is, double _Complex & dc ) { 988 (istype &)(is | dc); ends( is ); 989 } // ?|? 910 990 911 991 istype & ?|?( istype & is, long double _Complex & ldc ) { … … 915 995 return is; 916 996 } // ?|? 917 ISTYPE_VOID_IMPL( long double _Complex ) 997 void ?|?( istype & is, long double _Complex & ldc ) { 998 (istype &)(is | ldc); ends( is ); 999 } // ?|? 918 1000 919 1001 // istype & ?|?( istype & is, const char fmt[] ) { … … 926 1008 return is; 927 1009 } // ?|? 928 ISTYPE_VOID_VAL_IMPL( char * ) 1010 void ?|?( istype & is, char s[] ) { 1011 (istype &)(is | s); ends( is ); 1012 } // ?|? 929 1013 930 1014 // manipulators … … 988 1072 return is; 989 1073 } // ?|? 990 ISTYPE_VOID_VAL_IMPL( _Istream_Cstr ) 1074 void ?|?( istype & is, _Istream_Cstr f ) { 1075 (istype &)(is | f); ends( is ); 1076 } // ?|? 991 1077 992 1078 istype & ?|?( istype & is, _Istream_Char f ) { … … 994 1080 return is; 995 1081 } // ?|? 996 ISTYPE_VOID_VAL_IMPL( _Istream_Char ) 1082 void ?|?( istype & is, _Istream_Char f ) { 1083 (istype &)(is | f); ends( is ); 1084 } // ?|? 997 1085 } // distribution 998 1086 999 #define I NPUT_FMT_IMPL( T, CODE ) \1087 #define InputFMTImpl( T, CODE ) \ 1000 1088 forall( istype & | basic_istream( istype ) ) { \ 1001 1089 istype & ?|?( istype & is, _Istream_Manip(T) f ) { \ … … 1011 1099 return is; \ 1012 1100 } /* ?|? */ \ 1013 ISTYPE_VOID_VAL_IMPL( _Istream_Manip(T) ) \ 1101 void ?|?( istype & is, _Istream_Manip(T) f ) { \ 1102 (istype &)(is | f); ends( is ); \ 1103 } /* ?|? */ \ 1014 1104 } // distribution 1015 1105 1016 I NPUT_FMT_IMPL( signed char, "hhi" )1017 I NPUT_FMT_IMPL( unsigned char, "hhi" )1018 I NPUT_FMT_IMPL( signed short int, "hi" )1019 I NPUT_FMT_IMPL( unsigned short int, "hi" )1020 I NPUT_FMT_IMPL( signed int, "i" )1021 I NPUT_FMT_IMPL( unsigned int, "i" )1022 I NPUT_FMT_IMPL( signed long int, "li" )1023 I NPUT_FMT_IMPL( unsigned long int, "li" )1024 I NPUT_FMT_IMPL( signed long long int, "lli" )1025 I NPUT_FMT_IMPL( unsigned long long int, "lli" )1026 1027 I NPUT_FMT_IMPL( float, "f" )1028 I NPUT_FMT_IMPL( double, "lf" )1029 I NPUT_FMT_IMPL( long double, "Lf" )1106 InputFMTImpl( signed char, "hhi" ) 1107 InputFMTImpl( unsigned char, "hhi" ) 1108 InputFMTImpl( signed short int, "hi" ) 1109 InputFMTImpl( unsigned short int, "hi" ) 1110 InputFMTImpl( signed int, "i" ) 1111 InputFMTImpl( unsigned int, "i" ) 1112 InputFMTImpl( signed long int, "li" ) 1113 InputFMTImpl( unsigned long int, "li" ) 1114 InputFMTImpl( signed long long int, "lli" ) 1115 InputFMTImpl( unsigned long long int, "lli" ) 1116 1117 InputFMTImpl( float, "f" ) 1118 InputFMTImpl( double, "lf" ) 1119 InputFMTImpl( long double, "Lf" ) 1030 1120 1031 1121 forall( istype & | basic_istream( istype ) ) { … … 1039 1129 return is; 1040 1130 } // ?|? 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 } // ?|? 1042 1134 1043 1135 istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) { … … 1050 1142 return is; 1051 1143 } // ?|? 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 } // ?|? 1053 1147 1054 1148 istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) { … … 1061 1155 return is; 1062 1156 } // ?|? 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 } // ?|? 1064 1160 } // distribution 1065 1161 -
libcfa/src/iostream.hfa
rdb94b5d rc44705c 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 18 10:42:52202313 // Update Count : 4 3812 // Last Modified On : Thu Jun 29 11:07:25 2023 13 // Update Count : 427 14 14 // 15 15 … … 74 74 // implement writable for intrinsic types 75 75 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 82 76 forall( ostype & | basic_ostream( ostype ) ) { 83 77 ostype & ?|?( ostype &, bool ); 84 OSTYPE_VOID(bool );78 void ?|?( ostype &, bool ); 85 79 86 80 ostype & ?|?( ostype &, char ); 87 OSTYPE_VOID(char );81 void ?|?( ostype &, char ); 88 82 ostype & ?|?( ostype &, signed char ); 89 OSTYPE_VOID(signed char );83 void ?|?( ostype &, signed char ); 90 84 ostype & ?|?( ostype &, unsigned char ); 91 OSTYPE_VOID(unsigned char );85 void ?|?( ostype &, unsigned char ); 92 86 93 87 ostype & ?|?( ostype &, short int ); 94 OSTYPE_VOID(short int );88 void ?|?( ostype &, short int ); 95 89 ostype & ?|?( ostype &, unsigned short int ); 96 OSTYPE_VOID(unsigned short int );90 void ?|?( ostype &, unsigned short int ); 97 91 ostype & ?|?( ostype &, int ); 98 OSTYPE_VOID(int );92 void ?|?( ostype &, int ); 99 93 ostype & ?|?( ostype &, unsigned int ); 100 OSTYPE_VOID(unsigned int );94 void ?|?( ostype &, unsigned int ); 101 95 ostype & ?|?( ostype &, long int ); 102 OSTYPE_VOID(long int );96 void ?|?( ostype &, long int ); 103 97 ostype & ?|?( ostype &, long long int ); 104 OSTYPE_VOID(long long int );98 void ?|?( ostype &, long long int ); 105 99 ostype & ?|?( ostype &, unsigned long int ); 106 OSTYPE_VOID(unsigned long int );100 void ?|?( ostype &, unsigned long int ); 107 101 ostype & ?|?( ostype &, unsigned long long int ); 108 OSTYPE_VOID(unsigned long long int );102 void ?|?( ostype &, unsigned long long int ); 109 103 #if defined( __SIZEOF_INT128__ ) 110 104 ostype & ?|?( ostype &, int128 ); 111 OSTYPE_VOID(int128 );105 void ?|?( ostype &, int128 ); 112 106 ostype & ?|?( ostype &, unsigned int128 ); 113 OSTYPE_VOID(unsigned int128 );107 void ?|?( ostype &, unsigned int128 ); 114 108 #endif // __SIZEOF_INT128__ 115 109 116 110 ostype & ?|?( ostype &, float ); 117 OSTYPE_VOID(float );111 void ?|?( ostype &, float ); 118 112 ostype & ?|?( ostype &, double ); 119 OSTYPE_VOID(double );113 void ?|?( ostype &, double ); 120 114 ostype & ?|?( ostype &, long double ); 121 OSTYPE_VOID(long double );115 void ?|?( ostype &, long double ); 122 116 123 117 ostype & ?|?( ostype &, float _Complex ); 124 OSTYPE_VOID(float _Complex );118 void ?|?( ostype &, float _Complex ); 125 119 ostype & ?|?( ostype &, double _Complex ); 126 OSTYPE_VOID(double _Complex );120 void ?|?( ostype &, double _Complex ); 127 121 ostype & ?|?( ostype &, long double _Complex ); 128 OSTYPE_VOID(long double _Complex );122 void ?|?( ostype &, long double _Complex ); 129 123 130 124 ostype & ?|?( ostype &, const char [] ); 131 OSTYPE_VOID(const char [] );125 void ?|?( ostype &, const char [] ); 132 126 // ostype & ?|?( ostype &, const char16_t * ); 133 127 #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous … … 136 130 // ostype & ?|?( ostype &, const wchar_t * ); 137 131 ostype & ?|?( ostype &, const void * ); 138 OSTYPE_VOID(const void * );132 void ?|?( ostype &, const void * ); 139 133 140 134 // manipulators 141 135 ostype & ?|?( ostype &, ostype & (*)( ostype & ) ); 142 OSTYPE_VOID(ostype & (*)( ostype & ) );136 void ?|?( ostype &, ostype & (*)( ostype & ) ); 143 137 144 138 ostype & nl( ostype & ); … … 196 190 // initialized explicitly shall be initialized implicitly the same as objects that have static storage duration.*** 197 191 198 #define I NTEGRAL_FMT_DECL( T, CODE ) \192 #define IntegralFMTDecl( T, CODE ) \ 199 193 static inline { \ 200 194 _Ostream_Manip(T) bin( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'b', { .all : 0 } }; } \ … … 217 211 } // ?|? 218 212 219 I NTEGRAL_FMT_DECL( signed char, 'd' )220 I NTEGRAL_FMT_DECL( unsigned char, 'u' )221 I NTEGRAL_FMT_DECL( signed short int, 'd' )222 I NTEGRAL_FMT_DECL( unsigned short int, 'u' )223 I NTEGRAL_FMT_DECL( signed int, 'd' )224 I NTEGRAL_FMT_DECL( unsigned int, 'u' )225 I NTEGRAL_FMT_DECL( signed long int, 'd' )226 I NTEGRAL_FMT_DECL( unsigned long int, 'u' )227 I NTEGRAL_FMT_DECL( signed long long int, 'd' )228 I NTEGRAL_FMT_DECL( unsigned long long int, 'u' )213 IntegralFMTDecl( signed char, 'd' ) 214 IntegralFMTDecl( unsigned char, 'u' ) 215 IntegralFMTDecl( signed short int, 'd' ) 216 IntegralFMTDecl( unsigned short int, 'u' ) 217 IntegralFMTDecl( signed int, 'd' ) 218 IntegralFMTDecl( unsigned int, 'u' ) 219 IntegralFMTDecl( signed long int, 'd' ) 220 IntegralFMTDecl( unsigned long int, 'u' ) 221 IntegralFMTDecl( signed long long int, 'd' ) 222 IntegralFMTDecl( unsigned long long int, 'u' ) 229 223 #if defined( __SIZEOF_INT128__ ) 230 I NTEGRAL_FMT_DECL( int128, 'd' )231 I NTEGRAL_FMT_DECL( unsigned int128, 'u' )224 IntegralFMTDecl( int128, 'd' ) 225 IntegralFMTDecl( unsigned int128, 'u' ) 232 226 #endif // __SIZEOF_INT128__ 233 227 … … 235 229 236 230 // Default suffix for values with no fraction is "." 237 #define F LOATING_POINT_FMT_DECL( T ) \231 #define FloatingPointFMTDecl( T ) \ 238 232 static inline { \ 239 233 _Ostream_Manip(T) hex( T val ) { return (_Ostream_Manip(T))@{ val, 1, 0, 'a', { .all : 0 } }; } \ … … 262 256 } // ?|? 263 257 264 F LOATING_POINT_FMT_DECL( double )265 F LOATING_POINT_FMT_DECL( long double )258 FloatingPointFMTDecl( double ) 259 FloatingPointFMTDecl( long double ) 266 260 267 261 // *********************************** character *********************************** … … 303 297 // *********************************** istream *********************************** 304 298 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 } // ?|?311 299 312 300 forall( istype & ) … … 339 327 forall( istype & | basic_istream( istype ) ) { 340 328 istype & ?|?( istype &, bool & ); 341 ISTYPE_VOID(bool & );329 void ?|?( istype &, bool & ); 342 330 343 331 istype & ?|?( istype &, char & ); 344 ISTYPE_VOID(char & );332 void ?|?( istype &, char & ); 345 333 istype & ?|?( istype &, signed char & ); 346 ISTYPE_VOID(signed char & );334 void ?|?( istype &, signed char & ); 347 335 istype & ?|?( istype &, unsigned char & ); 348 ISTYPE_VOID(unsigned char & );336 void ?|?( istype &, unsigned char & ); 349 337 350 338 istype & ?|?( istype &, short int & ); 351 ISTYPE_VOID(short int & );339 void ?|?( istype &, short int & ); 352 340 istype & ?|?( istype &, unsigned short int & ); 353 ISTYPE_VOID(unsigned short int & );341 void ?|?( istype &, unsigned short int & ); 354 342 istype & ?|?( istype &, int & ); 355 ISTYPE_VOID(int & );343 void ?|?( istype &, int & ); 356 344 istype & ?|?( istype &, unsigned int & ); 357 ISTYPE_VOID(unsigned int & );345 void ?|?( istype &, unsigned int & ); 358 346 istype & ?|?( istype &, long int & ); 359 ISTYPE_VOID(long int & );347 void ?|?( istype &, long int & ); 360 348 istype & ?|?( istype &, unsigned long int & ); 361 ISTYPE_VOID(unsigned long int & );349 void ?|?( istype &, unsigned long int & ); 362 350 istype & ?|?( istype &, long long int & ); 363 ISTYPE_VOID(long long int & );351 void ?|?( istype &, long long int & ); 364 352 istype & ?|?( istype &, unsigned long long int & ); 365 ISTYPE_VOID(unsigned long long int & );353 void ?|?( istype &, unsigned long long int & ); 366 354 #if defined( __SIZEOF_INT128__ ) 367 355 istype & ?|?( istype &, int128 & ); 368 ISTYPE_VOID(int128 & );356 void ?|?( istype &, int128 & ); 369 357 istype & ?|?( istype &, unsigned int128 & ); 370 ISTYPE_VOID(unsigned int128 & );358 void ?|?( istype &, unsigned int128 & ); 371 359 #endif // __SIZEOF_INT128__ 372 360 373 361 istype & ?|?( istype &, float & ); 374 ISTYPE_VOID(float & );362 void ?|?( istype &, float & ); 375 363 istype & ?|?( istype &, double & ); 376 ISTYPE_VOID(double & );364 void ?|?( istype &, double & ); 377 365 istype & ?|?( istype &, long double & ); 378 ISTYPE_VOID(long double & );366 void ?|?( istype &, long double & ); 379 367 380 368 istype & ?|?( istype &, float _Complex & ); 381 ISTYPE_VOID(float _Complex & );369 void ?|?( istype &, float _Complex & ); 382 370 istype & ?|?( istype &, double _Complex & ); 383 ISTYPE_VOID(double _Complex & );371 void ?|?( istype &, double _Complex & ); 384 372 istype & ?|?( istype &, long double _Complex & ); 385 ISTYPE_VOID(long double _Complex & );373 void ?|?( istype &, long double _Complex & ); 386 374 387 375 // istype & ?|?( istype &, const char [] ); … … 391 379 // manipulators 392 380 istype & ?|?( istype &, istype & (*)( istype & ) ); 393 ISTYPE_VOID(istype & (*)( istype & ) );381 void ?|?( istype &, istype & (*)( istype & ) ); 394 382 istype & nl( istype & is ); 395 383 istype & nlOn( istype & ); … … 449 437 }; // _Istream_Manip 450 438 451 #define I NPUT_FMT_DECL( T ) \439 #define InputFMTDecl( T ) \ 452 440 static inline { \ 453 441 _Istream_Manip(T) ignore( const T & val ) { return (_Istream_Manip(T))@{ (T &)val, -1, true }; } \ … … 461 449 } // ?|? 462 450 463 I NPUT_FMT_DECL( signed char )464 I NPUT_FMT_DECL( unsigned char )465 I NPUT_FMT_DECL( signed short int )466 I NPUT_FMT_DECL( unsigned short int )467 I NPUT_FMT_DECL( signed int )468 I NPUT_FMT_DECL( unsigned int )469 I NPUT_FMT_DECL( signed long int )470 I NPUT_FMT_DECL( unsigned long int )471 I NPUT_FMT_DECL( signed long long int )472 I NPUT_FMT_DECL( unsigned long long int )473 474 I NPUT_FMT_DECL( float )475 I NPUT_FMT_DECL( double )476 I NPUT_FMT_DECL( long double )477 478 I NPUT_FMT_DECL( float _Complex )479 I NPUT_FMT_DECL( double _Complex )480 I NPUT_FMT_DECL( long double _Complex )451 InputFMTDecl( signed char ) 452 InputFMTDecl( unsigned char ) 453 InputFMTDecl( signed short int ) 454 InputFMTDecl( unsigned short int ) 455 InputFMTDecl( signed int ) 456 InputFMTDecl( unsigned int ) 457 InputFMTDecl( signed long int ) 458 InputFMTDecl( unsigned long int ) 459 InputFMTDecl( signed long long int ) 460 InputFMTDecl( unsigned long long int ) 461 462 InputFMTDecl( float ) 463 InputFMTDecl( double ) 464 InputFMTDecl( long double ) 465 466 InputFMTDecl( float _Complex ) 467 InputFMTDecl( double _Complex ) 468 InputFMTDecl( long double _Complex ) 481 469 482 470 -
libcfa/src/rational.cfa
rdb94b5d rc44705c 10 10 // Created On : Wed Apr 6 17:54:28 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 18 11:07:10202313 // Update Count : 19 712 // Last Modified On : Mon Jun 5 22:49:06 2023 13 // Update Count : 196 14 14 // 15 15 … … 206 206 return os | r.numerator | '/' | r.denominator; 207 207 } // ?|? 208 OSTYPE_VOID_IMPL( rational(T) ) 208 209 void ?|?( ostype & os, rational(T) r ) { 210 (ostype &)(os | r); ends( os ); 211 } // ?|? 209 212 } // distribution 210 213 } // distribution -
libcfa/src/rational.hfa
rdb94b5d rc44705c 12 12 // Created On : Wed Apr 6 17:56:25 2016 13 13 // Last Modified By : Peter A. Buhr 14 // Last Modified On : Tue Jul 18 11:08:24202315 // Update Count : 1 2114 // Last Modified On : Mon Jun 5 22:49:05 2023 15 // Update Count : 119 16 16 // 17 17 … … 78 78 forall( ostype & | ostream( ostype ) | { ostype & ?|?( ostype &, T ); } ) { 79 79 ostype & ?|?( ostype &, rational(T) ); 80 OSTYPE_VOID(rational(T) );80 void ?|?( ostype &, rational(T) ); 81 81 } // distribution 82 82 } // distribution -
libcfa/src/time.cfa
rdb94b5d rc44705c 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 18 10:55:01 202313 // Update Count : 7 112 // Last Modified On : Tue Feb 4 08:24:18 2020 13 // Update Count : 70 14 14 // 15 15 … … 43 43 return os; 44 44 } // ?|? 45 OSTYPE_VOID_IMPL( Duration ) 45 46 void ?|?( ostype & os, Duration dur ) with( dur ) { 47 (ostype &)(os | dur); ends( os ); 48 } // ?|? 46 49 } // distribution 47 50 … … 152 155 return os; 153 156 } // ?|? 154 OSTYPE_VOID_IMPL( Time ) 157 158 void ?|?( ostype & os, Time time ) with( time ) { 159 (ostype &)(os | time); ends( os ); 160 } // ?|? 155 161 } // distribution 156 162 -
libcfa/src/vec/vec2.hfa
rdb94b5d rc44705c 283 283 return os | '<' | x | ',' | y | '>'; 284 284 } 285 OSTYPE_VOID_IMPL( vec2(T) ) 285 void ?|?(ostype & os, vec2(T) v ) with (v) { 286 (ostype &)(os | v); ends(os); 287 } 286 288 } -
libcfa/src/vec/vec3.hfa
rdb94b5d rc44705c 292 292 return os | '<' | x | ',' | y | ',' | z | '>'; 293 293 } 294 OSTYPE_VOID_IMPL( vec3(T) ) 294 void ?|?(ostype & os, vec3(T) v ) with (v) { 295 (ostype &)(os | v); ends(os); 296 } 295 297 } -
libcfa/src/vec/vec4.hfa
rdb94b5d rc44705c 287 287 return os | '<' | x | ',' | y | ',' | z | ',' | w | '>'; 288 288 } 289 OSTYPE_VOID_IMPL( vec4(T) ) 289 void ?|?(ostype & os, vec4(T) v ) with (v) { 290 (ostype &)(os | v); ends(os); 291 } 290 292 } 291 293
Note:
See TracChangeset
for help on using the changeset viewer.