ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
|
Last change
on this file since a0d9f94 was 51b73452, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
|
initial commit
|
-
Property mode
set to
100644
|
|
File size:
790 bytes
|
| Line | |
|---|
| 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.