PreviousUpNext

15.4.72  src/app/makelib/freezefile/frozenlib-tome.pkg

## frozenlib-tome.pkg
#
# See overview comments in
#     src/app/makelib/freezefile/frozenlib-tome.api

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



stipulate
    package ad  =  anchor_dictionary;                                           # anchor_dictionary     is from   src/app/makelib/paths/anchor-dictionary.pkg
    package err =  error_message;                                               # error_message         is from   src/lib/compiler/front/basics/errormsg/error-message.pkg
    package int =  int;                                                         # int                   is from   src/lib/std/int.pkg
    package lnd =  line_number_db;                                              # line_number_db        is from   src/lib/compiler/front/basics/source/line-number-db.pkg
    package shm =  sharing_mode;                                                # sharing_mode          is from   src/app/makelib/stuff/sharing-mode.pkg
    package ph  =  picklehash;                                                  # picklehash            is from   src/lib/compiler/front/basics/map/picklehash.pkg
herein

    package   frozenlib_tome
    :         Frozenlib_Tome                                                    # Frozenlib_Tome        is from   src/app/makelib/freezefile/frozenlib-tome.api
    {
        Frozenlib_Tome                                                          # Named for symmetry with   Thawedlib_Tome   in   src/app/makelib/compilable/thawedlib-tome.pkg
          =
          {
            libfile:                    ad::File,                               # .lib file defining the library.
            freezefile_name:            String,                                 # Name of binary freezefile proper -- "foo.lib.frozen".
            api_or_pkg_file_path:       String,                                 # Sourcefile pathname verbatim from .lib-file, e.g. "foo.api" or "foo.pkg" or "fancy/graphviz/text/text-display.api" or "../emit/asm-emit.pkg".
            #   
            byte_offset_in_freezefile:  Int,                                    # Our byte offset within the containing freezefile.
            runtime_package_picklehash: Null_Or( ph::Picklehash ),              # Special kludge supporting C-coded runtime access -- see src/lib/core/init/runtime.pkg
            sharing_mode:               shm::Mode,                              # Normally SHARE(FALSE).
            plaint_sink:                err::Plaint_Sink                                # Where to send link error diagnostics etc.
          };

        Key =  Frozenlib_Tome;                                                  # Possibly we should do    package ord { Key = Frozenlib_Tome; compare = compare; }   in cases like this?  The current approach is messy, ugly and obscure.

        fun compare ( i1: Frozenlib_Tome,
                      i2: Frozenlib_Tome
                    )
            =
            case (int::compare ( i1.byte_offset_in_freezefile,                  
                                 i2.byte_offset_in_freezefile
                              ))
                #         
                EQUAL   =>  ad::compare (i1.libfile, i2.libfile);
                unequal =>  unequal;
            esac;

        fun describe_frozenlib_tome (fc: Frozenlib_Tome)                        # (sprintf "%s@%d(%s)"  libfile  byteoffset_in_lib  sourcefile)   -- something like  "$ROOT/src/lib/x-kit/xkit.lib@243309(src/color/rgb.pkg)"
            =
            cat [ ad::describe fc.libfile,
                  "@",
                  int::to_string  fc.byte_offset_in_freezefile,
                  "(", fc.api_or_pkg_file_path, ")"                             # E.g. "foo.api" or "../emit/asm-emit.pkg".
                ];
    };
end;

## (C) 1999 Lucent Technologies, Bell Laboratories
## Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp)
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext