Changes in / [7b84d3e:2ad5e1d5]


Ignore:
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/string.cfa

    r7b84d3e r2ad5e1d5  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 18 21:52:09 2023
    13 // Update Count     : 208
     12// Last Modified On : Sat Sep  2 12:05:57 2023
     13// Update Count     : 206
    1414//
    1515
     
    138138
    139139void ?|?( ifstream & in, _Istream_Sstr f ) {
    140     (ifstream &)(in | f);
     140    (ifstream &)(in | f); ends( in );
    141141}
    142142
  • libcfa/src/collections/string_res.cfa

    r7b84d3e r2ad5e1d5  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 18 21:54:54 2023
    13 // Update Count     : 15
     12// Last Modified On : Mon Aug 14 18:06:01 2023
     13// Update Count     : 12
    1414//
    1515
     
    253253
    254254void ?|?( ifstream & in, string_res & this ) {
    255     (ifstream &)(in | this);
     255    (ifstream &)(in | this); ends( in );
    256256}
    257257
     
    297297
    298298void ?|?( ifstream & in, _Istream_Rstr f ) {
    299     (ifstream &)(in | f);
     299    (ifstream &)(in | f); ends( in );
    300300}
    301301
  • libcfa/src/fstream.cfa

    r7b84d3e r2ad5e1d5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 18 22:05:54 2023
    13 // Update Count     : 549
     12// Last Modified On : Fri Aug 18 10:41:17 2023
     13// Update Count     : 541
    1414//
    1515
     
    230230void nlOff( ifstream & os ) { os.nlOnOff$ = false; }
    231231
     232void ends( ifstream & is ) {}
     233
    232234bool eof( ifstream & is ) { return feof( (FILE *)(is.file$) ) != 0; }
    233235
     
    309311        } // if
    310312        va_end( args );
    311 //      if ( len == 0 ) throw ExceptionInst( missing_data );
    312313        return len;
    313314} // fmt
  • libcfa/src/fstream.hfa

    r7b84d3e r2ad5e1d5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 18 20:30:12 2023
    13 // Update Count     : 261
     12// Last Modified On : Fri Aug 18 10:41:15 2023
     13// Update Count     : 258
    1414//
    1515
     
    117117void nlOn( ifstream & );
    118118void nlOff( ifstream & );
     119void ends( ifstream & );
    119120int fmt( ifstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
    120 ifstream & ungetc( ifstream & is, char c );
    121 bool eof( ifstream & is );
    122121
    123122bool fail( ifstream & is );
    124123void clear( ifstream & );
     124bool eof( ifstream & is );
    125125void open( ifstream & is, const char name[], const char mode[] ); // FIX ME: use default = "r"
    126126void open( ifstream & is, const char name[] );
    127127void close( ifstream & is );
     128
    128129ifstream & read( ifstream & is, char data[], size_t size );
     130ifstream & ungetc( ifstream & is, char c );
    129131
    130132void ?{}( ifstream & is );
  • libcfa/src/iostream.cfa

    r7b84d3e r2ad5e1d5  
     1
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    1011// Created On       : Wed May 27 17:56:53 2015
    1112// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct 19 21:10:10 2023
    13 // Update Count     : 1801
     13// Last Modified On : Sun Oct  8 12:10:21 2023
     14// Update Count     : 1564
    1415//
    1516
     
    784785                return is;
    785786        } // ?|?
     787        ISTYPE_VOID_IMPL( bool & )
    786788
    787789        istype & ?|?( istype & is, char & c ) {
     
    795797                return is;
    796798        } // ?|?
     799        ISTYPE_VOID_IMPL( char & )
    797800
    798801        istype & ?|?( istype & is, signed char & sc ) {
     
    800803                return is;
    801804        } // ?|?
     805        ISTYPE_VOID_IMPL( signed char & )
    802806
    803807        istype & ?|?( istype & is, unsigned char & usc ) {
     
    805809                return is;
    806810        } // ?|?
     811        ISTYPE_VOID_IMPL( unsigned char & )
    807812
    808813        istype & ?|?( istype & is, short int & si ) {
     
    810815                return is;
    811816        } // ?|?
     817        ISTYPE_VOID_IMPL( short int & )
    812818
    813819        istype & ?|?( istype & is, unsigned short int & usi ) {
     
    815821                return is;
    816822        } // ?|?
     823        ISTYPE_VOID_IMPL( unsigned short int & )
    817824
    818825        istype & ?|?( istype & is, int & i ) {
     
    820827                return is;
    821828        } // ?|?
     829        ISTYPE_VOID_IMPL( int & )
    822830
    823831        istype & ?|?( istype & is, unsigned int & ui ) {
     
    825833                return is;
    826834        } // ?|?
     835        ISTYPE_VOID_IMPL( unsigned int & )
    827836
    828837        istype & ?|?( istype & is, long int & li ) {
     
    830839                return is;
    831840        } // ?|?
     841        ISTYPE_VOID_IMPL( long int & )
    832842
    833843        istype & ?|?( istype & is, unsigned long int & ulli ) {
     
    835845                return is;
    836846        } // ?|?
     847        ISTYPE_VOID_IMPL( unsigned long int & )
    837848
    838849        istype & ?|?( istype & is, long long int & lli ) {
     
    840851                return is;
    841852        } // ?|?
     853        ISTYPE_VOID_IMPL( long long int & )
    842854
    843855        istype & ?|?( istype & is, unsigned long long int & ulli ) {
     
    845857                return is;
    846858        } // ?|?
     859        ISTYPE_VOID_IMPL( unsigned long long int & )
    847860
    848861        #if defined( __SIZEOF_INT128__ )
     
    850863                return (istype &)(is | (unsigned int128 &)llli);
    851864        } // ?|?
     865        ISTYPE_VOID_IMPL( int128 & )
    852866
    853867        istype & ?|?( istype & is, unsigned int128 & ullli ) {
     
    866880                return is;
    867881        } // ?|?
     882        ISTYPE_VOID_IMPL( unsigned int128 & )
    868883        #endif // __SIZEOF_INT128__
    869884
     
    872887                return is;
    873888        } // ?|?
     889        ISTYPE_VOID_IMPL( float & )
    874890
    875891        istype & ?|?( istype & is, double & d ) {
     
    877893                return is;
    878894        } // ?|?
     895        ISTYPE_VOID_IMPL( double & )
    879896
    880897        istype & ?|?( istype & is, long double & ld ) {
     
    882899                return is;
    883900        } // ?|?
     901        ISTYPE_VOID_IMPL( long double & )
    884902
    885903        istype & ?|?( istype & is, float _Complex & fc ) {
     
    889907                return is;
    890908        } // ?|?
     909        ISTYPE_VOID_IMPL( float _Complex & )
    891910
    892911        istype & ?|?( istype & is, double _Complex & dc ) {
     
    896915                return is;
    897916        } // ?|?
     917        ISTYPE_VOID_IMPL( double _Complex & )
    898918
    899919        istype & ?|?( istype & is, long double _Complex & ldc ) {
     
    903923                return is;
    904924        } // ?|?
     925        ISTYPE_VOID_IMPL( long double _Complex & )
    905926
    906927        istype & ?|?( istype & is, const char fmt[] ) {
     
    908929                return is;
    909930        } // ?|?
     931        ISTYPE_VOID_IMPL( const char * )
    910932
    911933        // manipulators
     
    915937
    916938        void ?|?( istype & is, istype & (* manip)( istype & ) ) {
    917                 manip( is );
     939                manip( is ); ends( is );
    918940        } // ?|?
    919941
     
    944966                        char fmtstr[ sizeof("%*[]") + nscanset ];
    945967                        int pos = 0;
    946                         strcpy( &fmtstr[pos], "%*[" );  pos += 3;
     968                        fmtstr[pos] = '%';                  pos += 1;
     969                        fmtstr[pos] = '*';                  pos += 1;
     970                        fmtstr[pos] = '[';                  pos += 1;
    947971                        strcpy( &fmtstr[pos], f.scanset );  pos += nscanset;
    948                         strcpy( &fmtstr[pos], "]" );
    949                         fmt( is, fmtstr, "" );                                          // skip scanset
    950                 } else {
    951                         char ch;
    952 //                      fprintf( stderr, "skip " );
    953                         for ( f.wd ) {                                                          // skip N characters
    954                           if ( eof( is ) ) break;
    955                                 fmt( is, "%c", &ch );
    956 //                              fprintf( stderr, "`%c' ", ch );
    957                         } // for
    958                 } // if
     972                        fmtstr[pos] = ']';                  pos += 1;
     973                        fmtstr[pos] = '\0';
     974                        fmt( is, fmtstr, (void*)0 );  // last arg is dummy: suppress gcc warning
     975                }
     976                else for ( f.wd ) fmt( is, "%*c" );
    959977                return is;
    960978        }
     979        ISTYPE_VOID_IMPL( _Istream_Cskip )
    961980
    962981        istype & ?|?( istype & is, _Istream_Cstr f ) {
    963                 const char * scanset;
    964                 size_t nscanset = 0;
     982                const char * scanset = f.scanset;
    965983                if ( f.flags.delimiter ) scanset = f.delimiter; // getline ?
    966                 else scanset = f.scanset;
    967                 if ( scanset ) nscanset = strlen( scanset );
    968 
    969                 char fmtstr[nscanset + 32];                                             // storage for scanset and format codes
     984
     985                size_t len = 0;
     986                if ( scanset ) len = strlen( scanset );
     987                char fmtstr[len + 16];
     988                int start = 1;
    970989                fmtstr[0] = '%';
    971 
    972                 int pos = 1;
    973                 int args;
    974                 bool check = true;
    975 
    976                 if ( f.flags.ignore ) { check = false; fmtstr[1] = '*'; pos += 1; }
    977                 int rwd = f.wd;
    978                 if ( f.wd != -1 ) {                                                             // => just ignore versus ignore with width
     990                if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; }
     991                // no maximum width necessary because text ignored => width is read width
     992                if ( f.wd != -1 ) {
    979993                        // wd is buffer bytes available (for input chars + null terminator)
    980994                        // rwd is count of input chars
    981                         // no maximum width necessary because text ignored => width is read width
    982                         if ( f.flags.rwd ) check = false;
    983                         else rwd = f.wd - 1;
    984                         pos += sprintf( &fmtstr[pos], "%d", rwd );
     995                        int rwd;
     996                        if (f.flags.rwd) {
     997                                verify (f.wd >= 0);
     998                                rwd = f.wd;
     999                        } else {
     1000                                verify (f.wd >= 1);
     1001                                rwd = f.wd - 1;
     1002                        } // if
     1003                        start += sprintf( &fmtstr[start], "%d", rwd );
     1004                }
     1005
     1006                if ( ! scanset ) {
     1007                        // %s, %*s, %ws, %*ws
     1008                        fmtstr[start] = 's'; fmtstr[start + 1] = '\0';
     1009                        // printf( "cstr %s\n", fmtstr );
     1010                } else {
     1011                        // incl %[xxx],  %*[xxx],  %w[xxx],  %*w[xxx]
     1012                        // excl %[^xxx], %*[^xxx], %w[^xxx], %*w[^xxx]
     1013                        fmtstr[start] = '['; start += 1;
     1014                        if ( f.flags.inex ) { fmtstr[start] = '^'; start += 1; }
     1015                        strcpy( &fmtstr[start], scanset );                      // copy includes '\0'
     1016                        len += start;
     1017                        fmtstr[len] = ']'; fmtstr[len + 1] = '\0';
     1018                        // printf( "incl/excl %s\n", fmtstr );
    9851019                } // if
    9861020
    987                 if ( ! scanset ) {                                                              // %s, %*s, %ws, %*ws
    988 //                      fprintf( stderr, "cstr %s\n", f.s );
    989                         strcpy( &fmtstr[pos], "s%n" );
    990                         int len = 0;                                                            // may not be set in fmt
    991                         if ( f.flags.ignore ) args = fmt( is, fmtstr, &len ); // no string argument for '*'
    992                         else args = fmt( is, fmtstr, f.s, &len );
    993 //                      fprintf( stderr, "cstr %s %d %d %d %s\n", fmtstr, args, len, f.wd, f.s );
    994                         if ( check && len >= rwd && ! eof( is ) ) {     // might not fit
     1021                int check = f.wd - 2;
     1022                if (! f.flags.ignore ) {
     1023                        if ( ! f.flags.rwd ) f.s[check] = '\0';         // insert sentinel
     1024                }
     1025                len = fmt( is, fmtstr, f.s );
     1026                //fprintf( stderr, "KK %s %zd %d %c %s\n", fmtstr, len, check, f.s[check], f.s );
     1027
     1028                if ( ! f.flags.ignore && ! f.flags.rwd && f.s[check] != '\0' ) { // sentinel overwritten ?
     1029                        // buffer filled, but would we have kept going?
     1030                        if ( ! eof( is ) ) {
    9951031                                char peek;
    996                                 fmt( is, "%c", &peek );                                 // check for whitespace terminator
    997 //                              fprintf( stderr, "peek %d '%c'\n", args, peek );
    998                                 if ( ! eof( is ) ) {
    999                                         ungetc( is, peek );
    1000                                         if ( ! isspace( peek ) ) throw ExceptionInst( cstring_length );
    1001                                 } // if
    1002                         } // if
    1003                 } else {
    1004                         if ( f.flags.delimiter ) {                                      // getline
    1005 //                              fprintf( stderr, "getline\n" );
    1006                                 sprintf( &fmtstr[pos], "[%s%s]%%n", f.flags.inex ? "^" : "", scanset );
    1007 //                              fprintf( stderr, "getline %s %d\n", fmtstr, f.wd );
    1008                                 int len = 0;                                                    // may not be set in fmt
    1009                                 if ( f.flags.ignore ) args = fmt( is, fmtstr, &len ); // no string argument for '*'
    1010                                 else args = fmt( is, fmtstr, f.s, &len );
    1011 //                              fprintf( stderr, "getline %s %d %d %d\n", fmtstr, args, f.wd, eof( is ) );
    1012                                 if ( check && len == rwd && ! eof( is ) ) {     // might not fit
    1013                                         char peek;
    1014                                         fmt( is, "%c", &peek );                         // check for delimiter
    1015 //                                      fprintf( stderr, "peek %d '%c'\n", args, peek );
    1016                                         if ( ! eof( is ) ) {
    1017                                                 if ( peek != f.delimiter[0] ) {
    1018                                                         ungetc( is, peek );
    1019                                                         throw ExceptionInst( cstring_length );
    1020                                                 } // if
    1021                                         } // if
    1022                                 } else fmt( is, "%*c" );                                //  remove delimiter
    1023                         } else {
    1024                                 // incl %[xxx],  %*[xxx],  %w[xxx],  %*w[xxx]
    1025                                 // excl %[^xxx], %*[^xxx], %w[^xxx], %*w[^xxx]
    1026                                 sprintf( &fmtstr[pos], "[%s%s]%%n", f.flags.inex ? "^" : "", scanset );
    1027 //                              fprintf( stderr, "incl/excl %s %d\n", fmtstr, f.wd );
    1028                                 int len = 0;                                                    // may not be set in fmt
    1029                                 if ( f.flags.ignore ) args = fmt( is, fmtstr, &len ); // no string argument for '*'
    1030                                 else args = fmt( is, fmtstr, f.s, &len );
    1031 //                              fprintf( stderr, "incl/excl %s \"%s\" %d %d %d %d %d %c\n", fmtstr, f.s, args, f.wd, len, eof( is ), check, f.s[f.wd] );
    1032                                 if ( check && len == rwd && ! eof( is ) ) {     // might not fit
    1033 //                                      fprintf( stderr, "overflow\n" );
    1034                                         char peek;
    1035                                         fmt( is, "%c", &peek );                         // check for whitespace terminator
    1036 //                                      fprintf( stderr, "peek %d '%c'\n", args, peek );
    1037                                         if ( ! eof( is ) ) {
    1038                                                 ungetc( is, peek );
    1039                                                 if ( f.flags.inex ^ strchr( f.scanset, peek ) != 0p ) throw ExceptionInst( cstring_length );
    1040                                         } // if
    1041                                 } // if
     1032                                fmt( is, "%c", &peek );
     1033                                ungetc( is, peek );
     1034                                bool hasMore;
     1035                                if (f.flags.delimiter) { // getline
     1036                                        hasMore = (peek != f.delimiter[0]);
     1037                                } else if (f.scanset) { // incl/excl
     1038                                        bool peekMatch = strchr(f.scanset, peek) != 0p;
     1039                                        hasMore = f.flags.inex ? (!peekMatch) : (peekMatch);
     1040                                } else { // %s
     1041                                        hasMore = !isspace(peek);
     1042                                }
     1043                                if (hasMore) throw (cstring_length){ &cstring_length_vt };
    10421044                        } // if
    10431045                } // if
    1044                 if ( args == 1 && eof( is ) ) {                                 // data but scan ended at EOF
    1045 //                      fprintf( stderr, "clear\n" );
    1046                         clear( is );                                                            // => reset EOF => detect again on next read
    1047                 } // if
    1048                 return is;
    1049         } // ?|?
     1046
     1047                if ( f.flags.delimiter ) {                                              // getline ?
     1048                        if ( len == 0 ) f.s[0] = '\0';                          // empty read => argument unchanged => set empty
     1049                        if ( ! eof( is ) ) {                                            // ignore delimiter, may not be present because of width
     1050                                char delimiter;
     1051                                fmt( is, "%c", &delimiter );
     1052                                if ( delimiter != f.delimiter[0] ) ungetc( is, delimiter );
     1053                        } // if
     1054                } //if
     1055                return is;
     1056        } // ?|?
     1057        ISTYPE_VOID_IMPL( _Istream_Cstr )
    10501058
    10511059        istype & ?|?( istype & is, _Istream_Char f ) {
     
    10531061                return is;
    10541062        } // ?|?
     1063        ISTYPE_VOID_IMPL( _Istream_Char )
    10551064} // distribution
    10561065
     
    10691078                return is; \
    10701079        } /* ?|? */ \
     1080        ISTYPE_VOID_IMPL( _Istream_Manip(T) ) \
    10711081} // distribution
    10721082
     
    10961106                return is;
    10971107        } // ?|?
     1108        ISTYPE_VOID_IMPL( _Istream_Manip(float _Complex) )
    10981109
    10991110        istype & ?|?( istype & is, _Istream_Manip(double _Complex) dc ) {
     
    11061117                return is;
    11071118        } // ?|?
     1119        ISTYPE_VOID_IMPL( _Istream_Manip(double _Complex) )
    11081120
    11091121        istype & ?|?( istype & is, _Istream_Manip(long double _Complex) ldc ) {
     
    11161128                return is;
    11171129        } // ?|?
     1130        ISTYPE_VOID_IMPL( _Istream_Manip(long double _Complex) )
    11181131} // distribution
    11191132
  • libcfa/src/iostream.hfa

    r7b84d3e r2ad5e1d5  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Oct 18 21:21:20 2023
    13 // Update Count     : 583
     12// Last Modified On : Sun Oct  8 12:02:55 2023
     13// Update Count     : 568
    1414//
    1515
     
    306306// *********************************** istream ***********************************
    307307
     308#define ISTYPE_VOID( T ) void ?|?( istype &, T )
     309#define ISTYPE_VOID_IMPL( T ) \
     310        void ?|?( istype & is, T t ) { \
     311                (istype &)(is | t); ends( is ); \
     312        } // ?|?
     313
    308314forall( istype & )
    309315trait basic_istream {
     
    314320        void nlOn( istype & );                                                          // read newline
    315321        void nlOff( istype & );                                                         // scan newline
     322        void ends( istype & os );                                                       // end of output statement
    316323        int fmt( istype &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
    317324        istype & ungetc( istype &, char );
    318325        bool eof( istype & );
    319         void clear( istype & );
    320326}; // basic_istream
    321327
     
    323329trait istream {
    324330        bool fail( istype & );
    325         void open( istype & is, const char name[], const char mode[] );
     331        void clear( istype & );
    326332        void open( istype & is, const char name[] );
    327333        void close( istype & is );
     
    336342forall( istype & | basic_istream( istype ) ) {
    337343        istype & ?|?( istype &, bool & );
     344        ISTYPE_VOID( bool & );
    338345
    339346        istype & ?|?( istype &, char & );
     347        ISTYPE_VOID( char & );
    340348        istype & ?|?( istype &, signed char & );
     349        ISTYPE_VOID( signed char & );
    341350        istype & ?|?( istype &, unsigned char & );
     351        ISTYPE_VOID( unsigned char & );
    342352
    343353        istype & ?|?( istype &, short int & );
     354        ISTYPE_VOID( short int & );
    344355        istype & ?|?( istype &, unsigned short int & );
     356        ISTYPE_VOID( unsigned short int & );
    345357        istype & ?|?( istype &, int & );
     358        ISTYPE_VOID( int & );
    346359        istype & ?|?( istype &, unsigned int & );
     360        ISTYPE_VOID( unsigned int & );
    347361        istype & ?|?( istype &, long int & );
     362        ISTYPE_VOID( long int & );
    348363        istype & ?|?( istype &, unsigned long int & );
     364        ISTYPE_VOID( unsigned long int & );
    349365        istype & ?|?( istype &, long long int & );
     366        ISTYPE_VOID( long long int & );
    350367        istype & ?|?( istype &, unsigned long long int & );
     368        ISTYPE_VOID( unsigned long long int & );
    351369        #if defined( __SIZEOF_INT128__ )
    352370        istype & ?|?( istype &, int128 & );
     371        ISTYPE_VOID( int128 & );
    353372        istype & ?|?( istype &, unsigned int128 & );
     373        ISTYPE_VOID( unsigned int128 & );
    354374        #endif // __SIZEOF_INT128__
    355375
    356376        istype & ?|?( istype &, float & );
     377        ISTYPE_VOID( float & );
    357378        istype & ?|?( istype &, double & );
     379        ISTYPE_VOID( double & );
    358380        istype & ?|?( istype &, long double & );
     381        ISTYPE_VOID( long double & );
    359382
    360383        istype & ?|?( istype &, float _Complex & );
     384        ISTYPE_VOID( float _Complex & );
    361385        istype & ?|?( istype &, double _Complex & );
     386        ISTYPE_VOID( double _Complex & );
    362387        istype & ?|?( istype &, long double _Complex & );
     388        ISTYPE_VOID( long double _Complex & );
    363389
    364390        istype & ?|?( istype &, const char [] );
     391        ISTYPE_VOID( const char [] );
    365392
    366393        // manipulators
    367394        istype & ?|?( istype &, istype & (*)( istype & ) );
     395        ISTYPE_VOID( istype & (*)( istype & ) );
    368396        istype & nl( istype & is );
    369397        istype & nlOn( istype & );
     
    374402
    375403ExceptionDecl( cstring_length );
    376 ExceptionDecl( missing_data );
    377404
    378405// *********************************** manipulators ***********************************
    379406
    380 // skip does not compose with other C string manipulators.
    381407struct _Istream_Cskip {
    382408        const char * scanset;
     
    390416forall( istype & | basic_istream( istype ) ) {
    391417        istype & ?|?( istype & is, _Istream_Cskip f );
     418        ISTYPE_VOID( _Istream_Cskip );
    392419}
    393420
     
    431458forall( istype & | basic_istream( istype ) ) {
    432459        istype & ?|?( istype & is, _Istream_Cstr f );
     460        ISTYPE_VOID( _Istream_Cstr );
    433461}
    434462
     
    443471forall( istype & | basic_istream( istype ) ) {
    444472        istype & ?|?( istype & is, _Istream_Char f );
     473        ISTYPE_VOID( _Istream_Char );
    445474}
    446475
     
    461490forall( istype & | basic_istream( istype ) ) { \
    462491        istype & ?|?( istype & is, _Istream_Manip(T) f ); \
     492        ISTYPE_VOID( _Istream_Manip(T) ); \
    463493} // ?|?
    464494
  • tests/concurrency/waituntil/channel_close.cfa

    r7b84d3e r2ad5e1d5  
    2626        for( ;; ) {
    2727            if ( useAnd ) {
    28                 waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; }
    29                 and waituntil( (in2 << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( B_removes == in2 ); B_removes++; removes++; }
     28                waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; }
     29                and waituntil( (in2 << B) ) { assert( B_removes == in2 ); B_removes++; removes++; }
    3030                continue;
    3131            }
    32             waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; }
    33             or waituntil( (in << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); ( B_removes == in ); B_removes++; removes++; }
     32            waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; }
     33            or waituntil( (in << B) ) { assert( B_removes == in ); B_removes++; removes++; }
    3434        }
    3535    } catchResume ( channel_closed * e ) {} // continue to remove until would block
     
    3737    try {
    3838        for( ;; )
    39             waituntil( (in << A) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( A_removes == in ); A_removes++; removes++; }
     39            waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; }
    4040    } catchResume ( channel_closed * e ) {} // continue to remove until would block
    4141    catch ( channel_closed * e ) {}
    4242    try {
    4343        for( ;; )
    44             waituntil( (in << B) ) { __atomic_thread_fence( __ATOMIC_SEQ_CST ); assert( B_removes == in ); B_removes++; removes++; }
     44            waituntil( (in << B) ) { assert( B_removes == in ); B_removes++; removes++; }
    4545    } catchResume ( channel_closed * e ) {} // continue to remove until would block
    4646    catch ( channel_closed * e ) {}
  • tests/genericUnion.cfa

    r7b84d3e r2ad5e1d5  
    1010// Created On       : Tue Dec 25 14:42:46 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct 20 09:13:26 2023
    13 // Update Count     : 15
     12// Last Modified On : Tue Dec 25 14:46:33 2018
     13// Update Count     : 2
    1414//
    1515
    16 #include <fstream.hfa>
    1716#include <limits.hfa>
    1817
    19 forall( T )
     18forall(T)
    2019union ByteView {
    2120        T val;
     
    2423
    2524forall(T)
    26 void print( ByteView(T) x ) {
    27         for ( i; sizeof(int) ) {                                                        // want to change to sizeof(T)
    28                 sout | nobase( pad0( wd( 2, hex( x.bytes[i] & 0xff ) ) ) ) | nosep;
     25void print(ByteView(T) x) {
     26        for (int i = 0; i < sizeof(int); i++) {                         // want to change to sizeof(T)
     27                printf("%02x", x.bytes[i] & 0xff);
    2928        }
    3029}
    3130
    3231forall(T)
    33 void f( ByteView(T) x, T val ) {
    34         print( x );
    35         sout | " ";
     32void f(ByteView(T) x, T val) {
     33        print(x);
     34        printf(" ");
    3635        x.val = val;
    37         print( x );
    38         sout | nl;
     36        print(x);
     37        printf("\n");
    3938}
    4039
    4140int main() {
    42         sout | nlOff;
    4341        ByteView(unsigned) u = { 0 };
    4442        ByteView(int) i = { 0 };
    45         f( u, MAX );
    46         f( i, -1 );
     43        f(u, MAX);
     44        f(i, -1);
    4745}
    4846
Note: See TracChangeset for help on using the changeset viewer.