#include "prelude/params.hats"
#if VERBOSE_PRELUDE #then
#print "Loading [basics_dyn.sats] starts!\n"
#endif
symintr ~ not
symintr && || << >> land lor lxor
symintr + - * / mod gcd
symintr < <= > >= = <>
symintr succ pred
symintr abs square sqrt cube cbrt
symintr compare max min pow
symintr foreach symintr iforeach
symintr fprint print prerr
symintr length
symintr ofstring ofstrptr
symintr tostring tostrptr
symintr liftmac evalmac
symintr assert assert_errmsg
symintr bool_of symintr char_of uchar_of symintr int_of uint_of symintr int1_of uint1_of symintr lint_of ulint_of symintr llint_of ullint_of symintr sint_of usint_of symintr ssint_of ussint_of symintr float_of double_of ldouble_of symintr ptr_of
praxi cleanup_top {a:viewt@ype} (x: a?):<> void
praxi eqsize_byte_one (): [sizeof byte == 1] void
praxi eqsize_byte_char (): [sizeof byte == sizeof char] void
praxi eqsize_int_uint (): [sizeof int == sizeof uint] void
praxi eqsize_char_schar (): [sizeof char == sizeof schar] void
praxi eqsize_char_uchar (): [sizeof char == sizeof uchar] void
praxi addr_is_gtez {l:addr} ():<> [l >= null] void
prfun ptr_is_gtez {l:addr} (p: ptr l):<> [l >= null] void
prfun verify_constraint {p:bool | p} (): void
val{elt:viewt@ype} sizeof : size_t (sizeof elt)
val empval : empty = "ats_empty_value"
val true : bool (true) = "#ats_true_bool"
and false : bool (false) = "#ats_false_bool"
fun crash (): void = "ats_crash"
fun exit {a:viewt@ype} (status: int):<!exn> a = "#ats_exit"
fun exit_main
{a:viewt@ype} {v_in:view} {v_out:view}
(pf: !v_in >> v_out | status: int):<!exn> a = "#ats_exit"
fun exit_errmsg
{a:viewt@ype} (status: int, msg: string): a = "#ats_exit_errmsg"
fun exit_prerrf {a:viewt@ype} {ts:types}
(status: int, fmt: printf_c ts, args: ts): a = "#atspre_exit_prerrf"
fun assertfalse ():<> [false] void = "atspre_assertfalse"
fun assert_bool
(assertion: bool):<!exn> void = "atspre_assert"
overload assert with assert_bool
fun assert_bool1 {b:bool}
(assertion: bool b):<!exn> [b] void = "atspre_assert"
overload assert with assert_bool1
fun assert_errmsg_bool
(assertion: bool, msg: string):<!exn> void
= "atspre_assert_errmsg"
overload assert_errmsg with assert_errmsg_bool
fun assert_errmsg_bool1 {b:bool}
(assertion: bool b, msg: string):<!exn> [b] void
= "atspre_assert_errmsg"
overload assert_errmsg with assert_errmsg_bool1
fun assert_errmsg_bool_string1
(assertion: bool, msg: String):<!exn> void = "atspre_assert_errmsg"
overload assert_errmsg with assert_errmsg_bool_string1
fun assert_errmsg_bool1_string1 {b:bool}
(assertion: bool b, msg: String):<!exn> [b] void = "atspre_assert_errmsg"
overload assert_errmsg with assert_errmsg_bool1_string1
prval main_dummy (): void
fun main_prelude (): void = "mainats_prelude"
symintr main
fun main_void (): void = "mainats"
overload main with main_void
fun main_argc_argv {n:int | n >= 1}
(argc: int n, argv: &(@[string][n])): void = "mainats"
overload main with main_argc_argv
symintr free_gc_elim
praxi free_gc_addr_elim {l:addr} (pf: free_gc_v l):<> void
overload free_gc_elim with free_gc_addr_elim
praxi free_gc_t0ype_addr_elim {a:viewt@ype} {l:addr} (pf: free_gc_v (a, l)):<> void
overload free_gc_elim with free_gc_t0ype_addr_elim
praxi free_gc_t0ype_int_addr_elim {a:viewt@ype} {n:int} {l:addr} (pf: free_gc_v (a, n, l)):<> void
overload free_gc_elim with free_gc_t0ype_int_addr_elim
castfn cloptr_get_view_ptr {a:viewt@ype}
(x: cloptr a):<> [l:addr] (free_gc_v l, clo a @ l | ptr l)
= "atspre_cloptr_get_view_ptr"
castfn cloptr_make_view_ptr {a:viewt@ype} {l:addr}
(pf_gc: free_gc_v l, pf_at: clo a @ l | p: ptr l):<> cloptr a
= "atspre_cloptr_make_view_ptr"
castfn cloref_get_view_ptr {a:t@ype}
(x: cloref a):<> [l:addr] (vbox (clo a @ l) | ptr l)
= "atspre_cloref_get_view_ptr"
castfn cloref_make_view_ptr {a:t@ype}
{l:addr} (pf: vbox (clo a @ l) | p: ptr l):<> cloref a
= "atspre_cloref_make_view_ptr"
fun cloptr_free {a:t@ype} (x: cloptr a):<> void = "atspre_cloptr_free"
praxi clstrans
{c1,c2,c3:cls | c1 <= c2; c2 <= c3} (): [c1 <= c3] void
dataprop SUBCLS (c1:cls, c2:cls, bool) =
| {c1 <= c2} SUBCLS (c1, c2, true) of () | SUBCLSfalse (c1, c2, false) of ()
fun vbox_make_view_ptr
{a:viewt@ype} {l:addr} (_: a @ l | _: ptr l):<> (vbox (a @ l) | void)
= "atspre_vbox_make_view_ptr"
praxi opt_some {a:viewt@ype} (x: !(a) >> opt (a, true)):<prf> void
praxi opt_unsome {a:viewt@ype} (x: !opt (a, true) >> a):<prf> void
praxi opt_none {a:viewt@ype} (x: !(a?) >> opt (a, false)):<prf> void
praxi opt_unnone {a:viewt@ype} (x: !opt (a, false) >> a?):<prf> void
praxi opt_clear {a:t@ype} {b:bool} (x: !opt (a, b) >> a?):<prf> void
abstype file_mode (file_mode)
dataprop file_mode_lte
(file_mode, file_mode) =
| {m:file_mode} file_mode_lte_refl (m, m)
| {m1,m2,m3:file_mode}
file_mode_lte_tran (m1, m3) of
(file_mode_lte (m1, m2), file_mode_lte (m2, m3))
| {m:file_mode} file_mode_lte_rw_r (rw, r)
| {m:file_mode} file_mode_lte_rw_w (rw, w)
prval file_mode_lte_r_r: file_mode_lte (r, r) prval file_mode_lte_w_w: file_mode_lte (w, w) prval file_mode_lte_rw_rw: file_mode_lte (rw, rw)
stadef <= = file_mode_lte
sta stdin_addr : addr
macdef stdin = $extval (ptr stdin_addr, "stdin")
fun stdin_get ():<!exnref> (FILE r @ stdin_addr | ptr stdin_addr)
= "atspre_stdin_get"
fun stdin_view_get ()
:<!exnref> (FILE r @ stdin_addr | void) = "atspre_stdin_view_get"
and stdin_view_set (pf: FILE r @ stdin_addr | ):<!exnref> void
= "atspre_stdin_view_set"
sta stdout_addr : addr
macdef stdout = $extval (ptr stdout_addr, "stdout")
fun stdout_get ()
:<!exnref> (FILE w @ stdout_addr | ptr stdout_addr)
= "atspre_stdout_get"
fun stdout_view_get ()
:<!exnref> (FILE w @ stdout_addr | void) = "atspre_stdout_view_get"
and stdout_view_set (pf: FILE w @ stdout_addr | ):<!exnref> void
= "atspre_stdout_view_set"
sta stderr_addr : addr
macdef stderr = $extval (ptr stderr_addr, "stderr")
fun stderr_get ()
:<!exnref> (FILE w @ stderr_addr | ptr stderr_addr)
= "atspre_stderr_get"
fun stderr_view_get ()
:<!exnref> (FILE w @ stderr_addr | void) = "atspre_stderr_view_get"
and stderr_view_set (pf: FILE w @ stderr_addr | ):<!exnref> void
= "atspre_stderr_view_set"
typedef
fprint_t0ype_type (a:t@ype) = {m:file_mode}
(file_mode_lte (m, w) | &FILE m, a) -<fun,!exnref> void
typedef
fprint_viewt0ype_type (a:viewt@ype) = {m:file_mode}
(file_mode_lte (m, w) | &FILE m, !a) -<fun,!exnref> void
symintr fprint_newline
fun fprint0_newline
(out: FILEref):<!ref> void = "atspre_fprint_newline"
fun fprint1_newline {m:file_mode}
(pf: file_mode_lte (m, w) | out: &FILE m):<!ref> void
= "atspre_fprint_newline"
overload fprint_newline with fprint0_newline
overload fprint_newline with fprint1_newline
fun print_newline ():<!ref> void = "atspre_print_newline"
and prerr_newline ():<!ref> void = "atspre_prerr_newline"
castfn FILEref_get_ref
{m:file_mode} (x: FILEref):<> ref (FILE m)
castfn FILEref_get_view_ptr {m:file_mode} (x: FILEref):<> [l:addr] (FILE m @ l, FILE m @ l -<lin,prf> void | ptr l)
prval option_v_unsome : {v:view} option_v (v, true) -<prf> v
prval option_v_unnone : {v:view} option_v (v, false) -<prf> void
prfun unit_v_elim (pf: unit_v): void
fun lazy_vt_free
{a:viewt@ype} (x: lazy_vt a):<1,~ref> void = "ats_lazy_vt_free"
overload ~ with lazy_vt_free
#if VERBOSE_PRELUDE #then
#print "Loading [basics_dyn.ats] finishes!\n"
#endif