mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 15:04:24 +03:00
2020-03-16 release
This commit is contained in:
28
quickjs.h
28
quickjs.h
@@ -335,6 +335,8 @@ void JS_SetMemoryLimit(JSRuntime *rt, size_t limit);
|
||||
void JS_SetGCThreshold(JSRuntime *rt, size_t gc_threshold);
|
||||
JSRuntime *JS_NewRuntime2(const JSMallocFunctions *mf, void *opaque);
|
||||
void JS_FreeRuntime(JSRuntime *rt);
|
||||
void *JS_GetRuntimeOpaque(JSRuntime *rt);
|
||||
void JS_SetRuntimeOpaque(JSRuntime *rt, void *opaque);
|
||||
typedef void JS_MarkFunc(JSRuntime *rt, JSGCObjectHeader *gp);
|
||||
void JS_MarkValue(JSRuntime *rt, JSValueConst val, JS_MarkFunc *mark_func);
|
||||
void JS_RunGC(JSRuntime *rt);
|
||||
@@ -508,7 +510,28 @@ static js_force_inline JSValue JS_NewCatchOffset(JSContext *ctx, int32_t val)
|
||||
return JS_MKVAL(JS_TAG_CATCH_OFFSET, val);
|
||||
}
|
||||
|
||||
JSValue JS_NewInt64(JSContext *ctx, int64_t v);
|
||||
static js_force_inline JSValue JS_NewInt64(JSContext *ctx, int64_t val)
|
||||
{
|
||||
JSValue v;
|
||||
if (val == (int32_t)val) {
|
||||
v = JS_NewInt32(ctx, val);
|
||||
} else {
|
||||
v = __JS_NewFloat64(ctx, val);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
static js_force_inline JSValue JS_NewUint32(JSContext *ctx, uint32_t val)
|
||||
{
|
||||
JSValue v;
|
||||
if (val <= 0x7fffffff) {
|
||||
v = JS_NewInt32(ctx, val);
|
||||
} else {
|
||||
v = __JS_NewFloat64(ctx, val);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
JSValue JS_NewBigInt64(JSContext *ctx, int64_t v);
|
||||
JSValue JS_NewBigUint64(JSContext *ctx, uint64_t v);
|
||||
|
||||
@@ -657,7 +680,10 @@ static int inline JS_ToUint32(JSContext *ctx, uint32_t *pres, JSValueConst val)
|
||||
int JS_ToInt64(JSContext *ctx, int64_t *pres, JSValueConst val);
|
||||
int JS_ToIndex(JSContext *ctx, uint64_t *plen, JSValueConst val);
|
||||
int JS_ToFloat64(JSContext *ctx, double *pres, JSValueConst val);
|
||||
/* return an exception if 'val' is a Number */
|
||||
int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValueConst val);
|
||||
/* same as JS_ToInt64() but allow BigInt */
|
||||
int JS_ToInt64Ext(JSContext *ctx, int64_t *pres, JSValueConst val);
|
||||
|
||||
JSValue JS_NewStringLen(JSContext *ctx, const char *str1, size_t len1);
|
||||
JSValue JS_NewString(JSContext *ctx, const char *str);
|
||||
|
Reference in New Issue
Block a user