/*************************************************************************/ /* variant_op.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ /* "Software"), to deal in the Software without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of the Software, and to */ /* permit persons to whom the Software is furnished to do so, subject to */ /* the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be */ /* included in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "variant_op.h" typedef void (*VariantEvaluatorFunction)(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid); static Variant::Type operator_return_type_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; static VariantEvaluatorFunction operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; static Variant::ValidatedOperatorEvaluator validated_operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; static Variant::PTROperatorEvaluator ptr_operator_evaluator_table[Variant::OP_MAX][Variant::VARIANT_MAX][Variant::VARIANT_MAX]; template void register_op(Variant::Operator p_op, Variant::Type p_type_a, Variant::Type p_type_b) { operator_return_type_table[p_op][p_type_a][p_type_b] = T::get_return_type(); operator_evaluator_table[p_op][p_type_a][p_type_b] = T::evaluate; validated_operator_evaluator_table[p_op][p_type_a][p_type_b] = T::validated_evaluate; ptr_operator_evaluator_table[p_op][p_type_a][p_type_b] = T::ptr_evaluate; } // Special cases that can't be done otherwise because of the forced casting to float. template <> class OperatorEvaluatorMul { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const Vector2i &a = *VariantGetInternalPtr::get_ptr(&p_left); const double &b = *VariantGetInternalPtr::get_ptr(&p_right); *r_ret = Vector2(a.x, a.y) * b; r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr::get_ptr(r_ret) = Vector2(VariantGetInternalPtr::get_ptr(left)->x, VariantGetInternalPtr::get_ptr(left)->y) * *VariantGetInternalPtr::get_ptr(right); } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg::encode(Vector2(PtrToArg::convert(left).x, PtrToArg::convert(left).y) * PtrToArg::convert(right), r_ret); } static Variant::Type get_return_type() { return GetTypeInfo::VARIANT_TYPE; } }; template <> class OperatorEvaluatorMul { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const Vector2i &a = *VariantGetInternalPtr::get_ptr(&p_right); const double &b = *VariantGetInternalPtr::get_ptr(&p_left); *r_ret = Vector2(a.x, a.y) * b; r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr::get_ptr(r_ret) = Vector2(VariantGetInternalPtr::get_ptr(right)->x, VariantGetInternalPtr::get_ptr(right)->y) * *VariantGetInternalPtr::get_ptr(left); } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg::encode(Vector2(PtrToArg::convert(right).x, PtrToArg::convert(right).y) * PtrToArg::convert(left), r_ret); } static Variant::Type get_return_type() { return GetTypeInfo::VARIANT_TYPE; } }; template <> class OperatorEvaluatorDivNZ { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const Vector2i &a = *VariantGetInternalPtr::get_ptr(&p_left); const double &b = *VariantGetInternalPtr::get_ptr(&p_right); if (unlikely(b == 0)) { r_valid = false; *r_ret = "Division by zero error"; return; } *r_ret = Vector2(a.x, a.y) / b; r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr::get_ptr(r_ret) = Vector2(VariantGetInternalPtr::get_ptr(left)->x, VariantGetInternalPtr::get_ptr(left)->y) / *VariantGetInternalPtr::get_ptr(right); } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg::encode(Vector2(PtrToArg::convert(left).x, PtrToArg::convert(left).y) / PtrToArg::convert(right), r_ret); } static Variant::Type get_return_type() { return GetTypeInfo::VARIANT_TYPE; } }; template <> class OperatorEvaluatorMul { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const Vector3i &a = *VariantGetInternalPtr::get_ptr(&p_left); const double &b = *VariantGetInternalPtr::get_ptr(&p_right); *r_ret = Vector3(a.x, a.y, a.z) * b; r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr::get_ptr(r_ret) = Vector3(VariantGetInternalPtr::get_ptr(left)->x, VariantGetInternalPtr::get_ptr(left)->y, VariantGetInternalPtr::get_ptr(left)->z) * *VariantGetInternalPtr::get_ptr(right); } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg::encode(Vector3(PtrToArg::convert(left).x, PtrToArg::convert(left).y, PtrToArg::convert(left).z) * PtrToArg::convert(right), r_ret); } static Variant::Type get_return_type() { return GetTypeInfo::VARIANT_TYPE; } }; template <> class OperatorEvaluatorMul { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const Vector3i &a = *VariantGetInternalPtr::get_ptr(&p_right); const double &b = *VariantGetInternalPtr::get_ptr(&p_left); *r_ret = Vector3(a.x, a.y, a.z) * b; r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr::get_ptr(r_ret) = Vector3(VariantGetInternalPtr::get_ptr(right)->x, VariantGetInternalPtr::get_ptr(right)->y, VariantGetInternalPtr::get_ptr(right)->z) * *VariantGetInternalPtr::get_ptr(left); } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg::encode(Vector3(PtrToArg::convert(right).x, PtrToArg::convert(right).y, PtrToArg::convert(right).z) * PtrToArg::convert(left), r_ret); } static Variant::Type get_return_type() { return GetTypeInfo::VARIANT_TYPE; } }; template <> class OperatorEvaluatorDivNZ { public: static void evaluate(const Variant &p_left, const Variant &p_right, Variant *r_ret, bool &r_valid) { const Vector3i &a = *VariantGetInternalPtr::get_ptr(&p_left); const double &b = *VariantGetInternalPtr::get_ptr(&p_right); if (unlikely(b == 0)) { r_valid = false; *r_ret = "Division by zero error"; return; } *r_ret = Vector3(a.x, a.y, a.z) / b; r_valid = true; } static inline void validated_evaluate(const Variant *left, const Variant *right, Variant *r_ret) { *VariantGetInternalPtr::get_ptr(r_ret) = Vector3(VariantGetInternalPtr::get_ptr(left)->x, VariantGetInternalPtr::get_ptr(left)->y, VariantGetInternalPtr::get_ptr(left)->z) / *VariantGetInternalPtr::get_ptr(right); } static void ptr_evaluate(const void *left, const void *right, void *r_ret) { PtrToArg::encode(Vector3(PtrToArg::convert(left).x, PtrToArg::convert(left).y, PtrToArg::convert(left).z) / PtrToArg::convert(right), r_ret); } static Variant::Type get_return_type() { return GetTypeInfo::VARIANT_TYPE; } }; void Variant::_register_variant_operators() { memset(operator_return_type_table, 0, sizeof(operator_return_type_table)); memset(operator_evaluator_table, 0, sizeof(operator_evaluator_table)); memset(validated_operator_evaluator_table, 0, sizeof(validated_operator_evaluator_table)); memset(ptr_operator_evaluator_table, 0, sizeof(ptr_operator_evaluator_table)); register_op>(Variant::OP_ADD, Variant::INT, Variant::INT); register_op>(Variant::OP_ADD, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_ADD, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_ADD, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_ADD, Variant::STRING, Variant::STRING); register_op>(Variant::OP_ADD, Variant::INT, Variant::STRING); register_op>(Variant::OP_ADD, Variant::STRING, Variant::INT); register_op>(Variant::OP_ADD, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_ADD, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_ADD, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_ADD, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_ADD, Variant::QUATERNION, Variant::QUATERNION); register_op>(Variant::OP_ADD, Variant::COLOR, Variant::COLOR); register_op(Variant::OP_ADD, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_INT32_ARRAY, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_INT64_ARRAY, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_FLOAT32_ARRAY, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_FLOAT64_ARRAY, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_STRING_ARRAY, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_VECTOR2_ARRAY, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_ADD, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY); register_op>(Variant::OP_SUBTRACT, Variant::INT, Variant::INT); register_op>(Variant::OP_SUBTRACT, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_SUBTRACT, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_SUBTRACT, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_SUBTRACT, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_SUBTRACT, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_SUBTRACT, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_SUBTRACT, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_SUBTRACT, Variant::QUATERNION, Variant::QUATERNION); register_op>(Variant::OP_SUBTRACT, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR2); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR2I); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR3); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::VECTOR3I); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR2); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR2I); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR3); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::VECTOR3I); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2I, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2I, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::QUATERNION); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::TRANSFORM2D); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::VECTOR2); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR2, Variant::TRANSFORM2D); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::RECT2); register_op>(Variant::OP_MULTIPLY, Variant::RECT2, Variant::TRANSFORM2D); register_op, Transform2D, Vector>>(Variant::OP_MULTIPLY, Variant::TRANSFORM2D, Variant::PACKED_VECTOR2_ARRAY); register_op, Vector, Transform2D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR2_ARRAY, Variant::TRANSFORM2D); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::TRANSFORM3D); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::VECTOR3); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::TRANSFORM3D); register_op>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::AABB); register_op>(Variant::OP_MULTIPLY, Variant::AABB, Variant::TRANSFORM3D); register_op, Transform3D, Vector>>(Variant::OP_MULTIPLY, Variant::TRANSFORM3D, Variant::PACKED_VECTOR3_ARRAY); register_op, Vector, Transform3D>>(Variant::OP_MULTIPLY, Variant::PACKED_VECTOR3_ARRAY, Variant::TRANSFORM3D); register_op>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::BASIS); register_op>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::VECTOR3); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::BASIS); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::QUATERNION); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::QUATERNION); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::QUATERNION); register_op>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::VECTOR3); register_op>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::QUATERNION); register_op>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::INT); register_op>(Variant::OP_MULTIPLY, Variant::INT, Variant::COLOR); register_op>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::FLOAT); register_op>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::COLOR); register_op>(Variant::OP_DIVIDE, Variant::INT, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2I, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2I, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR2, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_DIVIDE, Variant::VECTOR3, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR3, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::QUATERNION, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::QUATERNION, Variant::INT); register_op>(Variant::OP_DIVIDE, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_DIVIDE, Variant::COLOR, Variant::FLOAT); register_op>(Variant::OP_DIVIDE, Variant::COLOR, Variant::INT); register_op>(Variant::OP_MODULE, Variant::INT, Variant::INT); register_op>(Variant::OP_MODULE, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_MODULE, Variant::VECTOR2I, Variant::INT); register_op>(Variant::OP_MODULE, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_MODULE, Variant::VECTOR3I, Variant::INT); register_op(Variant::OP_MODULE, Variant::STRING, Variant::NIL); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::BOOL); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::INT); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::FLOAT); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::STRING); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR2); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR2I); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::RECT2); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::RECT2I); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR3); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR3I); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM2D); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PLANE); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::QUATERNION); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::AABB); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::BASIS); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM3D); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::COLOR); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::STRING_NAME); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::NODE_PATH); register_op(Variant::OP_MODULE, Variant::STRING, Variant::OBJECT); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::CALLABLE); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::SIGNAL); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::DICTIONARY); register_op(Variant::OP_MODULE, Variant::STRING, Variant::ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_MODULE, Variant::STRING, Variant::PACKED_COLOR_ARRAY); register_op>(Variant::OP_NEGATE, Variant::INT, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::FLOAT, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::VECTOR2, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::VECTOR2I, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::VECTOR3, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::VECTOR3I, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::QUATERNION, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::PLANE, Variant::NIL); register_op>(Variant::OP_NEGATE, Variant::COLOR, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::INT, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::FLOAT, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::VECTOR2, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::VECTOR2I, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::VECTOR3, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::VECTOR3I, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::QUATERNION, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::PLANE, Variant::NIL); register_op>(Variant::OP_POSITIVE, Variant::COLOR, Variant::NIL); register_op>(Variant::OP_SHIFT_LEFT, Variant::INT, Variant::INT); register_op>(Variant::OP_SHIFT_RIGHT, Variant::INT, Variant::INT); register_op>(Variant::OP_BIT_OR, Variant::INT, Variant::INT); register_op>(Variant::OP_BIT_AND, Variant::INT, Variant::INT); register_op>(Variant::OP_BIT_XOR, Variant::INT, Variant::INT); register_op>(Variant::OP_BIT_NEGATE, Variant::INT, Variant::NIL); register_op>(Variant::OP_BIT_NEGATE, Variant::INT, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::BOOL, Variant::BOOL); register_op>(Variant::OP_EQUAL, Variant::INT, Variant::INT); register_op>(Variant::OP_EQUAL, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_EQUAL, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_EQUAL, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_EQUAL, Variant::STRING, Variant::STRING); register_op>(Variant::OP_EQUAL, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_EQUAL, Variant::RECT2, Variant::RECT2); register_op>(Variant::OP_EQUAL, Variant::RECT2I, Variant::RECT2I); register_op>(Variant::OP_EQUAL, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_EQUAL, Variant::TRANSFORM2D, Variant::TRANSFORM2D); register_op>(Variant::OP_EQUAL, Variant::PLANE, Variant::PLANE); register_op>(Variant::OP_EQUAL, Variant::QUATERNION, Variant::QUATERNION); register_op>(Variant::OP_EQUAL, Variant::AABB, Variant::AABB); register_op>(Variant::OP_EQUAL, Variant::BASIS, Variant::BASIS); register_op>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D); register_op>(Variant::OP_EQUAL, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING); register_op>(Variant::OP_EQUAL, Variant::STRING, Variant::STRING_NAME); register_op>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME); register_op>(Variant::OP_EQUAL, Variant::NODE_PATH, Variant::NODE_PATH); register_op>(Variant::OP_EQUAL, Variant::RID, Variant::RID); register_op(Variant::OP_EQUAL, Variant::OBJECT, Variant::OBJECT); register_op(Variant::OP_EQUAL, Variant::OBJECT, Variant::NIL); register_op(Variant::OP_EQUAL, Variant::NIL, Variant::OBJECT); register_op>(Variant::OP_EQUAL, Variant::CALLABLE, Variant::CALLABLE); register_op>(Variant::OP_EQUAL, Variant::SIGNAL, Variant::SIGNAL); register_op>(Variant::OP_EQUAL, Variant::DICTIONARY, Variant::DICTIONARY); register_op>(Variant::OP_EQUAL, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY); register_op>(Variant::OP_EQUAL, Variant::BOOL, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::INT, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::FLOAT, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::STRING, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::VECTOR2, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::VECTOR2I, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::RECT2, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::RECT2I, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::VECTOR3, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::VECTOR3I, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::TRANSFORM2D, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PLANE, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::QUATERNION, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::AABB, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::BASIS, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::COLOR, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::NODE_PATH, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::RID, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::CALLABLE, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::SIGNAL, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::DICTIONARY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::BOOL); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::INT); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::FLOAT); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::STRING); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR2); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR2I); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::RECT2); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::RECT2I); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR3); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::VECTOR3I); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::TRANSFORM2D); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PLANE); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::QUATERNION); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::AABB); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::BASIS); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::TRANSFORM3D); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::COLOR); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::STRING_NAME); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::NODE_PATH); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::RID); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::CALLABLE); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::SIGNAL); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::DICTIONARY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PACKED_COLOR_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::BOOL, Variant::BOOL); register_op>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::INT); register_op>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_NOT_EQUAL, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_NOT_EQUAL, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING, Variant::STRING); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_NOT_EQUAL, Variant::RECT2, Variant::RECT2); register_op>(Variant::OP_NOT_EQUAL, Variant::RECT2I, Variant::RECT2I); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM2D, Variant::TRANSFORM2D); register_op>(Variant::OP_NOT_EQUAL, Variant::PLANE, Variant::PLANE); register_op>(Variant::OP_NOT_EQUAL, Variant::QUATERNION, Variant::QUATERNION); register_op>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::AABB); register_op>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::BASIS); register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D); register_op>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::COLOR); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING, Variant::STRING_NAME); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME); register_op>(Variant::OP_NOT_EQUAL, Variant::NODE_PATH, Variant::NODE_PATH); register_op>(Variant::OP_NOT_EQUAL, Variant::RID, Variant::RID); register_op(Variant::OP_NOT_EQUAL, Variant::OBJECT, Variant::OBJECT); register_op(Variant::OP_NOT_EQUAL, Variant::OBJECT, Variant::NIL); register_op(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::OBJECT); register_op>(Variant::OP_NOT_EQUAL, Variant::CALLABLE, Variant::CALLABLE); register_op>(Variant::OP_NOT_EQUAL, Variant::SIGNAL, Variant::SIGNAL); register_op>(Variant::OP_NOT_EQUAL, Variant::DICTIONARY, Variant::DICTIONARY); register_op>(Variant::OP_NOT_EQUAL, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::PACKED_COLOR_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::BOOL, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::INT, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::FLOAT, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR2, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR2I, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::RECT2, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::RECT2I, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR3, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::VECTOR3I, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM2D, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PLANE, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::QUATERNION, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::NODE_PATH, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::RID, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::CALLABLE, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::SIGNAL, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::DICTIONARY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_BYTE_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT32_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_INT64_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT32_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_FLOAT64_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_STRING_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR2_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_VECTOR3_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::PACKED_COLOR_ARRAY, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::BOOL); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::INT); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::FLOAT); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::STRING); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR2); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR2I); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::RECT2); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::RECT2I); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR3); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::VECTOR3I); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::TRANSFORM2D); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PLANE); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::QUATERNION); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::AABB); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::BASIS); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::TRANSFORM3D); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::COLOR); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::STRING_NAME); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NODE_PATH); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::RID); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::CALLABLE); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::SIGNAL); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::DICTIONARY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PACKED_COLOR_ARRAY); register_op>(Variant::OP_LESS, Variant::BOOL, Variant::BOOL); register_op>(Variant::OP_LESS, Variant::INT, Variant::INT); register_op>(Variant::OP_LESS, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_LESS, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_LESS, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_LESS, Variant::STRING, Variant::STRING); register_op>(Variant::OP_LESS, Variant::STRING_NAME, Variant::STRING_NAME); register_op>(Variant::OP_LESS, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_LESS, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_LESS, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_LESS, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_LESS, Variant::RID, Variant::RID); register_op>(Variant::OP_LESS, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_LESS_EQUAL, Variant::INT, Variant::INT); register_op>(Variant::OP_LESS_EQUAL, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_LESS_EQUAL, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_LESS_EQUAL, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_LESS_EQUAL, Variant::STRING, Variant::STRING); register_op>(Variant::OP_LESS_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME); register_op>(Variant::OP_LESS_EQUAL, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_LESS_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_LESS_EQUAL, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_LESS_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_LESS_EQUAL, Variant::RID, Variant::RID); register_op>(Variant::OP_LESS_EQUAL, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_GREATER, Variant::BOOL, Variant::BOOL); register_op>(Variant::OP_GREATER, Variant::INT, Variant::INT); register_op>(Variant::OP_GREATER, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_GREATER, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_GREATER, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_GREATER, Variant::STRING, Variant::STRING); register_op>(Variant::OP_GREATER, Variant::STRING_NAME, Variant::STRING_NAME); register_op>(Variant::OP_GREATER, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_GREATER, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_GREATER, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_GREATER, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_GREATER, Variant::RID, Variant::RID); register_op>(Variant::OP_GREATER, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_GREATER_EQUAL, Variant::INT, Variant::INT); register_op>(Variant::OP_GREATER_EQUAL, Variant::INT, Variant::FLOAT); register_op>(Variant::OP_GREATER_EQUAL, Variant::FLOAT, Variant::INT); register_op>(Variant::OP_GREATER_EQUAL, Variant::FLOAT, Variant::FLOAT); register_op>(Variant::OP_GREATER_EQUAL, Variant::STRING, Variant::STRING); register_op>(Variant::OP_GREATER_EQUAL, Variant::STRING_NAME, Variant::STRING_NAME); register_op>(Variant::OP_GREATER_EQUAL, Variant::VECTOR2, Variant::VECTOR2); register_op>(Variant::OP_GREATER_EQUAL, Variant::VECTOR2I, Variant::VECTOR2I); register_op>(Variant::OP_GREATER_EQUAL, Variant::VECTOR3, Variant::VECTOR3); register_op>(Variant::OP_GREATER_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I); register_op>(Variant::OP_GREATER_EQUAL, Variant::RID, Variant::RID); register_op>(Variant::OP_GREATER_EQUAL, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_OR, Variant::NIL, Variant::NIL); // OR register_op(Variant::OP_OR, Variant::NIL, Variant::BOOL); register_op(Variant::OP_OR, Variant::BOOL, Variant::NIL); register_op(Variant::OP_OR, Variant::NIL, Variant::INT); register_op(Variant::OP_OR, Variant::INT, Variant::NIL); register_op(Variant::OP_OR, Variant::NIL, Variant::FLOAT); register_op(Variant::OP_OR, Variant::FLOAT, Variant::NIL); register_op(Variant::OP_OR, Variant::NIL, Variant::OBJECT); register_op(Variant::OP_OR, Variant::OBJECT, Variant::NIL); register_op(Variant::OP_OR, Variant::BOOL, Variant::BOOL); register_op(Variant::OP_OR, Variant::BOOL, Variant::INT); register_op(Variant::OP_OR, Variant::INT, Variant::BOOL); register_op(Variant::OP_OR, Variant::BOOL, Variant::FLOAT); register_op(Variant::OP_OR, Variant::FLOAT, Variant::BOOL); register_op(Variant::OP_OR, Variant::BOOL, Variant::OBJECT); register_op(Variant::OP_OR, Variant::OBJECT, Variant::BOOL); register_op(Variant::OP_OR, Variant::INT, Variant::INT); register_op(Variant::OP_OR, Variant::INT, Variant::FLOAT); register_op(Variant::OP_OR, Variant::FLOAT, Variant::INT); register_op(Variant::OP_OR, Variant::INT, Variant::OBJECT); register_op(Variant::OP_OR, Variant::OBJECT, Variant::INT); register_op(Variant::OP_OR, Variant::FLOAT, Variant::FLOAT); register_op(Variant::OP_OR, Variant::FLOAT, Variant::OBJECT); register_op(Variant::OP_OR, Variant::OBJECT, Variant::FLOAT); register_op(Variant::OP_OR, Variant::OBJECT, Variant::OBJECT); // AND register_op(Variant::OP_AND, Variant::NIL, Variant::BOOL); register_op(Variant::OP_AND, Variant::BOOL, Variant::NIL); register_op(Variant::OP_AND, Variant::NIL, Variant::INT); register_op(Variant::OP_AND, Variant::INT, Variant::NIL); register_op(Variant::OP_AND, Variant::NIL, Variant::FLOAT); register_op(Variant::OP_AND, Variant::FLOAT, Variant::NIL); register_op(Variant::OP_AND, Variant::NIL, Variant::OBJECT); register_op(Variant::OP_AND, Variant::OBJECT, Variant::NIL); register_op(Variant::OP_AND, Variant::BOOL, Variant::BOOL); register_op(Variant::OP_AND, Variant::BOOL, Variant::INT); register_op(Variant::OP_AND, Variant::INT, Variant::BOOL); register_op(Variant::OP_AND, Variant::BOOL, Variant::FLOAT); register_op(Variant::OP_AND, Variant::FLOAT, Variant::BOOL); register_op(Variant::OP_AND, Variant::BOOL, Variant::OBJECT); register_op(Variant::OP_AND, Variant::OBJECT, Variant::BOOL); register_op(Variant::OP_AND, Variant::INT, Variant::INT); register_op(Variant::OP_AND, Variant::INT, Variant::FLOAT); register_op(Variant::OP_AND, Variant::FLOAT, Variant::INT); register_op(Variant::OP_AND, Variant::INT, Variant::OBJECT); register_op(Variant::OP_AND, Variant::OBJECT, Variant::INT); register_op(Variant::OP_AND, Variant::FLOAT, Variant::FLOAT); register_op(Variant::OP_AND, Variant::FLOAT, Variant::OBJECT); register_op(Variant::OP_AND, Variant::OBJECT, Variant::FLOAT); register_op(Variant::OP_AND, Variant::OBJECT, Variant::OBJECT); // XOR register_op(Variant::OP_XOR, Variant::NIL, Variant::BOOL); register_op(Variant::OP_XOR, Variant::BOOL, Variant::NIL); register_op(Variant::OP_XOR, Variant::NIL, Variant::INT); register_op(Variant::OP_XOR, Variant::INT, Variant::NIL); register_op(Variant::OP_XOR, Variant::NIL, Variant::FLOAT); register_op(Variant::OP_XOR, Variant::FLOAT, Variant::NIL); register_op(Variant::OP_XOR, Variant::NIL, Variant::OBJECT); register_op(Variant::OP_XOR, Variant::OBJECT, Variant::NIL); register_op(Variant::OP_XOR, Variant::BOOL, Variant::BOOL); register_op(Variant::OP_XOR, Variant::BOOL, Variant::INT); register_op(Variant::OP_XOR, Variant::INT, Variant::BOOL); register_op(Variant::OP_XOR, Variant::BOOL, Variant::FLOAT); register_op(Variant::OP_XOR, Variant::FLOAT, Variant::BOOL); register_op(Variant::OP_XOR, Variant::BOOL, Variant::OBJECT); register_op(Variant::OP_XOR, Variant::OBJECT, Variant::BOOL); register_op(Variant::OP_XOR, Variant::INT, Variant::INT); register_op(Variant::OP_XOR, Variant::INT, Variant::FLOAT); register_op(Variant::OP_XOR, Variant::FLOAT, Variant::INT); register_op(Variant::OP_XOR, Variant::INT, Variant::OBJECT); register_op(Variant::OP_XOR, Variant::OBJECT, Variant::INT); register_op(Variant::OP_XOR, Variant::FLOAT, Variant::FLOAT); register_op(Variant::OP_XOR, Variant::FLOAT, Variant::OBJECT); register_op(Variant::OP_XOR, Variant::OBJECT, Variant::FLOAT); register_op(Variant::OP_XOR, Variant::OBJECT, Variant::OBJECT); register_op>(Variant::OP_NOT, Variant::NIL, Variant::NIL); register_op(Variant::OP_NOT, Variant::BOOL, Variant::NIL); register_op(Variant::OP_NOT, Variant::INT, Variant::NIL); register_op(Variant::OP_NOT, Variant::FLOAT, Variant::NIL); register_op(Variant::OP_NOT, Variant::OBJECT, Variant::NIL); register_op>(Variant::OP_IN, Variant::STRING, Variant::STRING); register_op>(Variant::OP_IN, Variant::STRING_NAME, Variant::STRING); register_op>(Variant::OP_IN, Variant::STRING, Variant::STRING_NAME); register_op>(Variant::OP_IN, Variant::STRING_NAME, Variant::STRING_NAME); register_op(Variant::OP_IN, Variant::NIL, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::BOOL, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::INT, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::STRING, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::VECTOR2, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::VECTOR2I, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::RECT2, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::RECT2I, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::VECTOR3, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::VECTOR3I, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::TRANSFORM2D, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PLANE, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::QUATERNION, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::AABB, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::BASIS, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::COLOR, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::STRING_NAME, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::NODE_PATH, Variant::DICTIONARY); register_op(Variant::OP_IN, Variant::OBJECT, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::CALLABLE, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::SIGNAL, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::DICTIONARY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_BYTE_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_INT32_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_INT64_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_FLOAT32_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_FLOAT64_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_STRING_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_VECTOR2_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_VECTOR3_ARRAY, Variant::DICTIONARY); register_op>(Variant::OP_IN, Variant::PACKED_COLOR_ARRAY, Variant::DICTIONARY); register_op(Variant::OP_IN, Variant::NIL, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::BOOL, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::INT, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::STRING, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::VECTOR2, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::VECTOR2I, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::RECT2, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::RECT2I, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::VECTOR3, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::VECTOR3I, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::TRANSFORM2D, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PLANE, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::QUATERNION, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::AABB, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::BASIS, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::COLOR, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::STRING_NAME, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::NODE_PATH, Variant::ARRAY); register_op(Variant::OP_IN, Variant::OBJECT, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::CALLABLE, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::SIGNAL, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::DICTIONARY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_BYTE_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_INT32_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_INT64_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_FLOAT32_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_FLOAT64_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_STRING_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_VECTOR2_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_VECTOR3_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::PACKED_COLOR_ARRAY, Variant::ARRAY); register_op>(Variant::OP_IN, Variant::INT, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_BYTE_ARRAY); register_op>(Variant::OP_IN, Variant::INT, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_INT32_ARRAY); register_op>(Variant::OP_IN, Variant::INT, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_INT64_ARRAY); register_op>(Variant::OP_IN, Variant::INT, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_FLOAT32_ARRAY); register_op>(Variant::OP_IN, Variant::INT, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_IN, Variant::FLOAT, Variant::PACKED_FLOAT64_ARRAY); register_op>(Variant::OP_IN, Variant::STRING, Variant::PACKED_STRING_ARRAY); register_op>(Variant::OP_IN, Variant::VECTOR2, Variant::PACKED_VECTOR2_ARRAY); register_op>(Variant::OP_IN, Variant::VECTOR3, Variant::PACKED_VECTOR3_ARRAY); register_op>(Variant::OP_IN, Variant::COLOR, Variant::PACKED_COLOR_ARRAY); register_op(Variant::OP_IN, Variant::STRING, Variant::OBJECT); register_op(Variant::OP_IN, Variant::STRING_NAME, Variant::OBJECT); } void Variant::_unregister_variant_operators() { } void Variant::evaluate(const Operator &p_op, const Variant &p_a, const Variant &p_b, Variant &r_ret, bool &r_valid) { ERR_FAIL_INDEX(p_op, Variant::OP_MAX); Variant::Type type_a = p_a.get_type(); Variant::Type type_b = p_b.get_type(); ERR_FAIL_INDEX(type_a, Variant::VARIANT_MAX); ERR_FAIL_INDEX(type_b, Variant::VARIANT_MAX); VariantEvaluatorFunction ev = operator_evaluator_table[p_op][type_a][type_b]; if (unlikely(!ev)) { r_valid = false; r_ret = Variant(); return; } ev(p_a, p_b, &r_ret, r_valid); } Variant::Type Variant::get_operator_return_type(Operator p_operator, Type p_type_a, Type p_type_b) { ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, Variant::NIL); ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, Variant::NIL); ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, Variant::NIL); return operator_return_type_table[p_operator][p_type_a][p_type_b]; } Variant::ValidatedOperatorEvaluator Variant::get_validated_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b) { ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, nullptr); ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, nullptr); ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, nullptr); return validated_operator_evaluator_table[p_operator][p_type_a][p_type_b]; } Variant::PTROperatorEvaluator Variant::get_ptr_operator_evaluator(Operator p_operator, Type p_type_a, Type p_type_b) { ERR_FAIL_INDEX_V(p_operator, Variant::OP_MAX, nullptr); ERR_FAIL_INDEX_V(p_type_a, Variant::VARIANT_MAX, nullptr); ERR_FAIL_INDEX_V(p_type_b, Variant::VARIANT_MAX, nullptr); return ptr_operator_evaluator_table[p_operator][p_type_a][p_type_b]; } static const char *_op_names[Variant::OP_MAX] = { "==", "!=", "<", "<=", ">", ">=", "+", "-", "*", "/", "unary-", "unary+", "%", "<<", ">>", "&", "|", "^", "~", "and", "or", "xor", "not", "in" }; String Variant::get_operator_name(Operator p_op) { ERR_FAIL_INDEX_V(p_op, OP_MAX, ""); return _op_names[p_op]; } Variant::operator bool() const { return booleanize(); } // We consider all uninitialized or empty types to be false based on the type's // zeroiness. bool Variant::booleanize() const { return !is_zero(); } bool Variant::in(const Variant &p_index, bool *r_valid) const { bool valid; Variant ret; evaluate(OP_IN, p_index, *this, ret, valid); if (r_valid) { *r_valid = valid; return false; } ERR_FAIL_COND_V(ret.type != BOOL, false); return *VariantGetInternalPtr::get_ptr(&ret); }