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