Module: source-records-implementation Author: Jason Trenouth 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 /// NB There is an emulator copy of this code which should /// be kept up to date with this copy. The main difference /// is that the hashing function takes only one arg in the /// emulator. /// Protocol define open class () end class; define open generic source-location-hash (loc :: , state) => (id :: , state); define open generic source-location-equal? (loc1 :: , loc2 :: ) => (equal? :: ); define method table-protocol (table :: ) => (test :: , hash :: ) values(source-location-equal?, source-location-hash) end method; /// Implementation define method source-location-hash (loc :: , initial-state) => (id :: , state) let (sr-id, next-state) = object-hash(loc.source-location-source-record, initial-state); let (line-id, final-state) = object-hash(loc.source-location-start-line, next-state); values(merge-hash-ids(sr-id, line-id), final-state); end method; define method source-location-equal? (loc1 :: , loc2 :: ) => (equal? :: ) local method equal-wrt? (f, x, y) f(x) = f(y); end method; equal-wrt?(source-location-source-record, loc1, loc2) & equal-wrt?(source-location-start-line, loc1, loc2) end method;