Skip to content

Commit

Permalink
Updating: very very minorly
Browse files Browse the repository at this point in the history
  • Loading branch information
githwxi committed Sep 1, 2024
1 parent 0d7cef0 commit bfa79a8
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 23 deletions.
89 changes: 89 additions & 0 deletions prelude/DATS/CATS/JS/NODE/node000.cats
Original file line number Diff line number Diff line change
@@ -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]
////////////////////////////////////////////////////////////////////////.
////////////////////////////////////////////////////////////////////////.
92 changes: 92 additions & 0 deletions prelude/DATS/CATS/JS/NODE/node000.dats
Original file line number Diff line number Diff line change
@@ -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] *)
2 changes: 1 addition & 1 deletion prelude/DATS/CATS/JS/strn000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -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] *)
6 changes: 6 additions & 0 deletions prelude/DATS/bool000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ g_1<b0>() = (true)
(* ****** ****** *)
(* ****** ****** *)
//
#impltmp
g_print<bool> = bool_print<>
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)
(* ****** ****** *)(* ****** ****** *)

Expand Down
8 changes: 7 additions & 1 deletion prelude/DATS/char000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ if c1 < c2 then -1 else 0)
(* ****** ****** *)
(* ****** ****** *)
//
#impltmp
g_print<char> = char_print<>
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)
(* ****** ****** *)(* ****** ****** *)

(* end of [ATS3/XANADU_prelude_DATS_bool000.dats] *)
(* end of [ATS3/XANADU_prelude_DATS_char000.dats] *)
6 changes: 6 additions & 0 deletions prelude/DATS/gint000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ g_si<si>(i0) = (i0)
(* ****** ****** *)
//
#impltmp
g_print<sint> = sint_print<>
//
(* ****** ****** *)
(* ****** ****** *)
//
#impltmp
gasz_length<ni><ut>(ni) = (ni)
#impltmp
gseq_length<ni><ut>(ni) = (ni)
Expand Down
8 changes: 8 additions & 0 deletions prelude/DATS/strn000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ g_0<strn>
((*void*)) = ("")
//
(* ****** ****** *)
(* ****** ****** *)
#impltmp
g_cmp<strn> = strn_cmp<>
(* ****** ****** *)
(* ****** ****** *)
//
(*
HX:
Expand All @@ -64,6 +66,12 @@ g_ptype
(* ****** ****** *)
(* ****** ****** *)
//
#impltmp
g_print<strn> = strn_print<>
//
(* ****** ****** *)
(* ****** ****** *)
//
(*
HX-2024-08-10:
This one should definitely
Expand Down
5 changes: 0 additions & 5 deletions prelude/SATS/bool000.sats
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,6 @@ bool_ifval
#symload ifval with bool_ifval of 1000
//
(* ****** ****** *)
//
// HX-2020-05-30:
// symbol overloading for bool
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)
Expand Down
7 changes: 4 additions & 3 deletions prelude/SATS/char000.sats
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>
[char_print] may not be
the same as g_print<char>
*)
//
fun<>
char_print(chr: char): void
char_print(c0: char): void
//
(* ****** ****** *)
(* ****** ****** *)
//
fun<>
char_eqz
Expand Down
13 changes: 13 additions & 0 deletions prelude/SATS/gint000.sats
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ Authoremail: gmhwxiATgmailDOTcom
(* ****** ****** *)
(* ****** ****** *)
//
(*
HX-2024-09-01:
Note that
[sint_print] may not be
the same as g_print<sint>
*)
//
fun<>
sint_print(i0: sint): void
//
(* ****** ****** *)
(* ****** ****** *)
//
fun<>
sint_lt_sint
{i,j:int}
Expand Down
2 changes: 2 additions & 0 deletions prelude/TEST/CATS/JS/test01_a0rf000.dats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions srcgen1/TEST/DATA/syntax_dyn.dats
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ fprint_list(out, xs) = let
//
implement
{env}
list_iforeach$fwork<a><env>
list_iforitm$work<a><env>
(i, x, env) = let
val () =
if i > 0
Expand All @@ -557,9 +557,9 @@ list_iforeach$fwork<a><env>
// end of [val]
in
fprint_val<a>(out, x)
end // end of [list_iforeach$fwork]
end // end of [list_iforitm$work]
//
val _(*len*) = list_iforeach<a>(xs)
val _(*len*) = list_iforitm<a>(xs)
//
in
// nothing
Expand Down
8 changes: 4 additions & 4 deletions srcgen1/xatslib/TEST/test01_miscell.dats
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,15 @@ filter0$test<int>(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) =>
(
if j > 0 then prerr(",");
prerr("(", x, ",", y, ")");
if ((j+1)%4) = 0 then prerrln();
)
) (* end of [gseq_x2iforeach_f4np] *)
) (* end of [gseq_x2iforitm_f4np] *)
//
(* ****** ****** *)
//
Expand Down Expand Up @@ -460,10 +460,10 @@ fenum
(strx_vt_from(0))
in//local
val () =
foreach(10) where
foritm(10) where
{
#impltmp
foreach$work<int>(i0) =
foritm$work<int>(i0) =
prerrln("linum() = ", linum())
}
endloc (*local*) // end of [local(linum)]
Expand Down
Loading

0 comments on commit bfa79a8

Please sign in to comment.