/* *********************************************************************
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
Some functions has been originally written to the Openspace3d project.
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 the Scol virtual machine
* See http://redmine.scolring.org/projects/tutorials/wiki/Scol_usage
* for more informations
*/
/*! \file vm.pkg
* \author Scol team
* \version 0.1
* \copyright GNU Lesser General Public License 2.0 or later
* \brief Scol Standard Library - Scol virtual machine API
*
**/
var VM_ConsoleState = 0;;
/*! \brief Show or hide the Scol console.
*
* This function showes the Scol console if it was hidden and hides the
* Scol console if it was shown.
*
* If you directly call _showconsole or _hideconsole once at least, you
* should not use this function. To use this, you should only call this function.
*
* \ingroup std_vm
* Prototype: fun [] I
*
* \return I : 1 if the console has been shown, 0 if the console has been hidden.
* \see vmConsoleState
**/
fun vmConsoleToggle ()=
if VM_ConsoleState then _hideconsole else _showconsole;
set VM_ConsoleState = !VM_ConsoleState;;
/*! \brief Returns if the Scol console is shown or hidden.
*
* If you directly call _showconsole or _hideconsole once at least, you
* should not use this function. To use this, you should only call this function.
*
* \ingroup std_vm
* Prototype: fun [] I
*
* \return I : 1 if the console is shown, 0 if the console is hidden.
* \see vmConsoleToggle
**/
fun vmConsoleState ()=
VM_ConsoleState;;
/*! \brief Set a global variable (a string resource) for this VM only.
*
* If the global variable is not defined yet, it will be created in memory.
* If it is already defined, the new value will replace the old one.
*
* A such resource keeps available (in reading and in writing) during the
* VM's life.
*
* Thus, a value of the usmress.ini file can also be changed in memory.
*
* \ingroup std_vm
* Prototype: fun [S S] S
*
* \param S : a key, to retreive the value
* \param S : a (new) value
*
* \return S : the given value.
* \see vmRessGet
**/
fun vmRessSet (szKey, szValue)=
_setress szKey szValue;;
/*! \brief Get the value of a global variable (a string resource).
*
* It is the value at this moment, when this function is called.
*
* \ingroup std_vm
* Prototype: fun [S] S
*
* \param S : a key, to retreive the value
*
* \return S : the value.
* \see vmRessSet
**/
fun vmRessGet (szKey)=
_getress szKey;;