Changeset bb1eabc for libcfa/src
- Timestamp:
- May 4, 2026, 7:26:38 AM (9 days ago)
- Branches:
- master
- Children:
- 244335b
- Parents:
- 8403b32
- Location:
- libcfa/src
- Files:
-
- 4 edited
-
collections/string.cfa (modified) (2 diffs)
-
collections/string.hfa (modified) (3 diffs)
-
iostream.cfa (modified) (3 diffs)
-
iostream.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/collections/string.cfa
r8403b32 rbb1eabc 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 15 10:26:35 202513 // Update Count : 39 412 // Last Modified On : Sun May 3 23:21:25 2026 13 // Update Count : 395 14 14 // 15 15 … … 214 214 for ( i; l ) cstr[i] = f.val[i]; // copy string 215 215 cstr[l] = '\0'; // terminate 216 _Ostream_Manip(const char *) cf @= { cstr, f.wd, f.pc, f.base, {f.all} };216 _Ostream_Manip(const char *) cf @= { cstr, f.wd, f.pc, f.base, {f.all}, f.qleft, f.qright }; 217 217 return os | cf | nonl; 218 218 } // ?|? -
libcfa/src/collections/string.hfa
r8403b32 rbb1eabc 10 10 // Created On : Fri Sep 03 11:00:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at May 2 19:09:55202613 // Update Count : 32 212 // Last Modified On : Sun May 3 23:24:08 2026 13 // Update Count : 324 14 14 // 15 15 … … 90 90 _Ostream_Manip(string) oct( string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 'o', { .all = 0 } }; } 91 91 _Ostream_Manip(string) hex( string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 'x', { .all = 0 } }; } 92 _Ostream_Manip(string) quote( string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 's', { .flags.quote = true } }; } 92 _Ostream_Manip(string) quote( string s, const char qleft = '"', const char qright = '\0' ) { 93 return (_Ostream_Manip(string))@{ .val = s, .wd = 1, .pc = 0, .base = 's', { .flags.quote = true }, .qleft = qleft, .qright = qright }; } 93 94 _Ostream_Manip(string) wd( unsigned int wd, string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = wd, .pc = 0, .base = 's', { .all = 0 } }; } 94 95 _Ostream_Manip(string) wd( unsigned int wd, unsigned int pc, string s ) { return (_Ostream_Manip(string))@{ .val = s, .wd = wd, .pc = pc, .base = 's', { .flags.pc = true } }; } … … 98 99 _Ostream_Manip(string) & nobase( _Ostream_Manip(string) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 99 100 _Ostream_Manip(string) & upcase( _Ostream_Manip(string) & fmt ) { if ( fmt.base == 'x' || fmt.base == 'b' ) fmt.base -= 32; /* upper case */ return fmt; } 100 _Ostream_Manip(string) & quote( _Ostream_Manip(string) & fmt ) { fmt.flags.quote = true; return fmt; } \ 101 _Ostream_Manip(string) & quote( _Ostream_Manip(string) & fmt, const char qleft = '"', const char qright = '\0' ) { 102 fmt.flags.quote = true; fmt.qleft = qleft, fmt.qright = qright; return fmt; } 101 103 } // distribution 102 104 -
libcfa/src/iostream.cfa
r8403b32 rbb1eabc 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 3 08:08:29202613 // Update Count : 22 4112 // Last Modified On : Sun May 3 22:02:37 2026 13 // Update Count : 2271 14 14 // 15 15 … … 698 698 } // if 699 699 if ( f.flags.quote ) { // print as string 700 char qv[] = "' '"; 701 qv[1] = f.val; 700 char qv[] = { f.qleft, f.val, f.qright ? : f.qleft, '\0' }; 702 701 f.flags.quote = false; // already quoted 703 702 _Ostream_Manip(const char *) fmtuc @= { qv, f.wd, f.pc, 's', {f.all} }; … … 743 742 int len = strlen( f.val ); 744 743 char qv[len + 3]; // space for quotes and '\0' 745 qv[0] = '"'; // copy string surrounded with quotes 746 strcpy( &qv[1], f.val ); 747 qv[len + 1] = '"'; 748 qv[len + 2] = '\0'; 744 qv[0] = f.qleft; strcpy( &qv[1], f.val ); 745 qv[len + 1] = f.qright ? : f.qleft; qv[len + 2] = '\0'; // copy string surrounded with quotes 749 746 f.flags.quote = false; // already quoted 750 747 _Ostream_Manip(const char *) fmtuc @= { qv, f.wd, f.pc, 's', {f.all} }; -
libcfa/src/iostream.hfa
r8403b32 rbb1eabc 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at May 2 18:48:56 202613 // Update Count : 78012 // Last Modified On : Sun May 3 21:55:06 2026 13 // Update Count : 829 14 14 // 15 15 … … 209 209 char base; // numeric base / floating-point style 210 210 inline _Ostream_Manip_Mode; 211 char qleft, qright; // quote delimiters (PLACE HERE SO OPTIONAL IN INITIALIZATION) 211 212 }; // _Ostream_Manip 212 213 … … 289 290 _Ostream_Manip(char) oct( char c ) { return (_Ostream_Manip(char))@{ .val = c, .wd = 1, .pc = 0, .base = 'o', { .all = 0 } }; } 290 291 _Ostream_Manip(char) hex( char c ) { return (_Ostream_Manip(char))@{ .val = c, .wd = 1, .pc = 0, .base = 'x', { .all = 0 } }; } 291 _Ostream_Manip(char) quote( char c ) { return (_Ostream_Manip(char))@{ .val = c, .wd = 1, .pc = 0, .base = 'c', { .flags.quote = true } }; } 292 _Ostream_Manip(char) quote( char c, const char qleft = '\'', const char qright = '\0' ) { 293 return (_Ostream_Manip(char))@{ .val = c, .wd = 1, .pc = 0, .base = 'c', { .flags.quote = true }, .qleft = qleft, .qright = qright }; } 292 294 _Ostream_Manip(char) wd( unsigned int wd, char c ) { return (_Ostream_Manip(char))@{ .val = c, .wd = wd, .pc = 0, .base = 'c', { .all = 0 } }; } 293 295 _Ostream_Manip(char) & wd( unsigned int wd, _Ostream_Manip(char) & fmt ) { fmt.wd = wd; return fmt; } … … 295 297 _Ostream_Manip(char) & upcase( _Ostream_Manip(char) & fmt ) { if ( fmt.base == 'x' || fmt.base == 'b' ) fmt.base -= 32; /* upper case */ return fmt; } 296 298 _Ostream_Manip(char) & nobase( _Ostream_Manip(char) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 297 _Ostream_Manip(char) & quote( _Ostream_Manip(char) & fmt ) { fmt.flags.quote = true; return fmt; } 299 _Ostream_Manip(char) & quote( _Ostream_Manip(char) & fmt, const char qleft = '\'', const char qright = '\0' ) { 300 fmt.flags.quote = true; fmt.qleft = qleft, fmt.qright = qright; return fmt; } 298 301 } // distribution 299 302 forall( ostype & | basic_ostream( ostype ) ) { … … 308 311 _Ostream_Manip(const char *) oct( const char s[] ) { return (_Ostream_Manip(const char *))@{ .val = s, .wd = 1, .pc = 0, .base = 'o', { .all = 0 } }; } 309 312 _Ostream_Manip(const char *) hex( const char s[] ) { return (_Ostream_Manip(const char *))@{ .val = s, .wd = 1, .pc = 0, .base = 'x', { .all = 0 } }; } 310 _Ostream_Manip(const char *) quote( const char s[] ) { return (_Ostream_Manip(const char *))@{ .val = s, .wd = 1, .pc = 0, .base = 's', { .flags.quote = true } }; } 313 _Ostream_Manip(const char *) quote( const char s[], const char qleft = '"', const char qright = '\0' ) { 314 return (_Ostream_Manip(const char *))@{ .val = s, .wd = 1, .pc = 0, .base = 's', { .flags.quote = true }, .qleft = qleft, .qright = qright }; } 311 315 _Ostream_Manip(const char *) wd( unsigned int wd, const char s[] ) { return (_Ostream_Manip(const char *))@{ .val = s, .wd = wd, .pc = 0, .base = 's', { .all = 0 } }; } 312 316 _Ostream_Manip(const char *) wd( unsigned int wd, unsigned int pc, const char s[] ) { return (_Ostream_Manip(const char *))@{ .val = s, .wd = wd, .pc = pc, .base = 's', { .flags.pc = true } }; } … … 316 320 _Ostream_Manip(const char *) & upcase( _Ostream_Manip(const char *) & fmt ) { if ( fmt.base == 'x' || fmt.base == 'b' ) fmt.base -= 32; /* upper case */ return fmt; } 317 321 _Ostream_Manip(const char *) & nobase( _Ostream_Manip(const char *) & fmt ) { fmt.flags.nobsdp = true; return fmt; } 318 _Ostream_Manip(const char *) & quote( _Ostream_Manip(const char *) & fmt ) { fmt.flags.quote = true; return fmt; } \ 322 _Ostream_Manip(const char *) & quote( _Ostream_Manip(const char *) & fmt, const char qleft = '"', const char qright = '\0' ) { 323 fmt.flags.quote = true; fmt.qleft = qleft; fmt.qright = qright; return fmt; } 319 324 } // distribution 320 325 forall( ostype & | basic_ostream( ostype ) ) { … … 430 435 union { 431 436 const char * scanset; 432 char delimiters[3]; // [0] => left, [1] => right437 char delimiters[3]; // [0] => qleft or terminator, [1] => qright or getline '\0', [2] => char '\0' or char * '\1' 433 438 }; 434 439 int wd; // width
Note:
See TracChangeset
for help on using the changeset viewer.