module: ist-implementation synopsis: The interactive symbol table class and its interface author: Paul Howard Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND ///// (Internal implementation class) // A simple object to encapsulate the two delimiting addresses of // a region of memory. define sealed class () constant slot boundary-lower-address :: , required-init-keyword: from:; constant slot boundary-upper-address :: , required-init-keyword: to:; end class; ///// (Internal Implementation class) // The interactive symbol table is split up into these units, indexed // on objects. define sealed class () slot subtable-empty? :: , init-value: #t; constant slot subtable-address-boundaries :: = make(); // (Not constant due to use of idiom x := sort!(x). Maybe could be // constant). slot symbols-by-address :: = make(); constant slot symbols-by-name :: = make(); // Maps to a for the symbols static // object files: constant slot statics-by-object-file :: = make(
); end class; ///// (Exported class) // The class that provides an opaque interface to objects, // and allows new definitions to be created. define sealed class () ///// Exported Slots constant slot symbol-table-redefinition-allowed? :: , init-value: #t, init-keyword: redefinition-allowed?:; constant slot symbol-table-access-path :: , required-init-keyword: access-path:; ///// Internal Slots slot symbol-table-empty? :: , init-value: #t; ///// SYMBOLS-BY-LIBRARY // Maps to . constant slot symbols-by-library ::
= make(
); ///// KNOWN-SYMBOL-LIBRARIES // A sequence of s known to this symbol table. // Every member of this sequence must also be a key in the // above table. Further, there must be no keys in the table that // are not members of this sequence. constant slot known-symbol-libraries :: = make(); // This slot is set to TRUE when a client knows that a number of // definitions have to be made at once. The symbols-by-address field // must be maintained sorted, but it is inefficient to re-sort the field // after every individual addition to the table. When defining a symbol, // the sort will be deferred if this flag is set to #t. // The library provides a macro to set this flag during a period of // 'symbol-table-define-symbol' calls. slot performing-multiple-definitions? :: , init-value: #f; end class; ///// // The superclass of all errors that get signalled from within the // implementation of this library. define abstract class () constant slot offending-symbol-table :: , required-init-keyword: table:; end class; ///// // An attempt was made to remove a symbolic definition from the table, // but there is no such symbol present in the table. define class () constant slot target-name :: , required-init-keyword: name:; end class; ///// // An attempt was made to define a symbol, but there was no // instance of to associate with it. define class () constant slot defined-name :: , required-init-keyword: name:; end class; define class () end class; ///// // An attempt was made to define a file, but there was no // instance of to associate with it. define class () constant slot defined-filename :: , required-init-keyword: name:; end class; ///// // An attempt was made to define a symbol within the scope of a // , but the file was not associated with the // . define class () constant slot defined-name :: , required-init-keyword: name:; constant slot associated-library :: , required-init-keyword: library:; constant slot undefined-file :: , required-init-keyword: file:; end class; ///// // The error class that describes an attempt to redefine a symbol in // a table that does not allow redefinition. define abstract class () constant slot redefined-name :: , required-init-keyword: name:; constant slot existing-symbol :: , required-init-keyword: symbol:; end class; ///// // Trying to redefine a symbol by its name (ie, making that name // point to a different address) is only legal in symbol tables // that have a "redefinition allowed" policy. define class () end class; ///// // Trying to redefine a symbol by its address (ie, making a completely // different name point to that address) is always illegal! define class () end class;