// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab // Copyright (C) 2007-2008 - INRIA // Copyright (C) 2009-2011 - DIGITEO // // Copyright (C) 2012 - 2016 - Scilab Enterprises // // This file is hereby licensed under the terms of the GNU GPL v2.0, // pursuant to article 5.3.4 of the CeCILL v.2.1. // This file was originally licensed under the terms of the CeCILL v2.1, // and continues to be available under such terms. // For more information, see the COPYING file which you should have received // along with this program. // Main Scilab initialisation file mode(-1); // silent execution mode // clean database when restarted ====================================== //predef("clear"); //unprotect all variables clear; // erase all variables clearglobal(); %tk = (with_module("tclsci") & getscilabmode() <> "NWNI"); // Default Obsolete Warning policy =================================== global %modalWarning; // False -> Scilab will only display a Warning message in the console // if warnings are enabled [warning("on"/"off")]. // True -> Scilab will show a blocking popup. %modalWarning = %F; clear %modalWarning; // Create some configuration variables ================================ PWD = pwd(); // Startup message =================================================== // if (sciargs() <> "-nb") & ~fromjava() & ~fromc() & getscilabmode() == "STD" then if (sciargs() <> "-nb") & getscilabmode() == "STD" then printf("\n\n%s\n", gettext("Startup execution:")); printf(gettext(" loading initial environment") + "\n"); end //if ((getscilabmode() == "NWNI" | getscilabmode() == "NW") & ~fromjava() & ~fromc() & sciargs()<>"-nb") if ((getscilabmode() == "NWNI" | getscilabmode() == "NW") & sciargs()<>"-nb") [v, opts] = getversion() printf(strsubst(v, "scilab-", "Scilab ") + " (" + opts($-1) + ", " + opts($) + ")\n"); clear v opts; end // loads modules ====================================================== modules = getmodules(); for i=1:size(modules,"*") startFile = "SCI/modules/" + modules(i) + "/etc/" + modules(i) + ".start"; ierr=exec(startFile, 'errcatch', -1); if ierr <> 0 then disp(msprintf(gettext("Failed to execute %s:"),startFile)); disp(lasterror()); exit(2); end end clear modules i ierr startFile; // Create some configuration variables ================================ //home = getenv("HOME", SCI); if getos() <> "Windows" then if getenv("PRINTERS", "ndef") == "ndef" then setenv("PRINTERS", "lp"); end end setenv("VERSION", getversion()); // ATOMS =============================================================== if with_module("atoms") then atomsSystemInit(); if sciargs() <> "-noatomsautoload" then atomsAutoload(); clear atomsAutoload; end clear atomsSystemInit; end // Protect variable previously defined ================================ clear = clear // special case: http://bugzilla.scilab.org/12198 predef("all"); // At startup, no interactive vertical paging by default. ============== lines(0); // load contrib menu if present ======================================== function loadContrib() if isfile(SCI+"/contrib/loader.sce") then global %toolboxes; global %toolboxes_dir; exec(SCI+"/contrib/loader.sce"); end endfunction loadContrib(); clear loadContrib; // calling user initialization ========================================= if ~or(sciargs()=="-nouserstartup") then startupfiles = [ SCIHOME + filesep() + ".scilab" ; .. // Home directory startup SCIHOME + filesep() + "scilab.ini" ]; // "" "" startup for f = startupfiles' if isfile(f) then exec(f, -1) end end // execute .scilab and scilab.start only // if last exec does not change current directory to SCIHOME // See bug #4150 usedwd = xmlGetValues("//general/body/startup", "use"); if usedwd=="previous" workingDirectory = xmlGetValues("//general/body/startup", "previous"); elseif usedwd=="default" workingDirectory = xmlGetValues("//general/body/startup", "default"); else workingDirectory = pwd(); end if SCIHOME <> workingDirectory then startupfiles = [ workingDirectory + filesep() + ".scilab" ; .. // Working directory startup workingDirectory + filesep() + "scilab.ini" ]; // "" "" startup for f = startupfiles' if isfile(f) then exec(f, -1) end end end clear usedwd f startupfiles workingDirectory end // Menus/toolbar can now be enabled ==================================== if getscilabmode() == "STD" then setmenu(gettext("&File")); setmenu(gettext("&Edit")); setmenu(gettext("&Preferences")); setmenu(gettext("&Control")); setmenu(gettext("&Applications")); if ~with_module("scinotes") then // Desactivate Editor menu unsetmenu(gettext("&Applications"), 1); end if ~with_module("xcos") then // Desactivate xcos menu unsetmenu(gettext("&Applications"), 3); end if ~with_module("m2sci") then // Desactivate mfile2sci menu unsetmenu(gettext("&Applications"), 5); end if ~with_module("atoms") then // Desactivate atoms menu unsetmenu(gettext("&Applications"), 7); end setmenu(gettext("&?")); setmenu(gettext("&Toolboxes")); toolbar(-1, "on"); main_menubar_cb("setFavoriteDirs"); end // ==================================================================== clear ans main_menubar_cb getPreferencesValue