]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c
ShellPkg: Apply uncrustify changes
[mirror_edk2.git] / ShellPkg / Application / ShellSortTestApp / ShellSortTestApp.c
CommitLineData
4983ca93 1/** @file\r
2 This is a test application that demonstrates how to use the sorting functions.\r
3\r
3a888f2a 4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
56ba3746 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
4983ca93 6\r
7**/\r
8\r
9#include <Uefi.h>\r
10#include <Library/UefiLib.h>\r
11#include <Library/DebugLib.h>\r
12#include <Library/ShellCEntryLib.h>\r
13#include <Library/SortLib.h>\r
14\r
0f87f732 15/**\r
16 Test comparator.\r
17\r
18 @param[in] b1 The first INTN\r
19 @param[in] b2 The other INTN\r
20\r
21 @retval 0 They are the same.\r
22 @retval -1 b1 is less than b2\r
23 @retval 1 b1 is greater then b2\r
24**/\r
e26d7b59 25INTN\r
26EFIAPI\r
47d20b54
MK
27Test (\r
28 CONST VOID *b1,\r
29 CONST VOID *b2\r
30 )\r
4983ca93 31{\r
47d20b54 32 if (*(INTN *)b1 == *(INTN *)b2) {\r
4983ca93 33 return (0);\r
34 }\r
47d20b54
MK
35\r
36 if (*(INTN *)b1 < *(INTN *)b2) {\r
37 return (-1);\r
4983ca93 38 }\r
47d20b54 39\r
4983ca93 40 return (1);\r
41}\r
42\r
43/**\r
44 UEFI application entry point which has an interface similar to a\r
45 standard C main function.\r
46\r
47 The ShellCEntryLib library instance wrappers the actual UEFI application\r
48 entry point and calls this ShellAppMain function.\r
49\r
4ff7e37b
ED
50 @param Argc Argument count\r
51 @param Argv The parsed arguments\r
4983ca93 52\r
53 @retval 0 The application exited normally.\r
54 @retval Other An error occurred.\r
55\r
56**/\r
1e6e84c7 57INTN\r
58EFIAPI\r
4983ca93 59ShellAppMain (\r
47d20b54
MK
60 IN UINTN Argc,\r
61 IN CHAR16 **Argv\r
125c2cf4 62 )\r
63{\r
47d20b54 64 INTN Array[10];\r
f62f07ee
ED
65\r
66 Array[0] = 2;\r
67 Array[1] = 3;\r
68 Array[2] = 4;\r
69 Array[3] = 1;\r
70 Array[4] = 5;\r
71 Array[5] = 6;\r
72 Array[6] = 7;\r
73 Array[7] = 8;\r
74 Array[8] = 1;\r
75 Array[9] = 5;\r
76\r
47d20b54
MK
77 Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);\r
78 PerformQuickSort (Array, 10, sizeof (INTN), Test);\r
79 Print (L"POST-SORT\r\n");\r
80 Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);\r
4983ca93 81 return 0;\r
82}\r