]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c
Refine comments and two code style.
[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
1e6e84c7 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
4983ca93 9\r
1e6e84c7 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
4983ca93 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
e26d7b59 21INTN\r
22EFIAPI\r
23Test(CONST VOID*b1, CONST VOID*b2)\r
4983ca93 24{\r
25 if (*(INTN*)b1 == *(INTN*)b2) {\r
26 return (0);\r
27 }\r
28 if (*(INTN*)b1 < *(INTN*)b2) {\r
29 return(-1);\r
30 }\r
31 return (1);\r
32}\r
33\r
34/**\r
35 UEFI application entry point which has an interface similar to a\r
36 standard C main function.\r
37\r
38 The ShellCEntryLib library instance wrappers the actual UEFI application\r
39 entry point and calls this ShellAppMain function.\r
40\r
4ff7e37b
ED
41 @param Argc Argument count\r
42 @param Argv The parsed arguments\r
4983ca93 43\r
44 @retval 0 The application exited normally.\r
45 @retval Other An error occurred.\r
46\r
47**/\r
1e6e84c7 48INTN\r
49EFIAPI\r
4983ca93 50ShellAppMain (\r
1e6e84c7 51 IN UINTN Argc,\r
4983ca93 52 IN CHAR16 **Argv\r
125c2cf4 53 )\r
54{\r
4983ca93 55 INTN Array[10] = {2,3,4,1,5,6,7,8,1,5};\r
56 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
57 PerformQuickSort(Array, 10, sizeof(INTN), Test);\r
58 Print(L"POST-SORT\r\n");\r
59 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
60 return 0;\r
61}\r