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