From ad5a96ab2daeeac53f0c924113f23dc931f965c5 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Thu, 16 Apr 2009 08:46:28 +0000 Subject: Retire language conversion APIs from HII library class. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8104 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/UefiHiiLib/HiiString.c | 273 ---------------------------- 1 file changed, 273 deletions(-) (limited to 'MdeModulePkg/Library/UefiHiiLib') diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c b/MdeModulePkg/Library/UefiHiiLib/HiiString.c index 2c317e5de3..f6569754b2 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c @@ -15,153 +15,6 @@ #include "InternalHiiLib.h" - -// -// Lookup table of ISO639-2 3 character language codes to ISO 639-1 2 character language codes -// Each entry is 5 CHAR8 values long. The first 3 CHAR8 values are the ISO 639-2 code. -// The last 2 CHAR8 values are the ISO 639-1 code. -// -GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 Iso639ToRfc3066ConversionTable[] = -"\ -aaraa\ -abkab\ -afraf\ -amham\ -araar\ -asmas\ -aymay\ -azeaz\ -bakba\ -belbe\ -benbn\ -bihbh\ -bisbi\ -bodbo\ -brebr\ -bulbg\ -catca\ -cescs\ -corkw\ -cosco\ -cymcy\ -danda\ -deude\ -dzodz\ -ellel\ -engen\ -epoeo\ -estet\ -euseu\ -faofo\ -fasfa\ -fijfj\ -finfi\ -frafr\ -fryfy\ -gaiga\ -gdhgd\ -glggl\ -grngn\ -gujgu\ -hauha\ -hebhe\ -hinhi\ -hrvhr\ -hunhu\ -hyehy\ -ikuiu\ -ileie\ -inaia\ -indid\ -ipkik\ -islis\ -itait\ -jawjw\ -jpnja\ -kalkl\ -kankn\ -kasks\ -katka\ -kazkk\ -khmkm\ -kinrw\ -kirky\ -korko\ -kurku\ -laolo\ -latla\ -lavlv\ -linln\ -litlt\ -ltzlb\ -malml\ -marmr\ -mkdmk\ -mlgmg\ -mltmt\ -molmo\ -monmn\ -mrimi\ -msams\ -myamy\ -nauna\ -nepne\ -nldnl\ -norno\ -ocioc\ -ormom\ -panpa\ -polpl\ -porpt\ -pusps\ -quequ\ -rohrm\ -ronro\ -runrn\ -rusru\ -sagsg\ -sansa\ -sinsi\ -slksk\ -slvsl\ -smise\ -smosm\ -snasn\ -sndsd\ -somso\ -sotst\ -spaes\ -sqisq\ -srpsr\ -sswss\ -sunsu\ -swasw\ -swesv\ -tamta\ -tattt\ -telte\ -tgktg\ -tgltl\ -thath\ -tsnts\ -tuktk\ -twitw\ -uigug\ -ukruk\ -urdur\ -uzbuz\ -vievi\ -volvo\ -wolwo\ -xhoxh\ -yidyi\ -zhaza\ -zhozh\ -zulzu\ -"; - - - /** This function create a new string in String Package or updates an existing string in a String Package. If StringId is 0, then a new string is added to @@ -497,129 +350,3 @@ Error: return String; } -/** - Convert language code from RFC3066 to ISO639-2. - - @param LanguageRfc3066 RFC3066 language code. - @param LanguageIso639 ISO639-2 language code. - - @retval EFI_SUCCESS Language code converted. - @retval EFI_NOT_FOUND Language code not found. - -**/ -EFI_STATUS -EFIAPI -ConvertRfc3066LanguageToIso639Language ( - IN CHAR8 *LanguageRfc3066, - OUT CHAR8 *LanguageIso639 - ) -{ - UINTN Index; - - if ((LanguageRfc3066[2] != '-') && (LanguageRfc3066[2] != 0)) { - CopyMem (LanguageIso639, LanguageRfc3066, 3); - return EFI_SUCCESS; - } - - for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) { - if (CompareMem (LanguageRfc3066, &Iso639ToRfc3066ConversionTable[Index + 3], 2) == 0) { - CopyMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3); - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - - -/** - Convert language code from ISO639-2 to RFC3066 and return the converted language. - Caller is responsible for freeing the allocated buffer. - - LanguageIso639 contain a single ISO639-2 code such as - "eng" or "fra". - - If LanguageIso639 is NULL, then ASSERT. - If LanguageRfc3066 is NULL, then ASSERT. - - @param LanguageIso639 ISO639-2 language code. - - @return the allocated buffer or NULL, if the language is not found. - -**/ -CHAR8* -EFIAPI -ConvertIso639LanguageToRfc3066Language ( - IN CONST CHAR8 *LanguageIso639 - ) -{ - UINTN Index; - CHAR8 *Rfc3066Language; - - for (Index = 0; Iso639ToRfc3066ConversionTable[Index] != 0; Index += 5) { - if (CompareMem (LanguageIso639, &Iso639ToRfc3066ConversionTable[Index], 3) == 0) { - Rfc3066Language = AllocateZeroPool (3); - if (Rfc3066Language != NULL) { - Rfc3066Language = CopyMem (Rfc3066Language, &Iso639ToRfc3066ConversionTable[Index + 3], 2); - } - return Rfc3066Language; - } - } - - return NULL; -} - -/** - Convert language code list from RFC3066 to ISO639-2, e.g. "en-US;fr-FR" will - be converted to "engfra". - - @param SupportedLanguages The RFC3066 language list. - - @return The ISO639-2 language list. - -**/ -CHAR8 * -EFIAPI -Rfc3066ToIso639 ( - CHAR8 *SupportedLanguages - ) -{ - CHAR8 *Languages; - CHAR8 *ReturnValue; - CHAR8 *LangCodes; - CHAR8 *LangRfc3066; - CHAR8 LangIso639[ISO_639_2_ENTRY_SIZE]; - UINTN LanguageSize; - EFI_STATUS Status; - - LanguageSize = AsciiStrSize (SupportedLanguages); - ReturnValue = AllocateZeroPool (LanguageSize); - if (ReturnValue == NULL) { - return ReturnValue; - } - - // - // Allocate working buffer to contain substring in SupportedLanguages; - // - LangRfc3066 = AllocatePool (LanguageSize); - if (LangRfc3066 == NULL) { - FreePool (ReturnValue); - return NULL; - } - Languages = ReturnValue; - LangCodes = SupportedLanguages; - while (*LangCodes != 0) { - HiiLibGetNextLanguage (&LangCodes, LangRfc3066); - - Status = ConvertRfc3066LanguageToIso639Language (LangRfc3066, LangIso639); - if (!EFI_ERROR (Status)) { - CopyMem (Languages, LangIso639, 3); - Languages = Languages + 3; - } - } - - FreePool (LangRfc3066); - return ReturnValue; -} - - -- cgit v1.2.3