diff --git a/prelude/DATS/CATS/JS/NODE/node000.cats b/prelude/DATS/CATS/JS/NODE/node000.cats new file mode 100644 index 000000000..d4200a403 --- /dev/null +++ b/prelude/DATS/CATS/JS/NODE/node000.cats @@ -0,0 +1,89 @@ +////////////////////////////////////////////////////////////////////////. +// //. +// Applied Type System //. +// //. +////////////////////////////////////////////////////////////////////////. + +/* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2024 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*/ + +////////////////////////////////////////////////////////////////////////. +////////////////////////////////////////////////////////////////////////. +/* +Author: Hongwei Xi +Sun 01 Sep 2024 08:04:48 AM EDT +Authoremail: gmhwxiATgmailDOTcom +*/ +////////////////////////////////////////////////////////////////////////. +////////////////////////////////////////////////////////////////////////. +// +function +XATS2JS_NODE_g_print(obj) +{ + let rep = obj.toString(); + process.stdout.write(rep); + return; // XATS2JS_NODE_g_print +} +// +////////////////////////////////////////////////////////////////////////. +// +function +XATS2JS_NODE_sint_print + (i0) +{ + XATS2JS_NODE_g_print(i0); + return; // XATS2JS_NODE_sint_print +} +////////////////////////////////////////////////////////////////////////. +// +function +XATS2JS_NODE_bool_print + (b0) +{ + XATS2JS_NODE_g_print(b0); + return; // XATS2JS_NODE_bool_print +} +////////////////////////////////////////////////////////////////////////. +// +function +XATS2JS_NODE_char_print + (c0) +{ + let cs = + String.fromCharCode(c0) + XATS2JS_NODE_g_print(cs); + return; // XATS2JS_NODE_char_print +} +// +////////////////////////////////////////////////////////////////////////. +// +function +XATS2JS_NODE_strn_print + (cs) +{ + XATS2JS_NODE_g_print(cs); + return; // XATS2JS_NODE_strn_print +} +////////////////////////////////////////////////////////////////////////. +////////////////////////////////////////////////////////////////////////. +// end of [ATS3/XANADU_prelude_DATS_CATS_JS_strn000.cats] +////////////////////////////////////////////////////////////////////////. +////////////////////////////////////////////////////////////////////////. diff --git a/prelude/DATS/CATS/JS/NODE/node000.dats b/prelude/DATS/CATS/JS/NODE/node000.dats new file mode 100644 index 000000000..1083d23b1 --- /dev/null +++ b/prelude/DATS/CATS/JS/NODE/node000.dats @@ -0,0 +1,92 @@ +(***********************************************************************) +(* *) +(* Applied Type System *) +(* *) +(***********************************************************************) + +(* +** ATS/Xanadu - Unleashing the Potential of Types! +** Copyright (C) 2024 Hongwei Xi, ATS Trustful Software, Inc. +** All rights reserved +** +** ATS is free software; you can redistribute it and/or modify it under +** the terms of the GNU GENERAL PUBLIC LICENSE (GPL) as published by the +** Free Software Foundation; either version 3, or (at your option) any +** later version. +** +** ATS is distributed in the hope that it will be useful, but WITHOUT ANY +** WARRANTY; without even the implied warranty of MERCHANTABILITY or +** FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +** for more details. +** +** You should have received a copy of the GNU General Public License +** along with ATS; see the file COPYING. If not, please write to the +** Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +** 02110-1301, USA. +*) + +(* ****** ****** *) +(* ****** ****** *) +// +(* +Author: Hongwei Xi +Sun 01 Sep 2024 07:19:48 AM EDT +Authoremail: gmhwxiATgmailDOTcom +*) +// +(* ****** ****** *) +(* ****** ****** *) +// +#impltmp +sint_print<> = +XATS2JS_NODE_sint_print +where +{ +#extern +fun +XATS2JS_NODE_sint_print(b0: sint): void = $extnam() +} +// +(* ****** ****** *) +// +#impltmp +bool_print<> = +XATS2JS_NODE_bool_print +where +{ +#extern +fun +XATS2JS_NODE_bool_print(b0: bool): void = $extnam() +} +// +(* ****** ****** *) +// +#impltmp +char_print<> = +XATS2JS_NODE_char_print +where +{ +#extern +fun +XATS2JS_NODE_char_print(b0: char): void = $extnam() +} +// +(* ****** ****** *) +// +#impltmp +strn_print<> = +XATS2JS_NODE_strn_print +where +{ +#extern +fun +XATS2JS_NODE_strn_print(cs: strn): void = $extnam() +} +// +(* ****** ****** *) +(* ****** ****** *) +// +(* ****** ****** *)(* ****** ****** *) +(* ****** ****** *)(* ****** ****** *) + +(* end of [ATS3/XANADU_prelude_DATS_CATS_JS_axrf000.dats] *) diff --git a/prelude/DATS/CATS/JS/strn000.dats b/prelude/DATS/CATS/JS/strn000.dats index 67b3d5345..ebdd67afb 100644 --- a/prelude/DATS/CATS/JS/strn000.dats +++ b/prelude/DATS/CATS/JS/strn000.dats @@ -74,4 +74,4 @@ XATS2JS_strn_fmake_fwork (* ****** ****** *)(* ****** ****** *) (* ****** ****** *)(* ****** ****** *) -(* end of [ATS3/XANADU_prelude_DATS_CATS_JS_axrf000.dats] *) +(* end of [ATS3/XANADU_prelude_DATS_CATS_JS_strn000.dats] *) diff --git a/prelude/DATS/bool000.dats b/prelude/DATS/bool000.dats index 0cc46b6c4..c521b648d 100644 --- a/prelude/DATS/bool000.dats +++ b/prelude/DATS/bool000.dats @@ -53,6 +53,12 @@ g_1() = (true) (* ****** ****** *) (* ****** ****** *) // +#impltmp +g_print = bool_print<> +// +(* ****** ****** *) +(* ****** ****** *) +// (* ****** ****** *)(* ****** ****** *) (* ****** ****** *)(* ****** ****** *) diff --git a/prelude/DATS/char000.dats b/prelude/DATS/char000.dats index 8014bbf50..7ee0ae1ec 100644 --- a/prelude/DATS/char000.dats +++ b/prelude/DATS/char000.dats @@ -81,7 +81,13 @@ if c1 < c2 then -1 else 0) (* ****** ****** *) (* ****** ****** *) // +#impltmp +g_print = char_print<> +// +(* ****** ****** *) +(* ****** ****** *) +// (* ****** ****** *)(* ****** ****** *) (* ****** ****** *)(* ****** ****** *) -(* end of [ATS3/XANADU_prelude_DATS_bool000.dats] *) +(* end of [ATS3/XANADU_prelude_DATS_char000.dats] *) diff --git a/prelude/DATS/gint000.dats b/prelude/DATS/gint000.dats index f2ea8c14c..ea6efbff1 100644 --- a/prelude/DATS/gint000.dats +++ b/prelude/DATS/gint000.dats @@ -54,6 +54,12 @@ g_si(i0) = (i0) (* ****** ****** *) // #impltmp +g_print = sint_print<> +// +(* ****** ****** *) +(* ****** ****** *) +// +#impltmp gasz_length(ni) = (ni) #impltmp gseq_length(ni) = (ni) diff --git a/prelude/DATS/strn000.dats b/prelude/DATS/strn000.dats index 790e6b2b5..ed11e7306 100644 --- a/prelude/DATS/strn000.dats +++ b/prelude/DATS/strn000.dats @@ -48,9 +48,11 @@ g_0 ((*void*)) = ("") // (* ****** ****** *) +(* ****** ****** *) #impltmp g_cmp = strn_cmp<> (* ****** ****** *) +(* ****** ****** *) // (* HX: @@ -64,6 +66,12 @@ g_ptype (* ****** ****** *) (* ****** ****** *) // +#impltmp +g_print = strn_print<> +// +(* ****** ****** *) +(* ****** ****** *) +// (* HX-2024-08-10: This one should definitely diff --git a/prelude/SATS/bool000.sats b/prelude/SATS/bool000.sats index e27cb6349..ad7679e91 100644 --- a/prelude/SATS/bool000.sats +++ b/prelude/SATS/bool000.sats @@ -124,11 +124,6 @@ bool_ifval #symload ifval with bool_ifval of 1000 // (* ****** ****** *) -// -// HX-2020-05-30: -// symbol overloading for bool -// -(* ****** ****** *) (* ****** ****** *) // (* ****** ****** *)(* ****** ****** *) diff --git a/prelude/SATS/char000.sats b/prelude/SATS/char000.sats index 268c0a159..b1e8348db 100644 --- a/prelude/SATS/char000.sats +++ b/prelude/SATS/char000.sats @@ -86,14 +86,15 @@ char with char_make_uint of 1000 (* HX-2024-07-29: Note that -[bool_print] may not be -the same as g_print +[char_print] may not be +the same as g_print *) // fun<> -char_print(chr: char): void +char_print(c0: char): void // (* ****** ****** *) +(* ****** ****** *) // fun<> char_eqz diff --git a/prelude/SATS/gint000.sats b/prelude/SATS/gint000.sats index 8387e88f3..9c144a366 100644 --- a/prelude/SATS/gint000.sats +++ b/prelude/SATS/gint000.sats @@ -38,6 +38,19 @@ Authoremail: gmhwxiATgmailDOTcom (* ****** ****** *) (* ****** ****** *) // +(* +HX-2024-09-01: +Note that +[sint_print] may not be +the same as g_print +*) +// +fun<> +sint_print(i0: sint): void +// +(* ****** ****** *) +(* ****** ****** *) +// fun<> sint_lt_sint {i,j:int} diff --git a/prelude/TEST/CATS/JS/test01_a0rf000.dats b/prelude/TEST/CATS/JS/test01_a0rf000.dats index f3c9e0d0e..ae8013043 100644 --- a/prelude/TEST/CATS/JS/test01_a0rf000.dats +++ b/prelude/TEST/CATS/JS/test01_a0rf000.dats @@ -9,9 +9,11 @@ For testing xatslib/JS! "prelude/DATS/gdbg000.dats" (* ****** ****** *) (* ****** ****** *) +(* #include "srcgen1\ /prelude/HATS/prelude_dats.hats" +*) #include "srcgen2\ /prelude/HATS/prelude_dats.hats" diff --git a/srcgen1/TEST/DATA/syntax_dyn.dats b/srcgen1/TEST/DATA/syntax_dyn.dats index 62e2c9cf1..e359f21cb 100644 --- a/srcgen1/TEST/DATA/syntax_dyn.dats +++ b/srcgen1/TEST/DATA/syntax_dyn.dats @@ -548,7 +548,7 @@ fprint_list(out, xs) = let // implement {env} -list_iforeach$fwork +list_iforitm$work (i, x, env) = let val () = if i > 0 @@ -557,9 +557,9 @@ list_iforeach$fwork // end of [val] in fprint_val(out, x) -end // end of [list_iforeach$fwork] +end // end of [list_iforitm$work] // -val _(*len*) = list_iforeach(xs) +val _(*len*) = list_iforitm(xs) // in // nothing diff --git a/srcgen1/xatslib/TEST/test01_miscell.dats b/srcgen1/xatslib/TEST/test01_miscell.dats index d13dfc98a..53a8e214a 100644 --- a/srcgen1/xatslib/TEST/test01_miscell.dats +++ b/srcgen1/xatslib/TEST/test01_miscell.dats @@ -226,7 +226,7 @@ filter0$test(xy) = (xy % 10 <= 4) } } // Sat Jul 2 02:37:39 EDT 2022 *) val ( ) = -gseq_x2iforeach_f4np +gseq_x2iforitm_f4np ( list(1,3,5),"2468" , lam(i:int,x:int,j:int,y:char) => ( @@ -234,7 +234,7 @@ gseq_x2iforeach_f4np prerr("(", x, ",", y, ")"); if ((j+1)%4) = 0 then prerrln(); ) -) (* end of [gseq_x2iforeach_f4np] *) +) (* end of [gseq_x2iforitm_f4np] *) // (* ****** ****** *) // @@ -460,10 +460,10 @@ fenum (strx_vt_from(0)) in//local val () = -foreach(10) where +foritm(10) where { #impltmp -foreach$work(i0) = +foritm$work(i0) = prerrln("linum() = ", linum()) } endloc (*local*) // end of [local(linum)] diff --git a/srcgen1/xatslib/githwxi/DATS/genv000.dats b/srcgen1/xatslib/githwxi/DATS/genv000.dats index 986d096fa..196980ab4 100644 --- a/srcgen1/xatslib/githwxi/DATS/genv000.dats +++ b/srcgen1/xatslib/githwxi/DATS/genv000.dats @@ -144,31 +144,31 @@ endlet // end of [forall$test(x0)] -gseq_foreach_e1nv +gseq_foritm_e1nv (xs, e1) = ( -gseq_foreach +gseq_foritm < xs > < x0 >( xs )) where { val e1 = $UN.datacopy( e1 ) #impltmp -foreach$work(x0) = +foritm$work(x0) = let // val e1 = $UN.castlin10{e1}(e1) val res = -foreach$work_e1nv(x0, e1) +foritm$work_e1nv(x0, e1) // in//let // let val e1 = $UN.delinear(e1) in res end // -endlet // end of [foreach$work(x0)] -} (*where*) // end-of(gseq_foreach_e1nv) +endlet // end of [foritm$work(x0)] +} (*where*) // end-of(gseq_foritm_e1nv) (* ****** ****** *)