45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/* ------------------------------------------------------------------
|
|
* -- project: SCAN
|
|
* -- description: abstraction for terminal control sequences
|
|
* ------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef __FORMAT_H
|
|
#define __FORMAT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
/* -- defines */
|
|
#define NUMBER_STYLES ( ( int )8 )
|
|
#define ESCAPE "\x1b"
|
|
#define SEQUENCE_PREFIX ESCAPE"["
|
|
#define SEQUENCE_SUFFIX "m"
|
|
|
|
/* -- type definitions */
|
|
typedef enum {
|
|
style_bold = 0u,
|
|
style_dim,
|
|
style_italic,
|
|
style_underlined,
|
|
style_blinking,
|
|
style_reversed,
|
|
style_invisible,
|
|
style_strikethrough,
|
|
style_none = NUMBER_STYLES
|
|
} style_t;
|
|
|
|
|
|
/* -- constant definitions */
|
|
extern const uint8_t STYLE_SET[ NUMBER_STYLES ];
|
|
extern const uint8_t STYLE_RESET[ NUMBER_STYLES ];
|
|
|
|
/* -- function prototypes */
|
|
void format_clear( void );
|
|
void format_set_style( const style_t* const styles, uint8_t number_styles );
|
|
void format_reset_style( const style_t* const styles, uint8_t number_styles );
|
|
void format_set_colour( uint32_t colour );
|
|
void format_clear_colour( void );
|
|
|
|
#endif
|