[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
2018-10-28 14:41:57 +01:00
parent 473a79a57b
commit dae658088a
2 changed files with 134 additions and 100 deletions
+60 -51
View File
@@ -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,56 +416,16 @@ CONSOLE_SetUnderlinedTextXY(
}
VOID
CONSOLE_SetStatusText(
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(
CONSOLE_SetStatusTextXV(
IN SHORT x,
IN LPCSTR fmt, ...)
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;
@@ -483,6 +454,41 @@ CONSOLE_SetStatusTextX(
&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
VOID
CONSOLE_ClearStatusTextX(IN SHORT x,
@@ -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,
+74 -49
View File
@@ -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,