Changeset d395012
- Timestamp:
- Jul 1, 2017, 5:24:03 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:
- 86f384b
- Parents:
- b0f7a43
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
rb0f7a43 rd395012 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Thu Jun 22 16:53:29201714 %% Update Count : 249 313 %% Last Modified On : Sat Jul 1 17:19:42 2017 14 %% Update Count : 2495 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 2612 2612 Manipulators \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} \emph{locally} toggle printing the separator, \ie the seperator is adjusted only with respect to the next printed item. 2613 2613 \begin{cfa}[mathescape=off,belowskip=0pt] 2614 sout | sepOn | 1 | 2 | 3 | sepOn | endl; §\C{// separator at start of line}§2614 sout | sepOn | 1 | 2 | 3 | sepOn | endl; §\C{// separator at start/end of line}§ 2615 2615 \end{cfa} 2616 2616 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt] 2617 1 2 3 2617 ® ®1 2 3® ® 2618 2618 \end{cfa} 2619 2619 \begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt] -
src/libcfa/fstream
rb0f7a43 rd395012 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 15 18:11:09201713 // Update Count : 1 0412 // Last Modified On : Sat Jul 1 16:37:53 2017 13 // Update Count : 112 14 14 // 15 15 … … 24 24 _Bool sepDefault; 25 25 _Bool sepOnOff; 26 _Bool lastSepOn; 26 27 const char * sepCur; 27 28 char separator[separateSize]; … … 35 36 const char * sepGetCur( ofstream * ); 36 37 void sepSetCur( ofstream *, const char * ); 38 _Bool lastSepOn( ofstream * ); 37 39 38 40 // public -
src/libcfa/fstream.c
rb0f7a43 rd395012 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 15 18:11:11201713 // Update Count : 2 3412 // Last Modified On : Sat Jul 1 16:37:54 2017 13 // Update Count : 242 14 14 // 15 15 … … 33 33 this->sepDefault = sepDefault; 34 34 this->sepOnOff = sepOnOff; 35 this->lastSepOn = false; 35 36 sepSet( this, separator ); 36 37 sepSetCur( this, sepGet( this ) ); … … 39 40 40 41 // private 41 _Bool sepPrt( ofstream * os ) { return os->sepOnOff; } 42 _Bool lastSepOn( ofstream * os ) { return os->lastSepOn; } 43 _Bool sepPrt( ofstream * os ) { os->lastSepOn = false; return os->sepOnOff; } 42 44 void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; } 43 45 void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; } … … 46 48 47 49 // public 48 void sepOn( ofstream * os ) { os-> sepOnOff = 1; }49 void sepOff( ofstream * os ) { os-> sepOnOff = 0; }50 void sepOn( ofstream * os ) { os->lastSepOn = true; os->sepOnOff = true; } 51 void sepOff( ofstream * os ) { os->lastSepOn = false; os->sepOnOff = 0; } 50 52 51 53 _Bool sepDisable( ofstream *os ) { 52 54 _Bool temp = os->sepDefault; 53 55 os->sepDefault = false; 56 os->lastSepOn = false; 54 57 sepReset( os ); 55 58 return temp; … … 92 95 exit( EXIT_FAILURE ); 93 96 } // if 94 ?{}( os, file, 1, 0, " ", ", " );97 ?{}( os, file, true, false, " ", ", " ); 95 98 } // open 96 99 … … 132 135 } // fmt 133 136 134 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, " ", ", " };137 static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), true, false, " ", ", " }; 135 138 ofstream *sout = &soutFile; 136 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, " ", ", " };139 static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), true, false, " ", ", " }; 137 140 ofstream *serr = &serrFile; 138 141 -
src/libcfa/iostream
rb0f7a43 rd395012 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 15 18:08:44201713 // Update Count : 10 512 // Last Modified On : Sat Jul 1 16:37:52 2017 13 // Update Count : 108 14 14 // 15 15 … … 31 31 _Bool sepDisable( ostype * ); // set default state to off, and return previous state 32 32 _Bool sepEnable( ostype * ); // set default state to on, and return previous state 33 _Bool lastSepOn( ostype * ); // last manipulator is setOn (context sensitive) 33 34 34 35 const char * sepGet( ostype * ); // get separator string -
src/libcfa/iostream.c
rb0f7a43 rd395012 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 8 18:24:23201713 // Update Count : 3 6912 // Last Modified On : Sat Jul 1 16:37:51 2017 13 // Update Count : 374 14 14 // 15 15 … … 217 217 forall( dtype ostype | ostream( ostype ) ) 218 218 ostype * endl( ostype * os ) { 219 if ( lastSepOn( os ) ) fmt( os, "%s", sepGetCur( os ) ); 219 220 os | '\n'; 220 221 flush( os ); -
src/tests/.expect/io.txt
rb0f7a43 rd395012 5 5 6 6 x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10 7 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x 7 1, x 2. x 3; x 4! x 5? x 6% x 7¢ x 8» x 9) x 10] x 11} x 8 8 x`1`x'2'x"3"x:4:x 5 x 6 x 9 9 7 … … 14 14 x 15 15 10 16 x 16 x 17 17 x ( 1 ) x 2 , x 3 :x: 4 18 18 A … … 23 23 1.11.21.3 24 24 1.1+2.3i1.1-2.3i1.1-2.3i 25 abcxyz 26 abcxyz 25 abcxyz 26 abcxyz 27 27 28 28 1.1, $1.2, $1.3 29 29 1.1+2.3i, $1.1-2.3i, $1.1-2.3i 30 abc, $xyz 30 abc, $xyz, $ 31 31 32 32 1, 2, 3, 4 33 33 34 1, $2, $3 ", $" 34 35 1 2 3 " " 36 37 1 2 3 38 12 3 35 39 1 2 3 36 12 3 40 1 2 3 41 1 2 3 42 37 43 123 38 44 1 23 39 45 1 2 3 46 123 47 1 2 3 48 123 49 1 2 3 50 40 51 1 2 3 4 " " 41 52 1, 2, 3, 4 ", " 42 53 1, 2, 3, 4 54 43 55 3, 4, a, 7.2 44 56 3, 4, a, 7.2 -
src/tests/io.c
rb0f7a43 rd395012 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 8 09:52:10201713 // Update Count : 5 112 // Last Modified On : Sat Jul 1 16:21:07 2017 13 // Update Count : 58 14 14 // 15 15 … … 108 108 [int, int] t1 = [1, 2], t2 = [3, 4]; 109 109 sout | t1 | t2 | endl; // print tuple 110 sout | endl; 110 111 111 112 sepSet( sout, " " ); … … 114 115 sepSet( sout, " " ); // reset separator to " " 115 116 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 117 sout | endl; 116 118 117 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start of line119 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start/end of line 118 120 sout | 1 | sepOff | 2 | 3 | endl; // locally turn off implicit separator 121 sout | sepOn | 1 | 2 | 3 | sepOn | sepOff | endl; // separator at start of line 122 sout | 1 | 2 | 3 | endl | sepOn; // separator at start of next line 123 sout | 1 | 2 | 3 | endl; 124 sout | endl; 119 125 120 126 sout | sepDisable | 1 | 2 | 3 | endl; // globally turn off implicit separation 121 127 sout | 1 | sepOn | 2 | 3 | endl; // locally turn on implicit separator 122 sout | sepEnable | 1 | 2 | 3 | endl; // globally turn on implicit separation 128 sout | sepEnable | 1 | 2 | 3 | endl | sepDisable; // globally turn on/off implicit separation 129 sout | 1 | 2 | 3 | endl | sepEnable; // globally turn on implicit separation 130 sout | 1 | 2 | 3 | sepOn | sepDisable | endl; // ignore seperate at end of line 131 sout | 1 | 2 | 3 | sepOn | sepEnable | endl; // separator at end of line 132 sout | 1 | 2 | 3 | endl; 133 sout | endl; 123 134 124 135 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " … … 126 137 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 127 138 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 128 129 139 sout | t1 | t2 | endl; // print tuple 140 sout | endl; 130 141 131 142 [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
Note: See TracChangeset
for help on using the changeset viewer.