1 2 /* 3 * Copyright (C) NGINX, Inc. 4 */ 5 6 #ifndef _NXT_JS_H_INCLUDED_ 7 #define _NXT_JS_H_INCLUDED_ 8 9 #if (NXT_HAVE_NJS) 10 11 #include <njs_main.h> 12 13 14 typedef struct nxt_js_s nxt_js_t; 15 typedef struct nxt_js_conf_s nxt_js_conf_t; 16 17 18 typedef struct { 19 njs_vm_t *vm; 20 njs_value_t array; 21 } nxt_js_cache_t; 22 23 24 njs_mod_t *nxt_js_module_loader(njs_vm_t *vm, njs_external_ptr_t external, 25 njs_str_t *name); 26 nxt_js_conf_t *nxt_js_conf_new(nxt_mp_t *mp, nxt_bool_t test); 27 void nxt_js_conf_release(nxt_js_conf_t *jcf); 28 void nxt_js_set_proto(nxt_js_conf_t *jcf, njs_external_t *proto, nxt_uint_t n); 29 nxt_int_t nxt_js_add_module(nxt_js_conf_t *jcf, nxt_str_t *name, 30 nxt_str_t *text); 31 nxt_js_t *nxt_js_add_tpl(nxt_js_conf_t *jcf, nxt_str_t *str, nxt_bool_t strz); 32 nxt_int_t nxt_js_compile(nxt_js_conf_t *jcf); 33 nxt_int_t nxt_js_test(nxt_js_conf_t *jcf, nxt_str_t *str, u_char *error); 34 nxt_int_t nxt_js_call(nxt_task_t *task, nxt_js_conf_t *jcf, 35 nxt_js_cache_t *cache, nxt_js_t *js, nxt_str_t *str, void *ctx); 36 void nxt_js_release(nxt_js_cache_t *cache); 37 nxt_int_t nxt_js_error(njs_vm_t *vm, u_char *error); 38 39 40 extern njs_int_t nxt_js_proto_id; 41 42 43 #endif /* NXT_HAVE_NJS */ 44 45 #endif /* _NXT_JS_H_INCLUDED_ */ 46