ReactOS
0.4.16-dev-109-gf4cb10f
pager.h
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS Console Utilities Library
3
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4
* PURPOSE: Console/terminal paging functionality.
5
* COPYRIGHT: Copyright 2017-2021 Hermes Belusca-Maito
6
* Copyright 2021 Katayama Hirofumi MZ
7
*/
8
16
#ifndef __PAGER_H__
17
#define __PAGER_H__
18
19
#pragma once
20
21
#ifndef _UNICODE
22
#error The ConUtils library at the moment only supports compilation with _UNICODE defined!
23
#endif
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
// #include <wincon.h>
30
31
struct
_CON_PAGER
;
32
33
typedef
BOOL
34
(
__stdcall
*
CON_PAGER_LINE_FN
)(
35
IN
OUT
struct
_CON_PAGER
*Pager,
36
IN
PCTCH
line
,
37
IN
DWORD
cch
);
38
39
/* Flags for CON_PAGER */
40
#define CON_PAGER_EXPAND_TABS (1 << 0)
41
#define CON_PAGER_EXPAND_FF (1 << 1)
42
// Whether or not the pager will cache the line if it's incomplete (not NEWLINE-terminated).
43
#define CON_PAGER_CACHE_INCOMPLETE_LINE (1 << 2)
44
45
typedef
struct
_CON_PAGER
46
{
47
/* Console screen properties */
48
PCON_SCREEN
Screen
;
49
DWORD
PageColumns
;
50
DWORD
PageRows
;
51
52
/* Paging parameters */
53
CON_PAGER_LINE_FN
PagerLine
;
/* The line function */
54
DWORD
dwFlags
;
/* The CON_PAGER_... flags */
55
LONG
nTabWidth
;
56
DWORD
ScrollRows
;
57
58
/* Data buffer */
59
PCTCH
CachedLine
;
/* Cached line, HeapAlloc'ated */
60
SIZE_T
cchCachedLine
;
/* Its length (number of characters) */
61
SIZE_T
ich
;
/* The current index of character in TextBuff (a user-provided source buffer) */
62
63
/* Paging state */
64
PCTCH
CurrentLine
;
/* Pointer to the current line (either within a user-provided source buffer, or to CachedLine) */
65
SIZE_T
ichCurr
;
/* The current index of character in CurrentLine */
66
SIZE_T
iEndLine
;
/* End (length) of CurrentLine */
67
DWORD
nSpacePending
;
/* Pending spaces for TAB expansion */
68
DWORD
iColumn
;
/* The current index of column */
69
DWORD
iLine
;
/* The physical output line count of screen */
70
DWORD
lineno
;
/* The logical line number */
71
}
CON_PAGER
, *
PCON_PAGER
;
72
73
#define INIT_CON_PAGER(pScreen) {(pScreen), 0}
74
75
#define InitializeConPager(pPager, pScreen) \
76
do { \
77
ZeroMemory((pPager), sizeof(*(pPager))); \
78
(pPager)->Screen = (pScreen); \
79
} while (0)
80
81
82
typedef
BOOL
83
(
__stdcall
*
PAGE_PROMPT
)(
84
IN
PCON_PAGER
Pager,
85
IN
DWORD
Done,
86
IN
DWORD
Total);
87
88
BOOL
89
ConWritePaging
(
90
IN
PCON_PAGER
Pager,
91
IN
PAGE_PROMPT
PagePrompt
,
92
IN
BOOL
StartPaging,
93
IN
PCTCH
szStr,
94
IN
DWORD
len
);
95
96
BOOL
97
ConPutsPaging
(
98
IN
PCON_PAGER
Pager,
99
IN
PAGE_PROMPT
PagePrompt
,
100
IN
BOOL
StartPaging,
101
IN
PCTSTR
szStr);
102
103
BOOL
104
ConResPagingEx
(
105
IN
PCON_PAGER
Pager,
106
IN
PAGE_PROMPT
PagePrompt
,
107
IN
BOOL
StartPaging,
108
IN
HINSTANCE
hInstance
OPTIONAL
,
109
IN
UINT
uID);
110
111
BOOL
112
ConResPaging
(
113
IN
PCON_PAGER
Pager,
114
IN
PAGE_PROMPT
PagePrompt
,
115
IN
BOOL
StartPaging,
116
IN
UINT
uID);
117
118
#ifdef __cplusplus
119
}
120
#endif
121
122
#endif
/* __PAGER_H__ */
123
124
/* EOF */
hInstance
HINSTANCE hInstance
Definition:
charmap.c:19
BOOL
unsigned int BOOL
Definition:
ntddk_ex.h:94
DWORD
unsigned long DWORD
Definition:
ntddk_ex.h:95
len
GLenum GLsizei len
Definition:
glext.h:6722
void
Definition:
nsiface.idl:2307
cch
static DWORD DWORD void LPSTR DWORD cch
Definition:
str.c:202
PagePrompt
static BOOL __stdcall PagePrompt(PCON_PAGER Pager, DWORD Done, DWORD Total)
Definition:
more.c:160
UINT
unsigned int UINT
Definition:
ndis.h:50
BOOL
#define BOOL
Definition:
nt_native.h:43
PCTSTR
LPCSTR PCTSTR
Definition:
ntbasedef.h:488
PCTCH
LPCCH PCTCH
Definition:
ntbasedef.h:486
PCON_PAGER
struct _CON_PAGER * PCON_PAGER
ConResPagingEx
BOOL ConResPagingEx(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN HINSTANCE hInstance OPTIONAL, IN UINT uID)
Definition:
pager.c:663
PAGE_PROMPT
BOOL(__stdcall * PAGE_PROMPT)(IN PCON_PAGER Pager, IN DWORD Done, IN DWORD Total)
Definition:
pager.h:83
ConPutsPaging
BOOL ConPutsPaging(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN PCTSTR szStr)
Definition:
pager.c:646
CON_PAGER_LINE_FN
BOOL(__stdcall * CON_PAGER_LINE_FN)(IN OUT struct _CON_PAGER *Pager, IN PCTCH line, IN DWORD cch)
Definition:
pager.h:34
ConResPaging
BOOL ConResPaging(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN UINT uID)
Definition:
pager.c:681
ConWritePaging
BOOL ConWritePaging(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN PCTCH szStr, IN DWORD len)
Definition:
pager.c:549
CON_PAGER
struct _CON_PAGER CON_PAGER
LONG
long LONG
Definition:
pedump.c:60
OPTIONAL
PULONG MinorVersion OPTIONAL
Definition:
CrossNt.h:68
_CON_PAGER
Definition:
pager.h:46
_CON_PAGER::cchCachedLine
SIZE_T cchCachedLine
Definition:
pager.h:60
_CON_PAGER::dwFlags
DWORD dwFlags
Definition:
pager.h:54
_CON_PAGER::lineno
DWORD lineno
Definition:
pager.h:70
_CON_PAGER::PageRows
DWORD PageRows
Definition:
pager.h:50
_CON_PAGER::nTabWidth
LONG nTabWidth
Definition:
pager.h:55
_CON_PAGER::nSpacePending
DWORD nSpacePending
Definition:
pager.h:67
_CON_PAGER::PageColumns
DWORD PageColumns
Definition:
pager.h:49
_CON_PAGER::iLine
DWORD iLine
Definition:
pager.h:69
_CON_PAGER::CachedLine
PCTCH CachedLine
Definition:
pager.h:59
_CON_PAGER::CurrentLine
PCTCH CurrentLine
Definition:
pager.h:64
_CON_PAGER::ScrollRows
DWORD ScrollRows
Definition:
pager.h:56
_CON_PAGER::ichCurr
SIZE_T ichCurr
Definition:
pager.h:65
_CON_PAGER::PagerLine
CON_PAGER_LINE_FN PagerLine
Definition:
pager.h:53
_CON_PAGER::iColumn
DWORD iColumn
Definition:
pager.h:68
_CON_PAGER::Screen
PCON_SCREEN Screen
Definition:
pager.h:48
_CON_PAGER::ich
SIZE_T ich
Definition:
pager.h:61
_CON_PAGER::iEndLine
SIZE_T iEndLine
Definition:
pager.h:66
_CON_SCREEN
Definition:
screen.h:42
line
Definition:
parser.c:49
SIZE_T
ULONG_PTR SIZE_T
Definition:
typedefs.h:80
__stdcall
#define __stdcall
Definition:
typedefs.h:25
IN
#define IN
Definition:
typedefs.h:39
OUT
#define OUT
Definition:
typedefs.h:40
sdk
lib
conutils
pager.h
Generated on Wed Oct 9 2024 06:19:16 for ReactOS by
1.9.6