ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 51b7345 was
51b7345,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
initial commit
|
-
Property mode set to
100644
|
File size:
790 bytes
|
Rev | Line | |
---|
[51b7345] | 1 | // "cfa -c -o vector_test.o vector_test.c" |
---|
| 2 | // "cfa -CFA vector_test.c > vector_test_out.c" |
---|
| 3 | // "cfa -E vector_test.c > vector_test_out.c" |
---|
| 4 | // "gcc31 -c vector_test_out.c -o vector_test.o" |
---|
| 5 | |
---|
| 6 | #include "fstream.h" |
---|
| 7 | #include "vector_int.h" |
---|
| 8 | #include "array.h" |
---|
| 9 | |
---|
| 10 | extern "C" { |
---|
| 11 | int printf( const char *, ... ); |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | int |
---|
| 15 | main() |
---|
| 16 | { |
---|
| 17 | ofstream *sout = ofstream_stdout(); |
---|
| 18 | ifstream *sin = ifstream_stdin(); |
---|
| 19 | vector_int vec = vector_int_allocate(); |
---|
| 20 | int nombre; |
---|
| 21 | for(;;) { |
---|
| 22 | sin >> &nombre; |
---|
| 23 | if( fail( sin ) || eof( sin ) ) break; |
---|
| 24 | append( &vec, nombre ); |
---|
| 25 | } |
---|
| 26 | sout << "Array elements: "; |
---|
| 27 | write_all( get_begin( vec ), get_end( vec ), sout ); |
---|
| 28 | /// int index; |
---|
| 29 | /// for( index = 0; index <= array_last( vec ); ++index ) { |
---|
| 30 | /// sout << vec[ index ] << " "; |
---|
| 31 | /// } |
---|
| 32 | sout << "\n"; |
---|
| 33 | return 0; |
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.