Changeset c58f4ab for src/libcfa
- Timestamp:
- Mar 23, 2017, 11:30:42 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 578b637
- Parents:
- 9fcdfa3 (diff), 27cc24e (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:
- src/libcfa
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/libcfa/Makefile.am ¶
r9fcdfa3 rc58f4ab 35 35 ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -D__CFA_DEBUG__ -O0 -c -o $@ $< 36 36 37 EXTRA_FLAGS = -g -Wall -W no-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@37 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@ 38 38 39 39 AM_CCASFLAGS = @CFA_FLAGS@ -
TabularUnified src/libcfa/Makefile.in ¶
r9fcdfa3 rc58f4ab 305 305 AUTOMAKE_OPTIONS = subdir-objects 306 306 lib_LIBRARIES = $(am__append_1) $(am__append_2) 307 EXTRA_FLAGS = -g -Wall -W no-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@307 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@ 308 308 AM_CCASFLAGS = @CFA_FLAGS@ 309 309 headers = limits stdlib math iostream fstream iterator rational assert \ -
TabularUnified src/libcfa/fstream ¶
r9fcdfa3 rc58f4ab 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 7 14:48:08201713 // Update Count : 9112 // Last Modified On : Tue Mar 21 15:57:24 2017 13 // Update Count : 102 14 14 // 15 15 … … 21 21 enum { separateSize = 16 }; 22 22 struct ofstream { 23 void * file;23 void * file; 24 24 _Bool sepDefault; 25 25 _Bool sepOnOff; 26 const char * sepCur; 26 27 char separator[separateSize]; 28 char tupleSeparator[separateSize]; 27 29 }; // ofstream 28 30 … … 32 34 void sepReset( ofstream * ); 33 35 void sepReset( ofstream *, _Bool ); 36 const char * sepGetCur( ofstream * ); 37 void sepSetCur( ofstream *, const char * ); 34 38 const char * sepGet( ofstream * ); 35 39 void sepSet( ofstream *, const char * ); 40 const char * sepGetTuple( ofstream * ); 41 void sepSetTuple( ofstream *, const char * ); 36 42 _Bool sepDisable( ofstream * ); 37 43 _Bool sepEnable( ofstream * ); … … 42 48 void close( ofstream * ); 43 49 ofstream * write( ofstream *, const char * data, unsigned long int size ); 44 int prtfmt( ofstream *, const char fmt[], ... ); 50 int fmt( ofstream *, const char fmt[], ... ); 51 52 void ?{}( ofstream * ); 45 53 46 54 extern ofstream * sout, * serr; … … 48 56 // implement context istream 49 57 struct ifstream { 50 void * file;58 void * file; 51 59 }; // ifstream 52 60 … … 57 65 ifstream * read( ifstream * is, char * data, unsigned long int size ); 58 66 ifstream * ungetc( ifstream * is, char c ); 59 int scanfmt( ifstream *, const char fmt[], ... );67 int fmt( ifstream *, const char fmt[], ... ); 60 68 61 extern ifstream * sin;69 extern ifstream * sin; 62 70 63 71 #endif // __FSTREAM_H__ -
TabularUnified src/libcfa/fstream.c ¶
r9fcdfa3 rc58f4ab 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 Mar 7 14:48:09201713 // Update Count : 19212 // Last Modified On : Thu Mar 23 08:20:41 2017 13 // Update Count : 226 14 14 // 15 15 … … 25 25 #include <complex.h> // creal, cimag 26 26 } 27 #include "assert" 27 28 28 29 #define IO_MSG "I/O error: " 30 31 void ?{}( ofstream * this, void * file, _Bool sepDefault, _Bool sepOnOff, const char * separator, const char * tupleSeparator ) { 32 this->file = file; 33 this->sepDefault = sepDefault; 34 this->sepOnOff = sepOnOff; 35 sepSet( this, separator ); 36 sepSetCur( this, sepGet( this ) ); 37 sepSetTuple( this, tupleSeparator ); 38 } 29 39 30 40 _Bool sepPrt( ofstream * os ) { return os->sepOnOff; } … … 33 43 void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; } 34 44 void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; } 35 const char * sepGet( ofstream * os ) { return &(os->separator[0]); } 45 46 const char * sepGetCur( ofstream * os ) { return os->sepCur; } 47 void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; } 48 49 const char * sepGet( ofstream * os ) { return os->separator; } 36 50 37 51 void sepSet( ofstream * os, const char * s ) { 38 strncpy( &(os->separator[0]), s, separateSize - 1 ); 52 assert( s ); 53 strncpy( os->separator, s, separateSize - 1 ); 39 54 os->separator[separateSize - 1] = '\0'; 55 } // sepSet 56 57 const char * sepGetTuple( ofstream * os ) { return os->tupleSeparator; } 58 59 void sepSetTuple( ofstream * os, const char * s ) { 60 assert( s ); 61 strncpy( os->tupleSeparator, s, separateSize - 1 ); 62 os->tupleSeparator[separateSize - 1] = '\0'; 40 63 } // sepSet 41 64 … … 69 92 exit( EXIT_FAILURE ); 70 93 } // if 71 os->file = file; 72 sepOff( os ); 73 sepSet( os, " " ); 94 ?{}( os, file, 1, 0, " ", ", " ); 74 95 } // open 75 96 … … 95 116 } // write 96 117 97 int prtfmt( ofstream * os, const char fmt[], ... ) {118 int fmt( ofstream * os, const char format[], ... ) { 98 119 va_list args; 99 va_start( args, f mt );100 int len = vfprintf( (FILE *)(os->file), f mt, args );120 va_start( args, format ); 121 int len = vfprintf( (FILE *)(os->file), format, args ); 101 122 if ( len == EOF ) { 102 123 if ( ferror( (FILE *)(os->file) ) ) { … … 109 130 sepReset( os ); // reset separator 110 131 return len; 111 } // prtfmt 112 113 114 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, { ' ', '\0' } }; 132 } // fmt 133 134 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " }; 115 135 ofstream *sout = &soutFile; 116 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, { ' ', '\0' }};136 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " }; 117 137 ofstream *serr = &serrFile; 118 138 … … 173 193 } // ungetc 174 194 175 int scanfmt( ifstream * is, const char fmt[], ... ) {195 int fmt( ifstream * is, const char format[], ... ) { 176 196 va_list args; 177 197 178 va_start( args, f mt );179 int len = vfscanf( (FILE *)(is->file), f mt, args );198 va_start( args, format ); 199 int len = vfscanf( (FILE *)(is->file), format, args ); 180 200 if ( len == EOF ) { 181 201 if ( ferror( (FILE *)(is->file) ) ) { … … 186 206 va_end( args ); 187 207 return len; 188 } // prtfmt208 } // fmt 189 209 190 210 -
TabularUnified src/libcfa/iostream ¶
r9fcdfa3 rc58f4ab 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 6 20:51:35201713 // Update Count : 9812 // Last Modified On : Tue Mar 21 15:57:29 2017 13 // Update Count : 104 14 14 // 15 15 … … 25 25 void sepReset( ostype * ); // set separator state to default state 26 26 void sepReset( ostype *, _Bool ); // set separator and default state 27 const char * sepGetCur( ostype * ); // get current separator string 28 void sepSetCur( ostype *, const char * ); // set current separator string 29 const char * sepGet( ostype * ); // get separator string 27 30 void sepSet( ostype *, const char * ); // set separator to string (15 character maximum) 28 const char * sepGet( ostype * ); // get separator string 31 const char * sepGetTuple( ostype * ); // get tuple separator string 32 void sepSetTuple( ostype *, const char * ); // set tuple separator to string (15 character maximum) 29 33 _Bool sepDisable( ostype * ); // set default state to off, and return previous state 30 34 _Bool sepEnable( ostype * ); // set default state to on, and return previous state … … 35 39 void close( ostype * os ); 36 40 ostype * write( ostype *, const char *, unsigned long int ); 37 int prtfmt( ostype *, const char fmt[], ... );41 int fmt( ostype *, const char fmt[], ... ); 38 42 }; 39 43 … … 95 99 istype * read( istype *, char *, unsigned long int ); 96 100 istype * ungetc( istype *, char ); 97 int scanfmt( istype *, const char fmt[], ... );101 int fmt( istype *, const char fmt[], ... ); 98 102 }; 99 103 -
TabularUnified src/libcfa/iostream.c ¶
r9fcdfa3 rc58f4ab 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 6 20:52:02201713 // Update Count : 3 1312 // Last Modified On : Thu Mar 23 08:20:40 2017 13 // Update Count : 367 14 14 // 15 15 … … 24 24 25 25 forall( dtype ostype | ostream( ostype ) ) 26 ostype * ?|?( ostype * os, char c ) {27 prtfmt( os, "%c", c );26 ostype * ?|?( ostype * os, char c ) { 27 fmt( os, "%c", c ); 28 28 sepOff( os ); 29 29 return os; … … 31 31 32 32 forall( dtype ostype | ostream( ostype ) ) 33 ostype * ?|?( ostype * os, signed char c ) {34 prtfmt( os, "%hhd", c );33 ostype * ?|?( ostype * os, signed char c ) { 34 fmt( os, "%hhd", c ); 35 35 sepOff( os ); 36 36 return os; … … 38 38 39 39 forall( dtype ostype | ostream( ostype ) ) 40 ostype * ?|?( ostype * os, unsigned char c ) {41 prtfmt( os, "%hhu", c );40 ostype * ?|?( ostype * os, unsigned char c ) { 41 fmt( os, "%hhu", c ); 42 42 sepOff( os ); 43 43 return os; … … 45 45 46 46 forall( dtype ostype | ostream( ostype ) ) 47 ostype * ?|?( ostype * os, short int si ) {48 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );49 prtfmt( os, "%hd", si );50 return os; 51 } // ?|? 52 53 forall( dtype ostype | ostream( ostype ) ) 54 ostype * ?|?( ostype * os, unsigned short int usi ) {55 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );56 prtfmt( os, "%hu", usi );57 return os; 58 } // ?|? 59 60 forall( dtype ostype | ostream( ostype ) ) 61 ostype * ?|?( ostype * os, int i ) {62 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );63 prtfmt( os, "%d", i );64 return os; 65 } // ?|? 66 67 forall( dtype ostype | ostream( ostype ) ) 68 ostype * ?|?( ostype * os, unsigned int ui ) {69 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );70 prtfmt( os, "%u", ui );71 return os; 72 } // ?|? 73 74 forall( dtype ostype | ostream( ostype ) ) 75 ostype * ?|?( ostype * os, long int li ) {76 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );77 prtfmt( os, "%ld", li );78 return os; 79 } // ?|? 80 81 forall( dtype ostype | ostream( ostype ) ) 82 ostype * ?|?( ostype * os, unsigned long int uli ) {83 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );84 prtfmt( os, "%lu", uli );85 return os; 86 } // ?|? 87 88 forall( dtype ostype | ostream( ostype ) ) 89 ostype * ?|?( ostype * os, long long int lli ) {90 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );91 prtfmt( os, "%lld", lli );92 return os; 93 } // ?|? 94 95 forall( dtype ostype | ostream( ostype ) ) 96 ostype * ?|?( ostype * os, unsigned long long int ulli ) {97 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );98 prtfmt( os, "%llu", ulli );99 return os; 100 } // ?|? 101 102 forall( dtype ostype | ostream( ostype ) ) 103 ostype * ?|?( ostype * os, float f ) {104 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );105 prtfmt( os, "%g", f );106 return os; 107 } // ?|? 108 109 forall( dtype ostype | ostream( ostype ) ) 110 ostype * ?|?( ostype * os, double d ) {111 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );112 prtfmt( os, "%.*lg", DBL_DIG, d );113 return os; 114 } // ?|? 115 116 forall( dtype ostype | ostream( ostype ) ) 117 ostype * ?|?( ostype * os, long double ld ) {118 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );119 prtfmt( os, "%.*Lg", LDBL_DIG, ld );120 return os; 121 } // ?|? 122 123 forall( dtype ostype | ostream( ostype ) ) 124 ostype * ?|?( ostype * os, float _Complex fc ) {47 ostype * ?|?( ostype * os, short int si ) { 48 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 49 fmt( os, "%hd", si ); 50 return os; 51 } // ?|? 52 53 forall( dtype ostype | ostream( ostype ) ) 54 ostype * ?|?( ostype * os, unsigned short int usi ) { 55 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 56 fmt( os, "%hu", usi ); 57 return os; 58 } // ?|? 59 60 forall( dtype ostype | ostream( ostype ) ) 61 ostype * ?|?( ostype * os, int i ) { 62 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 63 fmt( os, "%d", i ); 64 return os; 65 } // ?|? 66 67 forall( dtype ostype | ostream( ostype ) ) 68 ostype * ?|?( ostype * os, unsigned int ui ) { 69 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 70 fmt( os, "%u", ui ); 71 return os; 72 } // ?|? 73 74 forall( dtype ostype | ostream( ostype ) ) 75 ostype * ?|?( ostype * os, long int li ) { 76 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 77 fmt( os, "%ld", li ); 78 return os; 79 } // ?|? 80 81 forall( dtype ostype | ostream( ostype ) ) 82 ostype * ?|?( ostype * os, unsigned long int uli ) { 83 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 84 fmt( os, "%lu", uli ); 85 return os; 86 } // ?|? 87 88 forall( dtype ostype | ostream( ostype ) ) 89 ostype * ?|?( ostype * os, long long int lli ) { 90 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 91 fmt( os, "%lld", lli ); 92 return os; 93 } // ?|? 94 95 forall( dtype ostype | ostream( ostype ) ) 96 ostype * ?|?( ostype * os, unsigned long long int ulli ) { 97 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 98 fmt( os, "%llu", ulli ); 99 return os; 100 } // ?|? 101 102 forall( dtype ostype | ostream( ostype ) ) 103 ostype * ?|?( ostype * os, float f ) { 104 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 105 fmt( os, "%g", f ); 106 return os; 107 } // ?|? 108 109 forall( dtype ostype | ostream( ostype ) ) 110 ostype * ?|?( ostype * os, double d ) { 111 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 112 fmt( os, "%.*lg", DBL_DIG, d ); 113 return os; 114 } // ?|? 115 116 forall( dtype ostype | ostream( ostype ) ) 117 ostype * ?|?( ostype * os, long double ld ) { 118 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 119 fmt( os, "%.*Lg", LDBL_DIG, ld ); 120 return os; 121 } // ?|? 122 123 forall( dtype ostype | ostream( ostype ) ) 124 ostype * ?|?( ostype * os, float _Complex fc ) { 125 125 os | crealf( fc ); 126 126 _Bool temp = sepDisable( os ); // disable separators within complex value … … 132 132 133 133 forall( dtype ostype | ostream( ostype ) ) 134 ostype * ?|?( ostype * os, double _Complex dc ) {134 ostype * ?|?( ostype * os, double _Complex dc ) { 135 135 os | creal( dc ); 136 136 _Bool temp = sepDisable( os ); // disable separators within complex value … … 142 142 143 143 forall( dtype ostype | ostream( ostype ) ) 144 ostype * ?|?( ostype * os, long double _Complex ldc ) {144 ostype * ?|?( ostype * os, long double _Complex ldc ) { 145 145 os | creall( ldc ); 146 146 _Bool temp = sepDisable( os ); // disable separators within complex value … … 152 152 153 153 forall( dtype ostype | ostream( ostype ) ) 154 ostype * ?|?( ostype * os, const char *cp ) {154 ostype * ?|?( ostype * os, const char * cp ) { 155 155 enum { Open = 1, Close, OpenClose }; 156 156 static const unsigned char mask[256] = { 157 157 // opening delimiters, no space after 158 158 ['('] : Open, ['['] : Open, ['{'] : Open, 159 [' $'] : Open, ['='] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open,159 ['='] : Open, ['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, 160 160 [(unsigned char)'¡'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open, 161 161 // closing delimiters, no space before 162 162 [','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close, 163 ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close, 163 164 [')'] : Close, [']'] : Close, ['}'] : Close, 164 ['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,165 165 // opening-closing delimiters, no space before or after 166 166 ['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose, … … 173 173 unsigned char ch = cp[0]; // must make unsigned 174 174 if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) { 175 prtfmt( os, "%s", sepGet( os ) );175 fmt( os, "%s", sepGetCur( os ) ); 176 176 } // if 177 177 … … 191 191 192 192 forall( dtype ostype | ostream( ostype ) ) 193 ostype * ?|?( ostype * os, const void *p ) {194 if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );195 prtfmt( os, "%p", p );193 ostype * ?|?( ostype * os, const void * p ) { 194 if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) ); 195 fmt( os, "%p", p ); 196 196 return os; 197 197 } // ?|? … … 201 201 forall( dtype ostype, otype T, ttype Params | ostream( ostype ) | writeable( T ) | { ostype * ?|?( ostype *, Params ); } ) 202 202 ostype * ?|?( ostype * os, T arg, Params rest ) { 203 os | arg | ", "; 204 os | rest; 203 sepSetCur( os, sepGetTuple( os ) ); // switch to tuple separator 204 os | arg; // print first argument 205 os | rest; // print remaining arguments 206 sepSetCur( os, sepGet( os ) ); // switch to regular separator 205 207 return os; 206 208 } // ?|? … … 217 219 os | '\n'; 218 220 flush( os ); 219 sepOff( os ); 221 sepOff( os ); // prepare for next line 220 222 return os; 221 223 } // endl … … 248 250 249 251 forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) ) 250 void write( iteratortype begin, iteratortype end, ostype * os ) {252 void write( iteratortype begin, iteratortype end, ostype * os ) { 251 253 void print( elttype i ) { os | i; } 252 254 for_each( begin, end, print ); … … 254 256 255 257 forall( otype elttype | writeable( elttype ), otype iteratortype | iterator( iteratortype, elttype ), dtype ostype | ostream( ostype ) ) 256 void write_reverse( iteratortype begin, iteratortype end, ostype * os ) {258 void write_reverse( iteratortype begin, iteratortype end, ostype * os ) { 257 259 void print( elttype i ) { os | i; } 258 260 for_each_reverse( begin, end, print ); … … 263 265 forall( dtype istype | istream( istype ) ) 264 266 istype * ?|?( istype * is, char * c ) { 265 scanfmt( is, "%c", c );267 fmt( is, "%c", c ); 266 268 return is; 267 269 } // ?|? … … 269 271 forall( dtype istype | istream( istype ) ) 270 272 istype * ?|?( istype * is, short int * si ) { 271 scanfmt( is, "%hd", si );273 fmt( is, "%hd", si ); 272 274 return is; 273 275 } // ?|? … … 275 277 forall( dtype istype | istream( istype ) ) 276 278 istype * ?|?( istype * is, unsigned short int * usi ) { 277 scanfmt( is, "%hu", usi );279 fmt( is, "%hu", usi ); 278 280 return is; 279 281 } // ?|? … … 281 283 forall( dtype istype | istream( istype ) ) 282 284 istype * ?|?( istype * is, int * i ) { 283 scanfmt( is, "%d", i );285 fmt( is, "%d", i ); 284 286 return is; 285 287 } // ?|? … … 287 289 forall( dtype istype | istream( istype ) ) 288 290 istype * ?|?( istype * is, unsigned int * ui ) { 289 scanfmt( is, "%u", ui );291 fmt( is, "%u", ui ); 290 292 return is; 291 293 } // ?|? … … 293 295 forall( dtype istype | istream( istype ) ) 294 296 istype * ?|?( istype * is, long int * li ) { 295 scanfmt( is, "%ld", li );297 fmt( is, "%ld", li ); 296 298 return is; 297 299 } // ?|? … … 299 301 forall( dtype istype | istream( istype ) ) 300 302 istype * ?|?( istype * is, unsigned long int * ulli ) { 301 scanfmt( is, "%lu", ulli );303 fmt( is, "%lu", ulli ); 302 304 return is; 303 305 } // ?|? … … 305 307 forall( dtype istype | istream( istype ) ) 306 308 istype * ?|?( istype * is, long long int * lli ) { 307 scanfmt( is, "%lld", lli );309 fmt( is, "%lld", lli ); 308 310 return is; 309 311 } // ?|? … … 311 313 forall( dtype istype | istream( istype ) ) 312 314 istype * ?|?( istype * is, unsigned long long int * ulli ) { 313 scanfmt( is, "%llu", ulli );315 fmt( is, "%llu", ulli ); 314 316 return is; 315 317 } // ?|? … … 318 320 forall( dtype istype | istream( istype ) ) 319 321 istype * ?|?( istype * is, float * f ) { 320 scanfmt( is, "%f", f );322 fmt( is, "%f", f ); 321 323 return is; 322 324 } // ?|? … … 324 326 forall( dtype istype | istream( istype ) ) 325 327 istype * ?|?( istype * is, double * d ) { 326 scanfmt( is, "%lf", d );328 fmt( is, "%lf", d ); 327 329 return is; 328 330 } // ?|? … … 330 332 forall( dtype istype | istream( istype ) ) 331 333 istype * ?|?( istype * is, long double * ld ) { 332 scanfmt( is, "%Lf", ld );334 fmt( is, "%Lf", ld ); 333 335 return is; 334 336 } // ?|? … … 338 340 istype * ?|?( istype * is, float _Complex * fc ) { 339 341 float re, im; 340 scanfmt( is, "%g%gi", &re, &im );342 fmt( is, "%g%gi", &re, &im ); 341 343 *fc = re + im * _Complex_I; 342 344 return is; … … 346 348 istype * ?|?( istype * is, double _Complex * dc ) { 347 349 double re, im; 348 scanfmt( is, "%lf%lfi", &re, &im );350 fmt( is, "%lf%lfi", &re, &im ); 349 351 *dc = re + im * _Complex_I; 350 352 return is; … … 354 356 istype * ?|?( istype * is, long double _Complex * ldc ) { 355 357 long double re, im; 356 scanfmt( is, "%Lf%Lfi", &re, &im );358 fmt( is, "%Lf%Lfi", &re, &im ); 357 359 *ldc = re + im * _Complex_I; 358 360 return is; … … 362 364 forall( dtype istype | istream( istype ) ) 363 365 istype * ?|?( istype * is, _Istream_cstrUC cstr ) { 364 scanfmt( is, "%s", cstr.s );366 fmt( is, "%s", cstr.s ); 365 367 return is; 366 368 } // cstr … … 371 373 char buf[16]; 372 374 sprintf( buf, "%%%ds", cstr.size ); 373 scanfmt( is, buf, cstr.s );375 fmt( is, buf, cstr.s ); 374 376 return is; 375 377 } // cstr
Note: See TracChangeset
for help on using the changeset viewer.