/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer 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 ----------------------------------------------------------------------------- */ /*! \brief Sample main function that log a "Hello World" message. * * Prototype: fun [] I * * \return I : 0 **/ fun main()= _showconsole; _HelloWorld;; /*! \brief Sample main function that show how to use a custom C++ type in Scol. * * The custom type is defined within a C++ plugin. * We checks creation of a new instance of the object, setting values in, * reading the values stored in, and then we manually deleting the instance. * * Prototype: fun [S I] I * * \param S : bloc name * \param I : bloc value * * \return I : 0 **/ fun objBlocTest(nameValue, integerValue)= let _CRbloc _channel -> blocInstance in { // Set ObjBloc properties values _SETblocName blocInstance nameValue; _SETblocValue blocInstance integerValue; // Check if values where correctly registered and log them on the console _fooS strcatn "Bloc name: "::(_GETblocName blocInstance)::"\nBloc value: "::(itoa (_GETblocValue blocInstance))::nil; // Manually destroying blocInstance _DSbloc blocInstance; }; 0;; /*! \brief Callback that show values of an ObjBloc whenever a property he owned is changed. * * Values are save to console log. * * Prototype: fun [u0 u1 u1 u2] I * * \param u0: not used, but the bloc instance where a value has changed is passed. * \param u1: not used * \param I : bloc value * \param S : bloc name * * \return I : 0 **/ fun blocHasChanged(blocInstance, userParam, newValue, newName)= // Log new values _fooS strcatn "Bloc name: "::newName::"\nBloc value: "::(itoa newValue)::nil; 0;; /*! \brief Sample main function that show how to use a callback. * * Prototype: fun [S I] I * * \param S : bloc name * \param I : bloc value * * \return I : 0 **/ fun objBlocTestEvent(nameValue, integerValue)= let _CRbloc _channel -> blocInstance in { // Setting callback _CBblocChangeValue blocInstance @blocHasChanged nil; // Set ObjBloc properties values _SETblocName blocInstance nameValue; _SETblocValue blocInstance integerValue; // Manually destroying blocInstance _DSbloc blocInstance; }; 0;;