]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Application/ShellSortTestApp/ShellSortTestApp.c
updating headers from code review.
[mirror_edk2.git] / ShellPkg / Application / ShellSortTestApp / ShellSortTestApp.c
1 /** @file
2 This is a test application that demonstrates how to use the sorting functions.
3
4 Copyright (c) 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <Uefi.h>
16 #include <Library/UefiLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/ShellCEntryLib.h>
19 #include <Library/SortLib.h>
20
21 INTN Test(VOID*b1, VOID*b2)
22 {
23 if (*(INTN*)b1 == *(INTN*)b2) {
24 return (0);
25 }
26 if (*(INTN*)b1 < *(INTN*)b2) {
27 return(-1);
28 }
29 return (1);
30 }
31
32 /**
33 UEFI application entry point which has an interface similar to a
34 standard C main function.
35
36 The ShellCEntryLib library instance wrappers the actual UEFI application
37 entry point and calls this ShellAppMain function.
38
39 @param ImageHandle The image handle of the UEFI Application.
40 @param SystemTable A pointer to the EFI System Table.
41
42 @retval 0 The application exited normally.
43 @retval Other An error occurred.
44
45 **/
46 INTN
47 EFIAPI
48 ShellAppMain (
49 IN UINTN Argc,
50 IN CHAR16 **Argv
51 )
52 {
53 INTN Array[10] = {2,3,4,1,5,6,7,8,1,5};
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]);
55 PerformQuickSort(Array, 10, sizeof(INTN), Test);
56 Print(L"POST-SORT\r\n");
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]);
58 return 0;
59 }