MySQL 8.0.32
Source Code Documentation
duk_module_shim.cc File Reference
#include "duk_module_shim.h"
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <sys/stat.h>
#include "duk_module_duktape.h"
#include "duk_module_node.h"
#include "duk_node_fs.h"
#include "duktape.h"

Macros

#define STDIN_FILENO   0
 
#define STDOUT_FILENO   1
 
#define STDERR_FILENO   2
 

Functions

static duk_ret_t node_path_join (duk_context *ctx)
 
static duk_ret_t normalize_path (duk_context *ctx, duk_idx_t obj_idx)
 
static duk_ret_t node_format_string (duk_context *ctx)
 
static duk_ret_t node_path_resolve (duk_context *ctx)
 
static duk_ret_t node_util_inherits (duk_context *ctx)
 
static duk_ret_t node_console_log (duk_context *ctx)
 
static duk_ret_t node_tty_isatty (duk_context *ctx)
 
static duk_ret_t node_tty_getwindowsize (duk_context *ctx)
 
static duk_ret_t node_process_getenv (duk_context *ctx)
 
static duk_ret_t node_process_cwd (duk_context *ctx)
 
static duk_ret_t node_process_on (duk_context *ctx)
 
static duk_ret_t node_process_remove_listener (duk_context *ctx)
 
static duk_ret_t node_process_nexttick (duk_context *ctx)
 
static duk_ret_t node_write_stderr (duk_context *ctx)
 
static duk_ret_t node_write_stdout (duk_context *ctx)
 
static duk_ret_t node_clear_timeout (duk_context *ctx)
 
static duk_ret_t dukopen_process_module (duk_context *ctx)
 
static duk_ret_t dukopen_process_module_init_env (duk_context *ctx)
 
static duk_ret_t cb_resolve_module (duk_context *ctx)
 
static duk_ret_t cb_load_module (duk_context *ctx)
 
void duk_module_shim_init (duk_context *ctx, const std::vector< std::string > &prefixes)
 
void duk_module_duktape_init (duk_context *ctx)
 

Variables

static const duk_function_list_entry path_module_funcs []
 
static const duk_function_list_entry util_module_funcs []
 
static const duk_function_list_entry fs_module_funcs []
 
static const duk_function_list_entry assert_module_funcs []
 
static const duk_function_list_entry os_module_funcs []
 
static const duk_function_list_entry console_module_funcs []
 
static const duk_function_list_entry tty_module_funcs []
 
static const duk_function_list_entry process_module_funcs []
 

Macro Definition Documentation

◆ STDERR_FILENO

#define STDERR_FILENO   2

◆ STDIN_FILENO

#define STDIN_FILENO   0

◆ STDOUT_FILENO

#define STDOUT_FILENO   1

Function Documentation

◆ cb_load_module()

static duk_ret_t cb_load_module ( duk_context *  ctx)
static

◆ cb_resolve_module()

static duk_ret_t cb_resolve_module ( duk_context *  ctx)
static

◆ duk_module_duktape_init()

void duk_module_duktape_init ( duk_context *  ctx)

◆ duk_module_shim_init()

void duk_module_shim_init ( duk_context *  ctx,
const std::vector< std::string > &  prefixes 
)

◆ dukopen_process_module()

static duk_ret_t dukopen_process_module ( duk_context *  ctx)
static

◆ dukopen_process_module_init_env()

static duk_ret_t dukopen_process_module_init_env ( duk_context *  ctx)
static

◆ node_clear_timeout()

static duk_ret_t node_clear_timeout ( duk_context *  ctx)
static

◆ node_console_log()

static duk_ret_t node_console_log ( duk_context *  ctx)
static

◆ node_format_string()

static duk_ret_t node_format_string ( duk_context *  ctx)
static

◆ node_path_join()

static duk_ret_t node_path_join ( duk_context *  ctx)
static

◆ node_path_resolve()

static duk_ret_t node_path_resolve ( duk_context *  ctx)
static

◆ node_process_cwd()

static duk_ret_t node_process_cwd ( duk_context *  ctx)
static

◆ node_process_getenv()

static duk_ret_t node_process_getenv ( duk_context *  ctx)
static

◆ node_process_nexttick()

static duk_ret_t node_process_nexttick ( duk_context *  ctx)
static

◆ node_process_on()

static duk_ret_t node_process_on ( duk_context *  ctx)
static

◆ node_process_remove_listener()

static duk_ret_t node_process_remove_listener ( duk_context *  ctx)
static

◆ node_tty_getwindowsize()

static duk_ret_t node_tty_getwindowsize ( duk_context *  ctx)
static

◆ node_tty_isatty()

static duk_ret_t node_tty_isatty ( duk_context *  ctx)
static

◆ node_util_inherits()

static duk_ret_t node_util_inherits ( duk_context *  ctx)
static

◆ node_write_stderr()

static duk_ret_t node_write_stderr ( duk_context *  ctx)
static

◆ node_write_stdout()

static duk_ret_t node_write_stdout ( duk_context *  ctx)
static

◆ normalize_path()

static duk_ret_t normalize_path ( duk_context *  ctx,
duk_idx_t  obj_idx 
)
static

Variable Documentation

◆ assert_module_funcs

const duk_function_list_entry assert_module_funcs[]
static
Initial value:
= {
{nullptr, nullptr, 0}}

◆ console_module_funcs

const duk_function_list_entry console_module_funcs[]
static
Initial value:
= {
{"log", node_console_log, DUK_VARARGS},
{"warn", node_console_log, DUK_VARARGS},
{nullptr, nullptr, 0}}
static duk_ret_t node_console_log(duk_context *ctx)
Definition: duk_module_shim.cc:195

◆ fs_module_funcs

const duk_function_list_entry fs_module_funcs[]
static
Initial value:
= {
{"readSync", duk_node_fs_read_file_sync, 1},
{nullptr, nullptr, 0}}
duk_ret_t duk_node_fs_read_file_sync(duk_context *ctx)
Definition: duk_node_fs.c:30

◆ os_module_funcs

const duk_function_list_entry os_module_funcs[]
static
Initial value:
= {
{nullptr, nullptr, 0}}

◆ path_module_funcs

const duk_function_list_entry path_module_funcs[]
static
Initial value:
= {
{"join", node_path_join, DUK_VARARGS},
{"resolve", node_path_resolve, 1},
{nullptr, nullptr, 0}}
static duk_ret_t node_path_resolve(duk_context *ctx)
Definition: duk_module_shim.cc:144
static duk_ret_t node_path_join(duk_context *ctx)
Definition: duk_module_shim.cc:62

◆ process_module_funcs

const duk_function_list_entry process_module_funcs[]
static
Initial value:
= {
{"getenv", node_process_getenv, 1},
{"cwd", node_process_cwd, 0},
{"on", node_process_on, 2},
{"removeListener", node_process_remove_listener, 2},
{"nextTick", node_process_nexttick, 1},
{nullptr, nullptr, 0}}
static duk_ret_t node_process_getenv(duk_context *ctx)
Definition: duk_module_shim.cc:237
static duk_ret_t node_process_remove_listener(duk_context *ctx)
Definition: duk_module_shim.cc:253
static duk_ret_t node_process_on(duk_context *ctx)
Definition: duk_module_shim.cc:248
static duk_ret_t node_process_cwd(duk_context *ctx)
Definition: duk_module_shim.cc:242
static duk_ret_t node_process_nexttick(duk_context *ctx)
Definition: duk_module_shim.cc:258

◆ tty_module_funcs

const duk_function_list_entry tty_module_funcs[]
static
Initial value:
= {
{"isatty", node_tty_isatty, 1},
{"getWindowSize", node_tty_getwindowsize, 0},
{nullptr, nullptr, 0}}
static duk_ret_t node_tty_isatty(duk_context *ctx)
Definition: duk_module_shim.cc:214
static duk_ret_t node_tty_getwindowsize(duk_context *ctx)
Definition: duk_module_shim.cc:223

◆ util_module_funcs

const duk_function_list_entry util_module_funcs[]
static
Initial value:
= {
{"inherits", node_util_inherits, 2},
{nullptr, nullptr, 0}}
static duk_ret_t node_util_inherits(duk_context *ctx)
Definition: duk_module_shim.cc:154