]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/UserInterface/SetupBrowser/Dxe/Ui.c
1. Use MemoryAllocationLib to replace boot services memory services functions in...
[mirror_edk2.git] / EdkModulePkg / Universal / UserInterface / SetupBrowser / Dxe / Ui.c
index 48b02bf33282fb0ce17e4e83986763a7ce8c8e1a..40bd826023612da0a4d4d0c3108f9b7bdd2ab5ae 100644 (file)
@@ -1,14 +1,14 @@
 /**@file\r
   Implementation for UI.\r
-  \r
-Copyright (c) 2006 - 2007, 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
+\r
+Copyright (c) 2006 - 2007, 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
 \r
 **/\r
 \r
@@ -63,7 +63,7 @@ Routine Description:
   Initialize Menu option list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -81,7 +81,7 @@ Routine Description:
   Initialize Menu option list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -100,7 +100,7 @@ Routine Description:
   Remove Menu option list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -119,7 +119,7 @@ Returns:
     (*PreviousSelection)->Handle    = UiMenuList->Selection.Handle;\r
     gEntryNumber                    = UiMenuList->FormerEntryNumber;\r
     RemoveEntryList (&UiMenuList->MenuLink);\r
-    gBS->FreePool (UiMenuList);\r
+    FreePool (UiMenuList);\r
   }\r
 }\r
 \r
@@ -133,7 +133,7 @@ Routine Description:
   Free Menu option linked list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -143,7 +143,7 @@ Returns:
   while (!IsListEmpty (&gMenuList)) {\r
     UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);\r
     RemoveEntryList (&UiMenuList->MenuLink);\r
-    gBS->FreePool (UiMenuList);\r
+    FreePool (UiMenuList);\r
   }\r
 }\r
 \r
@@ -157,7 +157,7 @@ Routine Description:
   Add one menu entry to the linked lst\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -183,7 +183,7 @@ Routine Description:
   Free Menu option linked list.\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -197,8 +197,8 @@ Returns:
     //\r
     // We allocated space for this description when we did a GetToken, free it here\r
     //\r
-    gBS->FreePool (MenuOption->Description);\r
-    gBS->FreePool (MenuOption);\r
+    FreePool (MenuOption->Description);\r
+    FreePool (MenuOption);\r
   }\r
 }\r
 \r
@@ -213,7 +213,7 @@ Routine Description:
   Refresh screen with current date and/or time based on screen context\r
 \r
 Arguments:\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -256,7 +256,7 @@ Returns:
   }\r
 \r
   if (OptionString != NULL) {\r
-    gBS->FreePool (OptionString);\r
+    FreePool (OptionString);\r
   }\r
 }\r
 \r
@@ -373,7 +373,7 @@ Routine Description:
 Arguments:\r
   String - String description for this option.\r
   Context - Context data for entry.\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -414,7 +414,7 @@ Routine Description:
 Arguments:\r
   String - String description for this option.\r
   Context - Context data for entry.\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -457,7 +457,7 @@ Routine Description:
 \r
 Arguments:\r
   NumberOfLines -     The number of lines for the dialog box\r
-  HotKey -            Defines whether a single character is parsed (TRUE) and returned in KeyValue \r
+  HotKey -            Defines whether a single character is parsed (TRUE) and returned in KeyValue\r
                       or a string is returned in StringBuffer.  Two special characters are considered when entering a string, a SCAN_ESC and\r
                       an CHAR_CARRIAGE_RETURN.  SCAN_ESC terminates string input and returns\r
   MaximumStringSize - The maximum size in bytes of a typed in string (each character is a CHAR16) and the minimum string returned is two bytes\r
@@ -465,7 +465,7 @@ Arguments:
   KeyValue -          The EFI_KEY value returned if HotKey is TRUE..\r
   String -            Pointer to the first string in the list\r
   ... -               A series of (quantity == NumberOfLines) text strings which will be used to construct the dialog box\r
-           \r
+\r
 Returns:\r
   EFI_SUCCESS -           Displayed dialog and received user interaction\r
   EFI_INVALID_PARAMETER - One of the parameters was invalid (e.g. (StringBuffer == NULL) && (HotKey == FALSE))\r
@@ -572,8 +572,8 @@ Returns:
       case CHAR_NULL:\r
         switch (Key.ScanCode) {\r
         case SCAN_ESC:\r
-          gBS->FreePool (TempString);\r
-          gBS->FreePool (BufferedString);\r
+          FreePool (TempString);\r
+          FreePool (BufferedString);\r
           gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);\r
           gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
           return EFI_DEVICE_ERROR;\r
@@ -586,8 +586,8 @@ Returns:
 \r
       case CHAR_CARRIAGE_RETURN:\r
         SelectionComplete = TRUE;\r
-        gBS->FreePool (TempString);\r
-        gBS->FreePool (BufferedString);\r
+        FreePool (TempString);\r
+        FreePool (BufferedString);\r
         gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);\r
         gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
         return EFI_SUCCESS;\r
@@ -829,8 +829,8 @@ UpdateStatusBar (
     break;\r
   }\r
 \r
-  gBS->FreePool (InputErrorMessage);\r
-  gBS->FreePool (NvUpdateMessage);\r
+  FreePool (InputErrorMessage);\r
+  FreePool (NvUpdateMessage);\r
   return ;\r
 }\r
 \r
@@ -843,11 +843,11 @@ FreeData (
 /*++\r
 \r
 Routine Description:\r
-  \r
+\r
   Used to remove the allocated data instances\r
 \r
 Arguments:\r
-             \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -867,11 +867,11 @@ Returns:
   FileForm = FileFormTagsHead;\r
 \r
   if (FormattedString != NULL) {\r
-    gBS->FreePool (FormattedString);\r
+    FreePool (FormattedString);\r
   }\r
 \r
   if (OptionString != NULL) {\r
-    gBS->FreePool (OptionString);\r
+    FreePool (OptionString);\r
   }\r
 \r
   for (; FileForm != NULL;) {\r
@@ -908,17 +908,17 @@ Returns:
         }\r
 \r
         if (FormTags->Tags[Index].IntList != NULL) {\r
-          gBS->FreePool (FormTags->Tags[Index].IntList);\r
+          FreePool (FormTags->Tags[Index].IntList);\r
         }\r
       }\r
 \r
       if (PreviousFormTags != NULL) {\r
-        gBS->FreePool (FormTags->Tags);\r
+        FreePool (FormTags->Tags);\r
         FormTags = PreviousFormTags;\r
-        gBS->FreePool (FormTags->Next);\r
+        FreePool (FormTags->Next);\r
         FormTags->Next = NULL;\r
       } else {\r
-        gBS->FreePool (FormTags->Tags);\r
+        FreePool (FormTags->Tags);\r
         FormTags = NULL;\r
       }\r
     }\r
@@ -942,7 +942,7 @@ Returns:
       //\r
       // Free the current entry\r
       //\r
-      gBS->FreePool (Inconsistent);\r
+      FreePool (Inconsistent);\r
 \r
       //\r
       // Restore the Previous pointer\r
@@ -963,26 +963,32 @@ Returns:
         PreviousVariableDefinition = VariableDefinition;\r
       }\r
 \r
-      gBS->FreePool (VariableDefinition->VariableName);\r
-      gBS->FreePool (VariableDefinition->NvRamMap);\r
-      gBS->FreePool (VariableDefinition->FakeNvRamMap);\r
+      FreePool (VariableDefinition->VariableName);\r
+\r
+      if (VariableDefinition->NvRamMap != NULL) {\r
+        FreePool (VariableDefinition->NvRamMap);\r
+      }\r
+\r
+      if (VariableDefinition->FakeNvRamMap != NULL) {\r
+        FreePool (VariableDefinition->FakeNvRamMap);\r
+      }\r
 \r
       if (PreviousVariableDefinition != NULL) {\r
         VariableDefinition = PreviousVariableDefinition;\r
-        gBS->FreePool (VariableDefinition->Next);\r
+        FreePool (VariableDefinition->Next);\r
         VariableDefinition->Next = NULL;\r
       } else {\r
-        gBS->FreePool (VariableDefinition);\r
+        FreePool (VariableDefinition);\r
         VariableDefinition = NULL;\r
       }\r
     }\r
 \r
     if (PreviousFileForm != NULL) {\r
       FileForm = PreviousFileForm;\r
-      gBS->FreePool (FileForm->NextFile);\r
+      FreePool (FileForm->NextFile);\r
       FileForm->NextFile = NULL;\r
     } else {\r
-      gBS->FreePool (FileForm);\r
+      FreePool (FileForm);\r
       FileForm = NULL;\r
     }\r
   }\r
@@ -1000,40 +1006,40 @@ Returns:
       PreviousIfrBinary = IfrBinary;\r
     }\r
 \r
-    gBS->FreePool (IfrBinary->IfrPackage);\r
+    FreePool (IfrBinary->IfrPackage);\r
 \r
     if (PreviousIfrBinary != NULL) {\r
       IfrBinary = PreviousIfrBinary;\r
-      gBS->FreePool (IfrBinary->Next);\r
+      FreePool (IfrBinary->Next);\r
       IfrBinary->Next = NULL;\r
     } else {\r
-      gBS->FreePool (IfrBinary);\r
+      FreePool (IfrBinary);\r
       IfrBinary = NULL;\r
     }\r
   }\r
 \r
-  gBS->FreePool (gPreviousValue);\r
+  FreePool (gPreviousValue);\r
   gPreviousValue = NULL;\r
 \r
   //\r
   // Free Browser Strings\r
   //\r
-  gBS->FreePool (gPressEnter);\r
-  gBS->FreePool (gConfirmError);\r
-  gBS->FreePool (gConfirmPassword);\r
-  gBS->FreePool (gPromptForNewPassword);\r
-  gBS->FreePool (gPromptForPassword);\r
-  gBS->FreePool (gToggleCheckBox);\r
-  gBS->FreePool (gNumericInput);\r
-  gBS->FreePool (gMakeSelection);\r
-  gBS->FreePool (gMoveHighlight);\r
-  gBS->FreePool (gEscapeString);\r
-  gBS->FreePool (gEnterCommitString);\r
-  gBS->FreePool (gEnterString);\r
-  gBS->FreePool (gFunctionOneString);\r
-  gBS->FreePool (gFunctionTwoString);\r
-  gBS->FreePool (gFunctionNineString);\r
-  gBS->FreePool (gFunctionTenString);\r
+  FreePool (gPressEnter);\r
+  FreePool (gConfirmError);\r
+  FreePool (gConfirmPassword);\r
+  FreePool (gPromptForNewPassword);\r
+  FreePool (gPromptForPassword);\r
+  FreePool (gToggleCheckBox);\r
+  FreePool (gNumericInput);\r
+  FreePool (gMakeSelection);\r
+  FreePool (gMoveHighlight);\r
+  FreePool (gEscapeString);\r
+  FreePool (gEnterCommitString);\r
+  FreePool (gEnterString);\r
+  FreePool (gFunctionOneString);\r
+  FreePool (gFunctionTwoString);\r
+  FreePool (gFunctionNineString);\r
+  FreePool (gFunctionTenString);\r
   return ;\r
 }\r
 \r
@@ -1046,11 +1052,11 @@ SelectionsAreValid (
 /*++\r
 \r
 Routine Description:\r
-  Initiate late consistency checks against the current page.  \r
+  Initiate late consistency checks against the current page.\r
 \r
 Arguments:\r
   None\r
-           \r
+\r
 Returns:\r
 \r
 --*/\r
@@ -1103,7 +1109,7 @@ Returns:
               // Since the value can be one byte long or two bytes long, do a CopyMem based on StorageWidth\r
               //\r
               CopyMem (NvRamMap, &Tag->OldValue, Tag->StorageWidth);\r
-              gBS->FreePool (StringPtr);\r
+              FreePool (StringPtr);\r
               break;\r
 \r
             default:\r
@@ -1133,7 +1139,7 @@ Routine Description:
 Arguments:\r
   Tag - The Tag structure passed in.\r
   Handle - The handle in the HII database being used\r
-  \r
+\r
 Returns:\r
   Returns the number of CHAR16 characters that is support.\r
 \r
@@ -1151,7 +1157,7 @@ Returns:
   if ((Tag->Operand == EFI_IFR_TEXT_OP) && (Tag->TextTwo != 0)) {\r
     String  = GetToken (Tag->TextTwo, Handle);\r
     Size    = StrLen (String);\r
-    gBS->FreePool (String);\r
+    FreePool (String);\r
   }\r
 \r
   if ((Tag->Operand == EFI_IFR_SUBTITLE_OP) ||\r
@@ -1188,7 +1194,7 @@ Arguments:
   LineWidth - Width of the desired string to extract in CHAR16 characters\r
   Index - Where in InputString to start the copy process\r
   OutputString - Buffer to copy the string into\r
-           \r
+\r
 Returns:\r
   Returns the number of CHAR16 characters that were copied into the OutputString buffer.\r
 \r
@@ -1213,14 +1219,14 @@ Returns:
   // Ensure we have got a valid buffer\r
   //\r
   if (*OutputString != NULL) {\r
-  \r
+\r
     //\r
     //NARROW_CHAR can not be printed in screen, so if a line only contain  the two CHARs: 'NARROW_CHAR + CHAR_CARRIAGE_RETURN' , it is a empty line  in Screen.\r
     //To avoid displaying this  empty line in screen,  just skip  the two CHARs here.\r
     //\r
    if ((InputString[*Index] == NARROW_CHAR) && (InputString[*Index + 1] == CHAR_CARRIAGE_RETURN)) {\r
      *Index = *Index + 2;\r
-   } \r
+   }\r
 \r
     //\r
     // Fast-forward the string and see if there is a carriage-return in the string\r
@@ -1323,7 +1329,7 @@ UpdateOptionSkipLines (
         }\r
       }\r
 \r
-      gBS->FreePool (OutputString);\r
+      FreePool (OutputString);\r
       if (SkipValue != 0) {\r
         SkipValue--;\r
       }\r
@@ -1382,9 +1388,9 @@ Arguments:
   SubMenu          - Indicate is sub menu.\r
   FileFormTagsHead - A pointer to the EFI_FILE_FORM_TAGS structure.\r
   PageData         - A pointer to the EFI_IFR_DATA_ARRAY.\r
-           \r
+\r
 Returns:\r
-  Return the pointer of the menu which selected, \r
+  Return the pointer of the menu which selected,\r
   otherwise return NULL.\r
 \r
 --*/\r
@@ -1548,7 +1554,7 @@ Returns:
         while (gMenuRefreshHead != NULL) {\r
           OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
 \r
-          gBS->FreePool (gMenuRefreshHead);\r
+          FreePool (gMenuRefreshHead);\r
 \r
           gMenuRefreshHead = OldMenuRefreshEntry;\r
         }\r
@@ -1586,7 +1592,7 @@ Returns:
                 }\r
               }\r
 \r
-              gBS->FreePool (OutputString);\r
+              FreePool (OutputString);\r
               if (Temp != 0) {\r
                 Temp--;\r
               }\r
@@ -1681,7 +1687,7 @@ Returns:
                   }\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
                 if (Temp2 != 0) {\r
                   Temp2--;\r
                 }\r
@@ -1723,14 +1729,14 @@ Returns:
                   }\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
                 if (Temp2 != 0) {\r
                   Temp2--;\r
                 }\r
               }\r
 \r
               Row = OriginalRow;\r
-              gBS->FreePool (StringPtr);\r
+              FreePool (StringPtr);\r
             }\r
           } else {\r
             //\r
@@ -1848,7 +1854,7 @@ Returns:
                 MenuOption->Row++;\r
               }\r
 \r
-              gBS->FreePool (OutputString);\r
+              FreePool (OutputString);\r
             }\r
 \r
             MenuOption->Row = OriginalRow;\r
@@ -1876,7 +1882,7 @@ Returns:
                   MenuOption->Row++;\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
               }\r
 \r
               MenuOption->Row = OriginalRow;\r
@@ -1969,7 +1975,7 @@ Returns:
                 MenuOption->Row++;\r
               }\r
 \r
-              gBS->FreePool (OutputString);\r
+              FreePool (OutputString);\r
             }\r
 \r
             MenuOption->Row = OriginalRow;\r
@@ -1990,7 +1996,7 @@ Returns:
                   MenuOption->Row++;\r
                 }\r
 \r
-                gBS->FreePool (OutputString);\r
+                FreePool (OutputString);\r
               }\r
 \r
               MenuOption->Row = OriginalRow;\r
@@ -2022,10 +2028,10 @@ Returns:
     case CfUpdateHelpString:\r
       ControlFlag = CfPrepareToReadKey;\r
 \r
-        if (SubMenu && \r
-            (Repaint || NewLine || \r
+        if (SubMenu &&\r
+            (Repaint || NewLine ||\r
              (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||\r
-             (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) && \r
+             (MenuOption->ThisTag->Operand == EFI_IFR_TIME_OP)) &&\r
             !(gClassOfVfr == EFI_GENERAL_APPLICATION_SUBCLASS)) {\r
         //\r
         // Don't print anything if it is a NULL help token\r
@@ -2305,7 +2311,7 @@ Returns:
       while (gMenuRefreshHead != NULL) {\r
         OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
 \r
-        gBS->FreePool (gMenuRefreshHead);\r
+        FreePool (gMenuRefreshHead);\r
 \r
         gMenuRefreshHead = OldMenuRefreshEntry;\r
       }\r
@@ -2328,7 +2334,7 @@ Returns:
       ExtractRequestedNvMap (FileFormTags, MenuOption->ThisTag->VariableNumber, &VariableDefinition);\r
 \r
       if (SubMenu) {\r
-        if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP && \r
+        if ((MenuOption->ThisTag->Operand == EFI_IFR_TEXT_OP &&\r
             !(MenuOption->ThisTag->Flags & EFI_IFR_FLAG_INTERACTIVE)) ||\r
             (MenuOption->ThisTag->GrayOut) ||\r
             (MenuOption->ThisTag->Operand == EFI_IFR_DATE_OP) ||\r
@@ -2966,9 +2972,9 @@ Returns:
 \r
       if (!EFI_ERROR (Status)) {\r
         ASSERT_EFI_ERROR (NULL != NvMapListHead);\r
-        \r
+\r
         NvMapListNode = NvMapListHead;\r
-        \r
+\r
         while (NULL != NvMapListNode) {\r
           if (FileFormTags->VariableDefinitions->VariableId == NvMapListNode->VariablePack->VariableId) {\r
             NvMap     = (VOID *) ((CHAR8 *) NvMapListNode->VariablePack + sizeof (EFI_HII_VARIABLE_PACK) + NvMapListNode->VariablePack->VariableNameLength);\r
@@ -2977,20 +2983,20 @@ Returns:
             }\r
           NvMapListNode = NvMapListNode->NextVariablePack;\r
         }\r
-        \r
+\r
         //\r
         // Free the buffer that was allocated.\r
         //\r
-        gBS->FreePool (FileFormTags->VariableDefinitions->NvRamMap);\r
-        gBS->FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);\r
-        \r
+        FreePool (FileFormTags->VariableDefinitions->NvRamMap);\r
+        FreePool (FileFormTags->VariableDefinitions->FakeNvRamMap);\r
+\r
         //\r
         // Allocate, copy the NvRamMap.\r
         //\r
         FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize - FileFormTags->VariableDefinitions->VariableSize);\r
         FileFormTags->VariableDefinitions->VariableSize = (UINT16) NvMapSize;\r
         FileFormTags->VariableDefinitions->VariableFakeSize = (UINT16) (FileFormTags->VariableDefinitions->VariableFakeSize + FileFormTags->VariableDefinitions->VariableSize);\r
-        \r
+\r
         FileFormTags->VariableDefinitions->NvRamMap = AllocateZeroPool (FileFormTags->VariableDefinitions->VariableSize);\r
         ASSERT (FileFormTags->VariableDefinitions->NvRamMap != NULL);\r
 \r
@@ -2998,7 +3004,7 @@ Returns:
         ASSERT (FileFormTags->VariableDefinitions->FakeNvRamMap != NULL);\r
 \r
         CopyMem (FileFormTags->VariableDefinitions->NvRamMap, NvMap, NvMapSize);\r
-        gBS->FreePool (NvMapListHead);\r
+        FreePool (NvMapListHead);\r
       }\r
 \r
       UpdateStatusBar (NV_UPDATE_REQUIRED, MenuOption->ThisTag->Flags, TRUE);\r
@@ -3017,7 +3023,7 @@ Returns:
       while (gMenuRefreshHead != NULL) {\r
         OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
 \r
-        gBS->FreePool (gMenuRefreshHead);\r
+        FreePool (gMenuRefreshHead);\r
 \r
         gMenuRefreshHead = OldMenuRefreshEntry;\r
       }\r
@@ -3043,11 +3049,11 @@ ValueIsScroll (
 /*++\r
 \r
 Routine Description:\r
-  Determine if the menu is the last menu that can be selected. \r
+  Determine if the menu is the last menu that can be selected.\r
 \r
 Arguments:\r
   Direction - the scroll direction. False is down. True is up.\r
-           \r
+\r
 Returns:\r
   FALSE -- the menu isn't the last menu that can be selected.\r
   TRUE  -- the menu is the last menu that can be selected.\r
@@ -3087,9 +3093,9 @@ Routine Description:
 Arguments:\r
   Direction - the up or down direction. False is down. True is up.\r
   CurrentPos - Current position.\r
-           \r
+\r
 Returns:\r
-  Return line number to pad. It is possible that we stand on a zero-advance \r
+  Return line number to pad. It is possible that we stand on a zero-advance\r
   data or time opcode, so pad one line when we judge if we are going to scroll outside.\r
 --*/\r
 {\r