]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c
updating comments mostly. also added some new lib functions.
[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
4 Copyright (c) 2009, Intel Corporation \r
5 All rights reserved. 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#include <Uefi.h>\r
16#include <Library/UefiLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/ShellCEntryLib.h>\r
19#include <Library/SortLib.h>\r
20\r
b3011f40 21INTN Test(CONST VOID*b1, CONST VOID*b2)\r
4983ca93 22{\r
23 if (*(INTN*)b1 == *(INTN*)b2) {\r
24 return (0);\r
25 }\r
26 if (*(INTN*)b1 < *(INTN*)b2) {\r
27 return(-1);\r
28 }\r
29 return (1);\r
30}\r
31\r
32/**\r
33 UEFI application entry point which has an interface similar to a\r
34 standard C main function.\r
35\r
36 The ShellCEntryLib library instance wrappers the actual UEFI application\r
37 entry point and calls this ShellAppMain function.\r
38\r
39 @param ImageHandle The image handle of the UEFI Application.\r
40 @param SystemTable A pointer to the EFI System Table.\r
41\r
42 @retval 0 The application exited normally.\r
43 @retval Other An error occurred.\r
44\r
45**/\r
46INTN \r
47EFIAPI \r
48ShellAppMain (\r
49 IN UINTN Argc, \r
50 IN CHAR16 **Argv\r
125c2cf4 51 )\r
52{\r
4983ca93 53 INTN Array[10] = {2,3,4,1,5,6,7,8,1,5};\r
54 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
55 PerformQuickSort(Array, 10, sizeof(INTN), Test);\r
56 Print(L"POST-SORT\r\n");\r
57 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
58 return 0;\r
59}\r