2 Commits

Author SHA1 Message Date
John Alanbrook
2c9d039271 massive cleanup 2026-02-04 14:26:17 -06:00
John Alanbrook
d4635f2a75 remove unused vars, fix warnings 2026-02-04 13:49:43 -06:00
2 changed files with 110 additions and 977 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -176,8 +176,6 @@ void JS_DeleteGCRef(JSContext *ctx, JSGCRef *ref);
Value Extraction Value Extraction
============================================================ */ ============================================================ */
#define JS_VALUE_GET_INT(v) ((int)(v) >> 1)
/* Get primary tag (low 2-3 bits) */ /* Get primary tag (low 2-3 bits) */
static inline int static inline int
JS_VALUE_GET_TAG (JSValue v) { JS_VALUE_GET_TAG (JSValue v) {
@@ -811,7 +809,14 @@ typedef enum JSCFunctionEnum {
JS_CFUNC_1, /* JSValue f(ctx, this_val, arg0) */ JS_CFUNC_1, /* JSValue f(ctx, this_val, arg0) */
JS_CFUNC_2, /* JSValue f(ctx, this_val, arg0, arg1) */ JS_CFUNC_2, /* JSValue f(ctx, this_val, arg0, arg1) */
JS_CFUNC_3, /* JSValue f(ctx, this_val, arg0, arg1, arg2) */ 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; } JSCFunctionEnum;
/* Fixed-arity C function types for fast paths */ /* 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 arg0, JSValue arg1,
JSValue arg2, JSValue arg3); 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 { typedef union JSCFunctionType {
JSCFunction *generic; JSCFunction *generic;
JSValue (*generic_magic) (JSContext *ctx, JSValue this_val, int argc, JSValue (*generic_magic) (JSContext *ctx, JSValue this_val, int argc,
@@ -839,6 +854,13 @@ typedef union JSCFunctionType {
JSCFunction2 *f2; JSCFunction2 *f2;
JSCFunction3 *f3; JSCFunction3 *f3;
JSCFunction4 *f4; JSCFunction4 *f4;
/* Pure function pointers */
JSCFunctionPure *pure;
JSCFunctionPure0 *pure0;
JSCFunctionPure1 *pure1;
JSCFunctionPure2 *pure2;
JSCFunctionPure3 *pure3;
JSCFunctionPure4 *pure4;
} JSCFunctionType; } JSCFunctionType;
JSValue JS_NewCFunction2 (JSContext *ctx, JSCFunction *func, const char *name, JSValue JS_NewCFunction2 (JSContext *ctx, JSCFunction *func, const char *name,
@@ -955,6 +977,43 @@ typedef struct JSCFunctionListEntry {
.u \ .u \
= {.func = { 3, JS_CFUNC_3, { .f3 = func1 } } } \ = {.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) \ #define JS_ITERATOR_NEXT_DEF(name, length, func1, magic) \
{ \ { \
name, 0, JS_DEF_CFUNC, magic, .u = { \ name, 0, JS_DEF_CFUNC, magic, .u = { \