Scripting: More const bringup

This commit is contained in:
Vicki Pfau 2022-04-29 00:32:06 -07:00
parent eadc0c677b
commit b0567832f8
2 changed files with 7 additions and 2 deletions

View File

@ -205,6 +205,7 @@ CXX_GUARD_START
}; \ }; \
const struct mScriptType mSTStructConst_ ## STRUCT = { \ const struct mScriptType mSTStructConst_ ## STRUCT = { \
.base = mSCRIPT_TYPE_OBJECT, \ .base = mSCRIPT_TYPE_OBJECT, \
.isConst = true, \
.details = { \ .details = { \
.cls = &_mSTStructDetails_ ## STRUCT \ .cls = &_mSTStructDetails_ ## STRUCT \
}, \ }, \
@ -427,8 +428,9 @@ CXX_GUARD_START
#define mSCRIPT_MAKE_F64(VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_F64, f64, VALUE) #define mSCRIPT_MAKE_F64(VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_F64, f64, VALUE)
#define mSCRIPT_MAKE_CHARP(VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_CHARP, opaque, VALUE) #define mSCRIPT_MAKE_CHARP(VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_CHARP, opaque, VALUE)
#define mSCRIPT_MAKE_S(STRUCT, VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_S(STRUCT), opaque, VALUE) #define mSCRIPT_MAKE_S(STRUCT, VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_S(STRUCT), opaque, VALUE)
#define mSCRIPT_MAKE_CS(STRUCT, VALUE) mSCRIPT_MAKE(mSCRIPT_TYPE_MS_CS(STRUCT), copaque, VALUE)
enum { enum mScriptTypeBase {
mSCRIPT_TYPE_VOID = 0, mSCRIPT_TYPE_VOID = 0,
mSCRIPT_TYPE_SINT, mSCRIPT_TYPE_SINT,
mSCRIPT_TYPE_UINT, mSCRIPT_TYPE_UINT,
@ -505,7 +507,9 @@ struct mScriptTypeClass {
struct mScriptValue; struct mScriptValue;
struct mScriptType { struct mScriptType {
int base; enum mScriptTypeBase base : 8;
bool isConst;
size_t size; size_t size;
const char* name; const char* name;
union { union {

View File

@ -255,6 +255,7 @@ uint32_t _hashScalar(const struct mScriptValue* val) {
x = val->value.s32; x = val->value.s32;
break; break;
case mSCRIPT_TYPE_UINT: case mSCRIPT_TYPE_UINT:
default:
x = val->value.u32; x = val->value.u32;
break; break;
} }