- Timestamp:
- Aug 10, 2023, 3:44:28 PM (12 months ago)
- Branches:
- master
- Children:
- 7839f78
- Parents:
- 23edb61 (diff), 74c6748 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- libcfa/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/iostream.cfa
r23edb61 r9ff71ff 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 7 08:59:29202313 // Update Count : 14 0712 // Last Modified On : Wed Aug 9 10:10:56 2023 13 // Update Count : 1432 14 14 // 15 15 … … 271 271 OSTYPE_VOID_IMPL( const char * ) 272 272 273 // ostype & ?|?( ostype & os, const char16_t * s) {273 // ostype & ?|?( ostype & os, const char16_t s[] ) { 274 274 // if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 275 275 // fmt( os, "%ls", s ); … … 278 278 279 279 // #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous 280 // ostype & ?|?( ostype & os, const char32_t * s) {280 // ostype & ?|?( ostype & os, const char32_t s[] ) { 281 281 // if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 282 282 // fmt( os, "%ls", s ); … … 285 285 // #endif // ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) 286 286 287 // ostype & ?|?( ostype & os, const wchar_t * s) {287 // ostype & ?|?( ostype & os, const wchar_t s[] ) { 288 288 // if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); 289 289 // fmt( os, "%ls", s ); … … 917 917 // } // ?|? 918 918 919 istype & ?|?( istype & is, char s[] ) {920 fmt( is, "%s", s );921 return is;922 } // ?|?923 ISTYPE_VOID_IMPL( char * )919 // istype & ?|?( istype & is, char s[] ) { 920 // fmt( is, "%s", s ); 921 // return is; 922 // } // ?|? 923 // ISTYPE_VOID_IMPL( char * ) 924 924 925 925 // manipulators … … 934 934 istype & nl( istype & is ) { 935 935 fmt( is, "%*[^\n]" ); // ignore characters to newline 936 if ( ! eof( is ) && getANL$( is ) ) fmt( is, "%*c" ); // read newline 936 937 return is; 937 938 } // nl … … 952 953 forall( istype & | basic_istream( istype ) ) { 953 954 istype & ?|?( istype & is, _Istream_Cstr f ) { 954 // skip xxx955 // skip 955 956 if ( ! f.s ) { 956 957 // printf( "skip %s %d\n", f.scanset, f.wd ); 957 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); 958 if ( f.wd == -1 ) fmt( is, f.scanset, "" ); // no input arguments 958 959 else for ( f.wd ) fmt( is, "%*c" ); 959 960 return is; 960 961 } // if 962 963 // getline 964 if ( f.flags.delimit ) { 965 char fmtstr[] = "%[^ ]s"; // delimit inserted into space 966 fmtstr[3] = f.delimit; 967 fmt( is, fmtstr, f.s ); // read upto delimiter 968 fmt( is, "%*c" ); // ignore delimiter 969 return is; 970 } // if 971 972 // incl/excl 961 973 size_t len = 0; 962 974 if ( f.scanset ) len = strlen( f.scanset ); … … 977 989 fmtstr[start] = '['; start += 1; 978 990 if ( f.flags.inex ) { fmtstr[start] = '^'; start += 1; } 979 strcpy( &fmtstr[start], f.scanset ); 991 strcpy( &fmtstr[start], f.scanset ); // copy includes '\0' 980 992 len += start; 981 993 fmtstr[len] = ']'; fmtstr[len + 1] = '\0'; … … 987 999 988 1000 istype & ?|?( istype & is, _Istream_Char f ) { 989 fmt( is, "%*c" ); 1001 fmt( is, "%*c" ); // argument variable unused 990 1002 return is; 991 1003 } // ?|? -
libcfa/src/iostream.hfa
r23edb61 r9ff71ff 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 19 14:25:52202313 // Update Count : 46312 // Last Modified On : Wed Aug 9 16:47:05 2023 13 // Update Count : 500 14 14 // 15 15 … … 130 130 ostype & ?|?( ostype &, const char [] ); 131 131 OSTYPE_VOID( const char [] ); 132 // ostype & ?|?( ostype &, const char16_t *);132 // ostype & ?|?( ostype &, const char16_t [] ); 133 133 #if ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) // char32_t == wchar_t => ambiguous 134 // ostype & ?|?( ostype &, const char32_t *);134 // ostype & ?|?( ostype &, const char32_t [] ); 135 135 #endif // ! ( __ARM_ARCH_ISA_ARM == 1 && __ARM_32BIT_STATE == 1 ) 136 // ostype & ?|?( ostype &, const wchar_t *);136 // ostype & ?|?( ostype &, const wchar_t [] ); 137 137 ostype & ?|?( ostype &, const void * ); 138 138 OSTYPE_VOID( const void * ); … … 390 390 391 391 // istype & ?|?( istype &, const char [] ); 392 istype & ?|?( istype &, char [] );393 ISTYPE_VOID( char *);392 // istype & ?|?( istype &, char [] ); 393 // ISTYPE_VOID( char [] ); 394 394 395 395 // manipulators … … 405 405 struct _Istream_Cstr { 406 406 char * s; 407 const char * scanset; 407 union { 408 const char * scanset; 409 char delimit; 410 }; 408 411 int wd; // width 409 412 union { … … 412 415 unsigned char ignore:1; // do not change input argument 413 416 unsigned char inex:1; // include/exclude characters in scanset 417 unsigned char delimit:1; // delimit character 414 418 } flags; 415 419 }; … … 417 421 418 422 static inline { 419 _Istream_Cstr skip( const char scanset[] ) { return (_Istream_Cstr){ 0p, scanset, -1, { .all : 0 } }; } 420 _Istream_Cstr skip( unsigned int n ) { return (_Istream_Cstr){ 0p, 0p, n, { .all : 0 } }; } 421 _Istream_Cstr incl( const char scanset[], char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : false } }; } 423 _Istream_Cstr skip( const char scanset[] ) { return (_Istream_Cstr){ 0p, {scanset}, -1, {.all : 0} }; } 424 _Istream_Cstr skip( unsigned int wd ) { return (_Istream_Cstr){ 0p, {0p}, wd, {.all : 0} }; } 425 _Istream_Cstr & getline( _Istream_Cstr & fmt ) { fmt.delimit = '\n'; fmt.flags.delimit = true; return fmt; } 426 _Istream_Cstr & getline( const char delimit, _Istream_Cstr & fmt ) { fmt.delimit = delimit; fmt.flags.delimit = true; return fmt; } 427 // _Istream_Cstr incl( const char scanset[], char s[] ) { return (_Istream_Cstr){ s, {scanset}, -1, { .flags.inex : false } }; } 428 // _Istream_Cstr incl( const char scanset[], unsigned int wd, char s[] ) { return (_Istream_Cstr){ s, {scanset}, wd, {.flags.inex : false} }; } 422 429 _Istream_Cstr & incl( const char scanset[], _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = false; return fmt; } 423 _Istream_Cstr excl( const char scanset[], char * s ) { return (_Istream_Cstr){ s, scanset, -1, { .flags.inex : true } }; } 430 // _Istream_Cstr excl( const char scanset[], char s[] ) { return (_Istream_Cstr){ s, {scanset}, -1, { .flags.inex : true } }; } 431 // _Istream_Cstr excl( const char scanset[], unsigned int wd, char s[] ) { return (_Istream_Cstr){ s, {scanset}, wd, {.flags.inex : true} }; } 424 432 _Istream_Cstr & excl( const char scanset[], _Istream_Cstr & fmt ) { fmt.scanset = scanset; fmt.flags.inex = true; return fmt; } 425 _Istream_Cstr ignore( char s[] ) { return (_Istream_Cstr)@{ s, 0p, -1, { .flags.ignore : true} }; }433 _Istream_Cstr ignore( char s[] ) { return (_Istream_Cstr)@{ s, {0p}, -1, {.flags.ignore : true} }; } 426 434 _Istream_Cstr & ignore( _Istream_Cstr & fmt ) { fmt.flags.ignore = true; return fmt; } 427 _Istream_Cstr wdi( unsigned int w , char s[] ) { return (_Istream_Cstr)@{ s, 0p, w, { .all : 0} }; }428 _Istream_Cstr & wdi( unsigned int w, _Istream_Cstr & fmt ) { fmt.wd = w; return fmt; }435 _Istream_Cstr wdi( unsigned int wd, char s[] ) { return (_Istream_Cstr)@{ s, {0p}, wd, {.all : 0} }; } 436 // _Istream_Cstr & wdi( unsigned int wd, _Istream_Cstr & fmt ) { fmt.wd = wd; return fmt; } 429 437 } // distribution 430 438 forall( istype & | basic_istream( istype ) ) { … … 457 465 _Istream_Manip(T) ignore( const T & val ) { return (_Istream_Manip(T))@{ (T &)val, -1, true }; } \ 458 466 _Istream_Manip(T) & ignore( _Istream_Manip(T) & fmt ) { fmt.ignore = true; return fmt; } \ 459 _Istream_Manip(T) wdi( unsigned int w , T & val ) { return (_Istream_Manip(T))@{ val, w, false }; } \460 _Istream_Manip(T) & wdi( unsigned int w , _Istream_Manip(T) & fmt ) { fmt.wd = w; return fmt; } \467 _Istream_Manip(T) wdi( unsigned int wd, T & val ) { return (_Istream_Manip(T))@{ val, wd, false }; } \ 468 _Istream_Manip(T) & wdi( unsigned int wd, _Istream_Manip(T) & fmt ) { fmt.wd = wd; return fmt; } \ 461 469 } /* distribution */ \ 462 470 forall( istype & | basic_istream( istype ) ) { \ -
libcfa/src/parseconfig.cfa
r23edb61 r9ff71ff 112 112 113 113 114 static [ bool ] comments( & ifstream in, [] char name ) {114 static [ bool ] comments( & ifstream in, size_t size, [] char name ) { 115 115 while () { 116 in | name;116 in | wdi( size, name ); 117 117 if ( eof( in ) ) return true; 118 118 if ( name[0] != '#' ) return false; … … 136 136 // NOTE: Must add check to see if already read in value for this key, 137 137 // once we switch to using hash table as intermediate storage 138 if ( comments( in, key ) ) break;// eof ?139 in | value;138 if ( comments( in, 64, key ) ) break; // eof ? 139 in | wdi( 256, value ); 140 140 141 141 add_kv_pair( *kv_pairs, key, value );
Note: See TracChangeset
for help on using the changeset viewer.