[CONUTILS] Split stream.c into input and output stream modules.

As code grows, this will allow for better maintenance of the console
stream code. In particular the input stream module will contain special
code for handling TTYs, and this is something not all console programs
will need. Having this code in a separate module will allow for the linker
to possibly remove this code when it is unused.
This commit is contained in:
Hermès Bélusca-Maïto 2017-10-16 23:58:23 +02:00
parent 7082b621a5
commit 4e697fee2c
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
16 changed files with 1179 additions and 958 deletions

View file

@ -0,0 +1,55 @@
/*
* PROJECT: ReactOS Console Utilities Library
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Provides basic abstraction wrappers around CRT streams or
* Win32 console API I/O functions, to deal with i18n + Unicode
* related problems.
* COPYRIGHT: Copyright 2017-2018 ReactOS Team
* Copyright 2017-2018 Hermes Belusca-Maito
*/
#ifndef __STREAM_PRIVATE_H__
#define __STREAM_PRIVATE_H__
#pragma once
/*
* Console I/O streams
*/
#if 0
// Shadow type, implementation-specific
typedef struct _CON_STREAM CON_STREAM, *PCON_STREAM;
#endif
typedef struct _CON_STREAM
{
CON_WRITE_FUNC WriteFunc;
#ifdef USE_CRT
FILE* fStream;
#else
BOOL IsInitialized;
CRITICAL_SECTION Lock;
HANDLE hHandle;
/*
* TRUE if 'hHandle' refers to a console, in which case I/O UTF-16
* is directly used. If 'hHandle' refers to a file or a pipe, the
* 'Mode' flag is used.
*/
BOOL IsConsole;
/*
* The 'Mode' flag is used to know the translation mode
* when 'hHandle' refers to a file or a pipe.
*/
CON_STREAM_MODE Mode;
UINT CodePage; // Used to convert UTF-16 text to some ANSI codepage.
#endif /* defined(USE_CRT) */
} CON_STREAM, *PCON_STREAM;
#endif /* __STREAM_PRIVATE_H__ */
/* EOF */