## picklehash-mapstack-g.pkg
## (C) 2001 Lucent Technologies, Bell Labs
# Compiled by:
#
src/lib/compiler/front/basics/basics.sublib# Dictionaries that bind pickle hashes (compiled Mythryl file identifiers).
#
# These get macro expanded to linking and inlining dictionaries by the compiler.
stipulate
package pm = picklehash_map; # picklehash_map is from
src/lib/compiler/front/basics/map/picklehash-map.pkgherein
# This generic is invoked in:
#
#
src/lib/compiler/toplevel/compiler-state/inlining-mapstack.pkg #
src/lib/compiler/execution/linking-mapstack/linking-mapstack.pkg #
generic package picklehash_mapstack_g (
#
Values_Type;
)
: (weak) Picklehash_Mapstack # Picklehash_Mapstack is from
src/lib/compiler/front/basics/map/picklehash-mapstack.api where
Values_Type == Values_Type
=
package {
#
Values_Type = Values_Type;
Picklehash_Mapstack = pm::Map( Values_Type );
empty = pm::empty;
fun get picklehash_map picklehash
=
pm::get (picklehash_map, picklehash);
fun bind (picklehash, value, picklehash_map)
=
pm::set (picklehash_map, picklehash, value);
fun atop (picklehash_map1, picklehash_map2)
=
pm::union_with #1 (picklehash_map1, picklehash_map2);
fun remove (picklehash_list, picklehash_map)
=
fold_backward
remove'
picklehash_map
picklehash_list
where
fun remove' (picklehash, picklehash_map)
=
pm::drop (picklehash_map, picklehash);
end;
fun consolidate picklehash_map
=
picklehash_map;
fun singleton (picklehash, value)
=
bind (picklehash, value, empty);
fun keyvals_list picklehash_map
=
pm::keyvals_list picklehash_map;
fun from_listi keyval_pairlist
=
fold_forward pm::set' empty keyval_pairlist;
fun make (NULL, _ ) => empty;
make (_, NULL ) => empty;
make (THE picklehash, THE value) => singleton (picklehash, value);
end;
};
end;