Add Windows and Switch build support

This commit is contained in:
2026-06-08 22:33:06 +08:00
parent 7a925c3736
commit 5525343656
11 changed files with 610 additions and 70 deletions
+26 -5
View File
@@ -215,12 +215,33 @@ typedef struct JSValue {
#define JS_VALUE_GET_FLOAT64(v) ((v).u.float64)
#define JS_VALUE_GET_PTR(v) ((v).u.ptr)
#define JS_MKVAL(tag, val) (JSValue){ (JSValueUnion){ .int32 = val }, tag }
#define JS_MKPTR(tag, p) (JSValue){ (JSValueUnion){ .ptr = p }, tag }
static inline JSValue JS_MKVAL(int tag, int32_t val)
{
JSValue v;
v.tag = tag;
v.u.int32 = val;
return v;
}
static inline JSValue JS_MKPTR(int tag, void *ptr)
{
JSValue v;
v.tag = tag;
v.u.ptr = ptr;
return v;
}
#define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64)
#define JS_NAN (JSValue){ .u.float64 = JS_FLOAT64_NAN, JS_TAG_FLOAT64 }
static inline JSValue JS_MKFLOAT64_NAN(void)
{
JSValue v;
v.tag = JS_TAG_FLOAT64;
v.u.float64 = JS_FLOAT64_NAN;
return v;
}
#define JS_NAN JS_MKFLOAT64_NAN()
static inline JSValue __JS_NewFloat64(JSContext *ctx, double d)
{
@@ -667,7 +688,7 @@ static inline JSValue JS_DupValue(JSContext *ctx, JSValueConst v)
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v);
p->ref_count++;
}
return (JSValue)v;
return v;
}
static inline JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v)
@@ -676,7 +697,7 @@ static inline JSValue JS_DupValueRT(JSRuntime *rt, JSValueConst v)
JSRefCountHeader *p = (JSRefCountHeader *)JS_VALUE_GET_PTR(v);
p->ref_count++;
}
return (JSValue)v;
return v;
}
int JS_ToBool(JSContext *ctx, JSValueConst val); /* return -1 for JS_EXCEPTION */