| 1968 | }; |
| 1969 | |
| 1970 | static int js_std_init(JSContext *ctx, JSModuleDef *m) |
| 1971 | { |
| 1972 | JSValue proto; |
| 1973 | JSRuntime *rt = JS_GetRuntime(ctx); |
| 1974 | JSThreadState *ts = js_get_thread_state(rt); |
| 1975 | |
| 1976 | /* FILE class */ |
| 1977 | /* the class ID is created once */ |
| 1978 | JS_NewClassID(rt, &ts->std_file_class_id); |
| 1979 | /* the class is created once per runtime */ |
| 1980 | JS_NewClass(rt, ts->std_file_class_id, &js_std_file_class); |
| 1981 | proto = JS_NewObject(ctx); |
| 1982 | JS_SetPropertyFunctionList(ctx, proto, js_std_file_proto_funcs, |
| 1983 | countof(js_std_file_proto_funcs)); |
| 1984 | JS_SetClassProto(ctx, ts->std_file_class_id, proto); |
| 1985 | |
| 1986 | JS_SetModuleExportList(ctx, m, js_std_funcs, |
| 1987 | countof(js_std_funcs)); |
| 1988 | JS_SetModuleExport(ctx, m, "in", js_new_std_file(ctx, stdin, false)); |
| 1989 | JS_SetModuleExport(ctx, m, "out", js_new_std_file(ctx, stdout, false)); |
| 1990 | JS_SetModuleExport(ctx, m, "err", js_new_std_file(ctx, stderr, false)); |
| 1991 | return 0; |
| 1992 | } |
| 1993 | |
| 1994 | JSModuleDef *js_init_module_std(JSContext *ctx, const char *module_name) |
| 1995 | { |
nothing calls this directly
no test coverage detected