| 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 | 
|---|
| 33 | extern "C"{ | 
|---|
| 34 | #endif | 
|---|
| 35 |  | 
|---|
| 36 | JSModuleDef *js_init_module_std(JSContext *ctx, const char *module_name); | 
|---|
| 37 | JSModuleDef *js_init_module_os(JSContext *ctx, const char *module_name); | 
|---|
| 38 | void js_std_add_helpers(JSContext *ctx, int argc, char **argv); | 
|---|
| 39 | void js_std_loop(JSContext *ctx); | 
|---|
| 40 | JSValue js_std_await(JSContext *ctx, JSValue obj); | 
|---|
| 41 | void js_std_init_handlers(JSRuntime *rt); | 
|---|
| 42 | void js_std_free_handlers(JSRuntime *rt); | 
|---|
| 43 | void js_std_dump_error(JSContext *ctx); | 
|---|
| 44 | uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename); | 
|---|
| 45 | int js_module_set_import_meta(JSContext *ctx, JSValueConst func_val, | 
|---|
| 46 | JS_BOOL use_realpath, JS_BOOL is_main); | 
|---|
| 47 | JSModuleDef *js_module_loader(JSContext *ctx, | 
|---|
| 48 | const char *module_name, void *opaque); | 
|---|
| 49 | void js_std_eval_binary(JSContext *ctx, const uint8_t *buf, size_t buf_len, | 
|---|
| 50 | int flags); | 
|---|
| 51 | void js_std_promise_rejection_tracker(JSContext *ctx, JSValueConst promise, | 
|---|
| 52 | JSValueConst reason, | 
|---|
| 53 | JS_BOOL is_handled, void *opaque); | 
|---|
| 54 | void 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 |  | 
|---|