Compare commits
2 Commits
serialize_
...
warningfix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c9d039271 | ||
|
|
d4635f2a75 |
1022
source/quickjs.c
1022
source/quickjs.c
File diff suppressed because it is too large
Load Diff
@@ -176,8 +176,6 @@ void JS_DeleteGCRef(JSContext *ctx, JSGCRef *ref);
|
||||
Value Extraction
|
||||
============================================================ */
|
||||
|
||||
#define JS_VALUE_GET_INT(v) ((int)(v) >> 1)
|
||||
|
||||
/* Get primary tag (low 2-3 bits) */
|
||||
static inline int
|
||||
JS_VALUE_GET_TAG (JSValue v) {
|
||||
@@ -811,7 +809,14 @@ typedef enum JSCFunctionEnum {
|
||||
JS_CFUNC_1, /* JSValue f(ctx, this_val, arg0) */
|
||||
JS_CFUNC_2, /* JSValue f(ctx, this_val, arg0, arg1) */
|
||||
JS_CFUNC_3, /* JSValue f(ctx, this_val, arg0, arg1, arg2) */
|
||||
JS_CFUNC_4
|
||||
JS_CFUNC_4,
|
||||
/* Pure functions (no this_val) - for global utility functions */
|
||||
JS_CFUNC_PURE, /* JSValue f(ctx, argc, argv) - generic pure */
|
||||
JS_CFUNC_PURE_0, /* JSValue f(ctx) */
|
||||
JS_CFUNC_PURE_1, /* JSValue f(ctx, arg0) */
|
||||
JS_CFUNC_PURE_2, /* JSValue f(ctx, arg0, arg1) */
|
||||
JS_CFUNC_PURE_3, /* JSValue f(ctx, arg0, arg1, arg2) */
|
||||
JS_CFUNC_PURE_4 /* JSValue f(ctx, arg0, arg1, arg2, arg3) */
|
||||
} JSCFunctionEnum;
|
||||
|
||||
/* Fixed-arity C function types for fast paths */
|
||||
@@ -827,6 +832,16 @@ typedef JSValue JSCFunction4 (JSContext *ctx, JSValue this_val,
|
||||
JSValue arg0, JSValue arg1,
|
||||
JSValue arg2, JSValue arg3);
|
||||
|
||||
/* Pure function types (no this_val) */
|
||||
typedef JSValue JSCFunctionPure (JSContext *ctx, int argc, JSValue *argv);
|
||||
typedef JSValue JSCFunctionPure0 (JSContext *ctx);
|
||||
typedef JSValue JSCFunctionPure1 (JSContext *ctx, JSValue arg0);
|
||||
typedef JSValue JSCFunctionPure2 (JSContext *ctx, JSValue arg0, JSValue arg1);
|
||||
typedef JSValue JSCFunctionPure3 (JSContext *ctx, JSValue arg0, JSValue arg1,
|
||||
JSValue arg2);
|
||||
typedef JSValue JSCFunctionPure4 (JSContext *ctx, JSValue arg0, JSValue arg1,
|
||||
JSValue arg2, JSValue arg3);
|
||||
|
||||
typedef union JSCFunctionType {
|
||||
JSCFunction *generic;
|
||||
JSValue (*generic_magic) (JSContext *ctx, JSValue this_val, int argc,
|
||||
@@ -839,6 +854,13 @@ typedef union JSCFunctionType {
|
||||
JSCFunction2 *f2;
|
||||
JSCFunction3 *f3;
|
||||
JSCFunction4 *f4;
|
||||
/* Pure function pointers */
|
||||
JSCFunctionPure *pure;
|
||||
JSCFunctionPure0 *pure0;
|
||||
JSCFunctionPure1 *pure1;
|
||||
JSCFunctionPure2 *pure2;
|
||||
JSCFunctionPure3 *pure3;
|
||||
JSCFunctionPure4 *pure4;
|
||||
} JSCFunctionType;
|
||||
|
||||
JSValue JS_NewCFunction2 (JSContext *ctx, JSCFunction *func, const char *name,
|
||||
@@ -955,6 +977,43 @@ typedef struct JSCFunctionListEntry {
|
||||
.u \
|
||||
= {.func = { 3, JS_CFUNC_3, { .f3 = func1 } } } \
|
||||
}
|
||||
/* Pure function (no this_val) macros */
|
||||
#define JS_CFUNC_PURE_DEF(name, length, func1) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, 0, \
|
||||
.u \
|
||||
= {.func = { length, JS_CFUNC_PURE, { .pure = func1 } } } \
|
||||
}
|
||||
#define JS_CFUNC_PURE0_DEF(name, func1) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, 0, \
|
||||
.u \
|
||||
= {.func = { 0, JS_CFUNC_PURE_0, { .pure0 = func1 } } } \
|
||||
}
|
||||
#define JS_CFUNC_PURE1_DEF(name, func1) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, 0, \
|
||||
.u \
|
||||
= {.func = { 1, JS_CFUNC_PURE_1, { .pure1 = func1 } } } \
|
||||
}
|
||||
#define JS_CFUNC_PURE2_DEF(name, func1) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, 0, \
|
||||
.u \
|
||||
= {.func = { 2, JS_CFUNC_PURE_2, { .pure2 = func1 } } } \
|
||||
}
|
||||
#define JS_CFUNC_PURE3_DEF(name, func1) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, 0, \
|
||||
.u \
|
||||
= {.func = { 3, JS_CFUNC_PURE_3, { .pure3 = func1 } } } \
|
||||
}
|
||||
#define JS_CFUNC_PURE4_DEF(name, func1) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, 0, \
|
||||
.u \
|
||||
= {.func = { 4, JS_CFUNC_PURE_4, { .pure4 = func1 } } } \
|
||||
}
|
||||
#define JS_ITERATOR_NEXT_DEF(name, length, func1, magic) \
|
||||
{ \
|
||||
name, 0, JS_DEF_CFUNC, magic, .u = { \
|
||||
|
||||
Reference in New Issue
Block a user