Environment for running text based programs.
More...
|
enum | NH_TTY_RESULT {
NH_TTY_SUCCESS
, NH_TTY_ERROR_NULL_POINTER
, NH_TTY_ERROR_BAD_STATE
, NH_TTY_ERROR_MEMORY_ALLOCATION
,
NH_TTY_ERROR_TERMINFO_DATA_CANNOT_BE_FOUND
, NH_TTY_ERROR_UNKNOWN_TERMINAL_TYPE
, NH_TTY_ERROR_TERMINAL_IS_HARDCOPY
, NH_TTY_ERROR_UNKNOWN_COMMAND
,
NH_TTY_ERROR_INVALID_ARGUMENT
} |
|
enum | NH_TTY_PROGRAM_E {
NH_TTY_PROGRAM_SHELL
, NH_TTY_PROGRAM_LOGGER
, NH_TTY_PROGRAM_EDITOR
, NH_TTY_PROGRAM_TAGGER
,
NH_TTY_PROGRAM_PREFERENCES
} |
|
enum | NH_TTY_MARK_E { NH_TTY_MARK_LINE_VERTICAL = 1 << 0
, NH_TTY_MARK_LINE_HORIZONTAL = 1 << 1
, NH_TTY_MARK_LINE_GRAPHICS = 1 << 2
, NH_TTY_MARK_ELEVATED = 1 << 3
} |
|
Environment for running text based programs.
In this API, TTY stands for TeleType and provides an interface for writing text based programs. Using these programs, it processes input streams from either standard input or nh_tty_sendInput and sends the result to either standard output or a nh_terminal_Terminal. Text based programs can be either added by using nh_tty_addDefaultProgram or nh_tty_addCustomProgram.
◆ nh_tty_createView_f
typedef void *(* nh_tty_createView_f) () |
◆ nh_tty_destroy_f
typedef void(* nh_tty_destroy_f) (void *p) |
◆ nh_tty_destroyPrototype_f
◆ nh_tty_destroyView_f
typedef void(* nh_tty_destroyView_f) (void *view_p) |
◆ nh_tty_draw_f
◆ nh_tty_getCursorPosition_f
◆ nh_tty_handleCommand_f
◆ nh_tty_handleInput_f
◆ nh_tty_init_f
typedef void *(* nh_tty_init_f) (void *arg_p) |
◆ nh_tty_TTY
◆ nh_tty_update_f
◆ NH_TTY_MARK_E
Enumerator |
---|
NH_TTY_MARK_LINE_VERTICAL | |
NH_TTY_MARK_LINE_HORIZONTAL | |
NH_TTY_MARK_LINE_GRAPHICS | |
NH_TTY_MARK_ELEVATED | |
◆ NH_TTY_PROGRAM_E
Enumerator |
---|
NH_TTY_PROGRAM_SHELL | |
NH_TTY_PROGRAM_LOGGER | |
NH_TTY_PROGRAM_EDITOR | |
NH_TTY_PROGRAM_TAGGER | |
NH_TTY_PROGRAM_PREFERENCES | |
◆ NH_TTY_RESULT
Return values for functions.
Enumerator |
---|
NH_TTY_SUCCESS | Indicates that something worked as planned.
|
NH_TTY_ERROR_NULL_POINTER | |
NH_TTY_ERROR_BAD_STATE | |
NH_TTY_ERROR_MEMORY_ALLOCATION | |
NH_TTY_ERROR_TERMINFO_DATA_CANNOT_BE_FOUND | |
NH_TTY_ERROR_UNKNOWN_TERMINAL_TYPE | |
NH_TTY_ERROR_TERMINAL_IS_HARDCOPY | |
NH_TTY_ERROR_UNKNOWN_COMMAND | |
NH_TTY_ERROR_INVALID_ARGUMENT | |
◆ nh_tty_api_addProgram()
Add a built-in program to TTY in a specific manner.
The built-in programs are currently named "shell", "editor", "logger" and "tagger". Please see the design document at TODO for further documentation.
- Parameters
-
TTY_p | Pointer to TTY. Must not be NULL. |
name_p | Type of the program. |
once | If NH_TRUE, the program will only be added to the currently focused tile of the currently focused tab. If NH_FALSE, it will be added to all current/future tiles of all current/future tabs until the program is removed. |
- Returns
- NH_TTY_SUCCESS on success.
◆ nh_tty_api_claimStandardIO()
◆ nh_tty_api_closeTTY()
Close the specified TTY.
Only call this if you want to force-close the TTY. There is no need to call this if you expect the user to close the TTY since this case is handled internally.
- Parameters
-
Pointer | to TTY. Must not be NULL. |
- Returns
- NH_TTY_SUCCESS on success.
◆ nh_tty_api_openTTY()
Get a new TTY handle.
You can check for user-closure with nh_getWorkload. If nh_getWorkload returns NULL, the user probably closed the TTY or there was an error. You can force-close the TTY with nh_tty_closeTTY.
- Returns
- Pointer to a new TTY handle. NULL on failure.
◆ nh_tty_api_sendCommandToShell()
◆ nh_tty_api_sendEvent()
◆ nh_tty_api_unclaimStandardIO()