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 8, 2024
1 parent ff327e6 commit ef34b6a
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 10 deletions.
146 changes: 146 additions & 0 deletions prelude/SATS/gmap000.sats
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ fun
<map:t0>
<key:t0>
<itm:vt>
gmap_nil((*0*)): map
//
(* ****** ****** *)
(* ****** ****** *)
//
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_size(kxs: map): nint
//
(* ****** ****** *)
Expand Down Expand Up @@ -84,6 +93,16 @@ gmap_keyq
//
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_strmize
(kxs: map): strm_vt@(key, itm)
//
(* ****** ****** *)
(* ****** ****** *)
//
fun
<map:t0>
<key:t0
,itm:vt>
gmap_search$tst
Expand All @@ -98,6 +117,133 @@ gmap_search$cpy
(* ****** ****** *)
(* ****** ****** *)
//
(*
HX-2024-09-08:
These are for imperative maps!
*)
(*
HX-2024-09-08:
Using [getout$old] if [key]
is known in the given map [map]
*)
#extern
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_getout$any
(kxs: map, key: key): itm
#extern
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_getout$old
(kxs: map, key: key): itm
#extern
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_getout$opt
(kxs: map, key: key): optn_vt(itm)
//
(* ****** ****** *)
(* ****** ****** *)
//
(*
HX-2024-09-08:
These are for imperative maps!
*)
(*
HX-2024-09-08
Using [insert$new] if [key] is
known not in the given map [map]
*)
#extern
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_insert$any
(kxs: map
,key: key, itm: itm): void
#extern
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_insert$new
(kxs: map
,key: key, itm: itm): void
#extern
fun
<map:t0>
<key:t0>
<itm:vt>
gmap_insert$opt
(kxs: map
,key: key, itm: itm): optn_vt(itm)
//
(* ****** ****** *)
(* ****** ****** *)
//
(*
HX-2024-09-08
These are for functional maps!
*)
//
#extern
fun
<map:t0>
<key:t0>
<itm:t0>
gmap_getout$any
(kxs: map, key: key): map
#extern
fun
<map:t0>
<key:t0>
<itm:t0>
gmap_getout$old
(kxs: map, key: key): map
fun
<map:t0>
<key:t0>
<itm:t0>
gmap_getout$opt
( kxs: map
, key: key): (map, optn_vt(itm))
//
#extern
fun
<map:t0>
<key:t0>
<itm:t0>
gmap_finsert$any
(kxs: map
,key: key, itm: itm): map
#extern
fun
<map:t0>
<key:t0>
<itm:t0>
gmap_finsert$new
(kxs: map
,key: key, itm: itm): map
#extern
fun
<map:t0>
<key:t0>
<itm:t0>
gmap_finsert$opt
( kxs: map
, key: key
, itm: itm): (map, optn_vt(itm))
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)
(* ****** ****** *)(* ****** ****** *)

Expand Down
5 changes: 5 additions & 0 deletions prelude/TEST/CATS/JS/Makefile_jsemit
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ all:: test08
all:: test99
########################################################################
########################################################################
testall:: test00; $(NODE) $<_out.js
testall:: test01; $(NODE) $<_out.js
testall:: test02; $(NODE) $<_out.js
testall:: test03; $(NODE) $<_out.js
Expand All @@ -31,6 +32,10 @@ testall:: test06; $(NODE) $<_out.js
testall:: test07; $(NODE) $<_out.js
testall:: test08; $(NODE) $<_out.js
########################################################################
testall1:: test00; $(NODE) $<_out1.js
########################################################################
testall2:: test00; $(NODE) $<_out2.js
########################################################################
########################################################################
SRCGEN2_SRCGENX=\
$(XATSHOME)/srcgen2/xats2js/srcgenx
Expand Down
14 changes: 7 additions & 7 deletions xatslib/DATS/CATS/JS/Hsmap00.dats
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ jshsmap_delete
//
(*
HX-2024-08-10:
Using [getout$any] if [key]
Using [getout$old] if [key]
is known in the given map [map]
*)
#extern
fun<>
jshsmap_getout$any
jshsmap_getout$old
{k:t0}{x:vt}
(map: jsm0(k,x), key: k): ( x )
#extern
Expand All @@ -279,12 +279,12 @@ jshsmap_getout$opt
//
(*
HX-2024-08-10:
Using [insert$any] if [key]
is known not in the given map [map]
Using [insert$new] if [key] is
known not in the given map [map]
*)
#extern
fun<>
jshsmap_insert$any
jshsmap_insert$new
{k:t0}{x:vt}
(map: jsm0(k,x), key: k, itm: x): void
#extern
Expand Down Expand Up @@ -559,7 +559,7 @@ XATS2JS_jshsmap_insert$raw
//
#impltmp
<(*tmp*)>
jshsmap_getout$any
jshsmap_getout$old
(map, key) =
( itm ) where
{
Expand All @@ -572,7 +572,7 @@ jshsmap_getout$opt<>(map, key) }
//
#impltmp
<(*tmp*)>
jshsmap_insert$any
jshsmap_insert$new
(map, k, x) =
let
val-
Expand Down
15 changes: 12 additions & 3 deletions xatslib/TEST/CATS/JS/Makefile_jsemit
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ testall:: test00; $(NODE) $<_out.js
testall:: test01; $(NODE) $<_out.js
testall:: test02; $(NODE) $<_out.js
########################################################################
testall1:: test00; $(NODE) $<_out1.js
########################################################################
testall2:: test00; $(NODE) $<_out2.js
########################################################################
########################################################################
SRCGEN2_SRCGENX=\
$(XATSHOME)/srcgen2/xats2js/srcgenx
Expand All @@ -37,12 +41,17 @@ $(CAT) $(SRCGEN2_XSHARED)/xats2js_prelude.js >> $@_out.js
test00:: ; \
$(CAT) $(SRCGEN2_XSHARED)/xats2js_xatslib.js >> $@_out.js
############
test00:: ; \
$(CAT) $(XATSHOME)/prelude/DATS/CATS/JS/NODE/node000.cats >> $@_out.js
############
test00:: \
test00_xatslib.dats; \
$(NODE) --stack-size=4096 $(SRCGEN2_XATS2JS) $< >> $@_out.js
############
test00:: ; \
npx google-closure-compiler -W QUIET \
--compilation_level SIMPLE --js=$@_out.js --js_output_file=$@_out1.js
############
test00:: ; \
npx google-closure-compiler -W QUIET \
--compilation_level ADVANCED --js=$@_out.js --js_output_file=$@_out2.js
########################################################################
########################################################################
test01:: ; \
Expand Down
7 changes: 7 additions & 0 deletions xatslib/TEST/CATS/JS/test00_xatslib.dats
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ For testing xatslib/JS!
"srcgen2\
/prelude/HATS/prelude_JS_dats.hats"
(* ****** ****** *)
(*
#include
"srcgen2\
/prelude/HATS/prelude_NODE_dats.hats"
*)
(* ****** ****** *)
(* ****** ****** *)
//
Expand All @@ -36,6 +38,11 @@ prints
(* ****** ****** *)
(* ****** ****** *)
//
val () = the_print_store_log( (*void*) )
//
(* ****** ****** *)
(* ****** ****** *)
//
(* ****** ****** *)(* ****** ****** *)(* ****** ****** *)
(* ****** ****** *)(* ****** ****** *)(* ****** ****** *)

Expand Down

0 comments on commit ef34b6a

Please sign in to comment.