/* ********************************************************************* This source file is a part of the standard library of Scol For the latest info, see http://www.scolring.org Copyright (c) 2014 Stephane Bisaro aka Iri. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ********************************************************************* */ /* * Standard functions for loading * See http://redmine.scolring.org/projects/tutorials/wiki/Scol_usage * for more informations */ /*! \file load.pkg * \author Scol team * \version 0.1 * \copyright GNU Lesser General Public License 2.0 or later * \brief Loading Scol Standard Library API * **/ /*! \brief Load a list of packages * * \ingroup std_load * Prototype : fun [[S r1] S I] S * * \param [S r1] : a list of packages to load * \param S : an optional path name (it will be prefixed to each package name, if any) * \param I : flag to set the safe loading (1 to safe it, 0 to unsafe it) * \return S : nil if success or the current package name if an error occurs. **/ fun std_loadPkgs (lFiles, dir, safeMode)= // end of list if lFiles == nil then nil else // package not found if nil == _checkpack strcat dir hd lFiles then strcat dir hd lFiles // secured loading (mode = 1) else if safeMode then let _testpak strcat dir hd lFiles -> szRes in // corrupted package if nil != szRes then ( _fooS szRes; strcat dir hd lFiles ) // safe package else // should be never ran if 0 != _load strcat dir hd lFiles then strcat dir hd lFiles // should be always ran else std_loadPkgs tl lFiles dir safeMode // classical loading else // corrupted package if 0 != _load strcat dir hd lFiles then strcat dir hd lFiles // package correctly loaded else std_loadPkgs tl lFiles dir safeMode;;