Module: environment-protocols Synopsis: Environment protocols Author: Andy Armstrong, 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 /// Interactively Executing Code. /// /// --- This class still needs to be defined. The Debugger-manager and /// Compiler-interface libraries need to agree on what this is, and we need /// to bind to whatever type they agree on, or in some other way make it /// available to users of the environment protocols. /// define constant = ; define sealed class () // // This slot holds the unique ID returned by the compiler that represents // an interactive evaluation request. constant slot execution-info-id :: , required-init-keyword: id:; // // This slot holds the thread on which the evaluation was performed. constant slot execution-info-thread :: , required-init-keyword: thread:; end class ; /// Project-execute-code /// /// This must be called while the target application is in a debugger /// transaction. Essentially, it creates a source-record for code, passes /// the source record to the compiler to be sent to the target app, saves an /// object that can later be retrived via /// 'project-execution-info', and returns the execution info. This function /// returns #f when the compiler could not process the code. /// /// Module must be a . define open generic project-execute-code (server :: , code :: , thread :: , #key module, runtime-context, stack-frame) => (execution-id :: , deferred-execution? :: ); define open generic project-macroexpand-code (server :: , module :: , code :: , #key expansion-stream :: , trace-stream :: ) => (); define open generic project-runtime-context (server :: , thread :: , #key stack-frame) => (runtime-context); define open generic fetch-interactor-return-values (server :: , execution-id :: ) => (environment-objects :: ); define open generic dispose-interactor-return-values (server :: , execution-id :: ) => (); define open generic project-valid-code? (server :: , code :: , thread :: , #key module, runtime-context, stack-frame) => (valid? :: , warnings :: ); define open generic application-state-at-code-entry (id :: ) => (state :: ); define open generic transaction-id-source-record (server :: , id :: ) => (source-record :: false-or()); /// Record-return-values /// /// Pass return values to the Interactor component via whatever interface it /// provides, or whatever the environment protocols provide. /// define open generic record-return-values (project :: , execution-id :: , values :: ) => (); /// Project-execution-info /// /// Returns the execution info associated with id, or #f if there is none. /// define open generic project-execution-info (project :: , id :: ) => (info :: false-or()); /// Project-remove-execution-info /// /// Removes any references the project may have to the execution-info. /// define open generic project-remove-execution-info (project :: , info :: ) => (); ///// INTERACTIVITY (Methods added by Paul Howard, June 1997) // Work is farmed out to the application server. define method project-execute-code (project :: , code :: , thread :: , #key module = #f, runtime-context = #f, stack-frame = #f) => (execution-id :: , deferred-execution? :: ) let server = choose-server(project, thread, error?: #t); project-execute-code (server, code, thread, module: module, runtime-context: runtime-context, stack-frame: stack-frame) end method; define method project-macroexpand-code (project :: , module :: , code :: , #key expansion-stream :: false-or() = #f, trace-stream :: false-or() = #f) => () let database = ensure-database-server(project, module, error?: #t); project-macroexpand-code (database, module, code, expansion-stream: expansion-stream, trace-stream: trace-stream) end method; define method project-runtime-context (project :: , thread :: , #key stack-frame = #f) => (runtime-context) let server = choose-server(project, thread, error?: #t); project-runtime-context(server, thread, stack-frame: stack-frame) end method; define method project-valid-code? (project :: , code :: , thread :: , #key module = #f, runtime-context = #f, stack-frame = #f) => (valid? :: , warnings :: ) let server = choose-server(project, thread, error?: #t); project-valid-code? (server, code, thread, module: module, runtime-context: runtime-context, stack-frame: stack-frame) end method; define method transaction-id-source-record (project :: , id :: ) => (record :: false-or()) let server = project-application(project); server & transaction-id-source-record(server, id) end method; define method fetch-interactor-return-values (project :: , execution-id :: ) => (environment-objects :: ) if (project.project-application) fetch-interactor-return-values(project.project-application, execution-id) else #[] end if; end method; define method dispose-interactor-return-values (project :: , execution-id :: ) => () if (project.project-application) dispose-interactor-return-values(project.project-application, execution-id); end if; end method;