Defines | |
#define | SCRIPT_BEGIN_EXPOSITION(category_name) |
#define | SCRIPT_BEGIN_CLASSES_EXPOSITION() |
#define | SCRIPT_EXPOSE_CLASS(class_name) class_name##Proxy::expose(squirrel_vm); |
#define | SCRIPT_END_CLASSES_EXPOSITION() |
#define | SCRIPT_BEGIN_ENUMS_EXPOSITION() |
#define | SCRIPT_EXPOSE_ENUM(enum_name) |
#define | SCRIPT_END_ENUMS_EXPOSITION() |
#define | SCRIPT_BEGIN_VARIABLES_EXPOSITION() |
#define | SCRIPT_EXPOSE_VARIABLE(variable_name) |
#define | SCRIPT_END_VARIABLES_EXPOSITION() |
#define | SCRIPT_END_EXPOSITION() |
#define | SCRIPT_BEGIN_CODE() |
#define | SCRIPT_END_CODE() |
#define | SCRIPT_BEGIN_CLASSES() |
#define | SCRIPT_END_CLASSES() |
#define | SCRIPT_BEGIN_CLASS(class_name, description) |
#define | SCRIPT_SET_CLASS_NO_CONSTRUCTOR(class_name) |
#define | SCRIPT_BEGIN_CLASS_CONSTRUCTOR(class_name, argument_count) |
#define | SCRIPT_END_CLASS_CONSTRUCTOR(class_name,...) |
#define | SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, argument_count, description) |
#define | SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() |
#define | SCRIPT_END_CLASS_FUNCTION_PARAMETERS() |
#define | SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() |
#define | SCRIPT_SET_CLASS_FUNCTION_BOOL_PARAMETER(class_name, function_name, parameter_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_FLOAT_PARAMETER(class_name, function_name, parameter_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER(class_name, function_name, parameter_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_INTEGER_PARAMETER(class_name, function_name, parameter_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_CLASS_PARAMETER(class_name, function_name, parameter_class_name, parameter_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_ENUM_PARAMETER(class_name, function_name, parameter_name, enum_name, script_enum_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_BOOL(result, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_FLOAT(result, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_STRING(result, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_INTEGER(result, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_INSTANCE(result, class_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_POINTER(result, class_name, description) |
#define | SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() |
#define | SCRIPT_END_CLASS_FUNCTION() |
#define | SCRIPT_BEGIN_CLASS_ATTRIBUTE_GETTER(class_name) |
#define | SCRIPT_SET_CLASS_ATTRIBUTE_FLOAT_GETTER(class_name, attribute_name, attribute_description) |
#define | SCRIPT_END_CLASS_ATTRIBUTES_GETTER(class_name) |
#define | SCRIPT_BEGIN_CLASS_ATTRIBUTE_SETTER(class_name) |
#define | SCRIPT_SET_CLASS_ATTRIBUTE_FLOAT_SETTER(class_name, attribute_name, attribute_description) |
#define | SCRIPT_END_CLASS_ATTRIBUTES_SETTER(class_name) |
#define | SCRIPT_BEGIN_CLASS_EXPOSE(class_name) |
#define | SCRIPT_EXPOSE_CONSTRUCTOR(class_name) SCRIPT_EXPOSE_FUNCTION(class_name, constructor) |
#define | SCRIPT_EXPOSE_DESTRUCTOR(class_name) SCRIPT_EXPOSE_FUNCTION(class_name, destructor) |
#define | SCRIPT_EXPOSE_ATTRIBUTE_GETTER(class_name) SCRIPT_EXPOSE_FUNCTION(class_name, _get) |
#define | SCRIPT_EXPOSE_ATTRIBUTE_SETTER(class_name) SCRIPT_EXPOSE_FUNCTION(class_name, _set) |
#define | SCRIPT_EXPOSE_FUNCTION(class_name, function_name) |
#define | SCRIPT_END_CLASS_EXPOSE() |
#define | SCRIPT_END_CLASS() }; \ |
#define | SCRIPT_BEGIN_ENUMS() |
#define | SCRIPT_BEGIN_ENUM(enum_name, description) |
#define | SCRIPT_SET_ENUM_ITEM(enum_item_name, enum_item_value, description) |
#define | SCRIPT_END_ENUM() sq_newslot(squirrel_vm, -3, false); |
#define | SCRIPT_END_ENUMS() |
#define | SCRIPT_BEGIN_VARIABLES() |
#define | SCRIPT_BIND_VARIABLE(variable, variable_name, variable_type, description) |
#define | SCRIPT_END_VARIABLES() |
#define | SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_BOOL(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_BOOL(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_BOOL(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_FLOAT(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_FLOAT(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_FLOAT(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_STRING(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_STRING(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_STRING(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_INTEGER(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_INTEGER(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_INTEGER(class_name, attribute_name, attribute_description, class_description, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_CLASS_POINTER(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_CLASS_INSTANCE(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_CLASS(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_CLASS_POINTER(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_CLASS_INSTANCE(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) |
#define | SCRIPT_CLASS_FUNCTION_BOOL_PARAMS1_STRING(class_name, function_name, function_description, param1_name, param1_description) |
#define | SCRIPT_CLASS_FUNCTION_CLASS_POINTER_PARAMS1_STRING(class_name, function_name, function_description, param1_name, param1_description, return_class_name, return_class_description) |
#define | SCRIPT_CLASS_FUNCTION_CLASS_INSTANCE_PARAMS1_STRING(class_name, function_name, function_description, param1_name, param1_description, return_class_name, return_class_description) |
#define | SCRIPT_CLASS_FUNCTION_VOID_PARAMS1_STRING(class_name, function_name, function_description, param1_name, param1_description) |
#define | SCRIPT_CLASS_FUNCTION_VOID_PARAMS1_FLOAT(class_name, function_name, function_description, param1_name, param1_description) |
#define | SCRIPT_CLASS_FUNCTION_VOID_PARAMS1_CLASS(class_name, function_name, function_description, param1_class_name, param1_name, param1_description) |
#define SCRIPT_BEGIN_CLASS | ( | class_name, | |||
description | ) |
Value:
class class_name##Proxy \ { \ public: \
#define SCRIPT_BEGIN_CLASS_ATTRIBUTE_GETTER | ( | class_name | ) |
Value:
static int _get(HSQUIRRELVM squirrel_vm) \ { \ int arguments = sq_gettop(squirrel_vm); \ if (arguments != 2) \ return sq_throwerror(squirrel_vm, "Wrong number of arguments in " #class_name "::_get"); \ class_name * self; \ if (SQ_FAILED(sq_getinstanceup(squirrel_vm, 1, (SQUserPointer *)&self, 0))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve this pointer in " #class_name "::_get"); \ if (!self) \ return sq_throwerror(squirrel_vm, "this pointer is null in " #class_name "::_get"); \ const char * attribute = NULL; \ if (SQ_FAILED(sq_getstring(squirrel_vm, 2, &attribute))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve attribute name in " #class_name "::_get"); \
#define SCRIPT_BEGIN_CLASS_ATTRIBUTE_SETTER | ( | class_name | ) |
Value:
static int _set(HSQUIRRELVM squirrel_vm) \ { \ int arguments = sq_gettop(squirrel_vm); \ if (arguments != 3) \ return sq_throwerror(squirrel_vm, "Wrong number of arguments in " #class_name "::_set"); \ class_name * self; \ if (SQ_FAILED(sq_getinstanceup(squirrel_vm, 1, (SQUserPointer *)&self, 0))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve this pointer in " #class_name "::_set"); \ if (!self) \ return sq_throwerror(squirrel_vm, "this pointer is null in " #class_name "::_set"); \ const char * attribute = NULL; \ if (SQ_FAILED(sq_getstring(squirrel_vm, 2, &attribute))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve attribute name in " #class_name "::_set"); \
#define SCRIPT_BEGIN_CLASS_CONSTRUCTOR | ( | class_name, | |||
argument_count | ) |
Value:
static int destructor(SQUserPointer object, int size) \ { \ delete static_cast<class_name *>(object); \ return 1; \ } \ \ static int constructor(HSQUIRRELVM squirrel_vm) \ { \ int current_argument = 1; \ \ int arguments = sq_gettop(squirrel_vm); \ \ if (arguments != (argument_count + 1)) \ return sq_throwerror(squirrel_vm, "Wrong number of arguments in " #class_name " constructor"); \
#define SCRIPT_BEGIN_CLASS_EXPOSE | ( | class_name | ) |
Value:
static void expose(HSQUIRRELVM squirrel_vm) \ { \ sq_pushstring(squirrel_vm, #class_name, -1); \ sq_newclass(squirrel_vm, false);
#define SCRIPT_BEGIN_CLASS_FUNCTION | ( | class_name, | |||
function_name, | |||||
argument_count, | |||||
description | ) |
Value:
static int function_name(HSQUIRRELVM squirrel_vm) \ { \ int current_argument = 0; \ \ int arguments = sq_gettop(squirrel_vm); \ if (arguments != (argument_count + 1)) \ return sq_throwerror(squirrel_vm, "Wrong number of arguments in " #class_name "::" #function_name); \ \ class_name * self; \ if (SQ_FAILED(sq_getinstanceup(squirrel_vm, ++current_argument, reinterpret_cast<SQUserPointer *>(&self), NULL))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve this pointer in " #class_name "::" #function_name); \ if (!self) \ return sq_throwerror(squirrel_vm, "this pointer is null in " #class_name "::" #function_name); \
#define SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS | ( | ) |
#define SCRIPT_BEGIN_CLASSES | ( | ) |
#define SCRIPT_BEGIN_CLASSES_EXPOSITION | ( | ) |
#define SCRIPT_BEGIN_CODE | ( | ) |
#define SCRIPT_BEGIN_ENUM | ( | enum_name, | |||
description | ) |
Value:
sq_pushstring(squirrel_vm, #enum_name, -1); \ sq_newtable(squirrel_vm);
#define SCRIPT_BEGIN_ENUMS | ( | ) |
#define SCRIPT_BEGIN_ENUMS_EXPOSITION | ( | ) |
#define SCRIPT_BEGIN_EXPOSITION | ( | category_name | ) |
#define SCRIPT_BEGIN_VARIABLES | ( | ) |
#define SCRIPT_BEGIN_VARIABLES_EXPOSITION | ( | ) |
#define SCRIPT_BIND_VARIABLE | ( | variable, | |||
variable_name, | |||||
variable_type, | |||||
description | ) |
Value:
sq_pushstring(squirrel_vm, #variable_name, -1); \ \ sq_pushroottable(squirrel_vm); \ sq_pushstring(squirrel_vm, #variable_type, -1 ); \ if (SQ_FAILED(sq_get(squirrel_vm, -2))) \ { \ ScriptManager::squirrelPrint(squirrel_vm, "Error binding variable " #variable_name ": Failed to get class " #variable_type "."); \ return; \ } \ if (SQ_FAILED(sq_createinstance(squirrel_vm, -1))) \ { \ ScriptManager::squirrelPrint(squirrel_vm, "Error binding variable " #variable_name ": Failed to create Squirrel instance of class " #variable_type "."); \ return; \ } \ sq_remove(squirrel_vm, -3); \ sq_remove(squirrel_vm, -2); \ if (SQ_FAILED(sq_setinstanceup(squirrel_vm, -1, variable))) \ { \ ScriptManager::squirrelPrint(squirrel_vm, "Error binding variable " #variable_name ": Failed to set Squirrel pointer to instance of class " #variable_type "."); \ return; \ } \ \ if (SQ_FAILED(sq_newslot(squirrel_vm, -3, SQFalse))) \ { \ return; \ }
#define SCRIPT_CLASS_FUNCTION_BOOL_PARAMS1_STRING | ( | class_name, | |||
function_name, | |||||
function_description, | |||||
param1_name, | |||||
param1_description | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, 1, function_description) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER(class_name, function_name, param1_name, param1_description) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ bool result = self->function_name(param1_name); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_BOOL(result, true in case of success; false otherwise.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_CLASS_INSTANCE_PARAMS1_STRING | ( | class_name, | |||
function_name, | |||||
function_description, | |||||
param1_name, | |||||
param1_description, | |||||
return_class_name, | |||||
return_class_description | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, 1, function_description) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER(class_name, function_name, param1_name, param1_description) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ return_class_name * object = self->function_name(param1_name); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_INSTANCE(object, return_class_name, Requested return_class_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_CLASS_POINTER_PARAMS1_STRING | ( | class_name, | |||
function_name, | |||||
function_description, | |||||
param1_name, | |||||
param1_description, | |||||
return_class_name, | |||||
return_class_description | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, 1, function_description) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER(class_name, function_name, param1_name, param1_description) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ return_class_name * object = self->function_name(param1_name); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_POINTER(object, return_class_name, Requested return_class_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_BOOL | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, get##attribute_name, 0, Get the attribute_description of the class_description.) \ SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ const bool attribute_value = self->get##attribute_name(); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_BOOL(attribute_value, Current value of the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_CLASS_INSTANCE | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_class_name, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, get##attribute_name, 0, Get the attribute_description of the class_description.) \ SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ const attribute_class_name & attribute_value = self->get##attribute_name(); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_INSTANCE(const_cast<attribute_class_name *>(&attribute_value), attribute_class_name, Current value of the attribute_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_CLASS_POINTER | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_class_name, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, get##attribute_name, 0, Get the attribute_description of the class_description.) \ SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ const attribute_class_name & attribute_value = self->get##attribute_name(); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_POINTER(const_cast<attribute_class_name *>(&attribute_value), attribute_class_name, Current value of the attribute_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_FLOAT | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, get##attribute_name, 0, Get the attribute_description of the class_description.) \ SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ const float attribute_value = self->get##attribute_name(); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_FLOAT(attribute_value, Current value of the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_INTEGER | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, get##attribute_name, 0, Get the attribute_description of the class_description.) \ SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ int attribute_value = self->get##attribute_name(); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_INTEGER(attribute_value, Current value of the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_STRING | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, get##attribute_name, 0, Get the attribute_description of the class_description.) \ SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ const std::string & attribute_value = self->get##attribute_name(); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_STRING(attribute_value.c_str(), Current value of the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_BOOL | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_BOOL(class_name, attribute_name, attribute_description, class_description, attribute_value) \ SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_BOOL(class_name, attribute_name, attribute_description, class_description, attribute_value)
#define SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_CLASS_INSTANCE | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_class_name, | |||||
attribute_value | ) |
Value:
SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_CLASS_INSTANCE(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) \ SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_CLASS(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value)
#define SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_CLASS_POINTER | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_class_name, | |||||
attribute_value | ) |
Value:
SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_CLASS_POINTER(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value) \ SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_CLASS(class_name, attribute_name, attribute_description, class_description, attribute_class_name, attribute_value)
#define SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_FLOAT | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_FLOAT(class_name, attribute_name, attribute_description, class_description, attribute_value) \ SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_FLOAT(class_name, attribute_name, attribute_description, class_description, attribute_value)
#define SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_INTEGER | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_INTEGER(class_name, attribute_name, attribute_description, class_description, attribute_value) \ SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_INTEGER(class_name, attribute_name, attribute_description, class_description, attribute_value)
#define SCRIPT_CLASS_FUNCTION_GET_SET_ATTRIBUTE_STRING | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_CLASS_FUNCTION_GET_ATTRIBUTE_STRING(class_name, attribute_name, attribute_description, class_description, attribute_value) \ SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_STRING(class_name, attribute_name, attribute_description, class_description, attribute_value)
#define SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_BOOL | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, set##attribute_name, 1, Set the attribute_description of the class_description.) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_BOOL_PARAMETER(class_name, set##attribute_name, attribute_value, New value for the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->set##attribute_name(attribute_value); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_CLASS | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_class_name, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, set##attribute_name, 1, Set the attribute_description of the class_description.) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_CLASS_PARAMETER(class_name, set##attribute_name, attribute_class_name, attribute_value, New falue for the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->set##attribute_name(*attribute_value); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_FLOAT | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, set##attribute_name, 1, Set the attribute_description of the class_description.) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_FLOAT_PARAMETER(class_name, set##attribute_name, attribute_value, New falue for the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->set##attribute_name(attribute_value); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_INTEGER | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, set##attribute_name, 1, Set the attribute_description of the class_description.) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_INTEGER_PARAMETER(class_name, set##attribute_name, attribute_value, New falue for the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->set##attribute_name(attribute_value); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_SET_ATTRIBUTE_STRING | ( | class_name, | |||
attribute_name, | |||||
attribute_description, | |||||
class_description, | |||||
attribute_value | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, set##attribute_name, 1, Set the attribute_description of the class_description.) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER(class_name, set##attribute_name, attribute_value, New falue for the attribute_description of the class_description.) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->set##attribute_name(attribute_value); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_VOID_PARAMS1_CLASS | ( | class_name, | |||
function_name, | |||||
function_description, | |||||
param1_class_name, | |||||
param1_name, | |||||
param1_description | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, 1, function_description) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_CLASS_PARAMETER(class_name, function_name, param1_class_name, param1_name, param1_description) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->function_name(*param1_name); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_VOID_PARAMS1_FLOAT | ( | class_name, | |||
function_name, | |||||
function_description, | |||||
param1_name, | |||||
param1_description | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, 1, function_description) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_FLOAT_PARAMETER(class_name, function_name, param1_name, param1_description) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->function_name(param1_name); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_CLASS_FUNCTION_VOID_PARAMS1_STRING | ( | class_name, | |||
function_name, | |||||
function_description, | |||||
param1_name, | |||||
param1_description | ) |
Value:
SCRIPT_BEGIN_CLASS_FUNCTION(class_name, function_name, 1, function_description) \ SCRIPT_BEGIN_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER(class_name, function_name, param1_name, param1_description) \ SCRIPT_END_CLASS_FUNCTION_PARAMETERS() \ SCRIPT_BEGIN_CODE() \ self->function_name(param1_name); \ SCRIPT_END_CODE() \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_END_CLASS | ( | ) | }; \ |
#define SCRIPT_END_CLASS_ATTRIBUTES_GETTER | ( | class_name | ) |
Value:
return sq_throwerror(squirrel_vm, "Error: unknow attribute in " #class_name "::_get"); \ }
#define SCRIPT_END_CLASS_ATTRIBUTES_SETTER | ( | class_name | ) |
Value:
return sq_throwerror(squirrel_vm, "Error: unknow attribute in " #class_name "::_set"); \ }
#define SCRIPT_END_CLASS_CONSTRUCTOR | ( | class_name, | |||
... | ) |
Value:
class_name * object = new class_name(__VA_ARGS__); \ if (SQ_FAILED(sq_setinstanceup(squirrel_vm, 1, object))) \ return sq_throwerror(squirrel_vm, "Error in " #class_name " constructor"); \ sq_setreleasehook(squirrel_vm, 1, destructor); \ SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE() \ SCRIPT_END_CLASS_FUNCTION()
#define SCRIPT_END_CLASS_EXPOSE | ( | ) |
Value:
sq_newslot(squirrel_vm, -3, false); \
}
#define SCRIPT_END_CLASS_FUNCTION | ( | ) |
Value:
return 0; \
}
#define SCRIPT_END_CLASS_FUNCTION_PARAMETERS | ( | ) |
#define SCRIPT_END_CLASSES | ( | ) |
#define SCRIPT_END_CLASSES_EXPOSITION | ( | ) |
#define SCRIPT_END_CODE | ( | ) |
#define SCRIPT_END_ENUM | ( | ) | sq_newslot(squirrel_vm, -3, false); |
#define SCRIPT_END_ENUMS | ( | ) |
#define SCRIPT_END_ENUMS_EXPOSITION | ( | ) |
#define SCRIPT_END_EXPOSITION | ( | ) |
#define SCRIPT_END_VARIABLES | ( | ) |
#define SCRIPT_END_VARIABLES_EXPOSITION | ( | ) |
#define SCRIPT_EXPOSE_ATTRIBUTE_GETTER | ( | class_name | ) | SCRIPT_EXPOSE_FUNCTION(class_name, _get) |
#define SCRIPT_EXPOSE_ATTRIBUTE_SETTER | ( | class_name | ) | SCRIPT_EXPOSE_FUNCTION(class_name, _set) |
#define SCRIPT_EXPOSE_CLASS | ( | class_name | ) | class_name##Proxy::expose(squirrel_vm); |
#define SCRIPT_EXPOSE_CONSTRUCTOR | ( | class_name | ) | SCRIPT_EXPOSE_FUNCTION(class_name, constructor) |
#define SCRIPT_EXPOSE_DESTRUCTOR | ( | class_name | ) | SCRIPT_EXPOSE_FUNCTION(class_name, destructor) |
#define SCRIPT_EXPOSE_ENUM | ( | enum_name | ) |
#define SCRIPT_EXPOSE_FUNCTION | ( | class_name, | |||
function_name | ) |
Value:
sq_pushstring(squirrel_vm, #function_name, -1); \
sq_newclosure(squirrel_vm, & class_name##Proxy::function_name, 0); \
sq_newslot(squirrel_vm, -3, false);
#define SCRIPT_EXPOSE_VARIABLE | ( | variable_name | ) |
#define SCRIPT_SET_CLASS_ATTRIBUTE_FLOAT_GETTER | ( | class_name, | |||
attribute_name, | |||||
attribute_description | ) |
Value:
if (strcmp(attribute, #attribute_name) == 0) \ { \ sq_pushfloat(squirrel_vm, self->attribute_name); \ return 1; \ }
#define SCRIPT_SET_CLASS_ATTRIBUTE_FLOAT_SETTER | ( | class_name, | |||
attribute_name, | |||||
attribute_description | ) |
Value:
if (strcmp(attribute, #attribute_name) == 0) \ { \ float attribute_value; \ if (SQ_FAILED(sq_getfloat(squirrel_vm, 3, &attribute_value))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve attribute value in " #class_name "::_set"); \ self->attribute_name = attribute_value; \ sq_pushfloat(squirrel_vm, attribute_value); \ return 1; \ }
#define SCRIPT_SET_CLASS_FUNCTION_BOOL_PARAMETER | ( | class_name, | |||
function_name, | |||||
parameter_name, | |||||
description | ) |
Value:
SQBool parameter_name; \ if (SQ_FAILED(sq_getbool(squirrel_vm, ++current_argument, ¶meter_name))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve bool parameter in " #class_name "::" #function_name); \
#define SCRIPT_SET_CLASS_FUNCTION_CLASS_PARAMETER | ( | class_name, | |||
function_name, | |||||
parameter_class_name, | |||||
parameter_name, | |||||
description | ) |
Value:
parameter_class_name * parameter_name; \ if (SQ_FAILED(sq_getinstanceup(squirrel_vm, ++current_argument, (SQUserPointer *)¶meter_name, NULL))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve class (" #parameter_class_name ") parameter in " #class_name "::" #function_name); \
#define SCRIPT_SET_CLASS_FUNCTION_ENUM_PARAMETER | ( | class_name, | |||
function_name, | |||||
parameter_name, | |||||
enum_name, | |||||
script_enum_name, | |||||
description | ) |
Value:
enum_name parameter_name; \ if (SQ_FAILED(sq_getinteger(squirrel_vm, ++current_argument, reinterpret_cast<int *>(¶meter_name)))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve enum (" #enum_name ") parameter in " #class_name "::" #function_name); \
#define SCRIPT_SET_CLASS_FUNCTION_FLOAT_PARAMETER | ( | class_name, | |||
function_name, | |||||
parameter_name, | |||||
description | ) |
Value:
float parameter_name; \ if (SQ_FAILED(sq_getfloat(squirrel_vm, ++current_argument, ¶meter_name))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve float parameter in " #class_name "::" #function_name); \
#define SCRIPT_SET_CLASS_FUNCTION_INTEGER_PARAMETER | ( | class_name, | |||
function_name, | |||||
parameter_name, | |||||
description | ) |
Value:
int parameter_name; \ if (SQ_FAILED(sq_getinteger(squirrel_vm, ++current_argument, ¶meter_name))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve integer parameter in " #class_name "::" #function_name); \
#define SCRIPT_SET_CLASS_FUNCTION_NO_PARAMETERS | ( | ) |
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_BOOL | ( | result, | |||
description | ) |
Value:
sq_pushbool(squirrel_vm, result); \
return 1;
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_INSTANCE | ( | result, | |||
class_name, | |||||
description | ) |
Value:
class_name * object = new class_name(*result); \ sq_pushroottable(squirrel_vm); \ sq_pushstring(squirrel_vm, #class_name, -1 ); \ if (SQ_FAILED(sq_get(squirrel_vm, -2))) \ return sq_throwerror(squirrel_vm, "Failed to get class " #class_name); \ if (SQ_FAILED(sq_createinstance(squirrel_vm, -1))) \ return sq_throwerror(squirrel_vm, "Failed to create Squirrel instance of class " #class_name); \ sq_remove(squirrel_vm, -3); \ sq_remove(squirrel_vm, -2); \ if (SQ_FAILED(sq_setinstanceup(squirrel_vm, -1, object))) \ return sq_throwerror(squirrel_vm, "Failed to set Squirrel pointer to instance of class " #class_name); \ sq_setreleasehook(squirrel_vm, -1, class_name##Proxy::destructor); \ return 1;
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_CLASS_POINTER | ( | result, | |||
class_name, | |||||
description | ) |
Value:
sq_pushroottable(squirrel_vm); \ sq_pushstring(squirrel_vm, #class_name, -1 ); \ if (SQ_FAILED(sq_get(squirrel_vm, -2))) \ return sq_throwerror(squirrel_vm, "Failed to get class " #class_name); \ if (SQ_FAILED(sq_createinstance(squirrel_vm, -1))) \ return sq_throwerror(squirrel_vm, "Failed to create Squirrel instance of class " #class_name); \ sq_remove(squirrel_vm, -3); \ sq_remove(squirrel_vm, -2); \ if (SQ_FAILED(sq_setinstanceup(squirrel_vm, -1, result))) \ return sq_throwerror(squirrel_vm, "Failed to set Squirrel pointer to instance of class " #class_name); \ return 1;
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_FLOAT | ( | result, | |||
description | ) |
Value:
sq_pushfloat(squirrel_vm, result); \
return 1;
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_INTEGER | ( | result, | |||
description | ) |
Value:
sq_pushinteger(squirrel_vm, result); \
return 1;
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_NONE | ( | ) |
#define SCRIPT_SET_CLASS_FUNCTION_RETURN_STRING | ( | result, | |||
description | ) |
Value:
sq_pushstring(squirrel_vm, result, -1); \
return 1;
#define SCRIPT_SET_CLASS_FUNCTION_STRING_PARAMETER | ( | class_name, | |||
function_name, | |||||
parameter_name, | |||||
description | ) |
Value:
const char * parameter_name = NULL; \ if (SQ_FAILED(sq_getstring(squirrel_vm, ++current_argument, ¶meter_name))) \ return sq_throwerror(squirrel_vm, "Failed to retrieve string parameter in " #class_name "::" #function_name); \
#define SCRIPT_SET_CLASS_NO_CONSTRUCTOR | ( | class_name | ) |
Value:
static int constructor(HSQUIRRELVM squirrel_vm) \ { \ return sq_throwerror(squirrel_vm, "Class " #class_name " cannot be instanciated."); \ }
#define SCRIPT_SET_ENUM_ITEM | ( | enum_item_name, | |||
enum_item_value, | |||||
description | ) |
Value:
sq_pushstring(squirrel_vm, #enum_item_name, -1); \
sq_pushinteger(squirrel_vm, enum_item_value); \
sq_newslot(squirrel_vm, -3, false);
Copyright © 2008 by Sebastien Frippiat
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:32 2008