Netzhaut
Web Browser Engine
ver.0.3.5.0
rev.0.23.55.58
Loading...
Searching...
No Matches
nhtty

Environment for running text based programs. More...

Data Structures

struct  nh_tty_GlyphAttributes
 
struct  nh_tty_GlyphColor
 
struct  nh_tty_Glyph
 
struct  nh_tty_Row
 
struct  nh_tty_ProgramCallbacks
 
struct  nh_tty_ProgramPrototype
 
struct  nh_tty_Program
 

Typedefs

typedef struct nh_tty_TTY nh_tty_TTY
 
typedef void *(* nh_tty_init_f) (void *arg_p)
 
typedef NH_TTY_RESULT(* nh_tty_draw_f) (nh_tty_Program *Program_p, nh_tty_Glyph *Glyphs_p, int width, int height, int row)
 
typedef NH_TTY_RESULT(* nh_tty_getCursorPosition_f) (nh_tty_Program *Program_p, int *x_p, int *y_p)
 
typedef NH_TTY_RESULT(* nh_tty_handleInput_f) (nh_tty_Program *Program_p, nh_wsi_Event Event)
 
typedef NH_TTY_RESULT(* nh_tty_update_f) (nh_tty_Program *Program_p)
 
typedef NH_TTY_RESULT(* nh_tty_handleCommand_f) (nh_tty_Program *Program_p, nh_List *Arguments_p)
 
typedef void *(* nh_tty_createView_f) ()
 
typedef void(* nh_tty_destroyView_f) (void *view_p)
 
typedef void(* nh_tty_destroy_f) (void *p)
 
typedef void(* nh_tty_destroyPrototype_f) (nh_tty_ProgramPrototype *Prototype_p)
 

Enumerations

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 }
 

Functions

nh_tty_TTYnh_tty_api_openTTY ()
 Get a new TTY handle.
 
NH_TTY_RESULT nh_tty_api_closeTTY (nh_tty_TTY *TTY_p)
 Close the specified TTY.
 
NH_TTY_RESULT nh_tty_api_addProgram (nh_tty_TTY *TTY_p, NH_TTY_PROGRAM_E type, NH_BOOL once)
 Add a built-in program to TTY in a specific manner.
 
NH_TTY_RESULT nh_tty_api_claimStandardIO (nh_tty_TTY *TTY_p)
 
NH_TTY_RESULT nh_tty_api_unclaimStandardIO (nh_tty_TTY *TTY_p)
 
NH_TTY_RESULT nh_tty_api_sendEvent (nh_tty_TTY *TTY_p, nh_wsi_Event Event)
 
NH_TTY_RESULT nh_tty_api_sendCommandToShell (int pid, NH_TTY_PROGRAM_E type)
 

Detailed Description

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.

Typedef Documentation

◆ 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

typedef void(* nh_tty_destroyPrototype_f) (nh_tty_ProgramPrototype *Prototype_p)

◆ nh_tty_destroyView_f

typedef void(* nh_tty_destroyView_f) (void *view_p)

◆ nh_tty_draw_f

typedef NH_TTY_RESULT(* nh_tty_draw_f) (nh_tty_Program *Program_p, nh_tty_Glyph *Glyphs_p, int width, int height, int row)

◆ nh_tty_getCursorPosition_f

typedef NH_TTY_RESULT(* nh_tty_getCursorPosition_f) (nh_tty_Program *Program_p, int *x_p, int *y_p)

◆ nh_tty_handleCommand_f

typedef NH_TTY_RESULT(* nh_tty_handleCommand_f) (nh_tty_Program *Program_p, nh_List *Arguments_p)

◆ nh_tty_handleInput_f

typedef NH_TTY_RESULT(* nh_tty_handleInput_f) (nh_tty_Program *Program_p, nh_wsi_Event Event)

◆ nh_tty_init_f

typedef void *(* nh_tty_init_f) (void *arg_p)

◆ nh_tty_TTY

typedef struct nh_tty_TTY nh_tty_TTY

◆ nh_tty_update_f

typedef NH_TTY_RESULT(* nh_tty_update_f) (nh_tty_Program *Program_p)

Enumeration Type Documentation

◆ 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 

Function Documentation

◆ nh_tty_api_addProgram()

NH_TTY_RESULT nh_tty_api_addProgram ( nh_tty_TTY TTY_p,
NH_TTY_PROGRAM_E  type,
NH_BOOL  once 
)

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_pPointer to TTY. Must not be NULL.
name_pType of the program.
onceIf 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_RESULT nh_tty_api_claimStandardIO ( nh_tty_TTY TTY_p)

Todo.

◆ nh_tty_api_closeTTY()

NH_TTY_RESULT nh_tty_api_closeTTY ( nh_tty_TTY TTY_p)

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
Pointerto TTY. Must not be NULL.
Returns
NH_TTY_SUCCESS on success.

◆ nh_tty_api_openTTY()

nh_tty_TTY * 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_RESULT nh_tty_api_sendCommandToShell ( int  pid,
NH_TTY_PROGRAM_E  type 
)

Todo.

◆ nh_tty_api_sendEvent()

NH_TTY_RESULT nh_tty_api_sendEvent ( nh_tty_TTY TTY_p,
nh_wsi_Event  Event 
)

Todo.

◆ nh_tty_api_unclaimStandardIO()

NH_TTY_RESULT nh_tty_api_unclaimStandardIO ( nh_tty_TTY TTY_p)

Todo.