initial attempt
This commit is contained in:
@@ -525,9 +525,6 @@ static const JSCFunctionListEntry js_enet_peer_funcs[] = {
|
||||
JS_CGETSET_DEF("address", js_enet_peer_get_address, NULL),
|
||||
};
|
||||
|
||||
/* Module entry point */
|
||||
static int js_enet_init(JSContext *ctx, JSModuleDef *m);
|
||||
|
||||
JSValue js_enet_use(JSContext *ctx)
|
||||
{
|
||||
JS_NewClassID(&enet_host_id);
|
||||
|
||||
6172
source/quickjs.c
6172
source/quickjs.c
File diff suppressed because it is too large
Load Diff
@@ -404,7 +404,6 @@ void JS_AddIntrinsicJSON(JSContext *ctx);
|
||||
void JS_AddIntrinsicProxy(JSContext *ctx);
|
||||
void JS_AddIntrinsicMapSet(JSContext *ctx);
|
||||
void JS_AddIntrinsicTypedArrays(JSContext *ctx);
|
||||
void JS_AddIntrinsicPromise(JSContext *ctx);
|
||||
void JS_AddIntrinsicWeakRef(JSContext *ctx);
|
||||
|
||||
JSValue js_string_codePointRange(JSContext *ctx, JSValueConst this_val,
|
||||
@@ -823,7 +822,6 @@ JSValue JS_CallConstructor(JSContext *ctx, JSValueConst func_obj,
|
||||
JSValue JS_CallConstructor2(JSContext *ctx, JSValueConst func_obj,
|
||||
JSValueConst new_target,
|
||||
int argc, JSValueConst *argv);
|
||||
JS_BOOL JS_DetectModule(const char *input, size_t input_len);
|
||||
/* 'input' must be zero terminated i.e. input[input_len] = '\0'. */
|
||||
JSValue JS_Eval(JSContext *ctx, const char *input, size_t input_len,
|
||||
const char *filename, int eval_flags);
|
||||
@@ -927,47 +925,6 @@ int JS_GetStripInfo(JSRuntime *rt);
|
||||
/* set the [IsHTMLDDA] internal slot */
|
||||
void JS_SetIsHTMLDDA(JSContext *ctx, JSValueConst obj);
|
||||
|
||||
typedef struct JSModuleDef JSModuleDef;
|
||||
|
||||
/* return the module specifier (allocated with js_malloc()) or NULL if
|
||||
exception */
|
||||
typedef char *JSModuleNormalizeFunc(JSContext *ctx,
|
||||
const char *module_base_name,
|
||||
const char *module_name, void *opaque);
|
||||
typedef JSModuleDef *JSModuleLoaderFunc(JSContext *ctx,
|
||||
const char *module_name, void *opaque);
|
||||
typedef JSModuleDef *JSModuleLoaderFunc2(JSContext *ctx,
|
||||
const char *module_name, void *opaque,
|
||||
JSValueConst attributes);
|
||||
/* return -1 if exception, 0 if OK */
|
||||
typedef int JSModuleCheckSupportedImportAttributes(JSContext *ctx, void *opaque,
|
||||
JSValueConst attributes);
|
||||
|
||||
/* module_normalize = NULL is allowed and invokes the default module
|
||||
filename normalizer */
|
||||
void JS_SetModuleLoaderFunc(JSRuntime *rt,
|
||||
JSModuleNormalizeFunc *module_normalize,
|
||||
JSModuleLoaderFunc *module_loader, void *opaque);
|
||||
/* same as JS_SetModuleLoaderFunc but with attributes. if
|
||||
module_check_attrs = NULL, no attribute checking is done. */
|
||||
void JS_SetModuleLoaderFunc2(JSRuntime *rt,
|
||||
JSModuleNormalizeFunc *module_normalize,
|
||||
JSModuleLoaderFunc2 *module_loader,
|
||||
JSModuleCheckSupportedImportAttributes *module_check_attrs,
|
||||
void *opaque);
|
||||
/* return the import.meta object of a module */
|
||||
JSValue JS_GetImportMeta(JSContext *ctx, JSModuleDef *m);
|
||||
JSAtom JS_GetModuleName(JSContext *ctx, JSModuleDef *m);
|
||||
JSValue JS_GetModuleNamespace(JSContext *ctx, JSModuleDef *m);
|
||||
|
||||
/* JS Job support */
|
||||
|
||||
typedef JSValue JSJobFunc(JSContext *ctx, int argc, JSValueConst *argv);
|
||||
int JS_EnqueueJob(JSContext *ctx, JSJobFunc *job_func, int argc, JSValueConst *argv);
|
||||
|
||||
JS_BOOL JS_IsJobPending(JSRuntime *rt);
|
||||
int JS_ExecutePendingJob(JSRuntime *rt, JSContext **pctx);
|
||||
|
||||
/* Object Writer/Reader (currently only used to handle precompiled code) */
|
||||
#define JS_WRITE_OBJ_BYTECODE (1 << 0) /* allow function/module */
|
||||
#define JS_WRITE_OBJ_BSWAP (1 << 1) /* byte swapped output */
|
||||
@@ -989,15 +946,6 @@ JSValue JS_ReadObject(JSContext *ctx, const uint8_t *buf, size_t buf_len,
|
||||
/* instantiate and evaluate a bytecode function. Only used when
|
||||
reading a script or module with JS_ReadObject() */
|
||||
JSValue JS_EvalFunction(JSContext *ctx, JSValue fun_obj);
|
||||
/* load the dependencies of the module 'obj'. Useful when JS_ReadObject()
|
||||
returns a module. */
|
||||
int JS_ResolveModule(JSContext *ctx, JSValueConst obj);
|
||||
|
||||
/* only exported for os.Worker() */
|
||||
JSAtom JS_GetScriptOrModuleName(JSContext *ctx, int n_stack_levels);
|
||||
/* only exported for os.Worker() */
|
||||
JSValue JS_LoadModule(JSContext *ctx, const char *basename,
|
||||
const char *filename);
|
||||
|
||||
/* C function definition */
|
||||
typedef enum JSCFunctionEnum { /* XXX: should rename for namespace isolation */
|
||||
@@ -1117,25 +1065,6 @@ int JS_SetPropertyFunctionList(JSContext *ctx, JSValueConst obj,
|
||||
const JSCFunctionListEntry *tab,
|
||||
int len);
|
||||
|
||||
/* C module definition */
|
||||
|
||||
typedef int JSModuleInitFunc(JSContext *ctx, JSModuleDef *m);
|
||||
|
||||
JSModuleDef *JS_NewCModule(JSContext *ctx, const char *name_str,
|
||||
JSModuleInitFunc *func);
|
||||
/* can only be called before the module is instantiated */
|
||||
int JS_AddModuleExport(JSContext *ctx, JSModuleDef *m, const char *name_str);
|
||||
int JS_AddModuleExportList(JSContext *ctx, JSModuleDef *m,
|
||||
const JSCFunctionListEntry *tab, int len);
|
||||
/* can only be called after the module is instantiated */
|
||||
int JS_SetModuleExport(JSContext *ctx, JSModuleDef *m, const char *export_name,
|
||||
JSValue val);
|
||||
int JS_SetModuleExportList(JSContext *ctx, JSModuleDef *m,
|
||||
const JSCFunctionListEntry *tab, int len);
|
||||
/* associate a JSValue to a C module */
|
||||
int JS_SetModulePrivateValue(JSContext *ctx, JSModuleDef *m, JSValue val);
|
||||
JSValue JS_GetModulePrivateValue(JSContext *ctx, JSModuleDef *m);
|
||||
|
||||
/* debug value output */
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user