]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
EdkCompatibilityPkg: Remove EdkCompatibilityPkg
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / FrameworkHiiOnUefiHiiThunk / Strings.c
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c
deleted file mode 100644 (file)
index f246c08..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-/** @file\r
-  This file implements the protocol functions related to string package.\r
-  \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
-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
-\r
-**/\r
-\r
-\r
-#include "HiiDatabase.h"\r
-\r
-/**\r
-  Test if all of the characters in a string have corresponding font characters.\r
-\r
-  This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and\r
-  return EFI_UNSUPPORTED.\r
-\r
-  @param This            A pointer to the EFI_HII_PROTOCOL instance.\r
-  @param StringToTest    A pointer to a Unicode string.\r
-  @param FirstMissing    A pointer to an index into the string. On input, the index of \r
-                         the first character in the StringToTest to examine. On exit, the index \r
-                         of the first character encountered for which a glyph is unavailable. \r
-                         If all glyphs in the string are available, the index is the index of the terminator \r
-                         of the string. \r
-  @param GlyphBufferSize A pointer to a value. On output, if the function returns EFI_SUCCESS, \r
-                         it contains the amount of memory that is required to store the string? glyph equivalent.\r
-\r
-  @retval EFI_UNSUPPORTED  The function performs nothing and return EFI_UNSUPPORTED.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HiiTestString (\r
-  IN     EFI_HII_PROTOCOL   *This,\r
-  IN     CHAR16             *StringToTest,\r
-  IN OUT UINT32             *FirstMissing,\r
-  OUT    UINT32             *GlyphBufferSize\r
-  )\r
-{\r
-  ASSERT (FALSE);\r
-  \r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-\r
-/**\r
-  Find the corressponding TAG GUID from a Framework HII Handle given.\r
-\r
-  @param Private      The HII Thunk Module Private context.\r
-  @param FwHiiHandle  The Framemwork HII Handle.\r
-  @param TagGuid      The output of TAG GUID found.\r
-\r
-  @return NULL        If Framework HII Handle is invalid.\r
-  @return The corresponding HII Thunk Context.\r
-**/\r
-EFI_STATUS\r
-GetTagGuidByFwHiiHandle (\r
-  IN  CONST HII_THUNK_PRIVATE_DATA      *Private,\r
-  IN        FRAMEWORK_EFI_HII_HANDLE    FwHiiHandle,\r
-  OUT       EFI_GUID                    *TagGuid\r
-  )\r
-{\r
-  LIST_ENTRY                                *Link;\r
-  HII_THUNK_CONTEXT                          *ThunkContext;\r
-\r
-  ASSERT (TagGuid != NULL);\r
-\r
-  Link = GetFirstNode (&Private->ThunkContextListHead);\r
-  while (!IsNull (&Private->ThunkContextListHead, Link)) {\r
-\r
-    ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);\r
-\r
-    if (FwHiiHandle == ThunkContext->FwHiiHandle) {\r
-      CopyGuid (TagGuid, &ThunkContext->TagGuid);\r
-      return EFI_SUCCESS;\r
-    }\r
-\r
-    Link = GetNextNode (&Private->ThunkContextListHead, Link);\r
-  }\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
-  Create or update the String given a new string and String ID.\r
-\r
-  @param ThunkContext           The Thunk Context.\r
-  @param Rfc4646AsciiLanguage   The RFC 4646 Language code in ASCII string format.\r
-  @param NewString              The new string.\r
-  @param StringId               The String ID. If StringId is 0, a new String Token\r
-                                is created. Otherwise, the String Token StringId is \r
-                                updated.\r
-                                \r
-\r
-  @retval EFI_SUCCESS           The new string is created or updated successfully. \r
-                                The new String Token ID is returned in StringId if\r
-                                *StringId is 0 on input.\r
-  @return Others                The update of string failed.                                  \r
-  \r
-**/\r
-EFI_STATUS\r
-UpdateString (\r
-  IN CONST HII_THUNK_CONTEXT        *ThunkContext,\r
-  IN CONST CHAR8                    *Rfc4646AsciiLanguage,\r
-  IN       CHAR16                   *NewString,\r
-  IN OUT STRING_REF                 *StringId\r
-  )\r
-{\r
-  EFI_STRING_ID                             NewStringId;\r
-\r
-  NewStringId = HiiSetString (ThunkContext->UefiHiiHandle, *StringId, NewString, Rfc4646AsciiLanguage);\r
-  *StringId = NewStringId;\r
-  if (NewStringId == 0) {\r
-    //\r
-    // Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.\r
-    //\r
-    return EFI_INVALID_PARAMETER;\r
-  } else {\r
-    return EFI_SUCCESS;\r
-  }\r
-}\r
-\r
-/**\r
-  Create or update a String Token in a String Package.\r
-\r
-  If *Reference == 0, a new String Token is created.\r
-\r
-  @param This            A pointer to the EFI_HII_PROTOCOL instance.\r
-  @param Language        Pointer to a NULL-terminated string containing a single ISO 639-2 language\r
-                         identifier, indicating the language to print. A string consisting of\r
-                         all spaces indicates that the string is applicable to all languages.\r
-  @param Handle          The handle of the language pack to which the string is to be added.\r
-  @param Reference       The string token assigned to the string.\r
-  @param NewString       The string to be added.\r
-\r
-\r
-  @retval EFI_SUCCESS             The string was effectively registered.\r
-  @retval EFI_INVALID_PARAMETER   The Handle was unknown. The string is not created or updated in the\r
-                                  the string package.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HiiNewString (\r
-  IN     EFI_HII_PROTOCOL           *This,\r
-  IN     CHAR16                     *Language,\r
-  IN     FRAMEWORK_EFI_HII_HANDLE   Handle,\r
-  IN OUT STRING_REF                 *Reference,\r
-  IN     CHAR16                     *NewString\r
-  )\r
-{\r
-  EFI_STATUS                                Status;\r
-  HII_THUNK_PRIVATE_DATA                    *Private;\r
-  EFI_GUID                                  TagGuid;\r
-  LIST_ENTRY                                *Link;\r
-  HII_THUNK_CONTEXT                          *ThunkContext;\r
-  HII_THUNK_CONTEXT                          *StringPackThunkContext;\r
-  EFI_STRING_ID                             StringId;\r
-  EFI_STRING_ID                             LastStringId;\r
-  CHAR8                                     AsciiLanguage[ISO_639_2_ENTRY_SIZE + 1];\r
-  CHAR16                                    LanguageCopy[ISO_639_2_ENTRY_SIZE + 1];\r
-  CHAR8                                     *Rfc4646AsciiLanguage;\r
-\r
-  LastStringId      = (EFI_STRING_ID) 0;\r
-  StringId          = (EFI_STRING_ID) 0;\r
-  Rfc4646AsciiLanguage = NULL;\r
-\r
-  if (Language != NULL) {\r
-    ZeroMem (AsciiLanguage, sizeof (AsciiLanguage));;\r
-    ZeroMem (LanguageCopy, sizeof (LanguageCopy));\r
-    CopyMem (LanguageCopy, Language, ISO_639_2_ENTRY_SIZE * sizeof (CHAR16));\r
-    UnicodeStrToAsciiStr (LanguageCopy, AsciiLanguage);\r
-    Rfc4646AsciiLanguage = ConvertLanguagesIso639ToRfc4646 (AsciiLanguage);\r
-    ASSERT (Rfc4646AsciiLanguage != NULL);\r
-  }\r
-\r
-  Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);\r
-\r
-  StringPackThunkContext = FwHiiHandleToThunkContext (Private, Handle);\r
-  if (StringPackThunkContext == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (StringPackThunkContext->SharingStringPack) {\r
-    Status = GetTagGuidByFwHiiHandle (Private, Handle, &TagGuid);\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    Link = GetFirstNode (&Private->ThunkContextListHead);\r
-    while (!IsNull (&Private->ThunkContextListHead, Link)) {\r
-      ThunkContext = HII_THUNK_CONTEXT_FROM_LINK (Link);\r
-\r
-      if (CompareGuid (&TagGuid, &ThunkContext->TagGuid)) {\r
-        if (ThunkContext->SharingStringPack) {\r
-          StringId = *Reference;\r
-          Status = UpdateString (ThunkContext, Rfc4646AsciiLanguage, NewString, &StringId);\r
-          if (EFI_ERROR (Status)) {\r
-            break;\r
-          }\r
-          \r
-          DEBUG_CODE_BEGIN ();\r
-          if (*Reference == 0) {\r
-            //\r
-            // When creating new string token, make sure all created token is the same\r
-            // for all string packages registered using FW HII interface.\r
-            //\r
-            if (LastStringId == (EFI_STRING_ID) 0) {\r
-              LastStringId = StringId;\r
-            } else {\r
-              if (LastStringId != StringId) {\r
-                ASSERT(FALSE);\r
-              }\r
-            }\r
-          }\r
-          DEBUG_CODE_END ();\r
-          \r
-        }\r
-      }\r
-\r
-      Link = GetNextNode (&Private->ThunkContextListHead, Link);\r
-    }\r
-  } else {\r
-    StringId = *Reference;\r
-    Status = UpdateString (StringPackThunkContext, Rfc4646AsciiLanguage, NewString, &StringId);\r
-  }\r
-\r
-  if (!EFI_ERROR (Status)) {\r
-    if (*Reference == 0) {\r
-      *Reference = StringId;\r
-    }\r
-  } else {\r
-    //\r
-    // Only EFI_INVALID_PARAMETER is defined in HII 0.92 specification.\r
-    //\r
-    Status = EFI_INVALID_PARAMETER;\r
-  }\r
-  \r
-  return Status;\r
-}\r
-\r
-/**\r
-  This function removes any new strings that were added after the initial string export for this handle.\r
-  UEFI HII String Protocol does not have Reset String function. This function perform nothing.\r
-\r
-  @param This            A pointer to the EFI_HII_PROTOCOL instance.\r
-  @param Handle          The HII handle on which the string resides.\r
-\r
-  @retval EFI_SUCCESS    This function is a NOP and always return EFI_SUCCESS.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HiiResetStrings (\r
-  IN     EFI_HII_PROTOCOL   *This,\r
-  IN     FRAMEWORK_EFI_HII_HANDLE      Handle\r
-  )\r
-{\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- This function extracts a string from a package already registered with the EFI HII database.\r
-\r
-  @param This            A pointer to the EFI_HII_PROTOCOL instance.\r
-  @param Handle          The HII handle on which the string resides.\r
-  @param Token           The string token assigned to the string.\r
-  @param Raw             If TRUE, the string is returned unedited in the internal storage format described\r
-                         above. If false, the string returned is edited by replacing <cr> with <space>\r
-                         and by removing special characters such as the <wide> prefix.\r
-  @param LanguageString  Pointer to a NULL-terminated string containing a single ISO 639-2 language\r
-                         identifier, indicating the language to print. If the LanguageString is empty (starts\r
-                         with a NULL), the default system language will be used to determine the language.\r
-  @param BufferLength    Length of the StringBuffer. If the status reports that the buffer width is too\r
-                         small, this parameter is filled with the length of the buffer needed.\r
-  @param StringBuffer    The buffer designed to receive the characters in the string. Type EFI_STRING is\r
-                         defined in String.\r
-\r
-  @retval EFI_INVALID_PARAMETER If input parameter is invalid.\r
-  @retval EFI_BUFFER_TOO_SMALL  If the *BufferLength is too small.\r
-  @retval EFI_SUCCESS           Operation is successful.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HiiThunkGetString (\r
-  IN     EFI_HII_PROTOCOL           *This,\r
-  IN     FRAMEWORK_EFI_HII_HANDLE   Handle,\r
-  IN     STRING_REF                 Token,\r
-  IN     BOOLEAN                    Raw,\r
-  IN     CHAR16                     *LanguageString,\r
-  IN OUT UINTN                      *BufferLength,\r
-  OUT    EFI_STRING                 StringBuffer\r
-  )\r
-{\r
-  HII_THUNK_PRIVATE_DATA                *Private;\r
-  CHAR8                                 *Iso639AsciiLanguage;\r
-  CHAR8                                 *Rfc4646AsciiLanguage;\r
-  CHAR8                                 *SupportedLanguages;\r
-  CHAR8                                 *PlatformLanguage;\r
-  CHAR8                                 *BestLanguage;\r
-  EFI_HII_HANDLE                        UefiHiiHandle;\r
-  EFI_STATUS                            Status;\r
-\r
-  Private = HII_THUNK_PRIVATE_DATA_FROM_THIS(This);\r
-\r
-  Rfc4646AsciiLanguage = NULL;\r
-  SupportedLanguages   = NULL;\r
-  PlatformLanguage     = NULL;\r
-  Status               = EFI_SUCCESS;\r
-\r
-  if (LanguageString != NULL) {\r
-    Iso639AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);\r
-    if (Iso639AsciiLanguage == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-    UnicodeStrToAsciiStr  (LanguageString, Iso639AsciiLanguage);\r
-\r
-    //\r
-    // Caller of Framework HII Interface uses the Language Identification String defined \r
-    // in Iso639. So map it to the Language Identifier defined in RFC4646.\r
-    //\r
-    Rfc4646AsciiLanguage = ConvertLanguagesIso639ToRfc4646 (Iso639AsciiLanguage);\r
-    FreePool (Iso639AsciiLanguage);\r
-\r
-    //\r
-    // If Rfc4646AsciiLanguage is NULL, more language mapping must be added to \r
-    // Iso639ToRfc4646Map.\r
-    //\r
-    ASSERT (Rfc4646AsciiLanguage != NULL);\r
-  }\r
-\r
-  UefiHiiHandle = FwHiiHandleToUefiHiiHandle (Private, Handle);\r
-  if (UefiHiiHandle == NULL) {\r
-    Status = EFI_NOT_FOUND;\r
-    goto Done;\r
-  }\r
-\r
-  //\r
-  // Get the languages that the package specified by HiiHandle supports\r
-  //\r
-  SupportedLanguages = HiiGetSupportedLanguages (UefiHiiHandle);\r
-  if (SupportedLanguages == NULL) {\r
-    goto Done;\r
-  }\r
-\r
-  //\r
-  // Get the current platform language setting\r
-  //\r
-  GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);\r
-\r
-  //\r
-  // Get the best matching language from SupportedLanguages\r
-  //\r
-  BestLanguage = GetBestLanguage (\r
-                   SupportedLanguages, \r
-                   FALSE,                // RFC 4646 mode\r
-                   (Rfc4646AsciiLanguage != NULL) ? Rfc4646AsciiLanguage : "", // Highest priority \r
-                   (PlatformLanguage != NULL) ? PlatformLanguage : "",         // Next highest priority\r
-                   SupportedLanguages,   // Lowest priority \r
-                   NULL\r
-                   );\r
-  if (BestLanguage != NULL) {\r
-    Status = mHiiStringProtocol->GetString (\r
-                                 mHiiStringProtocol,\r
-                                 BestLanguage,\r
-                                 UefiHiiHandle,\r
-                                 Token,\r
-                                 StringBuffer,\r
-                                 BufferLength,\r
-                                 NULL\r
-                                 );\r
-    FreePool (BestLanguage);\r
-  } else {\r
-    Status = EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-Done:\r
-       if (Rfc4646AsciiLanguage != NULL) {\r
-    FreePool (Rfc4646AsciiLanguage);\r
-  }\r
-\r
-  if (SupportedLanguages != NULL) {\r
-    FreePool (SupportedLanguages);\r
-  }\r
-\r
-  if (PlatformLanguage != NULL) {\r
-    FreePool (PlatformLanguage);\r
-  }\r
-  return Status;\r
-}\r
-\r
-/**\r
-\r
-  This function allows a program to extract a part of a string of not more than a given width.\r
-  With repeated calls, this allows a calling program to extract "lines" of text that fit inside\r
-  columns.  The effort of measuring the fit of strings inside columns is localized to this call.\r
-\r
-  This is a deprecated API. No Framework HII module is calling it. This function will ASSERT and\r
-  return EFI_UNSUPPORTED.\r
-\r
-  @param This            A pointer to the EFI_HII_PROTOCOL instance.\r
-  @param Handle          The HII handle on which the string resides.\r
-  @param Token           The string token assigned to the string.\r
-  @param Index           On input, the offset into the string where the line is to start.\r
-                         On output, the index is updated to point to beyond the last character returned\r
-                         in the call.\r
-  @param LineWidth       The maximum width of the line in units of narrow glyphs.\r
-  @param LanguageString  Pointer to a NULL-terminated string containing a single ISO 639-2 language\r
-                         identifier, indicating the language to print. If the LanguageString is empty (starts\r
-                         with a NULL), the default system language will be used to determine the language.\r
-  @param BufferLength    Length of the StringBuffer. If the status reports that the buffer width is too\r
-                         small, this parameter is filled with the length of the buffer needed.\r
-  @param StringBuffer    The buffer designed to receive the characters in the string. Type EFI_STRING is\r
-                         defined in String.\r
-\r
-  @retval EFI_UNSUPPORTED.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HiiGetLine (\r
-  IN     EFI_HII_PROTOCOL           *This,\r
-  IN     FRAMEWORK_EFI_HII_HANDLE   Handle,\r
-  IN     STRING_REF                 Token,\r
-  IN OUT UINT16                     *Index,\r
-  IN     UINT16                     LineWidth,\r
-  IN     CHAR16                     *LanguageString,\r
-  IN OUT UINT16                     *BufferLength,\r
-  OUT    EFI_STRING                 StringBuffer\r
-  )\r
-{\r
-  ASSERT (FALSE);\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-\r