update libs documentation

This commit is contained in:
Lisa Milne 2023-11-29 08:44:27 +10:00
parent 0fe4544107
commit d0a2029b87
2 changed files with 55 additions and 14 deletions

View file

@ -1,6 +1,6 @@
var clite = {
state:{
version:'0.3-2',
version:'0.3-3',
isinit:false,
runlevel:1
},

View file

@ -304,25 +304,66 @@ term (libterm.so): io.include('term')
Clears the current terminal, equivalent to running `clear' from
the shell.
opentty()
Creates a new blank terminal (tty) with raw key events, for
custom displays and interactions. (The less command uses this).
Returns a reference object for interacting with the new tty.
Returns null on error.
var tty = term.opentty();
closetty(tty)
Closes a tty created with opentty().
ttyctrl(func,v)
Special function for setting and accessing CLIte-specific tty
data. Specifically for interacting directly with the form used
for user data input.
data. Such as interacting directly with the form used for user
input.
func is a string containing the intended function.
v is the value to set.
Many functions of this are abstracted away in the curses library.
Returns either the requested data, or false on error.
term.ttyctrl('iset',string); // sets the current input value
var txt = term.ttyctrl('iget'); // gets the current input value
term.ttyctrl('prompt',string); // sets the current prompt text
curses (libcurses.so): io.include('curses')
provides an ncurses-like library, which functions for terminal management
curses.types:
A_NULL 0 NO OP / do nothing
A_BOLD 1 apply a bold face to text
initscr()
Switches the terminal to an alternate framebuffer, and resets io
ready for curses library calls.
endwin()
Exits curses and switches the terminal back to the main frambuffer
cbreak()
Sets input to raw unbuffered mode, so that each key press is received
individually, rather than the usual line buffering.
clear()
Clears the framebuffer.
noecho()
Causes key strokes to not be echoed to the terminal
printw(fmt)
A printf-like function for writing to the alternate framebuffer
getch(cb)
Receive input from stdin
refresh()
No op function for ncurses compatibility
attron(a)
Enable attribute 'a' for future input, see curses.types
attroff(a)
Disable attribute 'a' for future input, see curses.types
getmaxx()
Returns the width of the frambuffer in characters.
getmaxy()
Returns the height of the framebuffer in characters/lines.
getmaxyx(ptry,ptrx)
Gets the width and height of the framebuffer, as per getmaxx()
and getmaxy(), but writes the results to the pointers passed
as arguments. See clite.ptr*() functions for how to create,
read, and write with pointers.