[CMD]: Move console management prototypes to their own header.

svn path=/trunk/; revision=76002
This commit is contained in:
Hermès Bélusca-Maïto 2017-09-30 15:09:38 +00:00
parent 9254157290
commit 31530e9e62
2 changed files with 73 additions and 91 deletions

View file

@ -40,7 +40,6 @@
#define BREAK_IGNORE 4
/* define some error messages */
#define D_ON _T("on")
#define D_OFF _T("off")
@ -78,11 +77,9 @@ INT CommandAssoc (LPTSTR);
/* Prototypes for ATTRIB.C */
INT CommandAttrib (LPTSTR);
/* Prototypes for BEEP.C */
INT cmd_beep (LPTSTR);
/* Prototypes for CALL.C */
INT cmd_call (LPTSTR);
@ -90,11 +87,9 @@ INT cmd_call (LPTSTR);
/* Prototypes for CHOICE.C */
INT CommandChoice (LPTSTR);
/* Prototypes for CLS.C */
INT cmd_cls (LPTSTR);
/* Prototypes for CMD.C */
INT ConvertULargeInteger(ULONGLONG num, LPTSTR des, UINT len, BOOL bPutSeparator);
HANDLE RunFile(DWORD, LPTSTR, LPTSTR, LPTSTR, INT);
@ -145,77 +140,26 @@ LPCTSTR GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA );
/* Prototypes for COLOR.C */
INT CommandColor(LPTSTR);
VOID ConInDummy (VOID);
VOID ConInDisable (VOID);
VOID ConInEnable (VOID);
VOID ConInFlush (VOID);
VOID ConInKey (PINPUT_RECORD);
VOID ConInString (LPTSTR, DWORD);
VOID ConOutChar (TCHAR);
VOID ConOutPuts (LPTSTR);
VOID ConPrintf(LPTSTR, va_list, DWORD);
INT ConPrintfPaging(BOOL NewPage, LPTSTR, va_list, DWORD);
VOID ConOutPrintf (LPTSTR, ...);
INT ConOutPrintfPaging (BOOL NewPage, LPTSTR, ...);
VOID ConErrChar (TCHAR);
VOID ConErrPuts (LPTSTR);
VOID ConErrPrintf (LPTSTR, ...);
VOID ConOutFormatMessage (DWORD MessageId, ...);
VOID ConErrFormatMessage (DWORD MessageId, ...);
SHORT GetCursorX (VOID);
SHORT GetCursorY (VOID);
VOID GetCursorXY (PSHORT, PSHORT);
VOID SetCursorXY (SHORT, SHORT);
VOID GetScreenSize (PSHORT, PSHORT);
VOID SetCursorType (BOOL, BOOL);
VOID ConOutResPuts (UINT resID);
VOID ConErrResPuts (UINT resID);
VOID ConOutResPrintf (UINT resID, ...);
VOID ConErrResPrintf (UINT resID, ...);
VOID ConOutResPaging(BOOL NewPage, UINT resID);
BOOL ConSetTitle(IN LPCTSTR lpConsoleTitle);
#ifdef INCLUDE_CMD_BEEP
VOID ConRingBell(HANDLE hOutput);
#endif
#ifdef INCLUDE_CMD_CLS
VOID ConClearScreen(HANDLE hOutput);
#endif
#ifdef INCLUDE_CMD_COLOR
BOOL ConSetScreenColor(WORD wColor, BOOL bFill);
#endif
/* Prototypes for CONSOLE.C */
#include "console.h"
/* Prototypes for COPY.C */
INT cmd_copy (LPTSTR);
/* Prototypes for DATE.C */
INT cmd_date (LPTSTR);
/* Prototypes for DEL.C */
INT CommandDelete (LPTSTR);
/* Prototypes for DELAY.C */
INT CommandDelay (LPTSTR);
/* Prototypes for DIR.C */
INT FormatDate (TCHAR *, LPSYSTEMTIME, BOOL);
INT FormatTime (TCHAR *, LPSYSTEMTIME);
INT CommandDir (LPTSTR);
/* Prototypes for DIRSTACK.C */
VOID InitDirectoryStack (VOID);
VOID DestroyDirectoryStack (VOID);
@ -224,7 +168,6 @@ INT CommandPushd (LPTSTR);
INT CommandPopd (LPTSTR);
INT CommandDirs (LPTSTR);
/* Prototypes for ECHO.C */
BOOL OnOffCommand(LPTSTR param, LPBOOL flag, INT message);
INT CommandEcho (LPTSTR);
@ -232,7 +175,6 @@ INT CommandEchos (LPTSTR);
INT CommandEchoerr (LPTSTR);
INT CommandEchoserr (LPTSTR);
/* Prototypes for ERROR.C */
VOID ErrorMessage (DWORD, LPTSTR, ...);
@ -252,7 +194,6 @@ VOID error_syntax (LPTSTR);
VOID msg_pause (VOID);
/* Prototypes for FILECOMP.C */
#ifdef FEATURE_UNIX_FILENAME_COMPLETION
VOID CompleteFilename (LPTSTR, UINT);
@ -275,11 +216,9 @@ INT ExecuteFor(struct _PARSED_COMMAND *Cmd);
/* Prototypes for FREE.C */
INT CommandFree (LPTSTR);
/* Prototypes for GOTO.C */
INT cmd_goto (LPTSTR);
/* Prototypes for HISTORY.C */
#ifdef FEATURE_HISTORY
LPCTSTR PeekHistory(INT);
@ -291,7 +230,6 @@ VOID History_del_current_entry(LPTSTR str);/*CTRL-D*/
INT CommandHistory (LPTSTR param);
#endif
/* Prototypes for IF.C */
#define IFFLAG_NEGATE 1 /* NOT */
#define IFFLAG_IGNORECASE 2 /* /I */
@ -300,7 +238,6 @@ enum { IF_CMDEXTVERSION, IF_DEFINED, IF_ERRORLEVEL, IF_EXIST,
IF_EQU, IF_GTR, IF_GEQ, IF_LSS, IF_LEQ, IF_NEQ };
INT ExecuteIf(struct _PARSED_COMMAND *Cmd);
/* Prototypes for INTERNAL.C */
VOID InitLastPath (VOID);
VOID FreeLastPath (VOID);
@ -314,7 +251,6 @@ INT CommandShowCommands (LPTSTR);
/* Prototypes for LABEL.C */
INT cmd_label (LPTSTR);
/* Prototypes for LOCALE.C */
extern TCHAR cDateSeparator;
extern INT nDateFormat;
@ -324,23 +260,16 @@ extern TCHAR cThousandSeparator;
extern TCHAR cDecimalSeparator;
extern INT nNumberGroups;
VOID InitLocale (VOID);
LPTSTR GetDateString (VOID);
LPTSTR GetTimeString (VOID);
/* cache codepage */
extern UINT InputCodePage;
extern UINT OutputCodePage;
/* Prototypes for MEMORY.C */
INT CommandMemory (LPTSTR);
/* Prototypes for MKLINK.C */
INT cmd_mklink(LPTSTR);
/* Prototypes for MISC.C */
INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size);
BOOL SetRootPath(TCHAR *oldpath,TCHAR *InPath);
@ -367,15 +296,12 @@ INT PagePrompt (VOID);
INT FilePromptYN (UINT);
INT FilePromptYNA (UINT);
/* Prototypes for MOVE.C */
INT cmd_move (LPTSTR);
/* Prototypes for MSGBOX.C */
INT CommandMsgbox (LPTSTR);
/* Prototypes from PARSER.C */
enum { C_COMMAND, C_QUIET, C_BLOCK, C_MULTI, C_IFFAILURE, C_IFSUCCESS, C_PIPE, C_IF, C_FOR };
typedef struct _PARSED_COMMAND
@ -413,17 +339,14 @@ VOID EchoCommand(PARSED_COMMAND *Cmd);
TCHAR *Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd);
VOID FreeCommand(PARSED_COMMAND *Cmd);
/* Prototypes from PATH.C */
INT cmd_path (LPTSTR);
/* Prototypes from PROMPT.C */
VOID InitPrompt (VOID);
VOID PrintPrompt (VOID);
INT cmd_prompt (LPTSTR);
/* Prototypes for REDIR.C */
typedef enum _REDIR_MODE
{
@ -444,7 +367,6 @@ VOID UndoRedirection(REDIRECTION *, REDIRECTION *End);
INT GetRedirection(LPTSTR, REDIRECTION **);
VOID FreeRedirection(REDIRECTION *);
/* Prototypes for REN.C */
INT cmd_rename (LPTSTR);
@ -454,7 +376,6 @@ INT cmd_replace (LPTSTR);
/* Prototypes for SCREEN.C */
INT CommandScreen (LPTSTR);
/* Prototypes for SET.C */
INT cmd_set (LPTSTR);
@ -466,41 +387,32 @@ INT cmd_endlocal (LPTSTR);
/* Prototypes for START.C */
INT cmd_start (LPTSTR);
/* Prototypes for STRTOCLR.C */
BOOL StringToColor (LPWORD, LPTSTR *);
/* Prototypes for TIME.C */
INT cmd_time (LPTSTR);
/* Prototypes for TIMER.C */
INT CommandTimer (LPTSTR param);
/* Prototypes for TITLE.C */
INT cmd_title (LPTSTR);
/* Prototypes for TYPE.C */
INT cmd_type (LPTSTR);
/* Prototypes for VER.C */
VOID InitOSVersion(VOID);
VOID PrintOSVersion(VOID);
INT cmd_ver (LPTSTR);
/* Prototypes for VERIFY.C */
INT cmd_verify (LPTSTR);
/* Prototypes for VOL.C */
INT cmd_vol (LPTSTR);
/* Prototypes for WHERE.C */
BOOL SearchForExecutable (LPCTSTR, LPTSTR);
@ -508,7 +420,6 @@ BOOL SearchForExecutable (LPCTSTR, LPTSTR);
INT CommandActivate (LPTSTR);
INT CommandWindow (LPTSTR);
/* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
int cmd_if(TCHAR *);
int cmd_pause(TCHAR *);

View file

@ -0,0 +1,71 @@
#pragma once
/* Cache codepage */
extern UINT InputCodePage;
extern UINT OutputCodePage;
// /* Global variables */
// extern BOOL bCtrlBreak;
// extern BOOL bIgnoreEcho;
// extern BOOL bExit;
VOID ConInDummy (VOID);
VOID ConInDisable (VOID);
VOID ConInEnable (VOID);
VOID ConInFlush (VOID);
VOID ConInKey (PINPUT_RECORD);
VOID ConInString (LPTSTR, DWORD);
VOID ConOutChar (TCHAR);
VOID ConOutPuts (LPTSTR);
VOID ConPrintf(LPTSTR, va_list, DWORD);
INT ConPrintfPaging(BOOL NewPage, LPTSTR, va_list, DWORD);
VOID ConOutPrintf (LPTSTR, ...);
INT ConOutPrintfPaging (BOOL NewPage, LPTSTR, ...);
VOID ConErrChar (TCHAR);
VOID ConErrPuts (LPTSTR);
VOID ConErrPrintf (LPTSTR, ...);
VOID ConOutFormatMessage (DWORD MessageId, ...);
VOID ConErrFormatMessage (DWORD MessageId, ...);
SHORT GetCursorX (VOID);
SHORT GetCursorY (VOID);
VOID GetCursorXY (PSHORT, PSHORT);
VOID SetCursorXY (SHORT, SHORT);
VOID GetScreenSize (PSHORT, PSHORT);
VOID SetCursorType (BOOL, BOOL);
VOID ConOutResPuts (UINT resID);
VOID ConErrResPuts (UINT resID);
VOID ConOutResPrintf (UINT resID, ...);
VOID ConErrResPrintf (UINT resID, ...);
VOID ConOutResPaging(BOOL NewPage, UINT resID);
BOOL ConSetTitle(IN LPCTSTR lpConsoleTitle);
#ifdef INCLUDE_CMD_BEEP
VOID ConRingBell(HANDLE hOutput);
#endif
#ifdef INCLUDE_CMD_CLS
VOID ConClearScreen(HANDLE hOutput);
#endif
#ifdef INCLUDE_CMD_COLOR
BOOL ConSetScreenColor(WORD wColor, BOOL bFill);
#endif
// TCHAR cgetchar (VOID);
// BOOL CheckCtrlBreak (INT);
// #define PROMPT_NO 0
// #define PROMPT_YES 1
// #define PROMPT_ALL 2
// #define PROMPT_BREAK 3
// INT PagePrompt (VOID);
// INT FilePromptYN (UINT);
// INT FilePromptYNA (UINT);