[CONUTILS] Split stream.c into input and output stream modules.
[reactos.git] / sdk / lib / conutils / outstream.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 __OUTSTREAM_H__
12 #define __OUTSTREAM_H__
13
14 #pragma once
15
16 /*
17 * Enable this define if you want to only use CRT functions to output
18 * UNICODE stream to the console, as in the way explained by
19 * http://archives.miloush.net/michkap/archive/2008/03/18/8306597.html
20 */
21 /** NOTE: Experimental! Don't use USE_CRT yet because output to console is a bit broken **/
22 // #define USE_CRT
23
24 #ifndef _UNICODE
25 #error The ConUtils library at the moment only supports compilation with _UNICODE defined!
26 #endif
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 // Shadow type, implementation-specific
33 typedef struct _CON_STREAM CON_STREAM, *PCON_STREAM;
34
35 // typedef INT (__stdcall *CON_READ_FUNC)(IN PCON_STREAM, IN PTCHAR, IN DWORD);
36 // Stream, szStr, len
37 typedef INT (__stdcall *CON_WRITE_FUNC)(IN PCON_STREAM, IN PTCHAR, IN DWORD);
38
39
40 /*
41 * Console I/O utility API -- Output
42 */
43
44 INT
45 __stdcall
46 ConWrite(
47 IN PCON_STREAM Stream,
48 IN PTCHAR szStr,
49 IN DWORD len);
50
51 INT
52 ConStreamWrite(
53 IN PCON_STREAM Stream,
54 IN PTCHAR szStr,
55 IN DWORD len);
56
57 INT
58 ConPuts(
59 IN PCON_STREAM Stream,
60 IN LPWSTR szStr);
61
62 INT
63 ConPrintfV(
64 IN PCON_STREAM Stream,
65 IN LPWSTR szStr,
66 IN va_list args); // arg_ptr
67
68 INT
69 __cdecl
70 ConPrintf(
71 IN PCON_STREAM Stream,
72 IN LPWSTR szStr,
73 ...);
74
75 INT
76 ConResPutsEx(
77 IN PCON_STREAM Stream,
78 IN HINSTANCE hInstance OPTIONAL,
79 IN UINT uID);
80
81 INT
82 ConResPuts(
83 IN PCON_STREAM Stream,
84 IN UINT uID);
85
86 INT
87 ConResPrintfExV(
88 IN PCON_STREAM Stream,
89 IN HINSTANCE hInstance OPTIONAL,
90 IN UINT uID,
91 IN va_list args); // arg_ptr
92
93 INT
94 ConResPrintfV(
95 IN PCON_STREAM Stream,
96 IN UINT uID,
97 IN va_list args); // arg_ptr
98
99 INT
100 __cdecl
101 ConResPrintfEx(
102 IN PCON_STREAM Stream,
103 IN HINSTANCE hInstance OPTIONAL,
104 IN UINT uID,
105 ...);
106
107 INT
108 __cdecl
109 ConResPrintf(
110 IN PCON_STREAM Stream,
111 IN UINT uID,
112 ...);
113
114 INT
115 ConMsgPuts(
116 IN PCON_STREAM Stream,
117 IN DWORD dwFlags,
118 IN LPCVOID lpSource OPTIONAL,
119 IN DWORD dwMessageId,
120 IN DWORD dwLanguageId);
121
122 INT
123 ConMsgPrintf2V(
124 IN PCON_STREAM Stream,
125 IN DWORD dwFlags,
126 IN LPCVOID lpSource OPTIONAL,
127 IN DWORD dwMessageId,
128 IN DWORD dwLanguageId,
129 IN va_list args); // arg_ptr
130
131 INT
132 ConMsgPrintfV(
133 IN PCON_STREAM Stream,
134 IN DWORD dwFlags,
135 IN LPCVOID lpSource OPTIONAL,
136 IN DWORD dwMessageId,
137 IN DWORD dwLanguageId,
138 IN va_list args); // arg_ptr
139
140 INT
141 __cdecl
142 ConMsgPrintf(
143 IN PCON_STREAM Stream,
144 IN DWORD dwFlags,
145 IN LPCVOID lpSource OPTIONAL,
146 IN DWORD dwMessageId,
147 IN DWORD dwLanguageId,
148 ...);
149
150
151
152 VOID
153 ConClearLine(IN PCON_STREAM Stream);
154
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* __OUTSTREAM_H__ */
161
162 /* EOF */