From 67245a7eebeb135427d50171fda7af58770afc6d Mon Sep 17 00:00:00 2001 From: Xander Date: Thu, 13 Jul 2023 00:52:37 +0200 Subject: Full restructure --- kernel/prelude/DATS/print.dats | 20 ++++++++++++++++++++ kernel/prelude/kernel_prelude.hats | 12 ++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 kernel/prelude/DATS/print.dats create mode 100644 kernel/prelude/kernel_prelude.hats (limited to 'kernel/prelude') diff --git a/kernel/prelude/DATS/print.dats b/kernel/prelude/DATS/print.dats new file mode 100644 index 0000000..5049a98 --- /dev/null +++ b/kernel/prelude/DATS/print.dats @@ -0,0 +1,20 @@ +#include "share/atspre_staload.hats" + +#define ATS_DYNLOADFLAG 0 + +staload "lib/SATS/writer.sats" +staload "lib/DATS/itoa.dats" + +extern fun print_newline() : void +implement print_newline() = put_string("\n") + +extern fun assert_errmsg(b: bool, msg: string) : void +implement assert_errmsg(b,msg) = if (~b) then put_string(msg) + +extern fun print_int {n : nat | n > 0} (n : int n) : void +implement print_int(n) = put_string(itoa(n,10)) + +overload print with put_string of 1 +overload print with print_int of 1 + +macdef assertloc(tf) = assert_errmsg (,(tf), $mylocation) diff --git a/kernel/prelude/kernel_prelude.hats b/kernel/prelude/kernel_prelude.hats new file mode 100644 index 0000000..eb1990d --- /dev/null +++ b/kernel/prelude/kernel_prelude.hats @@ -0,0 +1,12 @@ +#ifndef PRELUDE +#define PRELUDE 1 + +#include "share/atspre_staload.hats" + +staload "lib/SATS/writer.sats" +val () = clear_screen() + +staload "./DATS/print.dats" + +#endif + -- cgit v1.2.3