source: translator/examples/array.c @ 93885663

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 93885663 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 678 bytes
Line 
1// "cfa -c -o array.o array.c"
2// "cfa -CFA array.c > array_out.c"
3// "gcc32 array_out.c ../LibCfa/libcfa.a"
4
5#include "array.h"
6
7/// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) )
8/// [ array_iterator begin, array_iterator end ]
9/// get_iterators( array_type array )
10/// {
11///   begin = 0;
12///   end = array_last( array );
13/// }
14
15forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) )
16elt_type *
17get_begin( array_type array )
18{
19  return &array[ 0 ];
20}
21
22forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) )
23elt_type *
24get_end( array_type array )
25{
26  return &array[ array_last( array ) ] + 1;
27}
28
Note: See TracBrowser for help on using the repository browser.