📄 oasisscriptinterpreter.h
字号:
/******************************************************************************
* This source file is part of Bad Camel Gaming
* Copyright (C) 2003 Zephie Greyvenstein
* See Readme.html for acknowledgements
*
* This library 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.1 of the License, or (at your option) any later version.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/******************************************************************************
* FILENAME : oasisResource.h
* DESCRIPTION : The Scripting resource base class
* AUTHOR : Godot, Gaw
*****************************************************************************/
/// Avoid double inclusion
#ifndef __SCRIPT_RESOURCE_H__
#define __SCRIPT_RESOURCE_H__
#include "oasisSystem.h"
namespace Oasis {
/// The Scripting resource base class
/** @remarks
This file is mainly a guideline for you to follow when you decide to
extend your favorite scripting language into OASIS.
**/
class _oasisExport scriptInterpreter {
public:
scriptInterpreter() {}
virtual ~scriptInterpreter() {}
/// This should open up a script file/execute it for you.
virtual bool executeScript(string &name) = 0;
/// This is a blunt "Execute the given string" function.
virtual void *executeString(string &command, uint8 &type) = 0;
/// Most likened to killing the interpreter and reloading it.
virtual void reset() = 0;
/* @remarks
For the following two functions (convertFromC/convertToC), the needed
conversions are:
'0' - NULL
'b' - bool
's' - char *
'i' - int32
'd' - int16
'f' - real
'r' - real
'v' - vector(3-element array)
'q' - quaternion(4-element array)
'c' - character
Probably should be implemented:
'u' - uint16
'w' - uint32
Not to be implemented yet, but kinda want in that getting-happy-at the
supermarket sorta way:
'h' - hash tables
'((h)(r))' - notation describing hash & real contained in two tuples
contained in another tuple...
Error codes:
'?' - Unknown data type (Restricted for now... don't worry about it.) */
/// This is used when Scripted calls a function from C with multiple
/// arguments.
virtual void *convertFromC(void *cObject, uint8 type) = 0;
/// This is used (for one) to convert return values from functions to C
/// data types. Note the error convention is to pass back a '?' on unknown
/// types, with the initial value pointer. This will make it possible to
/// access the functions of class instances later.
virtual void *convertToC(void *scriptObject, uint8 &type) = 0;
/// Call a function inside of Scripted Language
/// PENDING: How do we call functions in class instances?
/// Type is the type returned (see above for details )
virtual void *callFunction( string &name, string &types,
void ** arguments,
uint8 &returntype ) = 0;
virtual void freeVariable( void *script_value ) = 0;
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -