This commit is contained in:
1 parent
9055c5c825
commit
5e67c596b9
43 files changed
+476
-450
No files matched your search
@@ -29,7 +29,7 @@ wp_intern WpStr8RO colours[COUNT_TERM_COLOUR] = {
|
||||
[WP_TERM_COLOUR_CLEAR] = wpStr8LitRoInitialiserList("\033[0m"),
|
||||
};
|
||||
|
||||
void _printColouredText(WpStr8RO *text, WpTerminalColour colour) {
|
||||
void printColouredText(WpStr8RO *text, WpTerminalColour colour) {
|
||||
printf(WP_STR8_SPEC WP_STR8_SPEC, wpStr8Varg(colours[colour]), wpStr8Varg((*text)));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ void wpShellTermcolourPrintText(WpStr8RO *text, WpTerminalColour colour) {
|
||||
return;
|
||||
}
|
||||
|
||||
_printColouredText(text, colour);
|
||||
printColouredText(text, colour);
|
||||
}
|
||||
|
||||
void wpShellTermcolourClearColour(void) {
|
||||
WpStr8RO empty = wpStr8LitRo("");
|
||||
_printColouredText(&empty, WP_TERM_COLOUR_CLEAR);
|
||||
printColouredText(&empty, WP_TERM_COLOUR_CLEAR);
|
||||
}
|
||||
@@ -17,7 +17,7 @@ BEGIN_C_LINKAGE
|
||||
void wpShellTermcolourPrintText(WpStr8RO *text, WpTerminalColour colour);
|
||||
void wpShellTermcolourClearColour(void);
|
||||
|
||||
wp_extern void _printColouredText(WpStr8RO *text, WpTerminalColour colour);
|
||||
wp_extern void printColouredText(WpStr8RO *text, WpTerminalColour colour);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
@@ -22,7 +22,7 @@ struct TermcolourData {
|
||||
wpMiscUtilsReservePadding(sizeof(HANDLE) + sizeof(WORD) + sizeof(WORD));
|
||||
};
|
||||
|
||||
wp_intern void init_data(TermcolourData *data);
|
||||
wp_intern void initData(TermcolourData *data);
|
||||
|
||||
wp_intern WORD colours[COUNT_TERM_COLOUR] = {
|
||||
[WP_TERM_COLOUR_FG_BLACK] = 0,
|
||||
@@ -43,10 +43,10 @@ wp_intern WORD colours[COUNT_TERM_COLOUR] = {
|
||||
[WP_TERM_COLOUR_FG_BR_WHITE] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
|
||||
};
|
||||
|
||||
void _printColouredText(WpStr8RO *text, WpTerminalColour colour) {
|
||||
void printColouredText(WpStr8RO *text, WpTerminalColour colour) {
|
||||
wp_persist TermcolourData data = {0};
|
||||
if (data.handle == 0) {
|
||||
init_data(&data);
|
||||
initData(&data);
|
||||
}
|
||||
|
||||
if (colour == WP_TERM_COLOUR_CLEAR) {
|
||||
@@ -59,7 +59,7 @@ void _printColouredText(WpStr8RO *text, WpTerminalColour colour) {
|
||||
printf(WP_STR8_SPEC, wpStr8Varg((*text)));
|
||||
}
|
||||
|
||||
wp_intern void init_data(TermcolourData *data) {
|
||||
wp_intern void initData(TermcolourData *data) {
|
||||
// create handle
|
||||
data->handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
|
||||
Reference in new issue
Block a user