- Timestamp:
- Mar 22, 2017, 5:39:46 PM (7 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:
- 22854f8, 37f9860
- Parents:
- 87d13cd
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/fstream.c
r87d13cd rcb91437 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 21 20:56:10201713 // Update Count : 2 1512 // Last Modified On : Wed Mar 22 16:17:21 2017 13 // Update Count : 221 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: " … … 37 38 void sepSetCur( ofstream * os, const char * sepCur ) { os->sepCur = sepCur; } 38 39 39 const char * sepGet( ofstream * os ) { return &(os->separator[0]); }40 const char * sepGet( ofstream * os ) { return os->separator; } 40 41 41 42 void sepSet( ofstream * os, const char * s ) { 42 strncpy( &(os->separator[0]), s, separateSize - 1 ); 43 assert( s ); 44 strncpy( os->separator, s, separateSize - 1 ); 43 45 os->separator[separateSize - 1] = '\0'; 44 46 } // sepSet 45 47 46 const char * sepGetTuple( ofstream * os ) { return &(os->tupleSeparator[0]); }48 const char * sepGetTuple( ofstream * os ) { return os->tupleSeparator; } 47 49 48 50 void sepSetTuple( ofstream * os, const char * s ) { 49 strncpy( &(os->tupleSeparator[0]), s, separateSize - 1 ); 51 assert( s ); 52 strncpy( os->tupleSeparator, s, separateSize - 1 ); 50 53 os->tupleSeparator[separateSize - 1] = '\0'; 51 54 } // sepSet -
src/libcfa/iostream.c
r87d13cd rcb91437 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 21 22:05:57201713 // Update Count : 3 4812 // Last Modified On : Wed Mar 22 17:21:23 2017 13 // Update Count : 358 14 14 // 15 15 … … 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 … … 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 forall( ttype Params ) ostype * prtTuple( ostype * os, T arg, Params rest ) { 204 os | arg; // print first argument 205 os | rest; // print remaining arguments 206 return os; 207 } // prtTuple 203 208 sepSetCur( os, sepGetTuple( os ) ); // switch to tuple separator 204 os | arg; // print first argument 205 os | rest; // print remaining arguments 209 prtTuple( os, arg, rest ); // recursively print tuple 206 210 sepSetCur( os, sepGet( os ) ); // switch to regular separator 211 return os; 207 212 } // ?|? 208 213 -
src/tests/.expect/io.txt
r87d13cd rcb91437 25 25 27 25 27 25 26 26 27 27 Segmentation fault (core dumped) 27 3, 4, a, 7.2 28 3, 4, a, 7.2 29 3 4 a 7.2 30 3 4 a 7.234a7.2 3 4 a 7.2 31 3-4-a-7.2^3^4-3-4-a-7.2 -
src/tests/io.c
r87d13cd rcb91437 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 21 2 1:24:50201713 // Update Count : 4 712 // Last Modified On : Tue Mar 21 22:36:06 2017 13 // Update Count : 48 14 14 // 15 15 … … 108 108 109 109 [int, int, const char *, double] t = { 3, 4, "a", 7.2 }; 110 sout | [ 3, 4, 'a', 7.2 ] | endl;110 sout | [ 3, 4, "a", 7.2 ] | endl; 111 111 sout | t | endl; 112 112 sepSetTuple( sout, " " );
Note: See TracChangeset
for help on using the changeset viewer.