source: translator/examples/vector_test.c @ a0d9f94

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 a0d9f94 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 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
10extern "C" {
11int printf( const char *, ... );
12}
13
14int
15main()
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.