https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dae658088a6ca495714689...
commit dae658088a6ca4957146890f614d2fb202b8fd25 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Sun Sep 3 16:03:21 2017 +0000 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Oct 28 14:41:57 2018 +0100
[USETUP] Introduce some -V functions for CONSOLE_ConOutPrintf, CONSOLE_SetStatusText and CONSOLE_SetStatusTextX.
Additions: - Use explicit __cdecl calling convention for variadic functions. - Fix also the whitespace in consup.h.
svn path=/branches/setup_improvements/; revision=75749 --- base/setup/usetup/consup.c | 91 ++++++++++++++++++--------------- base/setup/usetup/consup.h | 123 +++++++++++++++++++++++++++------------------ 2 files changed, 124 insertions(+), 90 deletions(-)
diff --git a/base/setup/usetup/consup.c b/base/setup/usetup/consup.c index 3c4bf3d011..a919e07624 100644 --- a/base/setup/usetup/consup.c +++ b/base/setup/usetup/consup.c @@ -137,16 +137,14 @@ CONSOLE_ConOutPuts( }
VOID -CONSOLE_ConOutPrintf( - IN LPCSTR szFormat, ...) +CONSOLE_ConOutPrintfV( + IN LPCSTR szFormat, + IN va_list args) { CHAR szOut[256]; DWORD dwWritten; - va_list arg_ptr;
- va_start(arg_ptr, szFormat); - vsprintf(szOut, szFormat, arg_ptr); - va_end(arg_ptr); + vsprintf(szOut, szFormat, args);
WriteConsole( StdOutput, @@ -156,6 +154,19 @@ CONSOLE_ConOutPrintf( NULL); }
+VOID +__cdecl +CONSOLE_ConOutPrintf( + IN LPCSTR szFormat, + ...) +{ + va_list arg_ptr; + + va_start(arg_ptr, szFormat); + CONSOLE_ConOutPrintfV(szFormat, arg_ptr); + va_end(arg_ptr); +} + BOOL CONSOLE_Flush(VOID) { @@ -405,17 +416,16 @@ CONSOLE_SetUnderlinedTextXY( }
VOID -CONSOLE_SetStatusText( - IN LPCSTR fmt, ...) +CONSOLE_SetStatusTextXV( + IN SHORT x, + IN LPCSTR fmt, + IN va_list args) { - CHAR Buffer[128]; - va_list ap; COORD coPos; DWORD Written; + CHAR Buffer[128];
- va_start(ap, fmt); - vsprintf(Buffer, fmt, ap); - va_end(ap); + vsprintf(Buffer, fmt, args);
coPos.X = 0; coPos.Y = yScreen - 1; @@ -434,6 +444,8 @@ CONSOLE_SetStatusText( coPos, &Written);
+ coPos.X = x; + WriteConsoleOutputCharacterA( StdOutput, Buffer, @@ -443,44 +455,38 @@ CONSOLE_SetStatusText( }
VOID +__cdecl CONSOLE_SetStatusTextX( IN SHORT x, - IN LPCSTR fmt, ...) + IN LPCSTR fmt, + ...) { - CHAR Buffer[128]; va_list ap; - COORD coPos; - DWORD Written;
va_start(ap, fmt); - vsprintf(Buffer, fmt, ap); + CONSOLE_SetStatusTextXV(x, fmt, ap); va_end(ap); +}
- coPos.X = 0; - coPos.Y = yScreen - 1; - - FillConsoleOutputAttribute( - StdOutput, - BACKGROUND_WHITE, - xScreen, - coPos, - &Written); - - FillConsoleOutputCharacterA( - StdOutput, - ' ', - xScreen, - coPos, - &Written); +VOID +CONSOLE_SetStatusTextV( + IN LPCSTR fmt, + IN va_list args) +{ + CONSOLE_SetStatusTextXV(0, fmt, args); +}
- coPos.X = x; +VOID +__cdecl +CONSOLE_SetStatusText( + IN LPCSTR fmt, + ...) +{ + va_list ap;
- WriteConsoleOutputCharacterA( - StdOutput, - Buffer, - (ULONG)strlen(Buffer), - coPos, - &Written); + va_start(ap, fmt); + CONSOLE_SetStatusTextV(fmt, ap); + va_end(ap); }
static @@ -503,6 +509,7 @@ CONSOLE_ClearStatusTextX(IN SHORT x,
VOID +__cdecl CONSOLE_SetStatusTextAutoFitX( IN SHORT x, IN LPCSTR fmt, ...) @@ -588,6 +595,7 @@ CONSOLE_SetHighlightedTextXY( }
VOID +__cdecl CONSOLE_PrintTextXY( IN SHORT x, IN SHORT y, @@ -614,6 +622,7 @@ CONSOLE_PrintTextXY( }
VOID +__cdecl CONSOLE_PrintTextXYN( IN SHORT x, IN SHORT y, diff --git a/base/setup/usetup/consup.h b/base/setup/usetup/consup.h index dce5fa86aa..c107785cb3 100644 --- a/base/setup/usetup/consup.h +++ b/base/setup/usetup/consup.h @@ -55,14 +55,14 @@ extern SHORT xScreen, yScreen;
BOOLEAN CONSOLE_Init( - VOID); + VOID);
VOID CONSOLE_ClearScreen(VOID);
VOID CONSOLE_ConInKey( - OUT PINPUT_RECORD Buffer); + OUT PINPUT_RECORD Buffer);
BOOLEAN CONSOLE_ConInKeyPeek( @@ -70,15 +70,22 @@ CONSOLE_ConInKeyPeek(
VOID CONSOLE_ConOutChar( - IN CHAR c); + IN CHAR c); + +VOID +CONSOLE_ConOutPrintfV( + IN LPCSTR szFormat, + IN va_list args);
VOID +__cdecl CONSOLE_ConOutPrintf( - IN LPCSTR szFormat, ...); + IN LPCSTR szFormat, + ...);
VOID CONSOLE_ConOutPuts( - IN LPCSTR szText); + IN LPCSTR szText);
BOOL CONSOLE_Flush(VOID); @@ -96,97 +103,115 @@ CONSOLE_GetCursorY(VOID);
VOID CONSOLE_InvertTextXY( - IN SHORT x, - IN SHORT y, - IN SHORT col, - IN SHORT row); + IN SHORT x, + IN SHORT y, + IN SHORT col, + IN SHORT row);
VOID CONSOLE_NormalTextXY( - IN SHORT x, - IN SHORT y, - IN SHORT col, - IN SHORT row); + IN SHORT x, + IN SHORT y, + IN SHORT col, + IN SHORT row);
VOID +__cdecl CONSOLE_PrintTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR fmt, ...); + IN SHORT x, + IN SHORT y, + IN LPCSTR fmt, ...);
VOID +__cdecl CONSOLE_PrintTextXYN( - IN SHORT x, - IN SHORT y, - IN SHORT len, - IN LPCSTR fmt, ...); + IN SHORT x, + IN SHORT y, + IN SHORT len, + IN LPCSTR fmt, ...);
VOID CONSOLE_SetCursorType( - IN BOOL bInsert, - IN BOOL bVisible); + IN BOOL bInsert, + IN BOOL bVisible);
VOID CONSOLE_SetCursorXY( - IN SHORT x, - IN SHORT y); + IN SHORT x, + IN SHORT y);
VOID CONSOLE_SetCursorXY( - IN SHORT x, - IN SHORT y); + IN SHORT x, + IN SHORT y);
VOID CONSOLE_SetHighlightedTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text); + IN SHORT x, + IN SHORT y, + IN LPCSTR Text);
VOID CONSOLE_SetInputTextXY( - IN SHORT x, - IN SHORT y, - IN SHORT len, - IN LPCWSTR Text); + IN SHORT x, + IN SHORT y, + IN SHORT len, + IN LPCWSTR Text);
VOID CONSOLE_SetInvertedTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text); + IN SHORT x, + IN SHORT y, + IN LPCSTR Text);
VOID +CONSOLE_SetStatusTextV( + IN LPCSTR fmt, + IN va_list args); + +VOID +__cdecl CONSOLE_SetStatusText( - IN LPCSTR fmt, ...); + IN LPCSTR fmt, + ...); + +VOID +CONSOLE_SetStatusTextXV( + IN SHORT x, + IN LPCSTR fmt, + IN va_list args);
VOID +__cdecl CONSOLE_SetStatusTextX( IN SHORT x, - IN LPCSTR fmt, ...); + IN LPCSTR fmt, + ...);
VOID +__cdecl CONSOLE_SetStatusTextAutoFitX( IN SHORT x, - IN LPCSTR fmt, ...); + IN LPCSTR fmt, ...);
VOID CONSOLE_SetTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text); + IN SHORT x, + IN SHORT y, + IN LPCSTR Text);
VOID CONSOLE_SetUnderlinedTextXY( - IN SHORT x, - IN SHORT y, - IN LPCSTR Text); + IN SHORT x, + IN SHORT y, + IN LPCSTR Text);
VOID CONSOLE_SetStyledText( - IN SHORT x, - IN SHORT y, - IN INT Flags, - IN LPCSTR Text); + IN SHORT x, + IN SHORT y, + IN INT Flags, + IN LPCSTR Text);
VOID CONSOLE_ClearStyledText(IN SHORT x,