DukTerm bindings ================ As of 3 October 2020, DukTerm makes 35 functions and 35 constants available to Javascript (also 4 variables). A couple of helpers handle the details. In fact, you can get away with just: #include "dukterm.h" // ... duk_context *ctx = duk_create_heap_default(); dukterm_bind_to(ctx); Look in main.c for a more complete example. Notes ----- The current version of DukTerm has a couple of quirks: - It binds all names to the interpreter's global namespace, like the curses API was designed; that should be easy to change if it's a problem. - It only includes functions that operate on the default window; those that always take a window argument make it implicit instead. - Function behavior is inconsistent: some of them return ERR like their C counterparts, others throw an exception on error. Also, only string output functions are included in the first version. List of functions ----------------- initscr(); endwin(); isendwin(); cbreak(); nocbreak(); echo(); noecho(); raw(); noraw(); nl(); nonl(); // Note the changed argument list! keypad(flag); leaveok(flag); scrollok(flag); attron(attr); attroff(attr); attrset(attr); standout(); standend(); color_set(color); has_colors(); start_color(); init_pair(pair, fg, bg); getmaxx(); getmaxy(); erase(); clear(); refresh(); move(y, x); addstr(str); addnstr(str, n); mvaddstr(y, x, str); mvaddnstr(y, x, str, n); getch(); KEY_F(n); List of constants ----------------- OK ERR A_NORMAL A_STANDOUT A_UNDERLINE A_REVERSE A_BLINK A_DIM A_BOLD A_PROTECT A_INVIS A_ALTCHARSET COLOR_BLACK COLOR_RED COLOR_GREEN COLOR_YELLOW COLOR_BLUE COLOR_MAGENTA COLOR_CYAN COLOR_WHITE KEY_RESIZE KEY_BACKSPACE KEY_ENTER KEY_BREAK KEY_UP KEY_DOWN KEY_LEFT KEY_RIGHT KEY_HOME KEY_END KEY_PPAGE KEY_NPAGE KEY_DC KEY_IC KEY_F0 List of variables ----------------- LINES COLS COLORS COLOR_PAIRS