]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.h
ShellPkg: Apply uncrustify changes
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / BufferImage.h
CommitLineData
632820d1 1/** @file\r
ba0014b9 2 Defines BufferImage - the view of the file that is visible at any point,\r
632820d1 3 as well as the event handlers for editing the file\r
ba0014b9
LG
4\r
5 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>\r
56ba3746 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
632820d1 7\r
8**/\r
9\r
10#ifndef _LIB_BUFFER_IMAGE_H_\r
11#define _LIB_BUFFER_IMAGE_H_\r
12\r
13#include "HexEditor.h"\r
14\r
a1d4bfcc 15/**\r
16 Initialization function for HBufferImage\r
17\r
18 @retval EFI_SUCCESS The operation was successful.\r
a048af3c 19 @retval EFI_LOAD_ERROR A load error occurred.\r
a1d4bfcc 20**/\r
632820d1 21EFI_STATUS\r
22HBufferImageInit (\r
23 VOID\r
24 );\r
a1d4bfcc 25\r
26/**\r
27 Cleanup function for HBufferImage\r
28\r
29 @retval EFI_SUCCESS The operation was successful.\r
30**/\r
632820d1 31EFI_STATUS\r
32HBufferImageCleanup (\r
33 VOID\r
34 );\r
a1d4bfcc 35\r
36/**\r
37 Refresh function for HBufferImage.\r
38\r
39 @retval EFI_SUCCESS The operation was successful.\r
a048af3c 40 @retval EFI_LOAD_ERROR A Load error occurred.\r
a1d4bfcc 41\r
42**/\r
632820d1 43EFI_STATUS\r
44HBufferImageRefresh (\r
45 VOID\r
46 );\r
a1d4bfcc 47\r
48/**\r
49 Dispatch input to different handler\r
50\r
51 @param[in] Key The input key:\r
52 the keys can be:\r
53 ASCII KEY\r
54 Backspace/Delete\r
55 Direction key: up/down/left/right/pgup/pgdn\r
56 Home/End\r
57 INS\r
58\r
59 @retval EFI_SUCCESS The operation was successful.\r
a048af3c 60 @retval EFI_LOAD_ERROR A load error occurred.\r
a1d4bfcc 61 @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.\r
62**/\r
632820d1 63EFI_STATUS\r
64HBufferImageHandleInput (\r
47d20b54 65 IN EFI_INPUT_KEY *Key\r
632820d1 66 );\r
a1d4bfcc 67\r
68/**\r
ba0014b9 69 Backup function for HBufferImage. Only a few fields need to be backup.\r
a1d4bfcc 70 This is for making the file buffer refresh as few as possible.\r
71\r
72 @retval EFI_SUCCESS The operation was successful.\r
73**/\r
632820d1 74EFI_STATUS\r
75HBufferImageBackup (\r
76 VOID\r
77 );\r
78\r
a1d4bfcc 79/**\r
80 Read an image into a buffer friom a source.\r
81\r
82 @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r
83 @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
84 @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
85 @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
86 @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
87 @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
88 @param[in] BufferType The type of buffer to save. IGNORED.\r
89 @param[in] Recover TRUE for recovermode, FALSE otherwise.\r
90\r
91 @return EFI_SUCCESS The operation was successful.\r
92**/\r
632820d1 93EFI_STATUS\r
94HBufferImageRead (\r
47d20b54
MK
95 IN CONST CHAR16 *FileName,\r
96 IN CONST CHAR16 *DiskName,\r
97 IN UINTN DiskOffset,\r
98 IN UINTN DiskSize,\r
99 IN UINTN MemOffset,\r
100 IN UINTN MemSize,\r
101 IN EDIT_FILE_TYPE BufferType,\r
102 IN BOOLEAN Recover\r
632820d1 103 );\r
104\r
a1d4bfcc 105/**\r
106 Save the current image.\r
632820d1 107\r
a1d4bfcc 108 @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r
109 @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
110 @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
111 @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
112 @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
113 @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
114 @param[in] BufferType The type of buffer to save. IGNORED.\r
632820d1 115\r
a1d4bfcc 116 @return EFI_SUCCESS The operation was successful.\r
117**/\r
632820d1 118EFI_STATUS\r
a1d4bfcc 119HBufferImageSave (\r
47d20b54
MK
120 IN CHAR16 *FileName,\r
121 IN CHAR16 *DiskName,\r
122 IN UINTN DiskOffset,\r
123 IN UINTN DiskSize,\r
124 IN UINTN MemOffset,\r
125 IN UINTN MemSize,\r
126 IN EDIT_FILE_TYPE BufferType\r
632820d1 127 );\r
128\r
a1d4bfcc 129/**\r
130 According to cursor's file position, adjust screen display.\r
131\r
132 @param[in] NewFilePosRow Row of file position ( start from 1 ).\r
133 @param[in] NewFilePosCol Column of file position ( start from 1 ).\r
134 @param[in] HighBits Cursor will on high4 bits or low4 bits.\r
135**/\r
632820d1 136VOID\r
137HBufferImageMovePosition (\r
a1d4bfcc 138 IN UINTN NewFilePosRow,\r
139 IN UINTN NewFilePosCol,\r
140 IN BOOLEAN HighBits\r
632820d1 141 );\r
142\r
a1d4bfcc 143/**\r
144 Create a new line and append it to the line list.\r
145 Fields affected:\r
146 NumLines\r
ba0014b9 147 Lines\r
632820d1 148\r
a1d4bfcc 149 @retval NULL create line failed.\r
150 @return the line created.\r
632820d1 151\r
a1d4bfcc 152**/\r
153HEFI_EDITOR_LINE *\r
154HBufferImageCreateLine (\r
632820d1 155 VOID\r
156 );\r
157\r
a1d4bfcc 158/**\r
ae724571 159 Free the current image.\r
160\r
161 @retval EFI_SUCCESS The operation was successful.\r
162**/\r
632820d1 163EFI_STATUS\r
164HBufferImageFree (\r
165 VOID\r
ae724571 166 );\r
632820d1 167\r
a1d4bfcc 168/**\r
169 Delete character from buffer.\r
ba0014b9 170\r
a1d4bfcc 171 @param[in] Pos Position, Pos starting from 0.\r
172 @param[in] Count The Count of characters to delete.\r
173 @param[out] DeleteBuffer The DeleteBuffer.\r
174\r
ba0014b9 175 @retval EFI_SUCCESS Success\r
a1d4bfcc 176**/\r
632820d1 177EFI_STATUS\r
178HBufferImageDeleteCharacterFromBuffer (\r
47d20b54
MK
179 IN UINTN Pos,\r
180 IN UINTN Count,\r
181 OUT UINT8 *DeleteBuffer\r
632820d1 182 );\r
183\r
a1d4bfcc 184/**\r
185 Add character to buffer, add before pos.\r
186\r
187 @param[in] Pos Position, Pos starting from 0.\r
188 @param[in] Count Count of characters to add.\r
189 @param[in] AddBuffer Add buffer.\r
190\r
ba0014b9 191 @retval EFI_SUCCESS Success.\r
a1d4bfcc 192**/\r
632820d1 193EFI_STATUS\r
194HBufferImageAddCharacterToBuffer (\r
47d20b54
MK
195 IN UINTN Pos,\r
196 IN UINTN Count,\r
197 IN UINT8 *AddBuffer\r
632820d1 198 );\r
199\r
a1d4bfcc 200/**\r
201 Change the raw buffer to a list of lines for the UI.\r
ba0014b9 202\r
a1d4bfcc 203 @param[in] Buffer The pointer to the buffer to fill.\r
204 @param[in] Bytes The size of the buffer in bytes.\r
205\r
206 @retval EFI_SUCCESS The operation was successful.\r
207 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
208**/\r
632820d1 209EFI_STATUS\r
210HBufferImageBufferToList (\r
a1d4bfcc 211 IN VOID *Buffer,\r
212 IN UINTN Bytes\r
632820d1 213 );\r
214\r
a1d4bfcc 215/**\r
216 Change the list of lines from the UI to a raw buffer.\r
ba0014b9 217\r
a1d4bfcc 218 @param[in] Buffer The pointer to the buffer to fill.\r
219 @param[in] Bytes The size of the buffer in bytes.\r
220\r
221 @retval EFI_SUCCESS The operation was successful.\r
222**/\r
632820d1 223EFI_STATUS\r
224HBufferImageListToBuffer (\r
a1d4bfcc 225 IN VOID *Buffer,\r
226 IN UINTN Bytes\r
632820d1 227 );\r
228\r
a1d4bfcc 229/**\r
230 Move the mouse in the image buffer.\r
231\r
232 @param[in] TextX The x-coordinate.\r
233 @param[in] TextY The y-coordinate.\r
234**/\r
632820d1 235VOID\r
236HBufferImageAdjustMousePosition (\r
47d20b54
MK
237 IN INT32 TextX,\r
238 IN INT32 TextY\r
632820d1 239 );\r
240\r
a1d4bfcc 241/**\r
242 Function to decide if a column number is stored in the high bits.\r
243\r
244 @param[in] Column The column to examine.\r
245 @param[out] FCol The actual column number.\r
246\r
247 @retval TRUE The actual column was in high bits and is now in FCol.\r
248 @retval FALSE There was not a column number in the high bits.\r
249**/\r
632820d1 250BOOLEAN\r
251HBufferImageIsAtHighBits (\r
47d20b54
MK
252 IN UINTN Column,\r
253 OUT UINTN *FCol\r
632820d1 254 );\r
255\r
a1d4bfcc 256/**\r
257 Get the size of the open buffer.\r
258\r
259 @retval The size in bytes.\r
260**/\r
632820d1 261UINTN\r
262HBufferImageGetTotalSize (\r
263 VOID\r
264 );\r
265\r
632820d1 266#endif\r