/* 
 This is the script that gets run when the  Omega system is instantiated.
 It is evaluated in the newly created Evaluator object (which is generated
 by creating an EvaluatorManager in the application/applet).


 Note that the names of the classes are fully qualified now, even though
 this is not strictly necessary. The intent is to provide easier readability
 for people who want to understand this code and also to ensure that 
 systems such as kaffe, etc. don't get as confused.
*/

// source("Attachments");

show(("Omegahat: version " + options().getProperty("omegahatReleaseDate","?")));
setProperty("OmegaFinalScript", "OmegaFinal");


/*
   GUIs are quite curious in the interactive console omega.
   See the remarks in Console/omega.jweb as to why we create a frame here.
   This could be conditionally evaluated based on an Java proprty or 
   environment variable set in the shell script that starts Omega.
   
   Note that the quit won't work here at present if this is evaluated
   before the Startup script. The reason is that a second evaluator
   is created and the manager won't terminate that without a request
   to force the shutdown of all other evaluators.  Even with this,
   there are issues of thread priority, etc. More on this later!
*/

if(java.lang.System.getProperties().containsKey("UseGUI"))
  source("Splash");


if(System.getProperty("UserScript") != null && System.getProperty("UserScript") != "") {
  f = new File(System.getProperty("UserScript"));
  if(f.canRead()) 
    source(f);
}



/* 
  This creates the input reader in a separate thread.
  It is best to put this here (after the splash screen)
  because it is possible to get race conditions in 
  the evaluator used in interpreting the GUI script
  and immediate user input. The evaluate() method in the Evaluator
  is now synchronized which should remove this problem.
*/
source("Startup");

/* endSource("Test of the endSource() command."); */


/*
Copyright (c) 1998, 1999 The Omega Project for Statistical Computing.
     All rights reserved.

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are
     met:

       Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

       Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

       Neither name of the Omega Project for Statistical Computing nor the 
       names of its contributors may be used to endorse or promote products 
       derived from this software without specific prior written permission.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY
     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
     SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
     THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
*/
