/* *********************************************************************
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
********************************************************************* */
/*
* 3D errors for basic 3d manipulations
* See http://redmine.scolring.org/projects/tutorials/wiki/Scol_usage
* for more informations
*/
/*! \file base3dload.pkg
* \author Scol team
* \version 0.1
* \copyright GNU Lesser General Public License 2.0 or later
* \brief Scol 3D Library - 3D basic loader. This package is a part of basic3d.pkg
*
**/
// dependancies
var b3d_loadPkgsDep = "lib/std/stdlib.pkg" ::
"lib/std/float.pkg" ::
"lib/std/list.pkg" ::
"lib/std/string.pkg" ::
"lib/std/error.pkg" ::
nil;;
// basic 3d library
var b3d_loadPkgsB3D = "lib/3d/base3derror.pkg" ::
"lib/3d/base3struct.pkg" ::
"lib/3d/base3d.pkg" ::
nil;;
fun b3d_loader2 (pkgs, flag)=
if pkgs == nil then
[0 nil]
else
let pkgs -> [pkg npkg] in
if !flag then // unsafe
if !_load pkg then
b3d_loader2 npkg flag
else
[1 pkg]
else // safe
if nil == _testpak pkg then
if !_load pkg then
b3d_loader2 npkg flag
else
[1 pkg]
else
[1 pkg];;
fun b3d_loader (withDep, flag)=
if withDep then
let b3d_loader2 b3d_loadPkgsDep flag -> [res pkg] in
if !res then
let b3d_loader2 b3d_loadPkgsB3D flag -> [res2 pkg2] in
if !res2 then
nil
else
(
_fooS sprintf ">> b3d_loader : error with the package '%s' : the loading is failed !" [pkg2];
pkg2
)
else
(
_fooS sprintf ">> b3d_loader : error with the package '%s' : the loading is failed !" [pkg];
pkg
)
else
let b3d_loader2 b3d_loadPkgsB3D flag -> [res pkg] in
if !res then
nil
else
(
_fooS sprintf ">> b3d_loader : error with the package '%s' : the loading is failed !" [pkg];
pkg
);;
/*! @ingroup b3d_load
* \brief Load the 3d basic library and its all dependancies.
* This loading is unsafe but faster.
*
* Prototype : fun [] S
*
* \return I : nil if success, the name of the first uncorrect package if error
**/
fun b3d_load ()=
b3d_loader 1 0;;
/*! @ingroup b3d_load
* \brief Load the 3d basic library and its all dependancies.
* This loading is safe but slower.
*
* Prototype : fun [] S
*
* \return I : nil if success, the name of the first uncorrect package if error.
**/
fun b3d_loadSafe ()=
b3d_loader 1 1;;
/*! @ingroup b3d_load
* \brief Load the 3d basic library only (without its dependancies).
* This loading is unsafe but faster.
*
* Prototype : fun [] S
*
* \return I : nil if success, the name of the first uncorrect package if error.
**/
fun b3d_loadOnly ()=
b3d_loader 0 0;;
/*! @ingroup b3d_load
* \brief Load the 3d basic library only (without its dependancies).
* This loading is safe but slower.
*
* Prototype : fun [] S
*
* \return I : nil if success, the name of the first uncorrect package if error.
**/
fun b3d_loadOnlySafe ()=
b3d_loader 0 1;;