[CONUTILS] Split stream.c into input and output stream modules.
[reactos.git] / sdk / lib / conutils / stream_private.h
1 /*
2 * PROJECT: ReactOS Console Utilities Library
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Provides basic abstraction wrappers around CRT streams or
5 * Win32 console API I/O functions, to deal with i18n + Unicode
6 * related problems.
7 * COPYRIGHT: Copyright 2017-2018 ReactOS Team
8 * Copyright 2017-2018 Hermes Belusca-Maito
9 */
10
11 #ifndef __STREAM_PRIVATE_H__
12 #define __STREAM_PRIVATE_H__
13
14 #pragma once
15
16 /*
17 * Console I/O streams
18 */
19
20 #if 0
21 // Shadow type, implementation-specific
22 typedef struct _CON_STREAM CON_STREAM, *PCON_STREAM;
23 #endif
24
25 typedef struct _CON_STREAM
26 {
27 CON_WRITE_FUNC WriteFunc;
28
29 #ifdef USE_CRT
30 FILE* fStream;
31 #else
32 BOOL IsInitialized;
33 CRITICAL_SECTION Lock;
34
35 HANDLE hHandle;
36
37 /*
38 * TRUE if 'hHandle' refers to a console, in which case I/O UTF-16
39 * is directly used. If 'hHandle' refers to a file or a pipe, the
40 * 'Mode' flag is used.
41 */
42 BOOL IsConsole;
43
44 /*
45 * The 'Mode' flag is used to know the translation mode
46 * when 'hHandle' refers to a file or a pipe.
47 */
48 CON_STREAM_MODE Mode;
49 UINT CodePage; // Used to convert UTF-16 text to some ANSI codepage.
50 #endif /* defined(USE_CRT) */
51 } CON_STREAM, *PCON_STREAM;
52
53 #endif /* __STREAM_PRIVATE_H__ */
54
55 /* EOF */