Module: environment-protocols Synopsis: Environment protocols Author: Andy Armstrong 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 /// Compiler warnings define abstract class () end class ; define class (, , ) end class ; define class () sealed slot environment-object-proxy = #f, required-init-keyword: proxy:; end class ; //---*** andrewa: short term hack, we should classify this more carefully define class () end class ; define class () end class ; define open generic do-compiler-warnings (function :: , server :: , object :: , #key client) => (); define open generic compiler-warning-short-message (server :: , warning :: ) => (message :: ); define open generic compiler-warning-full-message (server :: , warning :: ) => (message :: ); define open generic warning-owner (server :: , warning :: ) => (owner :: false-or()); /// Project dispatching methods define method do-compiler-warnings (function :: , project :: , object :: , #key client) => () let database = ensure-database-server(project, object); database & do-compiler-warnings(function, database, object, client: client) end method do-compiler-warnings; define method do-compiler-warnings (function :: , project :: , object :: , #key client) => () assert(project = object, "Querying %= through different project %=!", object, project); local method do-library-warnings (library :: ) => () do-compiler-warnings(function, project, library, client: client) end method do-library-warnings; let library = project-library(project); library & do-library-warnings(library); do-project-used-libraries (method (library :: ) if (~library-read-only?(project, library)) do-library-warnings(library) end end, project, project) end method do-compiler-warnings; define method compiler-warning-short-message (project :: , warning :: ) => (message :: ) let database = ensure-database-server(project, warning, error?: #t); compiler-warning-short-message(database, warning) end method compiler-warning-short-message; define method compiler-warning-full-message (project :: , warning :: ) => (message :: ) let database = ensure-database-server(project, warning, error?: #t); compiler-warning-full-message(database, warning) end method compiler-warning-full-message; define method warning-owner (project :: , warning :: ) => (owner :: false-or()) // gz, 18-Feb-00: Changed this to not signal error, because it was // causing problems when the warnings pane got updated at certain // points during compilation, when the database is cleared out. // Probably the right thing is to cache the warning owner with // the warning object, so don't need to look it up in a possibly // since-changed database world. But I don't know enough to do that. let database = ensure-database-server(project, warning, error?: /* #t */ #f); database & warning-owner(database, warning) end method warning-owner; //--- This is to override the default method on , //--- probably we should reorganize the hierarchy so this isn't //--- necessary. define method environment-object-home-name (project :: , warning :: ) => (name :: false-or()) #f end method environment-object-home-name; //--- This is to override the default method on , //--- probably we should reorganize the hierarchy so this isn't //--- necessary. define method environment-object-name (project :: , warning :: , namespace :: ) => (name :: false-or()) #f end method environment-object-name; /// Some convenience functions built on these protocols define method environment-object-source (server :: , object :: ) => (source :: false-or()) let source-form = warning-owner(server, object); source-form & environment-object-source(server, source-form) end method environment-object-source; define function source-form-compiler-warnings (server :: , object :: , #key client) => (warnings :: ) collect-environment-objects (do-compiler-warnings, server, object, client: client) end function source-form-compiler-warnings; define function project-warnings (project :: , #key client) => (warnings :: ) collect-environment-objects (do-compiler-warnings, project, project, client: client) end function project-warnings; /// Printing support define method environment-object-type-name (object :: ) => (name :: ) "Warning" end method environment-object-type-name; define method environment-object-type-name (object :: ) => (name :: ) "Serious warning" end method environment-object-type-name; define method environment-object-type-name (object :: ) => (name :: ) "Error" end method environment-object-type-name;