2011-06-15 13:19:50 -05:00
|
|
|
|
2011-05-12 10:24:54 -05:00
|
|
|
import option::none;
|
|
|
|
import option::some;
|
|
|
|
import util::orb;
|
2011-03-21 19:21:35 -05:00
|
|
|
|
2011-08-11 22:26:37 -05:00
|
|
|
export vbuf;
|
|
|
|
export buf;
|
|
|
|
export len;
|
|
|
|
|
2011-05-12 10:24:54 -05:00
|
|
|
type vbuf = rustrt::vbuf;
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2011-04-28 19:15:32 -05:00
|
|
|
type array[T] = vec[mutable? T];
|
|
|
|
|
2010-06-23 23:03:09 -05:00
|
|
|
native "rust" mod rustrt {
|
2010-09-22 17:44:13 -05:00
|
|
|
type vbuf;
|
2011-07-27 07:19:39 -05:00
|
|
|
fn vec_buf[T](v: vec[T], offset: uint) -> vbuf;
|
|
|
|
fn vec_len[T](v: vec[T]) -> uint;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sometimes we modify the vec internal data via vec_buf and need to
|
|
|
|
* update the vec's fill length accordingly.
|
|
|
|
*/
|
|
|
|
fn vec_len_set[T](v: vec[T], n: uint);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The T in vec_alloc[T, U] is the type of the vec to allocate. The
|
|
|
|
* U is the type of an element in the vec. So to allocate a vec[U] we
|
|
|
|
* want to invoke this as vec_alloc[vec[U], U].
|
|
|
|
*/
|
|
|
|
fn vec_alloc[T, U](n_elts: uint) -> vec[U];
|
|
|
|
fn vec_alloc_mut[T, U](n_elts: uint) -> vec[mutable U];
|
|
|
|
fn refcount[T](v: vec[T]) -> uint;
|
|
|
|
fn vec_print_debug_info[T](v: vec[T]);
|
|
|
|
fn vec_from_vbuf[T](v: vbuf, n_elts: uint) -> vec[T];
|
|
|
|
fn unsafe_vec_to_mut[T](v: vec[T]) -> vec[mutable T];
|
|
|
|
}
|
|
|
|
|
|
|
|
fn buf[T](v: array[T]) -> vbuf { ret rustrt::vec_buf[T](v, 0u); }
|
2010-08-19 19:37:22 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn len[T](v: array[T]) -> uint { ret rustrt::vec_len[T](v); }
|
2010-06-23 23:03:09 -05:00
|
|
|
|
2010-09-22 17:44:13 -05:00
|
|
|
// Local Variables:
|
|
|
|
// mode: rust;
|
|
|
|
// fill-column: 78;
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
// c-basic-offset: 4
|
|
|
|
// buffer-file-coding-system: utf-8-unix
|
2011-06-15 14:01:19 -05:00
|
|
|
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
|
2010-09-22 17:44:13 -05:00
|
|
|
// End:
|