💾 Archived View for gemini.ctrl-c.club › ~nttp › toys › dukterm › bindings.gmi captured on 2024-05-26 at 16:38:08. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2020-10-31)

-=-=-=-=-=-=-

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:

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

DukTerm homepage