PreviousUpNext

15.4.64  src/app/makelib/depend/symbolmapstack–to–tome-symbolmapstack.pkg

## symbolmapstack--to--tome-symbolmapstack.pkg.pkg
## (C) 1999 Lucent Technologies, Bell Laboratories
## Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)

# Compiled by:
#     src/app/makelib/makelib.sublib



# See comments in
#
#     src/app/makelib/depend/tome-symbolmapstack.pkg



stipulate
    package syx =  symbolmapstack;                                                              # symbolmapstack                        is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg
    package tst =  tome_symbolmapstack;                                                         # tome_symbolmapstack                   is from   src/app/makelib/depend/tome-symbolmapstack.pkg
herein

    api Symbolmapstack__To__Tome_Symbolmapstack {
        #
        convert:  syx::Symbolmapstack   ->   (tst::Tome_Symbolmapstack,  Void -> symbol_set::Set);

        # The thunk passed to convert_memo will not be called
        # until the first attempt to query the resulting
        # tst::Tome_Symbolmapstack.
        #
        # If the symbols for which queries succeed are known, then one
        # should further guard the resulting dictionary with an appropriate filter
        # to avoid queries that are known in advance to be unsuccessful
        # because they would needlessly cause the thunk to be called.

        convert_memo:  (Void -> syx::Symbolmapstack)  ->   tst::Tome_Symbolmapstack;
    };
end;



stipulate
    package syx =  symbolmapstack;                                                                      # symbolmapstack                                is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg
    package bst =  browse_symbolmapstack;                                                               # browse_symbolmapstack                 is from   src/lib/compiler/front/typer-stuff/symbolmapstack/browse.pkg
    package sy  =  symbol;                                                                      # symbol                                is from   src/lib/compiler/front/basics/map/symbol.pkg
    package sys =  symbol_set;                                                                  # symbol_set                            is from   src/app/makelib/stuff/symbol-set.pkg
    package tst =  tome_symbolmapstack;                                                         # tome_symbolmapstack                   is from   src/app/makelib/depend/tome-symbolmapstack.pkg
herein

    package   symbolmapstack__to__tome_symbolmapstack
    :         Symbolmapstack__To__Tome_Symbolmapstack                                           # Symbolmapstack__To__Tome_Symbolmapstack       is from   src/app/makelib/depend/symbolmapstack--to--tome-symbolmapstack.pkg
    {
        fun convert_generic_dictionary get
            =
            tst::FCTENV (convert_result o get)

        also
        fun convert_result (bst::DICTIONARY { get, ... } )   =>   THE (convert_generic_dictionary get);
             convert_result  bst::NO_DICTIONARY                   =>   NULL;
        end;

        fun convert sb
            =
            {   fun list_to_set l
                    =
                    {   fun add_module ((symbol, _), set)
                            =
                            case (sy::name_space symbol)

                                 (   sy::PACKAGE_NAMESPACE
                                 |   sy::API_NAMESPACE
                                 |   sy::GENERIC_NAMESPACE
                                 |   sy::GENERIC_API_NAMESPACE
                                 )
                                     => sys::add (set, symbol);

                                _    => set;
                            esac;

                        fold_forward add_module sys::empty l;
                    };

                tome_exports
                    =
                    convert_generic_dictionary (bst::browse sb);

                fun make_domain ()
                    =
                    list_to_set (syx::to_sorted_list  sb);

                ( tome_exports,
                  make_domain
                );
            };

        fun convert_memo get_sb
            =
            {   l =   REF (\\ s = raise exception DIE "se2dae: uninitialized");

                fun looker s
                    =
                    {   fun get_cme () = bst::browse (get_sb ());

                        lk = convert_result o (get_cme ());

                        l := lk;
                        lk s;
                    };

                l := looker;
                tst::FCTENV (\\ s = *l s);
            };
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext