ReactOS 0.4.15-dev-8222-g9164419
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
26extern "C" {
27#endif
28
29// #include <wincon.h>
30
31struct _CON_PAGER;
32
33typedef BOOL
35 IN OUT struct _CON_PAGER *Pager,
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
45typedef struct _CON_PAGER
46{
47 /* Console screen properties */
51
52 /* Paging parameters */
53 CON_PAGER_LINE_FN PagerLine; /* The line function */
54 DWORD dwFlags; /* The CON_PAGER_... flags */
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 */
72
73#define INIT_CON_PAGER(pScreen) {(pScreen), 0}
74
75#define InitializeConPager(pPager, pScreen) \
76do { \
77 ZeroMemory((pPager), sizeof(*(pPager))); \
78 (pPager)->Screen = (pScreen); \
79} while (0)
80
81
82typedef BOOL
84 IN PCON_PAGER Pager,
85 IN DWORD Done,
86 IN DWORD Total);
87
88BOOL
90 IN PCON_PAGER Pager,
92 IN BOOL StartPaging,
93 IN PCTCH szStr,
94 IN DWORD len);
95
96BOOL
98 IN PCON_PAGER Pager,
100 IN BOOL StartPaging,
101 IN PCTSTR szStr);
102
103BOOL
105 IN PCON_PAGER Pager,
107 IN BOOL StartPaging,
109 IN UINT uID);
110
111BOOL
113 IN PCON_PAGER Pager,
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
Definition: charmap.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
static BOOL __stdcall PagePrompt(PCON_PAGER Pager, DWORD Done, DWORD Total)
Definition: more.c:160
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
LPCSTR PCTSTR
Definition: ntbasedef.h:488
LPCCH PCTCH
Definition: ntbasedef.h:486
struct _CON_PAGER * PCON_PAGER
BOOL ConResPagingEx(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN HINSTANCE hInstance OPTIONAL, IN UINT uID)
Definition: pager.c:663
BOOL(__stdcall * PAGE_PROMPT)(IN PCON_PAGER Pager, IN DWORD Done, IN DWORD Total)
Definition: pager.h:83
BOOL ConPutsPaging(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN PCTSTR szStr)
Definition: pager.c:646
BOOL(__stdcall * CON_PAGER_LINE_FN)(IN OUT struct _CON_PAGER *Pager, IN PCTCH line, IN DWORD cch)
Definition: pager.h:34
BOOL ConResPaging(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN UINT uID)
Definition: pager.c:681
BOOL ConWritePaging(IN PCON_PAGER Pager, IN PAGE_PROMPT PagePrompt, IN BOOL StartPaging, IN PCTCH szStr, IN DWORD len)
Definition: pager.c:549
struct _CON_PAGER CON_PAGER
long LONG
Definition: pedump.c:60
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
SIZE_T cchCachedLine
Definition: pager.h:60
DWORD dwFlags
Definition: pager.h:54
DWORD lineno
Definition: pager.h:70
DWORD PageRows
Definition: pager.h:50
LONG nTabWidth
Definition: pager.h:55
DWORD nSpacePending
Definition: pager.h:67
DWORD PageColumns
Definition: pager.h:49
DWORD iLine
Definition: pager.h:69
PCTCH CachedLine
Definition: pager.h:59
PCTCH CurrentLine
Definition: pager.h:64
DWORD ScrollRows
Definition: pager.h:56
SIZE_T ichCurr
Definition: pager.h:65
CON_PAGER_LINE_FN PagerLine
Definition: pager.h:53
DWORD iColumn
Definition: pager.h:68
PCON_SCREEN Screen
Definition: pager.h:48
SIZE_T ich
Definition: pager.h:61
SIZE_T iEndLine
Definition: pager.h:66
Definition: parser.c:49
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define __stdcall
Definition: typedefs.h:25
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40