]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Library used for sorting and comparison routines.\r | |
3 | \r | |
4 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved. <BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __SORT_LIB_H__\r | |
16 | #define __SORT_LIB_H__\r | |
17 | \r | |
18 | /**\r | |
19 | Prototype for comparison function for any two element types.\r | |
20 | \r | |
21 | @param[in] Buffer1 The pointer to first buffer.\r | |
22 | @param[in] Buffer2 The pointer to second buffer.\r | |
23 | \r | |
24 | @retval 0 Buffer1 equal to Buffer2.\r | |
25 | @return <0 Buffer1 is less than Buffer2.\r | |
26 | @return >0 Buffer1 is greater than Buffer2.\r | |
27 | **/\r | |
28 | typedef\r | |
29 | INTN\r | |
30 | (EFIAPI *SORT_COMPARE)(\r | |
31 | IN CONST VOID *Buffer1,\r | |
32 | IN CONST VOID *Buffer2\r | |
33 | );\r | |
34 | \r | |
35 | /**\r | |
36 | Function to perform a Quick Sort on a buffer of comparable elements.\r | |
37 | \r | |
38 | Each element must be equally sized.\r | |
39 | \r | |
40 | If BufferToSort is NULL, then ASSERT.\r | |
41 | If CompareFunction is NULL, then ASSERT.\r | |
42 | \r | |
43 | If Count is < 2 , then perform no action.\r | |
44 | If Size is < 1 , then perform no action.\r | |
45 | \r | |
46 | @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements;\r | |
47 | on return, a buffer of sorted elements.\r | |
48 | @param[in] Count The number of elements in the buffer to sort.\r | |
49 | @param[in] ElementSize The size of an element in bytes.\r | |
50 | @param[in] CompareFunction The function to call to perform the comparison\r | |
51 | of any two elements.\r | |
52 | **/\r | |
53 | VOID\r | |
54 | EFIAPI\r | |
55 | PerformQuickSort (\r | |
56 | IN OUT VOID *BufferToSort,\r | |
57 | IN CONST UINTN Count,\r | |
58 | IN CONST UINTN ElementSize,\r | |
59 | IN SORT_COMPARE CompareFunction\r | |
60 | );\r | |
61 | \r | |
62 | \r | |
63 | /**\r | |
64 | Function to compare 2 device paths for use as CompareFunction.\r | |
65 | \r | |
66 | @param[in] Buffer1 The pointer to Device Path to compare.\r | |
67 | @param[in] Buffer2 The pointer to second DevicePath to compare.\r | |
68 | \r | |
69 | @retval 0 Buffer1 equal to Buffer2.\r | |
70 | @return < 0 Buffer1 is less than Buffer2.\r | |
71 | @return > 0 Buffer1 is greater than Buffer2.\r | |
72 | **/\r | |
73 | INTN\r | |
74 | EFIAPI\r | |
75 | DevicePathCompare (\r | |
76 | IN CONST VOID *Buffer1,\r | |
77 | IN CONST VOID *Buffer2\r | |
78 | );\r | |
79 | \r | |
80 | /**\r | |
81 | Function to compare 2 strings without regard to case of the characters.\r | |
82 | \r | |
83 | @param[in] Buffer1 The pointer to String to compare (CHAR16**).\r | |
84 | @param[in] Buffer2 The pointer to second String to compare (CHAR16**).\r | |
85 | \r | |
86 | @retval 0 Buffer1 equal to Buffer2.\r | |
87 | @return < 0 Buffer1 is less than Buffer2.\r | |
88 | @return > 0 Buffer1 is greater than Buffer2.\r | |
89 | **/\r | |
90 | INTN\r | |
91 | EFIAPI\r | |
92 | StringNoCaseCompare (\r | |
93 | IN CONST VOID *Buffer1,\r | |
94 | IN CONST VOID *Buffer2\r | |
95 | );\r | |
96 | \r | |
97 | /**\r | |
98 | Function to compare 2 strings.\r | |
99 | \r | |
100 | @param[in] Buffer1 The pointer to String to compare (CHAR16**).\r | |
101 | @param[in] Buffer2 The pointer to second String to compare (CHAR16**).\r | |
102 | \r | |
103 | @retval 0 Buffer1 equal to Buffer2.\r | |
104 | @return < 0 Buffer1 is less than Buffer2.\r | |
105 | @return > 0 Buffer1 is greater than Buffer2.\r | |
106 | **/\r | |
107 | INTN\r | |
108 | EFIAPI\r | |
109 | StringCompare (\r | |
110 | IN CONST VOID *Buffer1,\r | |
111 | IN CONST VOID *Buffer2\r | |
112 | );\r | |
113 | \r | |
114 | #endif //__SORT_LIB_H__\r |