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 16, 2024
1 parent 406fb77 commit 65ba3a1
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 22 deletions.
2 changes: 2 additions & 0 deletions prelude/HATS/prelude_JS_dats.hats
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Sun 14 Jul 2024 12:14:49 PM EDT
"prelude/DATS/CATS/JS/char000.dats"
#staload _ =
"prelude/DATS/CATS/JS/gint000.dats"
#staload _ =
"prelude/DATS/CATS/JS/gflt000.dats"
//
(* ****** ****** *)
(* ****** ****** *)
Expand Down
2 changes: 1 addition & 1 deletion srcgen2/HATS/xatsopt_dats.hats
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ srcgen1\
#staload
"\
srcgen1\
/xatslib/githwxi/DATS/CATS/JS/Node/basics0.dats"
/xatslib/githwxi/DATS/CATS/JS/NODE/basics0.dats"
//
// #endif // end of [ifdef(_XATSOPT_JS_)]
//
Expand Down
2 changes: 1 addition & 1 deletion srcgen2/xats2js/srcgen1/UTIL/xats2js_jsemit.dats
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ srcgen1\
"\
srcgen1\
/prelude\
/DATS/CATS/JS/Node/process.dats"
/DATS/CATS/JS/NODE/process.dats"
(* ****** ****** *)
(* ****** ****** *)
//
Expand Down
23 changes: 23 additions & 0 deletions xatslib/githwxi/DATS/CATS/JS/NODE/myfil00.cats
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ XATS2JS_NODE_myfil00$fpath_readall$fwork
}
//
////////////////////////////////////////////////////////////////////////.
//
function
XATS2JS_NODE_myfil00$FILR_close
( filr )
{
return filr.end() // HX: [filr] needs to be a stream!
}
//
////////////////////////////////////////////////////////////////////////.
//
function
XATS2JS_NODE_myfil00$fpath_createWrite$fwork
(fpath, work)
{
try {
work(XATS2JS_NODE_fs.createWriteStream(fpath))
} catch (error) {
console.log
(`XATS2JS_NODE_myfil00$fpath_createWrite$fwork(error): fpath = ${fpath}`)
}
}
//
////////////////////////////////////////////////////////////////////////.
////////////////////////////////////////////////////////////////////////.
// end of [ATS3/XANADU_xatslib_githwxi_DATS_CATS_JS_NODE_myfil00.cats]
////////////////////////////////////////////////////////////////////////.
Expand Down
39 changes: 39 additions & 0 deletions xatslib/githwxi/DATS/CATS/JS/NODE/myfil00.dats
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Some simple stuff for handling files
*)
(* ****** ****** *)
(* ****** ****** *)
//
#include
"xatslib\
/libcats/HATS/libcats_dats.hats"
//
(* ****** ****** *)
#staload "./../../../myfil00.dats"
(* ****** ****** *)
(* ****** ****** *)
Expand Down Expand Up @@ -35,6 +41,39 @@ XATS2JS_NODE_myfil00$fpath_readall$fwork
(* ****** ****** *)
(* ****** ****** *)
//
#impltmp
<(*tmp*)>
myfil00$FILR_close
( filr ) =
(
XATS2JS_NODE_myfil00$FILR_close
( filr )) where
{
#extern
fun
XATS2JS_NODE_myfil00$FILR_close
(filr: FILR(*HX:it is a stream*)): void = $extnam()
}
//
(* ****** ****** *)
//
#impltmp
<(*tmp*)>
myfil00$fpath_createWrite$fwork
(fpath, work) =
(
XATS2JS_NODE_myfil00$fpath_createWrite$fwork
(fpath, work)) where
{
#extern
fun
XATS2JS_NODE_myfil00$fpath_createWrite$fwork
(fpath: strn, work: (FILR)->void): void = $extnam()
}
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)(* ****** ****** *)
(* ****** ****** *)(* ****** ****** *)(* ****** ****** *)

Expand Down
75 changes: 55 additions & 20 deletions xatslib/githwxi/DATS/myfil00.dats
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,9 @@ Some simple stuff for handling files
"prelude/SATS/unsfx00.sats"
(* ****** ****** *)
(* ****** ****** *)
#staload
"./../../libcats/DATS/gbas000.dats"
(* ****** ****** *)
(* ****** ****** *)
//
fun<>
myfil00$FILR_close
(filr: FILR): void
//
fun<>
myfil00$fpath_open$opt
(fpath: strn): FILRopt_vt
//
#include
"xatslib\
/libcats/HATS/libcats_dats.hats"
(* ****** ****** *)
(* ****** ****** *)
//
Expand Down Expand Up @@ -67,22 +57,64 @@ end//let
//
#extern
fun<>
myfil00_output(): void
myfil00_output
( (*void*) ): void
//
(* ****** ****** *)
//
#extern
fun<>
myfil00$myfil_make$opt_stdout
(fpath: strn): bool(*succ/fail*)
myfil00$FILR_close
(filr: FILR): void
//
(* ****** ****** *)
//
#extern
fun<>
myfil00$fpath_createWrite$opt
(fpath: strn): FILRopt_vt
#extern
fun<>
myfil00$fpath_createWrite$fwork
(fpath: strn, work: (FILR)->void): void
//
(* ****** ****** *)
//
#impltmp
myfil00$myfil_make$opt_stdout
<(*tmp*)>
myfil00$fpath_createWrite$opt
(fpath) =
let
//
val opt =
myfil00$fpath_open$opt(fpath)
#vwtpdef
r0 = // res
optn_vt(FILR)
//
var r0: r0 =
optn_vt_nil((*0*))
val p0 = $addr(r0)
//
in//let
myfil00$fpath_createWrite$fwork
(
fpath,
lam(cs) =>
$UN.p2tr_set<r0>(p0, optn_vt_cons(cs))); r0
end//let
//
(* ****** ****** *)
//
#extern
fun<> // HX: succ/fail: true/false
myfil00$myfil_make$opt_stdout(fpath: strn): bool
//
(* ****** ****** *)
(* ****** ****** *)
//
#impltmp
myfil00$myfil_make$opt_stdout
(fpath) =
(
//
case+ opt of
| ~
Expand All @@ -102,7 +134,10 @@ val () =
where{
#impltmp g_stdout<>() = out } } )
//
end(*let*)//end-of-[myfil00$myfil_make$opt_stdout(...)]
) where
{
val opt = myfil00$fpath_createWrite$opt(fpath)
}(*where*)//end-of-[myfil00$myfil_make$opt_stdout(...)]
//
(* ****** ****** *)
(* ****** ****** *)
Expand Down
10 changes: 10 additions & 0 deletions xatslib/githwxi/DATS/myobj00.dats
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,19 @@ case+ dtv of
|DTVa1sz(a0) =>
(
prints("DTVa1sz(", a0, ")"))
//
|DTVhmap(hm) =>
(*
HX-2024-09-16:
Handling recursion is tricky!
*)
(*
(
HX-2024-09-16: BUGGY!!!
prints("DTVhmap(", hm, ")"))
*)
(prints
("DTVhmap(", type(hm), ")"))
//
|DTVf1un(f1) =>
(
Expand Down
1 change: 1 addition & 0 deletions xatslib/githwxi/TEST/CATS/JS/test07_myobj00.dats
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Sat 07 Sep 2024 02:40:27 PM EDT
//
(* ****** ****** *)
(* ****** ****** *)
//
#include
"srcgen2\
/prelude/HATS/prelude_JS_dats.hats"
Expand Down

0 comments on commit 65ba3a1

Please sign in to comment.