tools/fire_script/main.cpp
// Translate JS callback function to C++
Translate JS callback function to C
Translate JS callback function to C
static void prog_set_term_out_cb(Program& prog, val write_cb) {
    if (write_cb.isNull())
        return;
    prog.ctx.term_out.set_write_callback([write_cb](std::string_view sv) {
        std::string str{sv};
        write_cb(str);
    });
}
static void prog_set_term_out_cb ( Program & prog , val write_cb ) { if ( write_cb . isNull ( ) ) return ; prog . ctx . term_out . set_write_callback ( [ write_cb ] ( std :: string_view sv ) { std :: string str { sv } ; write_cb ( str ) ; } ) ; }
Translate JS callback function to C++
Translate JS callback function to C ++