Add comments to terminal functions
This commit is contained in:
+19
-1
@@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
using namespace Terminal;
|
using namespace Terminal;
|
||||||
|
|
||||||
|
/* Terminal functions -- routines activated by CSI, escape or a C1 or C2 control char */
|
||||||
|
|
||||||
static void clearline( Framebuffer *fb, int row, int start, int end )
|
static void clearline( Framebuffer *fb, int row, int start, int end )
|
||||||
{
|
{
|
||||||
for ( int col = start; col <= end; col++ ) {
|
for ( int col = start; col <= end; col++ ) {
|
||||||
@@ -12,6 +14,7 @@ static void clearline( Framebuffer *fb, int row, int start, int end )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* erase in line */
|
||||||
void CSI_EL( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_EL( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
switch ( dispatch->getparam( 0, 0 ) ) {
|
switch ( dispatch->getparam( 0, 0 ) ) {
|
||||||
@@ -29,6 +32,7 @@ void CSI_EL( Framebuffer *fb, Dispatcher *dispatch )
|
|||||||
|
|
||||||
static Function func_CSI_EL( CSI, "K", CSI_EL );
|
static Function func_CSI_EL( CSI, "K", CSI_EL );
|
||||||
|
|
||||||
|
/* erase in display */
|
||||||
void CSI_ED( Framebuffer *fb, Dispatcher *dispatch ) {
|
void CSI_ED( Framebuffer *fb, Dispatcher *dispatch ) {
|
||||||
switch ( dispatch->getparam( 0, 0 ) ) {
|
switch ( dispatch->getparam( 0, 0 ) ) {
|
||||||
case 0: /* active position to end of screen, inclusive */
|
case 0: /* active position to end of screen, inclusive */
|
||||||
@@ -53,6 +57,7 @@ void CSI_ED( Framebuffer *fb, Dispatcher *dispatch ) {
|
|||||||
|
|
||||||
static Function func_CSI_ED( CSI, "J", CSI_ED );
|
static Function func_CSI_ED( CSI, "J", CSI_ED );
|
||||||
|
|
||||||
|
/* cursor movement -- relative and absolute */
|
||||||
void CSI_cursormove( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_cursormove( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
int num = dispatch->getparam( 0, 1 );
|
int num = dispatch->getparam( 0, 1 );
|
||||||
@@ -86,6 +91,7 @@ static Function func_CSI_cursormove_D( CSI, "D", CSI_cursormove );
|
|||||||
static Function func_CSI_cursormove_H( CSI, "H", CSI_cursormove );
|
static Function func_CSI_cursormove_H( CSI, "H", CSI_cursormove );
|
||||||
static Function func_CSI_cursormove_f( CSI, "f", CSI_cursormove );
|
static Function func_CSI_cursormove_f( CSI, "f", CSI_cursormove );
|
||||||
|
|
||||||
|
/* device attributes */
|
||||||
void CSI_DA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
|
void CSI_DA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
dispatch->terminal_to_host.append( "\033[?1;0c" );
|
dispatch->terminal_to_host.append( "\033[?1;0c" );
|
||||||
@@ -93,6 +99,7 @@ void CSI_DA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch )
|
|||||||
|
|
||||||
static Function func_CSI_DA( CSI, "c", CSI_DA );
|
static Function func_CSI_DA( CSI, "c", CSI_DA );
|
||||||
|
|
||||||
|
/* screen alignment diagnostic */
|
||||||
void Esc_DECALN( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Esc_DECALN( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
for ( int y = 0; y < fb->ds.get_height(); y++ ) {
|
for ( int y = 0; y < fb->ds.get_height(); y++ ) {
|
||||||
@@ -105,6 +112,7 @@ void Esc_DECALN( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Esc_DECALN( ESCAPE, "#8", Esc_DECALN );
|
static Function func_Esc_DECALN( ESCAPE, "#8", Esc_DECALN );
|
||||||
|
|
||||||
|
/* line feed */
|
||||||
void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
fb->move_rows_autoscroll( 1 );
|
fb->move_rows_autoscroll( 1 );
|
||||||
@@ -113,6 +121,7 @@ void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
static Function func_Ctrl_LF( CONTROL, "\x0a", Ctrl_LF );
|
static Function func_Ctrl_LF( CONTROL, "\x0a", Ctrl_LF );
|
||||||
static Function func_Ctrl_IND( CONTROL, "\x84", Ctrl_LF );
|
static Function func_Ctrl_IND( CONTROL, "\x84", Ctrl_LF );
|
||||||
|
|
||||||
|
/* carriage return */
|
||||||
void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
fb->ds.move_col( 0 );
|
fb->ds.move_col( 0 );
|
||||||
@@ -120,6 +129,7 @@ void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_CR( CONTROL, "\x0d", Ctrl_CR );
|
static Function func_Ctrl_CR( CONTROL, "\x0d", Ctrl_CR );
|
||||||
|
|
||||||
|
/* backspace */
|
||||||
void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
fb->ds.move_col( -1, true );
|
fb->ds.move_col( -1, true );
|
||||||
@@ -127,6 +137,7 @@ void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS );
|
static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS );
|
||||||
|
|
||||||
|
/* reverse index -- like a backwards linefeed */
|
||||||
void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
fb->move_rows_autoscroll( -1 );
|
fb->move_rows_autoscroll( -1 );
|
||||||
@@ -134,6 +145,7 @@ void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_RI( CONTROL, "\x8D", Ctrl_RI );
|
static Function func_Ctrl_RI( CONTROL, "\x8D", Ctrl_RI );
|
||||||
|
|
||||||
|
/* newline */
|
||||||
void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
fb->ds.move_col( 0 );
|
fb->ds.move_col( 0 );
|
||||||
@@ -142,6 +154,7 @@ void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_NEL( CONTROL, "\x85", Ctrl_NEL );
|
static Function func_Ctrl_NEL( CONTROL, "\x85", Ctrl_NEL );
|
||||||
|
|
||||||
|
/* horizontal tab */
|
||||||
void Ctrl_HT( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_HT( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
int col = fb->ds.get_next_tab();
|
int col = fb->ds.get_next_tab();
|
||||||
@@ -154,6 +167,7 @@ void Ctrl_HT( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_HT( CONTROL, "\x09", Ctrl_HT );
|
static Function func_Ctrl_HT( CONTROL, "\x09", Ctrl_HT );
|
||||||
|
|
||||||
|
/* horizontal tab set */
|
||||||
void Ctrl_HTS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_HTS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
||||||
{
|
{
|
||||||
fb->ds.set_tab();
|
fb->ds.set_tab();
|
||||||
@@ -161,6 +175,7 @@ void Ctrl_HTS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) )
|
|||||||
|
|
||||||
static Function func_Ctrl_HTS( CONTROL, "\x88", Ctrl_HTS );
|
static Function func_Ctrl_HTS( CONTROL, "\x88", Ctrl_HTS );
|
||||||
|
|
||||||
|
/* tabulation clear */
|
||||||
void CSI_TBC( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_TBC( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
int param = dispatch->getparam( 0, 0 );
|
int param = dispatch->getparam( 0, 0 );
|
||||||
@@ -198,6 +213,7 @@ static bool *get_DEC_mode( int param, Framebuffer *fb ) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* set private mode */
|
||||||
void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < dispatch->param_count(); i++ ) {
|
for ( int i = 0; i < dispatch->param_count(); i++ ) {
|
||||||
@@ -208,6 +224,7 @@ void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* clear private mode */
|
||||||
void CSI_DECRM( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_DECRM( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < dispatch->param_count(); i++ ) {
|
for ( int i = 0; i < dispatch->param_count(); i++ ) {
|
||||||
@@ -221,6 +238,7 @@ void CSI_DECRM( Framebuffer *fb, Dispatcher *dispatch )
|
|||||||
static Function func_CSI_DECSM( CSI, "?h", CSI_DECSM );
|
static Function func_CSI_DECSM( CSI, "?h", CSI_DECSM );
|
||||||
static Function func_CSI_DECRM( CSI, "?l", CSI_DECRM );
|
static Function func_CSI_DECRM( CSI, "?l", CSI_DECRM );
|
||||||
|
|
||||||
|
/* set top and bottom margins */
|
||||||
void CSI_DECSTBM( Framebuffer *fb, Dispatcher *dispatch )
|
void CSI_DECSTBM( Framebuffer *fb, Dispatcher *dispatch )
|
||||||
{
|
{
|
||||||
int top = dispatch->getparam( 0, 1 );
|
int top = dispatch->getparam( 0, 1 );
|
||||||
@@ -233,8 +251,8 @@ void CSI_DECSTBM( Framebuffer *fb, Dispatcher *dispatch )
|
|||||||
|
|
||||||
static Function func_CSI_DECSTMB( CSI, "r", CSI_DECSTBM );
|
static Function func_CSI_DECSTMB( CSI, "r", CSI_DECSTBM );
|
||||||
|
|
||||||
|
/* terminal bell -- ignored for now */
|
||||||
void Ctrl_BEL( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch __attribute((unused)) )
|
void Ctrl_BEL( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch __attribute((unused)) )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
static Function func_Ctrl_BEL( CONTROL, "\x07", Ctrl_BEL );
|
static Function func_Ctrl_BEL( CONTROL, "\x07", Ctrl_BEL );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user