Changeset a5de33e for src/tests/io.c
- Timestamp:
- Jul 5, 2017, 5:00:46 PM (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:
- 55a68c3, 5805d15
- Parents:
- f7cb0bc (diff), 1ce2189 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/io.c
rf7cb0bc ra5de33e 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 : 5112 // Last Modified On : Sun Jul 2 09:40:58 2017 13 // Update Count : 68 14 14 // 15 15 … … 42 42 sout | endl; 43 43 44 sout | "opening delimiters" | endl; 44 45 sout 45 // opening delimiters46 46 | "x (" | 1 47 47 | "x [" | 2 … … 54 54 | "x ¿" | 9 55 55 | "x «" | 10 56 | endl; 56 | endl | endl; 57 58 sout | "closing delimiters" | endl; 57 59 sout 58 // closing delimiters59 60 | 1 | ", x" 60 61 | 2 | ". x" … … 68 69 | 10 | "] x" 69 70 | 11 | "} x" 70 | endl; 71 | endl | endl; 72 73 sout | "opening/closing delimiters" | endl; 71 74 sout 72 // opening-closing delimiters73 75 | "x`" | 1 | "`x'" | 2 74 76 | "'x\"" | 3 | "\"x:" | 4 … … 76 78 | "\tx\f" | 7 | "\fx\v" | 8 77 79 | "\vx\n" | 9 | "\nx\r" | 10 78 | "\rx" | 79 endl; 80 | "\rx" 81 | endl | endl; 82 83 sout | "override opening/closing delimiters" | endl; 80 84 sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl; 85 sout | endl; 81 86 82 87 ifstream in; // create / open file 83 88 open( &in, "io.data", "r" ); 84 89 90 sout | "input bacis types" | endl; 85 91 &in | &c // character 86 92 | &si | &usi | &i | &ui | &li | &uli | &lli | &ulli // integral … … 88 94 | &fc | &dc | &ldc // floating-point complex 89 95 | cstr( s1 ) | cstr( s2, size ); // C string, length unchecked and checked 96 sout | endl; 90 97 98 sout | "output basic types" | endl; 91 99 sout | c | ' ' | endl // character 92 100 | si | usi | i | ui | li | uli | lli | ulli | endl // integral … … 94 102 | fc | dc | ldc | endl; // complex 95 103 sout | endl; 104 105 sout | "tuples" | endl; 106 [int, [ int, int ] ] t1 = [ 1, [ 2, 3 ] ], t2 = [ 3, [ 4, 5 ] ]; 107 sout | t1 | t2 | endl; // print tuple 108 sout | endl; 109 110 sout | "toggle separator" | endl; 96 111 sout | f | "" | d | "" | ld | endl // floating point without separator 97 112 | sepDisable | fc | dc | ldc | sepEnable | endl // complex without separator … … 100 115 sout | endl; 101 116 117 sout | "change separator" | endl; 118 sout | "from \" " | sepGet( sout ) | "\""; 102 119 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 120 sout | "to \" " | sepGet( sout ) | "\"" | endl; 103 121 sout | f | d | ld | endl 104 122 | fc | dc | ldc | endl 105 | s1 | s2 | endl; 123 | s1 | s2 | endl 124 | t1 | t2 | endl; // print tuple 125 sout | endl; 126 sout | "from \"" | sepGet( sout ) | "\""; 127 sepSet( sout, " " ); // restore separator 128 sout | "to \"" | sepGet( sout ) | "\"" | endl; 129 sout | f | d | ld | endl 130 | fc | dc | ldc | endl 131 | s1 | s2 | endl 132 | t1 | t2 | endl; // print tuple 106 133 sout | endl; 107 134 108 [int, int] t1 = [1, 2], t2 = [3, 4]; 109 sout | t1 | t2 | endl; // print tuple 110 111 sepSet( sout, " " ); 112 sepSet( sout, ", $" ); // set separator from " " to ", $" 113 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 114 sepSet( sout, " " ); // reset separator to " " 115 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl; 116 117 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start of line 135 sout | sepOn | 1 | 2 | 3 | sepOn | endl; // separator at start/end of line 118 136 sout | 1 | sepOff | 2 | 3 | endl; // locally turn off implicit separator 137 sout | sepOn | 1 | 2 | 3 | sepOn | sepOff | endl; // separator at start of line 138 sout | 1 | 2 | 3 | endl | sepOn; // separator at start of next line 139 sout | 1 | 2 | 3 | endl; 140 sout | endl; 119 141 120 142 sout | sepDisable | 1 | 2 | 3 | endl; // globally turn off implicit separation 121 143 sout | 1 | sepOn | 2 | 3 | endl; // locally turn on implicit separator 122 sout | sepEnable | 1 | 2 | 3 | endl; // globally turn on implicit separation 144 sout | sepEnable | 1 | 2 | 3 | endl | sepDisable; // globally turn on/off implicit separation 145 sout | 1 | 2 | 3 | endl | sepEnable; // globally turn on implicit separation 146 sout | 1 | 2 | 3 | sepOn | sepDisable | endl; // ignore seperate at end of line 147 sout | 1 | 2 | 3 | sepOn | sepEnable | endl; // separator at end of line 148 sout | 1 | 2 | 3 | endl; 149 sout | endl; 123 150 124 151 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " … … 126 153 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 127 154 sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl; 128 129 155 sout | t1 | t2 | endl; // print tuple 156 sout | endl; 130 157 131 158 [int, int, const char *, double] t3 = { 3, 4, "a", 7.2 };
Note:
See TracChangeset
for help on using the changeset viewer.