]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
simplify setcolor/getcolor
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 7 May 2010 23:06:22 +0000 (01:06 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 7 May 2010 23:06:22 +0000 (01:06 +0200)
13 files changed:
include/grub/i386/vga_common.h
include/grub/term.h
include/grub/terminfo.h
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
util/console.c

index 8ba09dfeaed08c915e348765557edf34bd479848..87279030769b024d9c848db11b3817696d4e052c 100644 (file)
@@ -28,11 +28,5 @@ extern grub_uint8_t grub_console_cur_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 59a90d500128e8a6831e8936d211c9bcea1a7957..5a098e2930b70024361515c365ee7d723b74ef51 100644 (file)
@@ -195,16 +195,6 @@ struct grub_term_output
   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) (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) (struct grub_term_output *term,
-                   grub_uint8_t *normal_color, grub_uint8_t *highlight_color);
-
   /* Turn on/off the cursor.  */
   void (*setcursor) (struct grub_term_output *term, int on);
 
@@ -214,10 +204,18 @@ struct grub_term_output
   /* The feature flags defined above.  */
   grub_uint32_t flags;
 
+  /* Current color state.  */
+  grub_uint8_t normal_color;
+  grub_uint8_t highlight_color;
+
   void *data;
 };
 typedef struct grub_term_output *grub_term_output_t;
 
+#define GRUB_TERM_DEFAULT_NORMAL_COLOR 0x07
+#define GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR 0x70
+#define GRUB_TERM_DEFAULT_STANDARD_COLOR 0x07
+
 extern struct grub_term_output *EXPORT_VAR(grub_term_outputs_disabled);
 extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled);
 extern struct grub_term_output *EXPORT_VAR(grub_term_outputs);
@@ -361,14 +359,14 @@ grub_term_setcolorstate (struct grub_term_output *term,
     term->setcolorstate (term, state);
 }
 
-  /* Set the normal color and the highlight color. The format of each
-     color is VGA's.  */
+/* Set the normal color and the highlight color. The format of each
+   color is VGA's.  */
 static inline void 
 grub_term_setcolor (struct grub_term_output *term,
                    grub_uint8_t normal_color, grub_uint8_t highlight_color)
 {
-  if (term->setcolor)
-    term->setcolor (term, normal_color, highlight_color);
+  term->normal_color = normal_color;
+  term->highlight_color = highlight_color;
 }
 
 /* Turn on/off the cursor.  */
@@ -429,13 +427,8 @@ static inline void
 grub_term_getcolor (struct grub_term_output *term, 
                    grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
 {
-  if (term->getcolor)
-    term->getcolor (term, normal_color, highlight_color);
-  else
-    {
-      *normal_color = 0x07;
-      *highlight_color = 0x07;
-    }
+  *normal_color = term->normal_color;
+  *highlight_color = term->highlight_color;
 }
 
 struct grub_term_autoload
index 54872caa813bd793338a95a1c8427b9fc09f0d7e..d6907d7f00ac639fcc0e2bed934c8bf7617cb996 100644 (file)
@@ -49,9 +49,6 @@ struct grub_terminfo_output_state
   char *cursor_off;
   char *setcolor;
 
-  grub_uint8_t normal_color;
-  grub_uint8_t highlight_color;
-
   unsigned int xpos, ypos;
 
   void (*put) (const int c);
@@ -72,12 +69,6 @@ grub_err_t EXPORT_FUNC (grub_terminfo_input_init) (struct grub_term_input *term)
 int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term);
 void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term,
                                          const struct grub_unicode_glyph *c);
-void EXPORT_FUNC (grub_terminfo_getcolor) (struct grub_term_output *term,
-                                          grub_uint8_t *normal_color,
-                                          grub_uint8_t *highlight_color);
-void EXPORT_FUNC (grub_terminfo_setcolor) (struct grub_term_output *term,
-                                          grub_uint8_t normal_color,
-                                          grub_uint8_t highlight_color);
 
 grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term,
                                                        const char *type);
index e5dab8a96fd33d7aee92030030fc47a88ae8c446..d54c1c4be545fbc2a458d07ce65bf113379f566d 100644 (file)
 #include <grub/efi/api.h>
 #include <grub/efi/console.h>
 
-static grub_uint8_t
+static const grub_uint8_t
 grub_console_standard_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_YELLOW,
                                                  GRUB_EFI_BACKGROUND_BLACK);
-static grub_uint8_t
-grub_console_normal_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_LIGHTGRAY,
-                                               GRUB_EFI_BACKGROUND_BLACK);
-static grub_uint8_t
-grub_console_highlight_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_BLACK,
-                                                  GRUB_EFI_BACKGROUND_LIGHTGRAY);
 
 static int read_key = -1;
 
@@ -292,7 +286,7 @@ grub_console_cls (struct grub_term_output *term __attribute__ ((unused)))
 }
 
 static void
-grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+grub_console_setcolorstate (struct grub_term_output *term,
                            grub_term_color_state state)
 {
   grub_efi_simple_text_output_interface_t *o;
@@ -304,32 +298,16 @@ grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused
       efi_call_2 (o->set_attributes, o, grub_console_standard_color);
       break;
     case GRUB_TERM_COLOR_NORMAL:
-      efi_call_2 (o->set_attributes, o, grub_console_normal_color);
+      efi_call_2 (o->set_attributes, o, term->normal_color);
       break;
     case GRUB_TERM_COLOR_HIGHLIGHT:
-      efi_call_2 (o->set_attributes, o, grub_console_highlight_color);
+      efi_call_2 (o->set_attributes, o, term->highlight_color);
       break;
     default:
       break;
   }
 }
 
-static void
-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 (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 (struct grub_term_output *term __attribute__ ((unused)),
                        int on)
@@ -356,9 +334,11 @@ static struct grub_term_output grub_console_term_output =
     .gotoxy = grub_console_gotoxy,
     .cls = grub_console_cls,
     .setcolorstate = grub_console_setcolorstate,
-    .setcolor = grub_console_setcolor,
-    .getcolor = grub_console_getcolor,
     .setcursor = grub_console_setcursor,
+    .normal_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_LIGHTGRAY,
+                                       GRUB_EFI_BACKGROUND_BLACK),
+    .highlight_color = GRUB_EFI_TEXT_ATTR (GRUB_EFI_BLACK,
+                                          GRUB_EFI_BACKGROUND_LIGHTGRAY),
     .flags = GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS
   };
 
index d9fb2e04c13f6720fb25648c2060b32125b845a3..c38e306cb7b1d0c5fe8a34f82b8679d61d609722 100644 (file)
@@ -35,8 +35,6 @@
 #define DEFAULT_BORDER_WIDTH   10
 
 #define DEFAULT_STANDARD_COLOR  0x07
-#define DEFAULT_NORMAL_COLOR    0x07
-#define DEFAULT_HIGHLIGHT_COLOR 0x70
 
 struct grub_dirty_region
 {
@@ -92,8 +90,6 @@ struct grub_virtual_screen
 
   /* Terminal color settings.  */
   grub_uint8_t standard_color_setting;
-  grub_uint8_t normal_color_setting;
-  grub_uint8_t highlight_color_setting;
   grub_uint8_t term_color;
 
   /* Color settings.  */
@@ -260,10 +256,8 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
   grub_video_set_active_render_target (text_layer);
 
   virtual_screen.standard_color_setting = DEFAULT_STANDARD_COLOR;
-  virtual_screen.normal_color_setting = DEFAULT_NORMAL_COLOR;
-  virtual_screen.highlight_color_setting = DEFAULT_HIGHLIGHT_COLOR;
 
-  virtual_screen.term_color = virtual_screen.normal_color_setting;
+  virtual_screen.term_color = GRUB_TERM_DEFAULT_NORMAL_COLOR;
 
   set_term_color (virtual_screen.term_color);
 
@@ -1041,7 +1035,7 @@ grub_gfxterm_cls (struct grub_term_output *term)
 }
 
 static void
-grub_virtual_screen_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+grub_virtual_screen_setcolorstate (struct grub_term_output *term,
                                   grub_term_color_state state)
 {
   switch (state)
@@ -1051,11 +1045,11 @@ grub_virtual_screen_setcolorstate (struct grub_term_output *term __attribute__ (
       break;
 
     case GRUB_TERM_COLOR_NORMAL:
-      virtual_screen.term_color = virtual_screen.normal_color_setting;
+      virtual_screen.term_color = term->normal_color;
       break;
 
     case GRUB_TERM_COLOR_HIGHLIGHT:
-      virtual_screen.term_color = virtual_screen.highlight_color_setting;
+      virtual_screen.term_color = term->highlight_color;
       break;
 
     default:
@@ -1066,24 +1060,6 @@ grub_virtual_screen_setcolorstate (struct grub_term_output *term __attribute__ (
   set_term_color (virtual_screen.term_color);
 }
 
-static void
-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;
-  virtual_screen.highlight_color_setting = highlight_color;
-}
-
-static void
-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;
-  *highlight_color = virtual_screen.highlight_color_setting;
-}
-
 static void
 grub_gfxterm_setcursor (struct grub_term_output *term __attribute__ ((unused)),
                        int on)
@@ -1211,11 +1187,11 @@ static struct grub_term_output grub_video_term =
     .gotoxy = grub_gfxterm_gotoxy,
     .cls = grub_gfxterm_cls,
     .setcolorstate = grub_virtual_screen_setcolorstate,
-    .setcolor = grub_virtual_screen_setcolor,
-    .getcolor = grub_virtual_screen_getcolor,
     .setcursor = grub_gfxterm_setcursor,
     .refresh = grub_gfxterm_refresh,
     .flags = GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS,
+    .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
+    .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
     .next = 0
   };
 
index c157f482c31f3d3b6dc62cca7b0bdaa2be145cc9..2a7e34ad40ce0f104438a5fe7f371fc8c7492107 100644 (file)
@@ -62,10 +62,10 @@ static struct grub_term_output grub_console_term_output =
     .gotoxy = grub_console_gotoxy,
     .cls = grub_console_cls,
     .setcolorstate = grub_console_setcolorstate,
-    .setcolor = grub_console_setcolor,
-    .getcolor = grub_console_getcolor,
     .setcursor = grub_console_setcursor,
-    .flags = GRUB_TERM_CODE_TYPE_VGA
+    .flags = GRUB_TERM_CODE_TYPE_VGA,
+    .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
+    .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
   };
 
 void
index a9dd5e2146dd4571df410e86d22a75aa0e5b3690..ace0504d41a3e10a74481ff33892180126135d57 100644 (file)
@@ -511,6 +511,8 @@ static struct grub_term_output grub_vga_term =
     .setcolorstate = grub_vga_setcolorstate,
     .setcursor = grub_vga_setcursor,
     .flags = GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS,
+    .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
+    .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
   };
 
 GRUB_MOD_INIT(vga)
index 9242adf0fbfca3032ce1b1ac43da911d82132a7a..60bde5b053daef20508121177f42507ff64daab8 100644 (file)
@@ -163,10 +163,10 @@ static struct grub_term_output grub_vga_text_term =
     .gotoxy = grub_vga_text_gotoxy,
     .cls = grub_vga_text_cls,
     .setcolorstate = grub_console_setcolorstate,
-    .setcolor = grub_console_setcolor,
-    .getcolor = grub_console_getcolor,
     .setcursor = grub_vga_text_setcursor,
-    .flags = GRUB_TERM_CODE_TYPE_VGA
+    .flags = GRUB_TERM_CODE_TYPE_VGA,
+    .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
+    .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
   };
 
 GRUB_MOD_INIT(vga_text)
index 16dc8c56ba760b5c44727054b20404359782fe40..02fb5c02d81adf9b10667890325fcfd2b8399db5 100644 (file)
@@ -21,9 +21,6 @@
 #include <grub/types.h>
 
 grub_uint8_t grub_console_cur_color = 0x7;
-static grub_uint8_t grub_console_standard_color = 0x7;
-static grub_uint8_t grub_console_normal_color = 0x7;
-static grub_uint8_t grub_console_highlight_color = 0x70;
 
 grub_uint16_t
 grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
@@ -32,36 +29,20 @@ grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
 }
 
 void
-grub_console_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+grub_console_setcolorstate (struct grub_term_output *term,
                            grub_term_color_state state)
 {
   switch (state) {
     case GRUB_TERM_COLOR_STANDARD:
-      grub_console_cur_color = grub_console_standard_color;
+      grub_console_cur_color = GRUB_TERM_DEFAULT_STANDARD_COLOR;
       break;
     case GRUB_TERM_COLOR_NORMAL:
-      grub_console_cur_color = grub_console_normal_color;
+      grub_console_cur_color = term->normal_color;
       break;
     case GRUB_TERM_COLOR_HIGHLIGHT:
-      grub_console_cur_color = grub_console_highlight_color;
+      grub_console_cur_color = term->highlight_color;
       break;
     default:
       break;
   }
 }
-
-void
-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 (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 151425a910c4a30230356a3c8f62a07985403ce0..604906ceb6690d285389e9ce931574d3cd71e45e 100644 (file)
@@ -204,11 +204,11 @@ static struct grub_term_output grub_ofconsole_term_output =
     .gotoxy = grub_terminfo_gotoxy,
     .cls = grub_terminfo_cls,
     .setcolorstate = grub_terminfo_setcolorstate,
-    .setcolor = grub_terminfo_setcolor,
-    .getcolor = grub_terminfo_getcolor,
     .setcursor = grub_ofconsole_setcursor,
     .flags = GRUB_TERM_CODE_TYPE_ASCII,
-    .data = &grub_ofconsole_terminfo_output
+    .data = &grub_ofconsole_terminfo_output,
+    .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
+    .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
   };
 
 void grub_terminfo_fini (void);
index 46656455fd86551aecb8f0665370a8c215f8f2ab..d97ead60ac041f479eadae0456bd6869351fb02f 100644 (file)
@@ -219,11 +219,11 @@ static struct grub_term_output grub_serial_term_output =
   .gotoxy = grub_terminfo_gotoxy,
   .cls = grub_terminfo_cls,
   .setcolorstate = grub_terminfo_setcolorstate,
-  .setcolor = grub_terminfo_setcolor,
-  .getcolor = grub_terminfo_getcolor,
   .setcursor = grub_terminfo_setcursor,
   .flags = GRUB_TERM_CODE_TYPE_ASCII,
-  .data = &grub_serial_terminfo_output
+  .data = &grub_serial_terminfo_output,
+  .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
+  .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
 };
 
 \f
index 34d82fdbbc01c51f0c2b9fe91906a1357618c8b2..dcf17106ac030fa734d995a1273eddc3808df7d2 100644 (file)
@@ -168,9 +168,6 @@ grub_terminfo_output_register (struct grub_term_output *term,
   data = (struct grub_terminfo_output_state *) term->data;
   data->next = terminfo_outputs;
   terminfo_outputs = term;
-  
-  data->normal_color = 0x07;
-  data->highlight_color = 0x70;
 
   return GRUB_ERR_NONE;
 }
@@ -247,30 +244,6 @@ grub_terminfo_cls (struct grub_term_output *term)
   data->xpos = data->ypos = 0;
 }
 
-void
-grub_terminfo_setcolor (struct grub_term_output *term,
-                       grub_uint8_t normal_color,
-                       grub_uint8_t highlight_color)
-{
-  struct grub_terminfo_output_state *data
-    = (struct grub_terminfo_output_state *) term->data;
-
-  data->normal_color = normal_color;
-  data->highlight_color = highlight_color;
-}
-
-void
-grub_terminfo_getcolor (struct grub_term_output *term,
-                       grub_uint8_t *normal_color,
-                       grub_uint8_t *highlight_color)
-{
-  struct grub_terminfo_output_state *data
-    = (struct grub_terminfo_output_state *) term->data;
-
-  *normal_color = data->normal_color;
-  *highlight_color = data->highlight_color;
-}
-
 void
 grub_terminfo_setcolorstate (struct grub_term_output *term,
                             const grub_term_color_state state)
@@ -298,12 +271,12 @@ grub_terminfo_setcolorstate (struct grub_term_output *term,
        {
        case GRUB_TERM_COLOR_STANDARD:
        case GRUB_TERM_COLOR_NORMAL:
-         fg = data->normal_color & 0x0f;
-         bg = data->normal_color >> 4;
+         fg = term->normal_color & 0x0f;
+         bg = term->normal_color >> 4;
          break;
        case GRUB_TERM_COLOR_HIGHLIGHT:
-         fg = data->highlight_color & 0x0f;
-         bg = data->highlight_color >> 4;
+         fg = term->highlight_color & 0x0f;
+         bg = term->highlight_color >> 4;
          break;
        default:
          return;
index e8ee9f7da9f10af55f0a9dbf686e15618fa07633..8e5b597765e37167359229681164b6560e886a2b 100644 (file)
@@ -43,9 +43,7 @@ static int grub_console_attr = A_NORMAL;
 
 grub_uint8_t grub_console_cur_color = 7;
 
-static grub_uint8_t grub_console_standard_color = 0x7;
-static grub_uint8_t grub_console_normal_color = 0x7;
-static grub_uint8_t grub_console_highlight_color = 0x70;
+static const grub_uint8_t grub_console_standard_color = 0x7;
 
 #define NUM_COLORS     8
 
@@ -71,7 +69,7 @@ grub_ncurses_putchar (struct grub_term_output *term __attribute__ ((unused)),
 }
 
 static void
-grub_ncurses_setcolorstate (struct grub_term_output *term __attribute__ ((unused)),
+grub_ncurses_setcolorstate (struct grub_term_output *term,
                            grub_term_color_state state)
 {
   switch (state)
@@ -81,11 +79,11 @@ grub_ncurses_setcolorstate (struct grub_term_output *term __attribute__ ((unused
       grub_console_attr = A_NORMAL;
       break;
     case GRUB_TERM_COLOR_NORMAL:
-      grub_console_cur_color = grub_console_normal_color;
+      grub_console_cur_color = term->normal_color;
       grub_console_attr = A_NORMAL;
       break;
     case GRUB_TERM_COLOR_HIGHLIGHT:
-      grub_console_cur_color = grub_console_highlight_color;
+      grub_console_cur_color = term->highlight_color;
       grub_console_attr = A_STANDOUT;
       break;
     default:
@@ -104,23 +102,6 @@ grub_ncurses_setcolorstate (struct grub_term_output *term __attribute__ ((unused
     }
 }
 
-/* XXX: This function is never called.  */
-static void
-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 (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 int saved_char = ERR;
 
 static int
@@ -322,8 +303,6 @@ static struct grub_term_output grub_ncurses_term_output =
     .gotoxy = grub_ncurses_gotoxy,
     .cls = grub_ncurses_cls,
     .setcolorstate = grub_ncurses_setcolorstate,
-    .setcolor = grub_ncurses_setcolor,
-    .getcolor = grub_ncurses_getcolor,
     .setcursor = grub_ncurses_setcursor,
     .refresh = grub_ncurses_refresh,
     .flags = GRUB_TERM_CODE_TYPE_ASCII