]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
pass pointer to term to term functions
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 7 May 2010 00:30:44 +0000 (02:30 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 7 May 2010 00:30:44 +0000 (02:30 +0200)
19 files changed:
commands/terminal.c
include/grub/i386/pc/console.h
include/grub/i386/vga_common.h
include/grub/term.h
kern/i386/pc/startup.S
kern/term.c
normal/term.c
term/at_keyboard.c
term/efi/console.c
term/gfxterm.c
term/i386/pc/console.c
term/i386/pc/vga.c
term/i386/pc/vga_text.c
term/i386/vga_common.c
term/ieee1275/ofconsole.c
term/serial.c
term/terminfo.c
term/usb_keyboard.c
util/console.c

index 1129c39bd0af87e5d95738ba334bfbdf7afbfcc5..d34602a1b550d980ddd8217e28fe2ef06ef798a4 100644 (file)
@@ -30,8 +30,8 @@ struct abstract_terminal
 {
   struct abstract_terminal *next;
   const char *name;
-  grub_err_t (*init) (void);
-  grub_err_t (*fini) (void);
+  grub_err_t (*init) (struct abstract_terminal *term);
+  grub_err_t (*fini) (struct abstract_terminal *term);
 };
 
 static grub_err_t
@@ -123,7 +123,7 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
              break;
          if (term)
            {
-              if (term->init && term->init () != GRUB_ERR_NONE)
+              if (term->init && term->init (term) != GRUB_ERR_NONE)
                 return grub_errno;
 
              grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
@@ -147,7 +147,7 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
                                   "can't remove the last terminal");
              grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
              if (term->fini)
-               term->fini ();
+               term->fini (term);
              grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
            }
        }
@@ -160,7 +160,7 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
          break;
       if (term)
        {
-         if (term->init && term->init () != GRUB_ERR_NONE)
+         if (term->init && term->init (term) != GRUB_ERR_NONE)
            return grub_errno;
 
          grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
@@ -183,7 +183,7 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
                                 "can't remove the last terminal");
            grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
            if (term->fini)
-             term->fini ();
+             term->fini (term);
            grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
          }
       }
index b677bb8869dc123e225f9ab53acfcaf46cbb2679..7f58344ecdec706863adf96d7a6e7c5110c4fe79 100644 (file)
 #include <grub/i386/vga_common.h>
 
 /* These are global to share code between C and asm.  */
-int grub_console_checkkey (void);
-int grub_console_getkey (void);
-grub_uint16_t grub_console_getxy (void);
-void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y);
-void grub_console_cls (void);
-void grub_console_setcursor (int on);
-void grub_console_putchar (const struct grub_unicode_glyph *c);
+int grub_console_checkkey (struct grub_term_input *term);
+int grub_console_getkey (struct grub_term_input *term);
+grub_uint16_t grub_console_getxy (struct grub_term_output *term);
+void grub_console_gotoxy (struct grub_term_output *term,
+                         grub_uint8_t x, grub_uint8_t y);
+void grub_console_cls (struct grub_term_output *term);
+void grub_console_setcursor (struct grub_term_output *term, int on);
+void grub_console_putchar (struct grub_term_output *term,
+                          const struct grub_unicode_glyph *c);
 
 /* Initialize the console system.  */
 void grub_console_init (void);
index 7df2b9e9e865329df29034dcd9a1662c7dd60a2a..8ba09dfeaed08c915e348765557edf34bd479848 100644 (file)
 
 extern grub_uint8_t grub_console_cur_color;
 
-grub_uint16_t grub_console_getwh (void);
-void grub_console_setcolorstate (grub_term_color_state state);
-void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color);
-void grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
+grub_uint16_t grub_console_getwh (struct grub_term_output *term);
+void grub_console_setcolorstate (struct grub_term_output *term,
+                                grub_term_color_state state);
+void grub_console_setcolor (struct grub_term_output *term,
+                           grub_uint8_t normal_color,
+                           grub_uint8_t highlight_color);
+void grub_console_getcolor (struct grub_term_output *term,
+                           grub_uint8_t *normal_color,
+                           grub_uint8_t *highlight_color);
 
 #endif /* ! GRUB_VGA_COMMON_CPU_HEADER */
index 40f7fb0b90dd76704c3b1e8367a2523c023211f8..c43eb6ff79aad9884d1beed8974e4a4df7534943 100644 (file)
@@ -136,19 +136,21 @@ struct grub_term_input
   const char *name;
 
   /* Initialize the terminal.  */
-  grub_err_t (*init) (void);
+  grub_err_t (*init) (struct grub_term_input *term);
 
   /* Clean up the terminal.  */
-  grub_err_t (*fini) (void);
+  grub_err_t (*fini) (struct grub_term_input *term);
 
   /* Check if any input character is available.  */
-  int (*checkkey) (void);
+  int (*checkkey) (struct grub_term_input *term);
 
   /* Get a character.  */
-  int (*getkey) (void);
+  int (*getkey) (struct grub_term_input *term);
 
   /* Get keyboard modifier status.  */
-  int (*getkeystatus) (void);
+  int (*getkeystatus) (struct grub_term_input *term);
+
+  void *data;
 };
 typedef struct grub_term_input *grub_term_input_t;
 
@@ -161,49 +163,57 @@ struct grub_term_output
   const char *name;
 
   /* Initialize the terminal.  */
-  grub_err_t (*init) (void);
+  grub_err_t (*init) (struct grub_term_output *term);
 
   /* Clean up the terminal.  */
-  grub_err_t (*fini) (void);
+  grub_err_t (*fini) (struct grub_term_output *term);
 
   /* Put a character. C is encoded in Unicode.  */
-  void (*putchar) (const struct grub_unicode_glyph *c);
+  void (*putchar) (struct grub_term_output *term,
+                  const struct grub_unicode_glyph *c);
 
   /* Get the number of columns occupied by a given character C. C is
      encoded in Unicode.  */
-  grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *c);
+  grub_ssize_t (*getcharwidth) (struct grub_term_output *term,
+                               const struct grub_unicode_glyph *c);
 
   /* Get the screen size. The return value is ((Width << 8) | Height).  */
-  grub_uint16_t (*getwh) (void);
+  grub_uint16_t (*getwh) (struct grub_term_output *term);
 
   /* Get the cursor position. The return value is ((X << 8) | Y).  */
-  grub_uint16_t (*getxy) (void);
+  grub_uint16_t (*getxy) (struct grub_term_output *term);
 
   /* Go to the position (X, Y).  */
-  void (*gotoxy) (grub_uint8_t x, grub_uint8_t y);
+  void (*gotoxy) (struct grub_term_output *term,
+                 grub_uint8_t x, grub_uint8_t y);
 
   /* Clear the screen.  */
-  void (*cls) (void);
+  void (*cls) (struct grub_term_output *term);
 
   /* Set the current color to be used */
-  void (*setcolorstate) (grub_term_color_state state);
+  void (*setcolorstate) (struct grub_term_output *term,
+                        grub_term_color_state state);
 
   /* Set the normal color and the highlight color. The format of each
      color is VGA's.  */
-  void (*setcolor) (grub_uint8_t normal_color, grub_uint8_t highlight_color);
+  void (*setcolor) (struct grub_term_output *term,
+                   grub_uint8_t normal_color, grub_uint8_t highlight_color);
 
   /* Get the normal color and the highlight color. The format of each
      color is VGA's.  */
-  void (*getcolor) (grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
+  void (*getcolor) (struct grub_term_output *term,
+                   grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
 
   /* Turn on/off the cursor.  */
-  void (*setcursor) (int on);
+  void (*setcursor) (struct grub_term_output *term, int on);
 
   /* Update the screen.  */
-  void (*refresh) (void);
+  void (*refresh) (struct grub_term_output *term);
 
   /* The feature flags defined above.  */
   grub_uint32_t flags;
+
+  void *data;
 };
 typedef struct grub_term_output *grub_term_output_t;
 
@@ -222,7 +232,7 @@ grub_term_register_input (const char *name __attribute__ ((unused)),
   else
     {
       /* If this is the first terminal, enable automatically.  */
-      if (! term->init || term->init () == GRUB_ERR_NONE)
+      if (! term->init || term->init (term) == GRUB_ERR_NONE)
        grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
     }
 }
@@ -237,7 +247,7 @@ grub_term_register_output (const char *name __attribute__ ((unused)),
   else
     {
       /* If this is the first terminal, enable automatically.  */
-      if (! term->init || term->init () == GRUB_ERR_NONE)
+      if (! term->init || term->init (term) == GRUB_ERR_NONE)
        grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
                        GRUB_AS_LIST (term));
     }
@@ -277,12 +287,12 @@ void grub_term_restore_pos (grub_uint16_t *pos);
 
 static inline unsigned grub_term_width (struct grub_term_output *term)
 {
-  return ((term->getwh()&0xFF00)>>8);
+  return ((term->getwh(term)&0xFF00)>>8);
 }
 
 static inline unsigned grub_term_height (struct grub_term_output *term)
 {
-  return (term->getwh()&0xFF);
+  return (term->getwh(term)&0xFF);
 }
 
 /* The width of the border.  */
@@ -326,20 +336,20 @@ grub_term_cursor_x (struct grub_term_output *term)
 static inline grub_uint16_t
 grub_term_getxy (struct grub_term_output *term)
 {
-  return term->getxy ();
+  return term->getxy (term);
 }
 
 static inline void
 grub_term_refresh (struct grub_term_output *term)
 {
   if (term->refresh)
-    term->refresh ();
+    term->refresh (term);
 }
 
 static inline void
 grub_term_gotoxy (struct grub_term_output *term, grub_uint8_t x, grub_uint8_t y)
 {
-  term->gotoxy (x, y);
+  term->gotoxy (term, x, y);
 }
 
 static inline void 
@@ -347,7 +357,7 @@ grub_term_setcolorstate (struct grub_term_output *term,
                         grub_term_color_state state)
 {
   if (term->setcolorstate)
-    term->setcolorstate (state);
+    term->setcolorstate (term, state);
 }
 
   /* Set the normal color and the highlight color. The format of each
@@ -357,7 +367,7 @@ grub_term_setcolor (struct grub_term_output *term,
                    grub_uint8_t normal_color, grub_uint8_t highlight_color)
 {
   if (term->setcolor)
-    term->setcolor (normal_color, highlight_color);
+    term->setcolor (term, normal_color, highlight_color);
 }
 
 /* Turn on/off the cursor.  */
@@ -365,14 +375,14 @@ static inline void
 grub_term_setcursor (struct grub_term_output *term, int on)
 {
   if (term->setcursor)
-    term->setcursor (on);
+    term->setcursor (term, on);
 }
 
 static inline void 
 grub_term_cls (struct grub_term_output *term)
 {
   if (term->cls)
-    (term->cls) ();
+    (term->cls) (term);
   else
     {
       grub_putcode ('\n', term);
@@ -402,7 +412,7 @@ grub_term_getcharwidth (struct grub_term_output *term,
                        const struct grub_unicode_glyph *c)
 {
   if (term->getcharwidth)
-    return term->getcharwidth (c);
+    return term->getcharwidth (term, c);
   else if (((term->flags & GRUB_TERM_CODE_TYPE_MASK)
            == GRUB_TERM_CODE_TYPE_UTF8_LOGICAL)
           || ((term->flags & GRUB_TERM_CODE_TYPE_MASK)
@@ -419,7 +429,7 @@ grub_term_getcolor (struct grub_term_output *term,
                    grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
 {
   if (term->getcolor)
-    term->getcolor (normal_color, highlight_color);
+    term->getcolor (term, normal_color, highlight_color);
   else
     {
       *normal_color = 0x07;
index f3942e199bf6e6d5929e7775fbcbbd088bef2894..761eb53fe0c8b574fefdee28912af05929092445 100644 (file)
@@ -1078,7 +1078,7 @@ xsmap:
  */
 FUNCTION(grub_console_putchar)
        /* Retrieve the base character.  */
-       movl    0(%eax), %edx
+       movl    0(%edx), %edx
        pusha
        movb    EXT_C(grub_console_cur_color), %bl
 
@@ -1329,8 +1329,8 @@ FUNCTION(grub_console_gotoxy)
        pushl   %ebp
        pushl   %ebx                    /* save EBX */
 
-       movb    %dl, %dh        /* %dh = y */
-       movb    %al, %dl        /* %dl = x */
+       movb    %cl, %dh        /* %dh = y */
+       /* %dl = x */
 
        call    prot_to_real
        .code16
@@ -1406,7 +1406,7 @@ FUNCTION(grub_console_setcursor)
        pushl   %ebx
 
        /* push ON */
-       pushl   %eax
+       pushl   %edx
 
        /* check if the standard cursor shape has already been saved */
        movw    console_cursor_shape, %ax
index dba94ecf70ae791d2e2011b114a73998f40ac859..a1f8b9f93cab63f860810ac8dc10159f0c4da07c 100644 (file)
@@ -47,14 +47,14 @@ grub_putcode_dumb (grub_uint32_t code,
     {
       int n;
 
-      n = 8 - ((term->getxy () >> 8) & 7);
+      n = 8 - ((term->getxy (term) >> 8) & 7);
       while (n--)
        grub_putcode_dumb (' ', term);
 
       return;
     }
 
-  (term->putchar) (&c);
+  (term->putchar) (term, &c);
   if (code == '\n')
     grub_putcode_dumb ('\r', term);
 }
@@ -87,9 +87,9 @@ grub_getkey (void)
     {
       FOR_ACTIVE_TERM_INPUTS(term)
       {
-       int key = term->checkkey ();
+       int key = term->checkkey (term);
        if (key != -1)
-         return term->getkey ();
+         return term->getkey (term);
       }
 
       grub_cpu_idle ();
@@ -103,7 +103,7 @@ grub_checkkey (void)
 
   FOR_ACTIVE_TERM_INPUTS(term)
   {
-    int key = term->checkkey ();
+    int key = term->checkkey (term);
     if (key != -1)
       return key;
   }
@@ -120,7 +120,7 @@ grub_getkeystatus (void)
   FOR_ACTIVE_TERM_INPUTS(term)
   {
     if (term->getkeystatus)
-      status |= term->getkeystatus ();
+      status |= term->getkeystatus (term);
   }
 
   return status;
@@ -139,7 +139,7 @@ grub_cls (void)
        grub_term_refresh (term);
       }
     else
-      (term->cls) ();
+      (term->cls) (term);
   }
 }
 
index 97c415f8a968c90c024a06bdfdbc8837c06bbb0a..f46930be4fbe428cd8bdc2a273ecb80cc8c6d826 100644 (file)
@@ -366,10 +366,10 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term)
     {
       int n;
 
-      n = 8 - ((term->getxy () >> 8) & 7);
+      n = 8 - ((term->getxy (term) >> 8) & 7);
       c2.base = ' ';
       while (n--)
-       (term->putchar) (&c2);
+       (term->putchar) (term, &c2);
 
       return;
     }
@@ -405,19 +405,19 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term)
          for (ptr = u8; *ptr; ptr++)
            {
              c2.base = *ptr;
-             (term->putchar) (&c2);
+             (term->putchar) (term, &c2);
              c2.estimated_width = 0;
            }
        }
       c2.estimated_width = 1;
     }
   else
-    (term->putchar) (c);
+    (term->putchar) (term, c);
 
   if (c->base == '\n')
     {
       c2.base = '\r';
-      (term->putchar) (&c2);
+      (term->putchar) (term, &c2);
     }
 }
 
@@ -468,7 +468,7 @@ static grub_ssize_t
 get_startwidth (struct grub_term_output *term,
                int margin_left)
 {
-  return ((term->getxy () >> 8) & 0xff) - margin_left;
+  return ((term->getxy (term) >> 8) & 0xff) - margin_left;
 }
 
 static int
@@ -670,8 +670,8 @@ print_ucs4_real (const grub_uint32_t * str,
   if (backlog)
     state = find_term_state (term);
 
-  if (((term->getxy () >> 8) & 0xff) < margin_left)
-    grub_print_spaces (term, margin_left - ((term->getxy () >> 8) & 0xff));
+  if (((term->getxy (term) >> 8) & 0xff) < margin_left)
+    grub_print_spaces (term, margin_left - ((term->getxy (term) >> 8) & 0xff));
 
   if ((term->flags & GRUB_TERM_CODE_TYPE_MASK) 
       == GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS
index 1f84ae71a05564b4fb4368b9519b9781da60ac2f..c3e71ea2dfebf991d9db7ff772dbacc534d97ef9 100644 (file)
@@ -236,7 +236,7 @@ grub_at_keyboard_getkey_noblock (void)
 }
 
 static int
-grub_at_keyboard_checkkey (void)
+grub_at_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   if (pending_key != -1)
     return 1;
@@ -250,7 +250,7 @@ grub_at_keyboard_checkkey (void)
 }
 
 static int
-grub_at_keyboard_getkey (void)
+grub_at_keyboard_getkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   int key;
   if (pending_key != -1)
@@ -267,7 +267,7 @@ grub_at_keyboard_getkey (void)
 }
 
 static grub_err_t
-grub_keyboard_controller_init (void)
+grub_keyboard_controller_init (struct grub_term_input *term __attribute__ ((unused)))
 {
   pending_key = -1;
   at_keyboard_status = 0;
@@ -277,7 +277,7 @@ grub_keyboard_controller_init (void)
 }
 
 static grub_err_t
-grub_keyboard_controller_fini (void)
+grub_keyboard_controller_fini (struct grub_term_input *term __attribute__ ((unused)))
 {
   grub_keyboard_controller_write (grub_keyboard_controller_orig);
   return GRUB_ERR_NONE;
index cba56bcc89dd872c5915e461eb7a6f91e64af3cd..e5dab8a96fd33d7aee92030030fc47a88ae8c446 100644 (file)
@@ -85,7 +85,8 @@ map_char (grub_uint32_t c)
 }
 
 static void
-grub_console_putchar (const struct grub_unicode_glyph *c)
+grub_console_putchar (struct grub_term_output *term __attribute__ ((unused)),
+                     const struct grub_unicode_glyph *c)
 {
   grub_efi_char16_t str[2 + c->ncomb];
   grub_efi_simple_text_output_interface_t *o;
@@ -113,7 +114,7 @@ grub_console_putchar (const struct grub_unicode_glyph *c)
 }
 
 static int
-grub_console_checkkey (void)
+grub_console_checkkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   grub_efi_simple_input_interface_t *i;
   grub_efi_input_key_t key;
@@ -208,7 +209,7 @@ grub_console_checkkey (void)
 }
 
 static int
-grub_console_getkey (void)
+grub_console_getkey (struct grub_term_input *term)
 {
   grub_efi_simple_input_interface_t *i;
   grub_efi_boot_services_t *b;
@@ -232,7 +233,7 @@ grub_console_getkey (void)
       if (status != GRUB_EFI_SUCCESS)
         return -1;
 
-      grub_console_checkkey ();
+      grub_console_checkkey (term);
     }
   while (read_key < 0);
 
@@ -242,7 +243,7 @@ grub_console_getkey (void)
 }
 
 static grub_uint16_t
-grub_console_getwh (void)
+grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   grub_efi_simple_text_output_interface_t *o;
   grub_efi_uintn_t columns, rows;
@@ -259,7 +260,7 @@ grub_console_getwh (void)
 }
 
 static grub_uint16_t
-grub_console_getxy (void)
+grub_console_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   grub_efi_simple_text_output_interface_t *o;
 
@@ -268,7 +269,8 @@ grub_console_getxy (void)
 }
 
 static void
-grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                    grub_uint8_t x, grub_uint8_t y)
 {
   grub_efi_simple_text_output_interface_t *o;
 
@@ -277,7 +279,7 @@ grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y)
 }
 
 static void
-grub_console_cls (void)
+grub_console_cls (struct grub_term_output *term __attribute__ ((unused)))
 {
   grub_efi_simple_text_output_interface_t *o;
   grub_efi_int32_t orig_attr;
@@ -290,7 +292,8 @@ grub_console_cls (void)
 }
 
 static void
-grub_console_setcolorstate (grub_term_color_state state)
+grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                           grub_term_color_state state)
 {
   grub_efi_simple_text_output_interface_t *o;
 
@@ -312,21 +315,24 @@ grub_console_setcolorstate (grub_term_color_state state)
 }
 
 static void
-grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
+grub_console_setcolor (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t normal_color, grub_uint8_t highlight_color)
 {
   grub_console_normal_color = normal_color;
   grub_console_highlight_color = highlight_color;
 }
 
 static void
-grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+grub_console_getcolor (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
 {
   *normal_color = grub_console_normal_color;
   *highlight_color = grub_console_highlight_color;
 }
 
 static void
-grub_console_setcursor (int on)
+grub_console_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                       int on)
 {
   grub_efi_simple_text_output_interface_t *o;
 
index af6401bbf56821860e0104516475166ceb1876a1..d9fb2e04c13f6720fb25648c2060b32125b845a3 100644 (file)
@@ -146,10 +146,11 @@ static unsigned int calculate_normal_character_width (grub_font_t font);
 
 static unsigned char calculate_character_width (struct grub_font_glyph *glyph);
 
-static void grub_gfxterm_refresh (void);
+static void grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused)));
 
 static grub_ssize_t
-grub_gfxterm_getcharwidth (const struct grub_unicode_glyph *c);
+grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
+                          const struct grub_unicode_glyph *c);
 
 static void
 set_term_color (grub_uint8_t term_color)
@@ -364,7 +365,7 @@ grub_gfxterm_fullscreen (void)
 }
 
 static grub_err_t
-grub_gfxterm_term_init (void)
+grub_gfxterm_term_init (struct grub_term_output *term __attribute__ ((unused)))
 {
   char *tmp;
   grub_err_t err;
@@ -408,7 +409,7 @@ destroy_window (void)
 }
 
 static grub_err_t
-grub_gfxterm_term_fini (void)
+grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused)))
 {
   destroy_window ();
   grub_video_restore ();
@@ -822,7 +823,8 @@ scroll_up (void)
 }
 
 static void
-grub_gfxterm_putchar (const struct grub_unicode_glyph *c)
+grub_gfxterm_putchar (struct grub_term_output *term,
+                     const struct grub_unicode_glyph *c)
 {
   if (c->base == '\a')
     /* FIXME */
@@ -860,7 +862,7 @@ grub_gfxterm_putchar (const struct grub_unicode_glyph *c)
 
       /* Calculate actual character width for glyph. This is number of
          times of normal_font_width.  */
-      char_width = grub_gfxterm_getcharwidth (c);
+      char_width = grub_gfxterm_getcharwidth (term, c);
 
       /* If we are about to exceed line length, wrap to next line.  */
       if (virtual_screen.cursor_x + char_width > virtual_screen.columns)
@@ -959,7 +961,8 @@ calculate_character_width (struct grub_font_glyph *glyph)
 }
 
 static grub_ssize_t
-grub_gfxterm_getcharwidth (const struct grub_unicode_glyph *c)
+grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
+                          const struct grub_unicode_glyph *c)
 {
   int dev_width;
   dev_width = grub_font_get_constructed_device_width (virtual_screen.font, c);
@@ -972,19 +975,20 @@ grub_gfxterm_getcharwidth (const struct grub_unicode_glyph *c)
 }
 
 static grub_uint16_t
-grub_virtual_screen_getwh (void)
+grub_virtual_screen_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (virtual_screen.columns << 8) | virtual_screen.rows;
 }
 
 static grub_uint16_t
-grub_virtual_screen_getxy (void)
+grub_virtual_screen_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   return ((virtual_screen.cursor_x << 8) | virtual_screen.cursor_y);
 }
 
 static void
-grub_gfxterm_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_gfxterm_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                    grub_uint8_t x, grub_uint8_t y)
 {
   if (x >= virtual_screen.columns)
     x = virtual_screen.columns - 1;
@@ -1005,7 +1009,7 @@ grub_gfxterm_gotoxy (grub_uint8_t x, grub_uint8_t y)
 }
 
 static void
-grub_virtual_screen_cls (void)
+grub_virtual_screen_cls (struct grub_term_output *term __attribute__ ((unused)))
 {
   grub_uint32_t i;
 
@@ -1016,12 +1020,12 @@ grub_virtual_screen_cls (void)
 }
 
 static void
-grub_gfxterm_cls (void)
+grub_gfxterm_cls (struct grub_term_output *term)
 {
   grub_video_color_t color;
 
   /* Clear virtual screen.  */
-  grub_virtual_screen_cls ();
+  grub_virtual_screen_cls (term);
 
   /* Clear text layer.  */
   grub_video_set_active_render_target (text_layer);
@@ -1033,11 +1037,12 @@ grub_gfxterm_cls (void)
   /* Mark virtual screen to be redrawn.  */
   dirty_region_add_virtualscreen ();
 
-  grub_gfxterm_refresh ();
+  grub_gfxterm_refresh (term);
 }
 
 static void
-grub_virtual_screen_setcolorstate (grub_term_color_state state)
+grub_virtual_screen_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                                  grub_term_color_state state)
 {
   switch (state)
     {
@@ -1062,7 +1067,8 @@ grub_virtual_screen_setcolorstate (grub_term_color_state state)
 }
 
 static void
-grub_virtual_screen_setcolor (grub_uint8_t normal_color,
+grub_virtual_screen_setcolor (struct grub_term_output *term __attribute__ ((unused)),
+                             grub_uint8_t normal_color,
                               grub_uint8_t highlight_color)
 {
   virtual_screen.normal_color_setting = normal_color;
@@ -1070,7 +1076,8 @@ grub_virtual_screen_setcolor (grub_uint8_t normal_color,
 }
 
 static void
-grub_virtual_screen_getcolor (grub_uint8_t *normal_color,
+grub_virtual_screen_getcolor (struct grub_term_output *term __attribute__ ((unused)),
+                             grub_uint8_t *normal_color,
                               grub_uint8_t *highlight_color)
 {
   *normal_color = virtual_screen.normal_color_setting;
@@ -1078,7 +1085,8 @@ grub_virtual_screen_getcolor (grub_uint8_t *normal_color,
 }
 
 static void
-grub_gfxterm_setcursor (int on)
+grub_gfxterm_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                       int on)
 {
   if (virtual_screen.cursor_state != on)
     {
@@ -1092,7 +1100,7 @@ grub_gfxterm_setcursor (int on)
 }
 
 static void
-grub_gfxterm_refresh (void)
+grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused)))
 {
   real_scroll ();
 
index 146e1664349fda7127664bd430a02eb26d02c751..c157f482c31f3d3b6dc62cca7b0bdaa2be145cc9 100644 (file)
@@ -30,7 +30,7 @@ static const struct grub_machine_bios_data_area *bios_data_area =
 #define KEYBOARD_ALT           (1 << 3)
 
 static int
-grub_console_getkeystatus (void)
+grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused)))
 {
   grub_uint8_t status = bios_data_area->keyboard_flag_lower;
   int mods = 0;
index 036ac592ac79f1583f427076154ff2915b3f4421..a9dd5e2146dd4571df410e86d22a75aa0e5b3690 100644 (file)
@@ -152,7 +152,7 @@ set_start_address (unsigned int start)
 }
 
 static grub_err_t
-grub_vga_mod_init (void)
+grub_vga_mod_init (struct grub_term_output *term __attribute__ ((unused)))
 {
   text_mode = grub_vga_set_mode (0x10);
   cursor_state = 1;
@@ -169,7 +169,7 @@ grub_vga_mod_init (void)
 }
 
 static grub_err_t
-grub_vga_mod_fini (void)
+grub_vga_mod_fini (struct grub_term_output *term __attribute__ ((unused)))
 {
   set_map_mask (saved_map_mask);
   grub_vga_set_mode (text_mode);
@@ -287,7 +287,8 @@ scroll_up (void)
 }
 
 static void
-grub_vga_putchar (const struct grub_unicode_glyph *c)
+grub_vga_putchar (struct grub_term_output *term __attribute__ ((unused)),
+                 const struct grub_unicode_glyph *c)
 {
 #if DEBUG_VGA
   static int show = 1;
@@ -393,7 +394,8 @@ grub_vga_putchar (const struct grub_unicode_glyph *c)
 }
 
 static grub_ssize_t
-grub_vga_getcharwidth (const struct grub_unicode_glyph *c)
+grub_vga_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
+                      const struct grub_unicode_glyph *c)
 {
 #if 0
   struct grub_font_glyph glyph;
@@ -408,19 +410,20 @@ grub_vga_getcharwidth (const struct grub_unicode_glyph *c)
 }
 
 static grub_uint16_t
-grub_vga_getwh (void)
+grub_vga_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (TEXT_WIDTH << 8) | TEXT_HEIGHT;
 }
 
 static grub_uint16_t
-grub_vga_getxy (void)
+grub_vga_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   return ((xpos << 8) | ypos);
 }
 
 static void
-grub_vga_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_vga_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                grub_uint8_t x, grub_uint8_t y)
 {
   if (x >= TEXT_WIDTH || y >= TEXT_HEIGHT)
     {
@@ -440,7 +443,7 @@ grub_vga_gotoxy (grub_uint8_t x, grub_uint8_t y)
 }
 
 static void
-grub_vga_cls (void)
+grub_vga_cls (struct grub_term_output *term __attribute__ ((unused)))
 {
   unsigned i;
 
@@ -460,7 +463,8 @@ grub_vga_cls (void)
 }
 
 static void
-grub_vga_setcolorstate (grub_term_color_state state)
+grub_vga_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                       grub_term_color_state state)
 {
   switch (state)
     {
@@ -479,7 +483,8 @@ grub_vga_setcolorstate (grub_term_color_state state)
 }
 
 static void
-grub_vga_setcursor (int on)
+grub_vga_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                   int on)
 {
   if (cursor_state != on)
     {
index 3f352afb4dd0854e1ff4d53b3ae39f1399a74eb4..9242adf0fbfca3032ce1b1ac43da911d82132a7a 100644 (file)
@@ -84,7 +84,8 @@ inc_x (void)
 }
 
 static void
-grub_vga_text_putchar (const struct grub_unicode_glyph *c)
+grub_vga_text_putchar (struct grub_term_output *term __attribute__ ((unused)),
+                      const struct grub_unicode_glyph *c)
 {
   switch (c->base)
     {
@@ -108,13 +109,14 @@ grub_vga_text_putchar (const struct grub_unicode_glyph *c)
 }
 
 static grub_uint16_t
-grub_vga_text_getxy (void)
+grub_vga_text_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (grub_curr_x << 8) | grub_curr_y;
 }
 
 static void
-grub_vga_text_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_vga_text_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                     grub_uint8_t x, grub_uint8_t y)
 {
   grub_curr_x = x;
   grub_curr_y = y;
@@ -122,16 +124,17 @@ grub_vga_text_gotoxy (grub_uint8_t x, grub_uint8_t y)
 }
 
 static void
-grub_vga_text_cls (void)
+grub_vga_text_cls (struct grub_term_output *term)
 {
   int i;
   for (i = 0; i < ROWS * COLS; i++)
     ((short *) VGA_TEXT_SCREEN)[i] = ' ' | (grub_console_cur_color << 8);
-  grub_vga_text_gotoxy (0, 0);
+  grub_vga_text_gotoxy (term, 0, 0);
 }
 
 static void
-grub_vga_text_setcursor (int on)
+grub_vga_text_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                        int on)
 {
   grub_uint8_t old;
   grub_outb (CRTC_CURSOR, CRTC_ADDR_PORT);
@@ -143,9 +146,9 @@ grub_vga_text_setcursor (int on)
 }
 
 static grub_err_t
-grub_vga_text_init_fini (void)
+grub_vga_text_init_fini (struct grub_term_output *term)
 {
-  grub_vga_text_cls ();
+  grub_vga_text_cls (term);
   return 0;
 }
 
index 894c5d9118398aa40d5748f1e2f27c0256bf6c4f..16dc8c56ba760b5c44727054b20404359782fe40 100644 (file)
@@ -26,13 +26,14 @@ static grub_uint8_t grub_console_normal_color = 0x7;
 static grub_uint8_t grub_console_highlight_color = 0x70;
 
 grub_uint16_t
-grub_console_getwh (void)
+grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (80 << 8) | 25;
 }
 
 void
-grub_console_setcolorstate (grub_term_color_state state)
+grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                           grub_term_color_state state)
 {
   switch (state) {
     case GRUB_TERM_COLOR_STANDARD:
@@ -50,14 +51,16 @@ grub_console_setcolorstate (grub_term_color_state state)
 }
 
 void
-grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
+grub_console_setcolor (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t normal_color, grub_uint8_t highlight_color)
 {
   grub_console_normal_color = normal_color;
   grub_console_highlight_color = highlight_color;
 }
 
 void
-grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+grub_console_getcolor (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
 {
   *normal_color = grub_console_normal_color;
   *highlight_color = grub_console_highlight_color;
index b9b60901b3e78385ba36a4fe3fbef78c5735b113..590fa7f530d22c12cd8808b8255ff47c2ad5fef1 100644 (file)
@@ -77,7 +77,8 @@ grub_ofconsole_writeesc (const char *str)
 }
 
 static void
-grub_ofconsole_putchar (const struct grub_unicode_glyph *c)
+grub_ofconsole_putchar (struct grub_term_output *term __attribute__ ((unused)),
+                       const struct grub_unicode_glyph *c)
 {
   char chr;
 
@@ -109,7 +110,8 @@ grub_ofconsole_putchar (const struct grub_unicode_glyph *c)
 }
 
 static void
-grub_ofconsole_setcolorstate (grub_term_color_state state)
+grub_ofconsole_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                             grub_term_color_state state)
 {
   char setcol[256];
   int fg;
@@ -135,7 +137,8 @@ grub_ofconsole_setcolorstate (grub_term_color_state state)
 }
 
 static void
-grub_ofconsole_setcolor (grub_uint8_t normal_color,
+grub_ofconsole_setcolor (struct grub_term_output *term __attribute__ ((unused)),
+                        grub_uint8_t normal_color,
                         grub_uint8_t highlight_color)
 {
   /* Discard bright bit.  */
@@ -144,7 +147,8 @@ grub_ofconsole_setcolor (grub_uint8_t normal_color,
 }
 
 static void
-grub_ofconsole_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+grub_ofconsole_getcolor (struct grub_term_output *term __attribute__ ((unused)),
+                        grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
 {
   *normal_color = grub_ofconsole_normal_color;
   *highlight_color = grub_ofconsole_highlight_color;
@@ -163,7 +167,7 @@ readkey (void)
 }
 
 static int
-grub_ofconsole_checkkey (void)
+grub_ofconsole_checkkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   if (grub_buflen)
     return grub_keybuf[0];
@@ -177,7 +181,7 @@ grub_ofconsole_checkkey (void)
 }
 
 static int
-grub_ofconsole_getkey (void)
+grub_ofconsole_getkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   int ret;
   while (! grub_buflen)
@@ -190,7 +194,7 @@ grub_ofconsole_getkey (void)
 }
 
 static grub_uint16_t
-grub_ofconsole_getxy (void)
+grub_ofconsole_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (grub_curr_x << 8) | grub_curr_y;
 }
@@ -232,13 +236,14 @@ grub_ofconsole_dimensions (void)
 }
 
 static grub_uint16_t
-grub_ofconsole_getwh (void)
+grub_ofconsole_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (grub_ofconsole_width << 8) | grub_ofconsole_height;
 }
 
 static void
-grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_ofconsole_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t x, grub_uint8_t y)
 {
   if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_NO_ANSI))
     {
@@ -265,17 +270,18 @@ grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y)
 }
 
 static void
-grub_ofconsole_cls (void)
+grub_ofconsole_cls (struct grub_term_output *term)
 {
   /* Clear the screen.  Using serial console, screen(1) only recognizes the
    * ANSI escape sequence.  Using video console, Apple Open Firmware (version
    * 3.1.1) only recognizes the literal ^L.  So use both.  */
   grub_ofconsole_writeesc ("\f\e[2J");
-  grub_ofconsole_gotoxy (0, 0);
+  grub_ofconsole_gotoxy (term, 0, 0);
 }
 
 static void
-grub_ofconsole_setcursor (int on)
+grub_ofconsole_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                         int on)
 {
   /* Understood by the Open Firmware flavour in OLPC.  */
   if (on)
@@ -285,13 +291,13 @@ grub_ofconsole_setcursor (int on)
 }
 
 static void
-grub_ofconsole_refresh (void)
+grub_ofconsole_refresh (struct grub_term_output *term __attribute__ ((unused)))
 {
   /* Do nothing, the current console state is ok.  */
 }
 
 static grub_err_t
-grub_ofconsole_init_input (void)
+grub_ofconsole_init_input (struct grub_term_input *term __attribute__ ((unused)))
 {
   grub_ssize_t actual;
 
@@ -304,7 +310,7 @@ grub_ofconsole_init_input (void)
 }
 
 static grub_err_t
-grub_ofconsole_init_output (void)
+grub_ofconsole_init_output (struct grub_term_output *term)
 {
   grub_ssize_t actual;
 
@@ -328,7 +334,7 @@ grub_ofconsole_init_output (void)
                                 colors[col].green, colors[col].blue);
 
     /* Set the right fg and bg colors.  */
-      grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL);
+      grub_ofconsole_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
     }
 
   grub_ofconsole_dimensions ();
@@ -336,19 +342,11 @@ grub_ofconsole_init_output (void)
   return 0;
 }
 
-static grub_err_t
-grub_ofconsole_fini (void)
-{
-  return 0;
-}
-
-
 \f
 static struct grub_term_input grub_ofconsole_term_input =
   {
     .name = "ofconsole",
     .init = grub_ofconsole_init_input,
-    .fini = grub_ofconsole_fini,
     .checkkey = grub_ofconsole_checkkey,
     .getkey = grub_ofconsole_getkey,
   };
@@ -357,7 +355,6 @@ static struct grub_term_output grub_ofconsole_term_output =
   {
     .name = "ofconsole",
     .init = grub_ofconsole_init_output,
-    .fini = grub_ofconsole_fini,
     .putchar = grub_ofconsole_putchar,
     .getxy = grub_ofconsole_getxy,
     .getwh = grub_ofconsole_getwh,
index bdc80cb74ae482c746d5f8741ab8ab27545dc4ef..61bad192fd67f15cc5d7ee375f80750b4f8a8361 100644 (file)
@@ -154,7 +154,7 @@ serial_get_divisor (unsigned int speed)
 
 /* The serial version of checkkey.  */
 static int
-grub_serial_checkkey (void)
+grub_serial_checkkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   if (npending)
     return input_buf[0];
@@ -169,7 +169,7 @@ grub_serial_checkkey (void)
 
 /* The serial version of getkey.  */
 static int
-grub_serial_getkey (void)
+grub_serial_getkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   int ret;
   while (! npending)
@@ -219,8 +219,8 @@ serial_hw_init (void)
 #endif
 
   /* Drain the input buffer.  */
-  while (grub_serial_checkkey () != -1)
-    (void) grub_serial_getkey ();
+  while (grub_serial_checkkey (0) != -1)
+    (void) grub_serial_getkey (0);
 
   /*  FIXME: should check if the serial terminal was found.  */
 
@@ -229,7 +229,8 @@ serial_hw_init (void)
 
 /* The serial version of putchar.  */
 static void
-grub_serial_putchar (const struct grub_unicode_glyph *c)
+grub_serial_putchar (struct grub_term_output *term __attribute__ ((unused)),
+                    const struct grub_unicode_glyph *c)
 {
   /* Keep track of the cursor.  */
   if (keep_track)
@@ -274,19 +275,20 @@ grub_serial_putchar (const struct grub_unicode_glyph *c)
 }
 
 static grub_uint16_t
-grub_serial_getwh (void)
+grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   return (TEXT_WIDTH << 8) | TEXT_HEIGHT;
 }
 
 static grub_uint16_t
-grub_serial_getxy (void)
+grub_serial_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   return ((xpos << 8) | ypos);
 }
 
 static void
-grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_serial_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                   grub_uint8_t x, grub_uint8_t y)
 {
   if (x > TEXT_WIDTH || y > TEXT_HEIGHT)
     {
@@ -304,7 +306,7 @@ grub_serial_gotoxy (grub_uint8_t x, grub_uint8_t y)
 }
 
 static void
-grub_serial_cls (void)
+grub_serial_cls (struct grub_term_output *term __attribute__ ((unused)))
 {
   keep_track = 0;
   grub_terminfo_cls (&grub_serial_term_output);
@@ -314,7 +316,8 @@ grub_serial_cls (void)
 }
 
 static void
-grub_serial_setcolorstate (const grub_term_color_state state)
+grub_serial_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                          const grub_term_color_state state)
 {
   keep_track = 0;
   switch (state)
@@ -333,7 +336,8 @@ grub_serial_setcolorstate (const grub_term_color_state state)
 }
 
 static void
-grub_serial_setcursor (const int on)
+grub_serial_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                      const int on)
 {
   if (on)
     grub_terminfo_cursor_on (&grub_serial_term_output);
index ef713e1511f0adc0032a0b735c93cf8fff1d9ce6..eb14d47f1f148b1d1b27d00f62f766f234c39ac9 100644 (file)
@@ -122,7 +122,7 @@ putstr (const char *str, grub_term_output_t oterm)
          .ncomb = 0,
          .combining = 0
        };
-      oterm->putchar (&c);
+      oterm->putchar (oterm, &c);
     }
 }
 
index 5d76c5e02a760ef7b3448dd8f0bea77b1d6dfcb6..51855c09b12b2e8611cc63ca76f85dd31910c0f7 100644 (file)
@@ -120,7 +120,7 @@ grub_usb_keyboard_getreport (grub_usb_device_t dev, grub_uint8_t *report)
 \f
 
 static int
-grub_usb_keyboard_checkkey (void)
+grub_usb_keyboard_checkkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   grub_uint8_t data[8];
   int key;
@@ -189,7 +189,7 @@ typedef enum
 } grub_usb_keyboard_repeat_t;
 
 static int
-grub_usb_keyboard_getkey (void)
+grub_usb_keyboard_getkey (struct grub_term_input *term)
 {
   int key;
   grub_err_t err;
@@ -202,7 +202,7 @@ grub_usb_keyboard_getkey (void)
 
   do
     {
-      key = grub_usb_keyboard_checkkey ();
+      key = grub_usb_keyboard_checkkey (term);
     } while (key == -1);
 
   data[2] = !0; /* Or whatever.  */
@@ -254,7 +254,7 @@ grub_usb_keyboard_getkey (void)
 }
 
 static int
-grub_usb_keyboard_getkeystatus (void)
+grub_usb_keyboard_getkeystatus (struct grub_term_input *term __attribute__ ((unused)))
 {
   grub_uint8_t data[8];
   int mods = 0;
index b4316042ed57a491467b64f5a41b03005eb2c81d..e8ee9f7da9f10af55f0a9dbf686e15618fa07633 100644 (file)
@@ -64,13 +64,15 @@ static grub_uint8_t color_map[NUM_COLORS] =
 static int use_color;
 
 static void
-grub_ncurses_putchar (const struct grub_unicode_glyph *c)
+grub_ncurses_putchar (struct grub_term_output *term __attribute__ ((unused)),
+                     const struct grub_unicode_glyph *c)
 {
   addch (c->base | grub_console_attr);
 }
 
 static void
-grub_ncurses_setcolorstate (grub_term_color_state state)
+grub_ncurses_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+                           grub_term_color_state state)
 {
   switch (state)
     {
@@ -104,14 +106,16 @@ grub_ncurses_setcolorstate (grub_term_color_state state)
 
 /* XXX: This function is never called.  */
 static void
-grub_ncurses_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
+grub_ncurses_setcolor (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t normal_color, grub_uint8_t highlight_color)
 {
   grub_console_normal_color = normal_color;
   grub_console_highlight_color = highlight_color;
 }
 
 static void
-grub_ncurses_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+grub_ncurses_getcolor (struct grub_term_output *term __attribute__ ((unused)),
+                      grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
 {
   *normal_color = grub_console_normal_color;
   *highlight_color = grub_console_highlight_color;
@@ -120,7 +124,7 @@ grub_ncurses_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color
 static int saved_char = ERR;
 
 static int
-grub_ncurses_checkkey (void)
+grub_ncurses_checkkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   int c;
 
@@ -142,7 +146,7 @@ grub_ncurses_checkkey (void)
 }
 
 static int
-grub_ncurses_getkey (void)
+grub_ncurses_getkey (struct grub_term_input *term __attribute__ ((unused)))
 {
   int c;
 
@@ -212,7 +216,7 @@ grub_ncurses_getkey (void)
 }
 
 static grub_uint16_t
-grub_ncurses_getxy (void)
+grub_ncurses_getxy (struct grub_term_output *term __attribute__ ((unused)))
 {
   int x;
   int y;
@@ -223,7 +227,7 @@ grub_ncurses_getxy (void)
 }
 
 static grub_uint16_t
-grub_ncurses_getwh (void)
+grub_ncurses_getwh (struct grub_term_output *term __attribute__ ((unused)))
 {
   int x;
   int y;
@@ -234,32 +238,34 @@ grub_ncurses_getwh (void)
 }
 
 static void
-grub_ncurses_gotoxy (grub_uint8_t x, grub_uint8_t y)
+grub_ncurses_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
+                    grub_uint8_t x, grub_uint8_t y)
 {
   move (y, x);
 }
 
 static void
-grub_ncurses_cls (void)
+grub_ncurses_cls (struct grub_term_output *term __attribute__ ((unused)))
 {
   clear ();
   refresh ();
 }
 
 static void
-grub_ncurses_setcursor (int on)
+grub_ncurses_setcursor (struct grub_term_output *term __attribute__ ((unused)),
+                       int on)
 {
   curs_set (on ? 1 : 0);
 }
 
 static void
-grub_ncurses_refresh (void)
+grub_ncurses_refresh (struct grub_term_output *term __attribute__ ((unused)))
 {
   refresh ();
 }
 
 static grub_err_t
-grub_ncurses_init (void)
+grub_ncurses_init (struct grub_term_output *term __attribute__ ((unused)))
 {
   initscr ();
   raw ();
@@ -291,7 +297,7 @@ grub_ncurses_init (void)
 }
 
 static grub_err_t
-grub_ncurses_fini (void)
+grub_ncurses_fini (struct grub_term_output *term __attribute__ ((unused)))
 {
   endwin ();
   return 0;
@@ -333,5 +339,5 @@ grub_console_init (void)
 void
 grub_console_fini (void)
 {
-  grub_ncurses_fini ();
+  grub_ncurses_fini (&grub_ncurses_term_output);
 }