Module: environment-tools Synopsis: Progress window/build dialog Author: Scott McKay, Chris Page 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 locking define constant $project-compilation-timeout :: = 10; define variable $compiler-lock :: = make(); define macro with-compiler-locked { with-compiler-locked (?owner:expression, #rest ?options:*) ?:body end } => { begin let _continue? = #t; while (_continue?) with-lock ($compiler-lock, ?options) block () ?body cleanup _continue? := #f end failure unless (environment-question ("The compiler is already busy; keep waiting for it?", owner: ?owner)) _continue? := #f end end end end } end macro with-compiler-locked; /// Combined build dialog and compiler progress notification define constant = one-of(#"parse", #"compile", #"compile-and-link", #"release", #"link"); define constant $build-operations = #[#[#"parse", "Parse only"], #[#"compile", "Compile only"], #[#"compile-and-link", "Compile and link"], #[#"release", "Compile, link and release"], #[#"link", "Link only"]]; define constant = one-of(#"warnings", //--- obsolete, but it might be in the registry #"always", //--- obsolete, but it might be in the registry #"force", #"ask", #"no-warnings"); define constant $link-modes = #[#[#"force", "Always link, even if there are serious warnings"], #[#"ask", "Ask whether to link if there are serious warnings"], #[#"no-warnings", "Don't link if there are serious warnings"]]; define frame (, ) sealed slot %lightweight? = #f, init-keyword: lightweight?:; // Internals slots for maintaining the dialog state sealed slot %build-operation :: = #"compile-and-link", init-keyword: build-operation:; sealed slot %clean-build? :: = #f, init-keyword: clean-build?:; sealed slot %copy-sources? :: = #f, init-keyword: copy-sources?:; sealed slot %save-databases? :: = #t, init-keyword: save-databases?:; sealed slot %process-subprojects? :: = #t, init-keyword: process-subprojects?:; sealed slot %link-mode :: = #"ask", init-keyword: link-mode:; sealed slot %upgrade-warnings? :: = #f, init-keyword: upgrade-warnings?:; // Slots for maintaining the compiler progress sealed slot %progress-note-function :: = always(#f), init-keyword: progress-function:; sealed slot %progress-body-function :: = always(#f), init-keyword: body-function:; sealed slot %progress-cleanup-function :: = always(#f), init-keyword: cleanup-function:; sealed slot %progress-function-frame :: false-or() = #f, init-keyword: progress-frame:; sealed slot %stop-progress? :: = #f; // request a stop sealed slot %progress-stopped? :: = #t; // we are now stopped virtual slot compiler-progress-heading-label :: ; virtual slot compiler-progress-item-label :: ; virtual slot compiler-progress-numerator :: ; virtual slot compiler-progress-denominator :: ; // The dialog panes... pane %build-operation-pane (frame) make(, items: $build-operations, value-key: first, label-key: second, value: frame.%build-operation, value-changed-callback: method (b) frame.%build-operation := gadget-value(b) end method, documentation: "Choose the build operation."); pane %clean-build-pane (frame) make(, label: "&Clean build", value: frame.%clean-build?, value-changed-callback: method (b) frame.%clean-build? := gadget-value(b) end method, documentation: "Compile all source files rather than only changed ones."); /* ---*** Removed for 2.0 Beta 1 -- put it back in later pane %copy-sources-pane (frame) make(, label: "Sa&ve 'canonical' sources in the build area for the build", value: frame.%copy-sources?, value-changed-callback: method (b) frame.%copy-sources? := gadget-value(b) end method, documentation: "Choose whether to copy canonical sources to the build area before building."); */ pane %save-databases-pane (frame) make(, label: "&Save compiler databases after build", value: frame.%save-databases?, value-changed-callback: method (b) frame.%save-databases? := gadget-value(b) end method, documentation: "Choose whether to save compiler databases."); pane %process-subprojects-pane (frame) make(, label: "P&rocess subprojects", value: frame.%process-subprojects?, value-changed-callback: method (b) frame.%process-subprojects? := gadget-value(b) end method, documentation: "Choose whether to build subprojects."); pane %link-mode-pane (frame) make(, items: $link-modes, value-key: first, label-key: second, value: frame.%link-mode, value-changed-callback: method (b) frame.%link-mode := gadget-value(b) end method, documentation: "Choose the link mode."); pane %upgrade-warnings-pane (frame) make(, label: "Treat all &warnings as serious warnings", value: frame.%upgrade-warnings?, value-changed-callback: method (b) frame.%upgrade-warnings? := gadget-value(b) end method, documentation: "Choose whether to treat all warnings as serious warnings."); pane %progress-heading-label (frame) make(