"div" operator for integer division,

Added parser support for closure operator fun@(args)
Use equal() function for all script comparisons, better support for deciding when to use strings and when to use pointers equality.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@964 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-06-03 16:38:33 +00:00
parent 6912dfda09
commit c5159ebcf7
12 changed files with 197 additions and 66 deletions
+12 -3
View File
@@ -33,6 +33,12 @@ enum ScriptType
, SCRIPT_ERROR
};
enum CompareWhat
{ COMPARE_NO
, COMPARE_AS_STRING
, COMPARE_AS_POINTER
};
/// A value that can be handled by the scripting engine.
/// Actual values are derived types
class ScriptValue : public IntrusivePtrBaseWithDelete {
@@ -43,9 +49,9 @@ class ScriptValue : public IntrusivePtrBaseWithDelete {
virtual ScriptType type() const = 0;
/// Name of the type of value
virtual String typeName() const = 0;
/// A pointer that uniquely identifies the value, used for comparing.
/** If implementation is not possible, should return nullptr. */
virtual const void* comparePointer() const;
/// How to compare this object?
/** Returns 1 if the pointer should be used, 0 otherwise */
virtual CompareWhat compareAs(String& compare_str, void const*& compare_ptr) const;
/// Convert this value to a string
virtual operator String() const;
@@ -89,5 +95,8 @@ extern ScriptValueP script_true; ///< The preallocated true value
extern ScriptValueP script_false; ///< The preallocated false value
extern ScriptValueP dependency_dummy; ///< Dummy value used during dependency analysis
/// compare script values for equallity
bool equal(const ScriptValue& a, const ScriptValue& b);
// ----------------------------------------------------------------------------- : EOF
#endif