/** @file\r
This is a test application that demonstrates how to use the sorting functions.\r
\r
- Copyright (c) 2009, Intel Corporation \r
- All rights reserved. This program and the accompanying materials \r
- are licensed and made available under the terms and conditions of the BSD License \r
- which accompanies this distribution. The full text of the license may be found at \r
- http://opensource.org/licenses/bsd-license.php \r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include <Library/ShellCEntryLib.h>\r
#include <Library/SortLib.h>\r
\r
-INTN Test(VOID*b1, VOID*b2)\r
+/**\r
+ Test comparator.\r
+\r
+ @param[in] b1 The first INTN\r
+ @param[in] b2 The other INTN\r
+\r
+ @retval 0 They are the same.\r
+ @retval -1 b1 is less than b2\r
+ @retval 1 b1 is greater then b2\r
+**/\r
+INTN\r
+EFIAPI\r
+Test (\r
+ CONST VOID *b1,\r
+ CONST VOID *b2\r
+ )\r
{\r
- if (*(INTN*)b1 == *(INTN*)b2) {\r
+ if (*(INTN *)b1 == *(INTN *)b2) {\r
return (0);\r
}\r
- if (*(INTN*)b1 < *(INTN*)b2) {\r
- return(-1);\r
+\r
+ if (*(INTN *)b1 < *(INTN *)b2) {\r
+ return (-1);\r
}\r
+\r
return (1);\r
}\r
\r
The ShellCEntryLib library instance wrappers the actual UEFI application\r
entry point and calls this ShellAppMain function.\r
\r
- @param ImageHandle The image handle of the UEFI Application.\r
- @param SystemTable A pointer to the EFI System Table.\r
+ @param Argc Argument count\r
+ @param Argv The parsed arguments\r
\r
@retval 0 The application exited normally.\r
@retval Other An error occurred.\r
\r
**/\r
-INTN \r
-EFIAPI \r
+INTN\r
+EFIAPI\r
ShellAppMain (\r
- IN UINTN Argc, \r
- IN CHAR16 **Argv\r
- ){\r
- INTN Array[10] = {2,3,4,1,5,6,7,8,1,5};\r
- 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
- PerformQuickSort(Array, 10, sizeof(INTN), Test);\r
- Print(L"POST-SORT\r\n");\r
- 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
+ IN UINTN Argc,\r
+ IN CHAR16 **Argv\r
+ )\r
+{\r
+ INTN Array[10];\r
+\r
+ Array[0] = 2;\r
+ Array[1] = 3;\r
+ Array[2] = 4;\r
+ Array[3] = 1;\r
+ Array[4] = 5;\r
+ Array[5] = 6;\r
+ Array[6] = 7;\r
+ Array[7] = 8;\r
+ Array[8] = 1;\r
+ Array[9] = 5;\r
+\r
+ 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
+ PerformQuickSort (Array, 10, sizeof (INTN), Test);\r
+ Print (L"POST-SORT\r\n");\r
+ 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
return 0;\r
}\r