To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/231c5688-dbf7-42d7-bb3e-27c04eb6868c%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/a2e3bd7e-44d5-4c25-a9a7-e6acfb2b07f0%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/2c3bcbb2-cad6-46da-956c-b0da4c129450%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAAZxu4zZHWYAW2AD8sU6VVdsQ7Fk%3DGbG81JdpMV5ZYPzYurAsg%40mail.gmail.com.
Thanks, also here's some related discussion http://stackoverflow.com/questions/1018853/why-is-alloca-not-considered-good-practice.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/57f1a0bb-f0ba-4a06-95b3-15f988245530%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/3b808393-f696-4513-b065-f978e68e751b%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/58c3c8d5-3127-4979-bd72-728e60714c4d%40googlegroups.com.
Where is the implementation for vector_make_ngc?
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAAZxu4xy1fbQVOEusuYegR4_oirETTL6k-9JRxGCrYKpUvF9VA%40mail.gmail.com.
#include "share/atspre_define.hats"#include "share/atspre_staload.hats"
staload "prelude/basics_sta.sats"staload UN = "prelude/SATS/unsafe.sats"
externfunvector_make_ngc{n:int}{l:addr} (!bytes(n) @ l | ptr (l)): void
implement main0 () = { var mybytes = @[byte][100]() // statically allocated stack memory of 100 bytes
val (pf2, fpf2 | p2) = $UN.ptr0_vtake{bytes(100)}(addr@mybytes) val () = vector_make_ngc (pf2 | p2) prval() = fpf2(pf2)
}To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/4514da67-3db8-4b9c-92fa-590d3d3a208a%40googlegroups.com.
(* ****** ****** *)
abstype vector(l:addr, n:int)
(* ****** ****** *)
extern
fun vector_make_ngc
{l:addr}{n:int} (b0ytes(n) @ l | ptr l): vector(l, n)
extern
fun vector_unmake_ngc
{l:addr}{n:int} (vector(l, n)): (bytes(n) @ l | ptr l)
(* ****** ****** *)
implement
main0 () =
{
var mybuf = @[byte][100]()
val myvec = vector_make_ngc (view@mybuf | addr@mybuf)
val (pf | p) = vector_unmake_ngc (myvec)
prval () = view@mybuf := pf
}
(* ****** ****** *)
typedef bytes (n:int) = @[byte][n]
typedef b0ytes (n:int) = @[byte?][n]