1/*
2 * QuickJS C library
3 *
4 * Copyright (c) 2017-2018 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24#ifndef QUICKJS_LIBC_H
25#define QUICKJS_LIBC_H
26
27#include <stdio.h>
28#include <stdlib.h>
29
30#include "quickjs.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36JSModuleDef *js_init_module_std(JSContext *ctx, const char *module_name);
37JSModuleDef *js_init_module_os(JSContext *ctx, const char *module_name);
38void js_std_add_helpers(JSContext *ctx, int argc, char **argv);
39void js_std_loop(JSContext *ctx);
40JSValue js_std_await(JSContext *ctx, JSValue obj);
41void js_std_init_handlers(JSRuntime *rt);
42void js_std_free_handlers(JSRuntime *rt);
43void js_std_dump_error(JSContext *ctx);
44uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename);
45int js_module_set_import_meta(JSContext *ctx, JSValueConst func_val,
46 JS_BOOL use_realpath, JS_BOOL is_main);
47JSModuleDef *js_module_loader(JSContext *ctx,
48 const char *module_name, void *opaque);
49void js_std_eval_binary(JSContext *ctx, const uint8_t *buf, size_t buf_len,
50 int flags);
51void js_std_promise_rejection_tracker(JSContext *ctx, JSValueConst promise,
52 JSValueConst reason,
53 JS_BOOL is_handled, void *opaque);
54void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt));
55
56#ifdef __cplusplus
57} /* extern "C" { */
58#endif
59
60#endif /* QUICKJS_LIBC_H */
61