@@ -207,7 +207,7 @@ typedef struct JSValue {
207207 JSValueUnion u ;
208208 int64_t tag ;
209209} JSValue ;
210-
210+
211211#define JSValueConst JSValue
212212
213213#define JS_VALUE_GET_TAG (v ) ((int32_t)(v).tag)
@@ -221,6 +221,31 @@ typedef struct JSValue {
221221#define JS_MKVAL (tag , val ) (JSValue){ (JSValueUnion){ .int32 = val }, tag }
222222#define JS_MKPTR (tag , p ) (JSValue){ (JSValueUnion){ .ptr = p }, tag }
223223
224+ #ifdef _MSC_VER
225+ static inline JSValue __NewValue_WithInt32 (int32_t Value , int64_t Tag )
226+ {
227+ JSValue v ;
228+ v .u = { .int32 = Value };
229+ v .tag = Tag ;
230+ return v ;
231+ }
232+
233+ static inline JSValue __NewValue_WithPtr (void * Value , int64_t Tag )
234+ {
235+ JSValue v ;
236+ v .u = { .ptr = Value };
237+ v .tag = Tag ;
238+ return v ;
239+ }
240+
241+ #undef JS_MKVAL
242+ #undef JS_MKPTR
243+
244+ #define JS_MKVAL (tag , val ) __NewValue_WithInt32(val, tag)
245+ #define JS_MKPTR (tag , p ) __NewValue_WithPtr(val, tag)
246+ #endif
247+
248+
224249#define JS_TAG_IS_FLOAT64 (tag ) ((unsigned)(tag) == JS_TAG_FLOAT64)
225250
226251#define JS_NAN (JSValue){ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 }
@@ -1040,6 +1065,14 @@ typedef struct JSCFunctionListEntry {
10401065#define JS_ALIAS_DEF (name , from ) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_ALIAS, 0, .u = { .alias = { from, -1 } } }
10411066#define JS_ALIAS_BASE_DEF (name , from , base ) { name, JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, JS_DEF_ALIAS, 0, .u = { .alias = { from, base } } }
10421067
1068+ #ifdef _MSC_VER
1069+ #undef JS_CFUNC_DEF
1070+ #undef JS_CGETSET_DEF
1071+
1072+ #define JS_CFUNC_DEF (name , length , func1 ) { .name = name, .prop_flags = JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, .def_type = JS_DEF_CFUNC, .magic = 0, .u = { .func = { length, JS_CFUNC_generic, { .generic = func1 } } } }
1073+ #define JS_CGETSET_DEF (name , fgetter , fsetter ) { .name = name, .prop_flags = JS_PROP_CONFIGURABLE, .def_type = JS_DEF_CGETSET, .magic = 0, .u = { .getset = { .get = { .getter = fgetter }, .set = { .setter = fsetter } } } }
1074+ #endif
1075+
10431076void JS_SetPropertyFunctionList (JSContext * ctx , JSValueConst obj ,
10441077 const JSCFunctionListEntry * tab ,
10451078 int len );
0 commit comments