| 1 | /* File generated automatically by the QuickJS compiler. */ |
| 2 | |
| 3 | #include "quickjs-libc.h" |
| 4 | |
| 5 | const uint32_t qjsc_test_fib_size = 175; |
| 6 | |
| 7 | const uint8_t qjsc_test_fib[175] = { |
| 8 | 0x04, 0x07, 0x28, 0x65, 0x78, 0x61, 0x6d, 0x70, |
| 9 | 0x6c, 0x65, 0x73, 0x2f, 0x74, 0x65, 0x73, 0x74, |
| 10 | 0x5f, 0x66, 0x69, 0x62, 0x2e, 0x6a, 0x73, 0x10, |
| 11 | 0x2e, 0x2f, 0x66, 0x69, 0x62, 0x2e, 0x73, 0x6f, |
| 12 | 0x06, 0x66, 0x69, 0x62, 0x0e, 0x63, 0x6f, 0x6e, |
| 13 | 0x73, 0x6f, 0x6c, 0x65, 0x06, 0x6c, 0x6f, 0x67, |
| 14 | 0x16, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, |
| 15 | 0x6f, 0x72, 0x6c, 0x64, 0x10, 0x66, 0x69, 0x62, |
| 16 | 0x28, 0x31, 0x30, 0x29, 0x3d, 0x0d, 0xbe, 0x03, |
| 17 | 0x01, 0xc0, 0x03, 0x00, 0x00, 0x01, 0x00, 0xc2, |
| 18 | 0x03, 0x00, 0x00, 0x0c, 0x20, 0x06, 0x01, 0xa4, |
| 19 | 0x01, 0x00, 0x00, 0x00, 0x05, 0x01, 0x00, 0x32, |
| 20 | 0x00, 0xc2, 0x03, 0x00, 0x0c, 0x08, 0xec, 0x02, |
| 21 | 0x29, 0x39, 0xe2, 0x00, 0x00, 0x00, 0x43, 0xe3, |
| 22 | 0x00, 0x00, 0x00, 0x04, 0xe4, 0x00, 0x00, 0x00, |
| 23 | 0x24, 0x01, 0x00, 0x0e, 0x39, 0xe2, 0x00, 0x00, |
| 24 | 0x00, 0x43, 0xe3, 0x00, 0x00, 0x00, 0x04, 0xe5, |
| 25 | 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0xbf, 0x0a, |
| 26 | 0xf1, 0x24, 0x02, 0x00, 0x0e, 0x06, 0x2f, 0xbe, |
| 27 | 0x03, 0x14, 0x00, 0x00, 0x00, 0x04, 0x08, 0x00, |
| 28 | 0x1b, 0x0e, 0x34, 0x08, 0x17, 0x15, 0x1b, 0x0e, |
| 29 | 0x34, 0x22, 0x1b, 0x06, 0x07, 0x1f, 0x00, |
| 30 | }; |
| 31 | |
| 32 | static JSContext *JS_NewCustomContext(JSRuntime *rt) |
| 33 | { |
| 34 | JSContext *ctx = JS_NewContextRaw(rt); |
| 35 | if (!ctx) |
| 36 | return NULL; |
| 37 | JS_AddIntrinsicBaseObjects(ctx); |
| 38 | JS_AddIntrinsicDate(ctx); |
| 39 | JS_AddIntrinsicEval(ctx); |
| 40 | JS_AddIntrinsicStringNormalize(ctx); |
| 41 | JS_AddIntrinsicRegExp(ctx); |
| 42 | JS_AddIntrinsicJSON(ctx); |
| 43 | JS_AddIntrinsicProxy(ctx); |
| 44 | JS_AddIntrinsicMapSet(ctx); |
| 45 | JS_AddIntrinsicTypedArrays(ctx); |
| 46 | JS_AddIntrinsicPromise(ctx); |
| 47 | JS_AddIntrinsicWeakRef(ctx); |
| 48 | { |
| 49 | extern JSModuleDef *js_init_module_fib(JSContext *ctx, const char *name); |
| 50 | js_init_module_fib(ctx, "examples/fib.so" ); |
| 51 | } |
| 52 | return ctx; |
| 53 | } |
| 54 | |
| 55 | int main(int argc, char **argv) |
| 56 | { |
| 57 | JSRuntime *rt; |
| 58 | JSContext *ctx; |
| 59 | rt = JS_NewRuntime(); |
| 60 | js_std_set_worker_new_context_func(JS_NewCustomContext); |
| 61 | js_std_init_handlers(rt); |
| 62 | JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL); |
| 63 | ctx = JS_NewCustomContext(rt); |
| 64 | js_std_add_helpers(ctx, argc, argv); |
| 65 | js_std_eval_binary(ctx, qjsc_test_fib, qjsc_test_fib_size, 0); |
| 66 | js_std_loop(ctx); |
| 67 | js_std_free_handlers(rt); |
| 68 | JS_FreeContext(ctx); |
| 69 | JS_FreeRuntime(rt); |
| 70 | return 0; |
| 71 | } |
| 72 | |