[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
This commit is contained in:
Hermès Bélusca-Maïto 2017-09-03 16:03:21 +00:00
parent 473a79a57b
commit dae658088a
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 134 additions and 100 deletions

View file

@ -137,16 +137,14 @@ CONSOLE_ConOutPuts(
} }
VOID VOID
CONSOLE_ConOutPrintf( CONSOLE_ConOutPrintfV(
IN LPCSTR szFormat, ...) IN LPCSTR szFormat,
IN va_list args)
{ {
CHAR szOut[256]; CHAR szOut[256];
DWORD dwWritten; DWORD dwWritten;
va_list arg_ptr;
va_start(arg_ptr, szFormat); vsprintf(szOut, szFormat, args);
vsprintf(szOut, szFormat, arg_ptr);
va_end(arg_ptr);
WriteConsole( WriteConsole(
StdOutput, StdOutput,
@ -156,6 +154,19 @@ CONSOLE_ConOutPrintf(
NULL); 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 BOOL
CONSOLE_Flush(VOID) CONSOLE_Flush(VOID)
{ {
@ -405,56 +416,16 @@ CONSOLE_SetUnderlinedTextXY(
} }
VOID VOID
CONSOLE_SetStatusText( CONSOLE_SetStatusTextXV(
IN LPCSTR fmt, ...)
{
CHAR Buffer[128];
va_list ap;
COORD coPos;
DWORD Written;
va_start(ap, fmt);
vsprintf(Buffer, fmt, ap);
va_end(ap);
coPos.X = 0;
coPos.Y = yScreen - 1;
FillConsoleOutputAttribute(
StdOutput,
BACKGROUND_WHITE,
xScreen,
coPos,
&Written);
FillConsoleOutputCharacterA(
StdOutput,
' ',
xScreen,
coPos,
&Written);
WriteConsoleOutputCharacterA(
StdOutput,
Buffer,
(ULONG)strlen(Buffer),
coPos,
&Written);
}
VOID
CONSOLE_SetStatusTextX(
IN SHORT x, IN SHORT x,
IN LPCSTR fmt, ...) IN LPCSTR fmt,
IN va_list args)
{ {
CHAR Buffer[128];
va_list ap;
COORD coPos; COORD coPos;
DWORD Written; DWORD Written;
CHAR Buffer[128];
va_start(ap, fmt); vsprintf(Buffer, fmt, args);
vsprintf(Buffer, fmt, ap);
va_end(ap);
coPos.X = 0; coPos.X = 0;
coPos.Y = yScreen - 1; coPos.Y = yScreen - 1;
@ -483,6 +454,41 @@ CONSOLE_SetStatusTextX(
&Written); &Written);
} }
VOID
__cdecl
CONSOLE_SetStatusTextX(
IN SHORT x,
IN LPCSTR fmt,
...)
{
va_list ap;
va_start(ap, fmt);
CONSOLE_SetStatusTextXV(x, fmt, ap);
va_end(ap);
}
VOID
CONSOLE_SetStatusTextV(
IN LPCSTR fmt,
IN va_list args)
{
CONSOLE_SetStatusTextXV(0, fmt, args);
}
VOID
__cdecl
CONSOLE_SetStatusText(
IN LPCSTR fmt,
...)
{
va_list ap;
va_start(ap, fmt);
CONSOLE_SetStatusTextV(fmt, ap);
va_end(ap);
}
static static
VOID VOID
CONSOLE_ClearStatusTextX(IN SHORT x, CONSOLE_ClearStatusTextX(IN SHORT x,
@ -503,6 +509,7 @@ CONSOLE_ClearStatusTextX(IN SHORT x,
VOID VOID
__cdecl
CONSOLE_SetStatusTextAutoFitX( CONSOLE_SetStatusTextAutoFitX(
IN SHORT x, IN SHORT x,
IN LPCSTR fmt, ...) IN LPCSTR fmt, ...)
@ -588,6 +595,7 @@ CONSOLE_SetHighlightedTextXY(
} }
VOID VOID
__cdecl
CONSOLE_PrintTextXY( CONSOLE_PrintTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
@ -614,6 +622,7 @@ CONSOLE_PrintTextXY(
} }
VOID VOID
__cdecl
CONSOLE_PrintTextXYN( CONSOLE_PrintTextXYN(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,

View file

@ -55,14 +55,14 @@ extern SHORT xScreen, yScreen;
BOOLEAN BOOLEAN
CONSOLE_Init( CONSOLE_Init(
VOID); VOID);
VOID VOID
CONSOLE_ClearScreen(VOID); CONSOLE_ClearScreen(VOID);
VOID VOID
CONSOLE_ConInKey( CONSOLE_ConInKey(
OUT PINPUT_RECORD Buffer); OUT PINPUT_RECORD Buffer);
BOOLEAN BOOLEAN
CONSOLE_ConInKeyPeek( CONSOLE_ConInKeyPeek(
@ -70,15 +70,22 @@ CONSOLE_ConInKeyPeek(
VOID VOID
CONSOLE_ConOutChar( CONSOLE_ConOutChar(
IN CHAR c); IN CHAR c);
VOID VOID
CONSOLE_ConOutPrintfV(
IN LPCSTR szFormat,
IN va_list args);
VOID
__cdecl
CONSOLE_ConOutPrintf( CONSOLE_ConOutPrintf(
IN LPCSTR szFormat, ...); IN LPCSTR szFormat,
...);
VOID VOID
CONSOLE_ConOutPuts( CONSOLE_ConOutPuts(
IN LPCSTR szText); IN LPCSTR szText);
BOOL BOOL
CONSOLE_Flush(VOID); CONSOLE_Flush(VOID);
@ -96,97 +103,115 @@ CONSOLE_GetCursorY(VOID);
VOID VOID
CONSOLE_InvertTextXY( CONSOLE_InvertTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN SHORT col, IN SHORT col,
IN SHORT row); IN SHORT row);
VOID VOID
CONSOLE_NormalTextXY( CONSOLE_NormalTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN SHORT col, IN SHORT col,
IN SHORT row); IN SHORT row);
VOID VOID
__cdecl
CONSOLE_PrintTextXY( CONSOLE_PrintTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN LPCSTR fmt, ...); IN LPCSTR fmt, ...);
VOID VOID
__cdecl
CONSOLE_PrintTextXYN( CONSOLE_PrintTextXYN(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN SHORT len, IN SHORT len,
IN LPCSTR fmt, ...); IN LPCSTR fmt, ...);
VOID VOID
CONSOLE_SetCursorType( CONSOLE_SetCursorType(
IN BOOL bInsert, IN BOOL bInsert,
IN BOOL bVisible); IN BOOL bVisible);
VOID VOID
CONSOLE_SetCursorXY( CONSOLE_SetCursorXY(
IN SHORT x, IN SHORT x,
IN SHORT y); IN SHORT y);
VOID VOID
CONSOLE_SetCursorXY( CONSOLE_SetCursorXY(
IN SHORT x, IN SHORT x,
IN SHORT y); IN SHORT y);
VOID VOID
CONSOLE_SetHighlightedTextXY( CONSOLE_SetHighlightedTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN LPCSTR Text); IN LPCSTR Text);
VOID VOID
CONSOLE_SetInputTextXY( CONSOLE_SetInputTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN SHORT len, IN SHORT len,
IN LPCWSTR Text); IN LPCWSTR Text);
VOID VOID
CONSOLE_SetInvertedTextXY( CONSOLE_SetInvertedTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN LPCSTR Text); IN LPCSTR Text);
VOID VOID
CONSOLE_SetStatusTextV(
IN LPCSTR fmt,
IN va_list args);
VOID
__cdecl
CONSOLE_SetStatusText( CONSOLE_SetStatusText(
IN LPCSTR fmt, ...); IN LPCSTR fmt,
...);
VOID VOID
CONSOLE_SetStatusTextXV(
IN SHORT x,
IN LPCSTR fmt,
IN va_list args);
VOID
__cdecl
CONSOLE_SetStatusTextX( CONSOLE_SetStatusTextX(
IN SHORT x, IN SHORT x,
IN LPCSTR fmt, ...); IN LPCSTR fmt,
...);
VOID VOID
__cdecl
CONSOLE_SetStatusTextAutoFitX( CONSOLE_SetStatusTextAutoFitX(
IN SHORT x, IN SHORT x,
IN LPCSTR fmt, ...); IN LPCSTR fmt, ...);
VOID VOID
CONSOLE_SetTextXY( CONSOLE_SetTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN LPCSTR Text); IN LPCSTR Text);
VOID VOID
CONSOLE_SetUnderlinedTextXY( CONSOLE_SetUnderlinedTextXY(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN LPCSTR Text); IN LPCSTR Text);
VOID VOID
CONSOLE_SetStyledText( CONSOLE_SetStyledText(
IN SHORT x, IN SHORT x,
IN SHORT y, IN SHORT y,
IN INT Flags, IN INT Flags,
IN LPCSTR Text); IN LPCSTR Text);
VOID VOID
CONSOLE_ClearStyledText(IN SHORT x, CONSOLE_ClearStyledText(IN SHORT x,