@ -6,6 +6,7 @@
@@ -6,6 +6,7 @@
# ifndef SHELL_OPS_H__
# define SHELL_OPS_H__
# include <stdbool.h>
# include <shell/shell.h>
# include "shell_vt100.h"
# include "shell_utils.h"
@ -68,11 +69,81 @@ static inline void shell_putc(const struct shell *shell, char ch)
@@ -68,11 +69,81 @@ static inline void shell_putc(const struct shell *shell, char ch)
shell_raw_fprintf ( shell - > fprintf_ctx , " %c " , ch ) ;
}
static inline bool flag_echo_is_set ( const struct shell * shell )
static inline bool flag_insert_mode_get ( const struct shell * shell )
{
return ( ( shell - > ctx - > internal . flags . insert_mode = = 1 ) ? true : false ) ;
}
static inline void flag_insert_mode_set ( const struct shell * shell , bool val )
{
shell - > ctx - > internal . flags . insert_mode = val ? 1 : 0 ;
}
static inline bool flag_use_colors_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . use_colors = = 1 ? true : false ;
}
static inline void flag_use_colors_set ( const struct shell * shell , bool val )
{
shell - > ctx - > internal . flags . use_colors = val ? 1 : 0 ;
}
static inline bool flag_echo_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . echo = = 1 ? true : false ;
}
static inline void flag_echo_set ( const struct shell * shell , bool val )
{
shell - > ctx - > internal . flags . echo = val ? 1 : 0 ;
}
static inline bool flag_processing_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . processing = = 1 ? true : false ;
}
static inline bool flag_tx_rdy_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . tx_rdy = = 1 ? true : false ;
}
static inline void flag_tx_rdy_set ( const struct shell * shell , bool val )
{
shell - > ctx - > internal . flags . tx_rdy = val ? 1 : 0 ;
}
static inline bool flag_mode_delete_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . mode_delete = = 1 ? true : false ;
}
static inline void flag_mode_delete_set ( const struct shell * shell , bool val )
{
shell - > ctx - > internal . flags . mode_delete = val ? 1 : 0 ;
}
static inline bool flag_history_exit_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . history_exit = = 1 ? true : false ;
}
static inline void flag_history_exit_set ( const struct shell * shell , bool val )
{
shell - > ctx - > internal . flags . history_exit = val ? 1 : 0 ;
}
static inline u8_t flag_last_nl_get ( const struct shell * shell )
{
return shell - > ctx - > internal . flags . last_nl ;
}
static inline void flag_last_nl_set ( const struct shell * shell , u8_t val )
{
shell - > ctx - > internal . flags . last_nl = val ;
}
void shell_op_cursor_vert_move ( const struct shell * shell , s32_t delta ) ;
void shell_op_cursor_horiz_move ( const struct shell * shell , s32_t delta ) ;
@ -121,6 +192,8 @@ void shell_op_completion_insert(const struct shell *shell,
@@ -121,6 +192,8 @@ void shell_op_completion_insert(const struct shell *shell,
bool shell_cursor_in_empty_line ( const struct shell * shell ) ;
void shell_cmd_line_erase ( const struct shell * shell ) ;
/* Function sends data stream to the shell instance. Each time before the
* shell_write function is called , it must be ensured that IO buffer of fprintf
* is flushed to avoid synchronization issues .
@ -143,6 +216,19 @@ void shell_write(const struct shell *shell, const void *data,
@@ -143,6 +216,19 @@ void shell_write(const struct shell *shell, const void *data,
void shell_print_stream ( const void * user_ctx , const char * data ,
size_t data_len ) ;
/** @internal @brief Function for setting font color */
void shell_vt100_color_set ( const struct shell * shell ,
enum shell_vt100_color color ) ;
static inline void shell_vt100_colors_store ( const struct shell * shell ,
struct shell_vt100_colors * color )
{
memcpy ( color , & shell - > ctx - > vt100_ctx . col , sizeof ( * color ) ) ;
}
void shell_vt100_colors_restore ( const struct shell * shell ,
const struct shell_vt100_colors * color ) ;
# ifdef __cplusplus
}
# endif