- Timestamp:
- Jul 19, 2019, 4:49:20 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 3e91703
- Parents:
- 8e87f37
- Location:
- tests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/copyfile.txt
r8e87f37 r3f654ec 10 10 // Created On : Tue Jul 16 16:47:22 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 16 16:48:16201913 // Update Count : 112 // Last Modified On : Wed Jul 17 18:04:44 2019 13 // Update Count : 26 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <stdlib.hfa> // new/delete 17 18 18 19 int main( int argc, char * argv[] ) { 19 ifstream & in = stdin;// default files20 ofstream & out =stdout;21 22 choose ( argc ) {23 case 2, 3:24 open( in, argv[1] );// open input file first as output creates file25 if ( argc == 3 ) open( out, argv[2] );// only open output if input opens as output created if nonexistent26 case 1: ; // use default files27 default:28 29 } // choose20 ifstream * in = &stdin; // default files 21 ofstream * out = &stdout; 22 try { 23 choose ( argc ) { 24 case 2, 3: 25 in = new( (const char *)argv[1] ); // open input file first as output creates file 26 if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent 27 case 1: ; // use default files 28 default: 29 exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]"; 30 } // choose 30 31 31 char ch;32 out | nlOff;// turn off auto newline33 in | nlOn;// turn on reading newline32 char ch; 33 *out | nlOff; // turn off auto newline 34 *in | nlOn; // turn on reading newline 34 35 35 for () {// read all characters36 37 if ( eof( in ) ) break;// eof ?38 39 } // for40 41 close( in ); // stdin, stdout are never closed42 close( out );43 36 for () { // read all characters 37 *in | ch; 38 if ( eof( *in ) ) break; // eof ? 39 *out | ch; 40 } // for 41 } finally { 42 if ( in != &stdin ) delete( in ); // close file, do not delete stdin! 43 if ( out != &stdout ) delete( out ); // close file, do not delete stdout! 44 } // try 44 45 } // main 45 46 -
tests/.in/copyfile.txt
r8e87f37 r3f654ec 10 10 // Created On : Tue Jul 16 16:47:22 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 16 16:48:16201913 // Update Count : 112 // Last Modified On : Wed Jul 17 18:04:44 2019 13 // Update Count : 26 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <stdlib.hfa> // new/delete 17 18 18 19 int main( int argc, char * argv[] ) { 19 ifstream & in = stdin;// default files20 ofstream & out =stdout;21 22 choose ( argc ) {23 case 2, 3:24 open( in, argv[1] );// open input file first as output creates file25 if ( argc == 3 ) open( out, argv[2] );// only open output if input opens as output created if nonexistent26 case 1: ; // use default files27 default:28 29 } // choose20 ifstream * in = &stdin; // default files 21 ofstream * out = &stdout; 22 try { 23 choose ( argc ) { 24 case 2, 3: 25 in = new( (const char *)argv[1] ); // open input file first as output creates file 26 if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent 27 case 1: ; // use default files 28 default: 29 exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]"; 30 } // choose 30 31 31 char ch;32 out | nlOff;// turn off auto newline33 in | nlOn;// turn on reading newline32 char ch; 33 *out | nlOff; // turn off auto newline 34 *in | nlOn; // turn on reading newline 34 35 35 for () {// read all characters36 37 if ( eof( in ) ) break;// eof ?38 39 } // for40 41 close( in ); // stdin, stdout are never closed42 close( out );43 36 for () { // read all characters 37 *in | ch; 38 if ( eof( *in ) ) break; // eof ? 39 *out | ch; 40 } // for 41 } finally { 42 if ( in != &stdin ) delete( in ); // close file, do not delete stdin! 43 if ( out != &stdout ) delete( out ); // close file, do not delete stdout! 44 } // try 44 45 } // main 45 46 -
tests/copyfile.cfa
r8e87f37 r3f654ec 10 10 // Created On : Tue Jul 16 16:47:22 2019 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 16 16:48:16201913 // Update Count : 112 // Last Modified On : Wed Jul 17 18:04:44 2019 13 // Update Count : 26 14 14 // 15 15 16 16 #include <fstream.hfa> 17 #include <stdlib.hfa> // new/delete 17 18 18 19 int main( int argc, char * argv[] ) { 19 ifstream & in = stdin;// default files20 ofstream & out =stdout;21 22 choose ( argc ) {23 case 2, 3:24 open( in, argv[1] );// open input file first as output creates file25 if ( argc == 3 ) open( out, argv[2] );// only open output if input opens as output created if nonexistent26 case 1: ; // use default files27 default:28 29 } // choose20 ifstream * in = &stdin; // default files 21 ofstream * out = &stdout; 22 try { 23 choose ( argc ) { 24 case 2, 3: 25 in = new( (const char *)argv[1] ); // open input file first as output creates file 26 if ( argc == 3 ) out = new( (const char *)argv[2] ); // only open output if input opens as output created if nonexistent 27 case 1: ; // use default files 28 default: 29 exit | "Usage [ input-file (default stdin) [ output-file (default stdout) ] ]"; 30 } // choose 30 31 31 char ch;32 out | nlOff;// turn off auto newline33 in | nlOn;// turn on reading newline32 char ch; 33 *out | nlOff; // turn off auto newline 34 *in | nlOn; // turn on reading newline 34 35 35 for () {// read all characters36 37 if ( eof( in ) ) break;// eof ?38 39 } // for40 41 close( in ); // stdin, stdout are never closed42 close( out );43 36 for () { // read all characters 37 *in | ch; 38 if ( eof( *in ) ) break; // eof ? 39 *out | ch; 40 } // for 41 } finally { 42 if ( in != &stdin ) delete( in ); // close file, do not delete stdin! 43 if ( out != &stdout ) delete( out ); // close file, do not delete stdout! 44 } // try 44 45 } // main 45 46
Note: See TracChangeset
for help on using the changeset viewer.