]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Several fixes phcoder/brltty
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 28 Oct 2013 16:42:40 +0000 (17:42 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Mon, 28 Oct 2013 16:42:40 +0000 (17:42 +0100)
25 files changed:
configure.ac
grub-core/Makefile.core.def
grub-core/commands/help.c
grub-core/gettext/gettext.c
grub-core/gfxmenu/font.c
grub-core/lib/posix_wrap/include/assert.h [moved from grub-core/lib/posix_wrap/assert.h with 100% similarity]
grub-core/lib/posix_wrap/include/ctype.h [moved from grub-core/lib/posix_wrap/ctype.h with 100% similarity]
grub-core/lib/posix_wrap/include/errno.h [moved from grub-core/lib/posix_wrap/errno.h with 95% similarity]
grub-core/lib/posix_wrap/include/inttypes.h [moved from grub-core/lib/posix_wrap/inttypes.h with 100% similarity]
grub-core/lib/posix_wrap/include/langinfo.h [moved from grub-core/lib/posix_wrap/langinfo.h with 100% similarity]
grub-core/lib/posix_wrap/include/limits.h [moved from grub-core/lib/posix_wrap/limits.h with 100% similarity]
grub-core/lib/posix_wrap/include/localcharset.h [moved from grub-core/lib/posix_wrap/localcharset.h with 100% similarity]
grub-core/lib/posix_wrap/include/locale.h [moved from grub-core/lib/posix_wrap/locale.h with 100% similarity]
grub-core/lib/posix_wrap/include/stdint.h [moved from grub-core/lib/posix_wrap/stdint.h with 100% similarity]
grub-core/lib/posix_wrap/include/stdio.h [moved from grub-core/lib/posix_wrap/stdio.h with 100% similarity]
grub-core/lib/posix_wrap/include/stdlib.h [moved from grub-core/lib/posix_wrap/stdlib.h with 92% similarity]
grub-core/lib/posix_wrap/include/string.h [moved from grub-core/lib/posix_wrap/string.h with 97% similarity]
grub-core/lib/posix_wrap/include/sys/types.h [moved from grub-core/lib/posix_wrap/sys/types.h with 100% similarity]
grub-core/lib/posix_wrap/include/unistd.h [moved from grub-core/lib/posix_wrap/unistd.h with 100% similarity]
grub-core/lib/posix_wrap/include/wchar.h [moved from grub-core/lib/posix_wrap/wchar.h with 87% similarity]
grub-core/lib/posix_wrap/include/wctype.h [moved from grub-core/lib/posix_wrap/wctype.h with 100% similarity]
grub-core/normal/cmdline.c
grub-core/normal/main.c
grub-core/normal/term.c
include/grub/misc.h

index 209173a6c47241803311c34f8088a364de286e3a..98f281e1172e46cb5bda2fcc067793d8d5e98a53 100644 (file)
@@ -85,7 +85,7 @@ HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
-TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Dfloat=__float__bug__ -Ddouble=__double__bug__ -DGRUB_RUNTIME=1"
+TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_RUNTIME=1"
 
 case "$target_cpu" in
   i[[3456]]86) target_cpu=i386 ;;
index f45e90e582c1ccc99a9a3903cba018d1169c9267..c2f6ea5bf6ace058d9e2ef921956bdece4d08844 100644 (file)
@@ -642,8 +642,8 @@ module = {
   name = regexp;
   common = commands/regexp.c;
   common = commands/wildcard.c;
-  ldadd = libgnulib.a;
-  dependencies = libgnulib.a;
+  ldadd = libregexp.a;
+  dependencies = libregexp.a;
   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
 };
@@ -835,7 +835,7 @@ module = {
   name = verify;
   common = commands/verify.c;
   cflags = '$(CFLAGS_POSIX)';
-  cppflags = '-I$(srcdir)/lib/posix_wrap';
+  cppflags = '-I$(srcdir)/lib/posix_wrap/include';
 };
 
 module = {
index a04489daa42619ee394f1d65a11d2639e8e3057c..f0be89baa191087cc3aa2ce8f1ecc96dccbb42de 100644 (file)
@@ -45,8 +45,8 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
            struct grub_term_output *term;
            const char *summary_translated = _(cmd->summary);
            char *command_help;
-           grub_wchar_t *unicode_command_help;
-           grub_wchar_t *unicode_last_position;
+           grub_uint32_t *unicode_command_help;
+           grub_uint32_t *unicode_last_position;
 
            command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
            if (!command_help)
@@ -58,7 +58,7 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
            FOR_ACTIVE_TERM_OUTPUTS(term)
            {
              unsigned stringwidth;
-             grub_wchar_t *unicode_last_screen_position;
+             grub_uint32_t *unicode_last_screen_position;
 
              unicode_last_screen_position = unicode_command_help;
 
index 8e70185a18094bbdfd3511160348f05f7dabc157..dca33e9edcd969966b974919de8b094bebfcb55f 100644 (file)
@@ -554,7 +554,6 @@ GRUB_MOD_INIT (gettext)
   COMPILE_TIME_ASSERT (ARRAY_SIZE (domains) == CONTEXT_CNT);
   for (i = 0; i < ARRAY_SIZE (domains); i++)
     {
-      grub_err_t err;
       err = grub_gettext_init_ext (&main_context[i], lang,
                                   grub_env_get ("locale_dir"),
                                   grub_env_get ("prefix"), domains[i]);
index b76f61f1ea0a57a5f4dc2d5f2efbc03dd406bd01..64d52670bfbcddc9e1f5dafeeba6981afab98455 100644 (file)
@@ -42,7 +42,7 @@ grub_font_draw_string (const char *str, grub_font_t font,
                        int left_x, int baseline_y)
 {
   int x;
-  grub_wchar_t *logical;
+  grub_uint32_t *logical;
   grub_ssize_t logical_len, visual_len;
   struct grub_unicode_glyph *visual, *ptr;
 
@@ -83,9 +83,9 @@ int
 grub_font_get_string_width (grub_font_t font, const char *str)
 {
   int width = 0;
-  grub_wchar_t *ptr;
+  grub_uint32_t *ptr;
   grub_ssize_t logical_len;
-  grub_wchar_t *logical;
+  grub_uint32_t *logical;
 
   logical_len = grub_utf8_to_ucs4_alloc (str, &logical, 0);
   if (logical_len < 0)
similarity index 95%
rename from grub-core/lib/posix_wrap/errno.h
rename to grub-core/lib/posix_wrap/include/errno.h
index b40203df11c85096cacb354f1cf029b357ed3083..6015e92e9d9b72cb2fc8fb81b87eae845934e02e 100644 (file)
 #define errno  grub_posix_errno
 #define EINVAL GRUB_ERR_BAD_NUMBER
 #define ENOMEM GRUB_ERR_OUT_OF_MEMORY
-#define EAGAIN GRUB_ERR_AGAIN
+#define EAGAIN GRUB_ERR_WAIT
     /* FIXME: Disambiguate this.  */
 #define ENODEV GRUB_ERR_IO
 #define ENOSYS GRUB_ERR_IO
 #define ENOENT GRUB_ERR_IO
 #define EIO GRUB_ERR_IO
 #define EROFS GRUB_ERR_POSIX_EROFS
-#define EINTR GRUB_ERR_AGAIN
+#define EINTR GRUB_ERR_WAIT
 #define EACCES GRUB_ERR_ACCESS_DENIED
 #define ERANGE GRUB_ERR_BAD_ARGUMENT
 #define EEXIST GRUB_ERR_POSIX_EEXIST
similarity index 92%
rename from grub-core/lib/posix_wrap/stdlib.h
rename to grub-core/lib/posix_wrap/include/stdlib.h
index a8fdde43c50feffe2b49d87b3f27451ec1670342..920e35db6a247fef47689a45a0a308ad57c64008 100644 (file)
@@ -97,9 +97,11 @@ atol (const char *nptr)
 }
 
 static inline grub_size_t
-mbstowcs (grub_wchar_t *dest, const char *src, grub_size_t n)
+mbstowcs (wchar_t *dest, const char *src, grub_size_t n)
 {
-  grub_size_t ret = grub_utf8_to_ucs4 (dest, n, (const grub_uint8_t *) src,
+  COMPILE_TIME_ASSERT( sizeof (grub_uint32_t) == sizeof (wchar_t));
+  grub_size_t ret = grub_utf8_to_ucs4 ((grub_uint32_t *) dest,
+                                      n, (const grub_uint8_t *) src,
                                       -1, NULL);
   if (ret < n)
     dest[ret] = 0;
similarity index 97%
rename from grub-core/lib/posix_wrap/string.h
rename to grub-core/lib/posix_wrap/include/string.h
index 748b1c662c4f15c470b24417541736e190525580..ee7254d820543e99227c7dc0a190877b113195b1 100644 (file)
@@ -167,8 +167,8 @@ strdup (const char *s)
   return grub_strdup (s);
 }
 
-static inline grub_wchar_t *
-wmempcpy (grub_wchar_t *dest, const grub_wchar_t *src, grub_size_t n)
+static inline wchar_t *
+wmempcpy (wchar_t *dest, const wchar_t *src, grub_size_t n)
 {
   grub_memcpy (dest, src, sizeof (dest[0]) * n);
   return dest + n;
@@ -215,7 +215,7 @@ static inline char *
 mbschr (const char *src, int c)
 {
   int count = 0;
-  grub_wchar_t code = 0;
+  grub_uint32_t code = 0;
   const char *last_start = src;
 
   while (1)
@@ -233,7 +233,7 @@ mbschr (const char *src, int c)
        continue;
       if (code == 0)
        break;
-      if (code == c)
+      if ((int) code == c)
        return (char *) last_start;
       last_start = src;
     }
similarity index 87%
rename from grub-core/lib/posix_wrap/wchar.h
rename to grub-core/lib/posix_wrap/include/wchar.h
index beb45dfaa1209e618dc226659725fdae418d8f51..ef3bed9ceffd9636a4222bede430b8003033d659 100644 (file)
@@ -22,8 +22,8 @@
 #include <grub/charset.h>
 #include <grub/misc.h>
 
-#define wint_t grub_posix_wint_t
-#define wchar_t grub_posix_wchar_t
+#include <stddef.h>
+
 #define mbstate_t grub_posix_mbstate_t
 
 /* UCS-4.  */
@@ -32,20 +32,21 @@ enum
     WEOF = -1
   };
 
+typedef int wint_t;
+
 typedef struct mbstate {
-  grub_wchar_t code;
+  grub_uint32_t code;
   int count;
 } mbstate_t;
 
+
 /* UTF-8. */
 #define MB_CUR_MAX 4
 #define MB_LEN_MAX 4
 
 static inline grub_size_t
-mbrtowc (grub_wchar_t *pwc, const char *s, grub_size_t n, mbstate_t *ps)
+mbrtowc (wchar_t *pwc, const char *s, grub_size_t n, mbstate_t *ps)
 {
-  COMPILE_TIME_ASSERT (sizeof (wchar_t) == sizeof (grub_wchar_t));
-  COMPILE_TIME_ASSERT (GRUB_WCHAR_MAX == WCHAR_MAX);
   const char *ptr;
   if (!s)
     {
@@ -149,22 +150,22 @@ wmemcmp (const wchar_t *s1, const wchar_t *s2, grub_size_t n)
   return 0;
 }
 
-static inline grub_wchar_t *
-wmemchr (const grub_wchar_t *s, grub_wchar_t c, grub_size_t n)
+static inline wchar_t *
+wmemchr (const wchar_t *s, wchar_t c, grub_size_t n)
 {
   for (; n--; s++)
     {
       if (*s == c)
-       return (grub_wchar_t *) s;
+       return (wchar_t *) s;
     }
 
   return 0;
 }
 
 static inline grub_size_t
-wcslen (const grub_wchar_t *s)
+wcslen (const wchar_t *s)
 {
-  const grub_wchar_t *ptr;
+  const wchar_t *ptr;
   for (ptr = s; *ptr; ptr++);
   return ptr - s;
 }
@@ -196,7 +197,7 @@ mbslen (const char *src)
 {
   int count = 0;
   grub_size_t ret = 0;
-  grub_wchar_t code = 0;
+  grub_uint32_t code = 0;
 
   while (1)
     {
index c19a1dfddcf70688da067c21efbe0368fe269c3b..f7cd115d7cb148e271f56454deda88848f09c61b 100644 (file)
 #include <grub/i18n.h>
 #include <grub/charset.h>
 
-static grub_wchar_t *kill_buf;
+static grub_uint32_t *kill_buf;
 
 static int hist_size;
-static grub_wchar_t **hist_lines = 0;
+static grub_uint32_t **hist_lines = 0;
 static int hist_pos = 0;
 static int hist_end = 0;
 static int hist_used = 0;
@@ -40,8 +40,8 @@ static int hist_used = 0;
 grub_err_t
 grub_set_history (int newsize)
 {
-  grub_wchar_t **old_hist_lines = hist_lines;
-  hist_lines = grub_malloc (sizeof (hist_lines[0]) * newsize);
+  grub_uint32_t **old_hist_lines = hist_lines;
+  hist_lines = grub_malloc (sizeof (grub_uint32_t *) * newsize);
 
   /* Copy the old lines into the new buffer.  */
   if (old_hist_lines)
@@ -68,16 +68,16 @@ grub_set_history (int newsize)
 
       if (hist_pos < hist_end)
        grub_memmove (hist_lines, old_hist_lines + hist_pos,
-                     (hist_end - hist_pos) * sizeof (grub_wchar_t *));
+                     (hist_end - hist_pos) * sizeof (grub_uint32_t *));
       else if (hist_used)
        {
          /* Copy the older part.  */
          grub_memmove (hist_lines, old_hist_lines + hist_pos,
-                       (hist_size - hist_pos) * sizeof (grub_wchar_t *));
+                       (hist_size - hist_pos) * sizeof (grub_uint32_t *));
 
          /* Copy the newer part. */
          grub_memmove (hist_lines + hist_size - hist_pos, old_hist_lines,
-                       hist_end * sizeof (grub_wchar_t *));
+                       hist_end * sizeof (grub_uint32_t *));
        }
     }
 
@@ -91,7 +91,7 @@ grub_set_history (int newsize)
 
 /* Get the entry POS from the history where `0' is the newest
    entry.  */
-static grub_wchar_t *
+static grub_uint32_t *
 grub_history_get (unsigned pos)
 {
   pos = (hist_pos + pos) % hist_size;
@@ -99,9 +99,9 @@ grub_history_get (unsigned pos)
 }
 
 static grub_size_t
-strlen_ucs4 (const grub_wchar_t *s)
+strlen_ucs4 (const grub_uint32_t *s)
 {
-  const grub_wchar_t *p = s;
+  const grub_uint32_t *p = s;
 
   while (*p)
     p++;
@@ -111,23 +111,23 @@ strlen_ucs4 (const grub_wchar_t *s)
 
 /* Replace the history entry on position POS with the string S.  */
 static void
-grub_history_set (int pos, grub_wchar_t *s, grub_size_t len)
+grub_history_set (int pos, grub_uint32_t *s, grub_size_t len)
 {
   grub_free (hist_lines[pos]);
-  hist_lines[pos] = grub_malloc ((len + 1) * sizeof (grub_wchar_t));
+  hist_lines[pos] = grub_malloc ((len + 1) * sizeof (grub_uint32_t));
   if (!hist_lines[pos])
     {
       grub_print_error ();
       grub_errno = GRUB_ERR_NONE;
       return ;
     }
-  grub_memcpy (hist_lines[pos], s, len * sizeof (grub_wchar_t));
+  grub_memcpy (hist_lines[pos], s, len * sizeof (grub_uint32_t));
   hist_lines[pos][len] = 0;
 }
 
 /* Insert a new history line S on the top of the history.  */
 static void
-grub_history_add (grub_wchar_t *s, grub_size_t len)
+grub_history_add (grub_uint32_t *s, grub_size_t len)
 {
   /* Remove the oldest entry in the history to make room for a new
      entry.  */
@@ -154,7 +154,7 @@ grub_history_add (grub_wchar_t *s, grub_size_t len)
 
 /* Replace the history entry on position POS with the string S.  */
 static void
-grub_history_replace (unsigned pos, grub_wchar_t *s, grub_size_t len)
+grub_history_replace (unsigned pos, grub_uint32_t *s, grub_size_t len)
 {
   grub_history_set ((hist_pos + pos) % hist_size, s, len);
 }
@@ -219,16 +219,16 @@ char *
 grub_cmdline_get (const char *prompt_translated)
 {
   grub_size_t lpos, llen;
-  grub_wchar_t *buf;
+  grub_uint32_t *buf;
   grub_size_t max_len = 256;
   int key;
   int histpos = 0;
-  auto void cl_insert (const grub_wchar_t *str);
+  auto void cl_insert (const grub_uint32_t *str);
   auto void cl_delete (unsigned len);
   auto inline void __attribute__ ((always_inline)) cl_print (struct cmdline_term *cl_term, int pos,
-                       grub_wchar_t c);
+                       grub_uint32_t c);
   auto void cl_set_pos (struct cmdline_term *cl_term);
-  auto void cl_print_all (int pos, grub_wchar_t c);
+  auto void cl_print_all (int pos, grub_uint32_t c);
   auto void cl_set_pos_all (void);
   auto void init_clterm (struct cmdline_term *cl_term_cur);
   auto void init_clterm_all (void);
@@ -251,9 +251,9 @@ grub_cmdline_get (const char *prompt_translated)
       cl_set_pos (&cl_terms[i]);
   }
 
-  inline void __attribute__ ((always_inline)) cl_print (struct cmdline_term *cl_term, int pos, grub_wchar_t c)
+  inline void __attribute__ ((always_inline)) cl_print (struct cmdline_term *cl_term, int pos, grub_uint32_t c)
     {
-      grub_wchar_t *p;
+      grub_uint32_t *p;
 
       for (p = buf + pos; p < buf + llen; p++)
        {
@@ -274,22 +274,22 @@ grub_cmdline_get (const char *prompt_translated)
        }
     }
 
-  void cl_print_all (int pos, grub_wchar_t c)
+  void cl_print_all (int pos, grub_uint32_t c)
   {
     unsigned i;
     for (i = 0; i < nterms; i++)
       cl_print (&cl_terms[i], pos, c);
   }
 
-  void cl_insert (const grub_wchar_t *str)
+  void cl_insert (const grub_uint32_t *str)
     {
       grub_size_t len = strlen_ucs4 (str);
 
       if (len + llen >= max_len)
        {
-         grub_wchar_t *nbuf;
+         grub_uint32_t *nbuf;
          max_len *= 2;
-         nbuf = grub_realloc (buf, sizeof (nbuf[0]) * max_len);
+         nbuf = grub_realloc (buf, sizeof (grub_uint32_t) * max_len);
          if (nbuf)
            buf = nbuf;
          else
@@ -303,8 +303,8 @@ grub_cmdline_get (const char *prompt_translated)
       if (len + llen < max_len)
        {
          grub_memmove (buf + lpos + len, buf + lpos,
-                       (llen - lpos + 1) * sizeof (grub_wchar_t));
-         grub_memmove (buf + lpos, str, len * sizeof (grub_wchar_t));
+                       (llen - lpos + 1) * sizeof (grub_uint32_t));
+         grub_memmove (buf + lpos, str, len * sizeof (grub_uint32_t));
 
          llen += len;
          cl_set_pos_all ();
@@ -327,7 +327,7 @@ grub_cmdline_get (const char *prompt_translated)
          cl_set_pos_all ();
 
          grub_memmove (buf + lpos, buf + lpos + len,
-                       sizeof (grub_wchar_t) * (llen - lpos + 1));
+                       sizeof (grub_uint32_t) * (llen - lpos + 1));
          llen -= len;
          cl_print_all (lpos, 0);
          cl_set_pos_all ();
@@ -350,7 +350,7 @@ grub_cmdline_get (const char *prompt_translated)
       init_clterm (&cl_terms[i]);
   }
 
-  buf = grub_malloc (max_len * sizeof (grub_wchar_t));
+  buf = grub_malloc (max_len * sizeof (grub_uint32_t));
   if (!buf)
     return 0;
 
@@ -371,7 +371,7 @@ grub_cmdline_get (const char *prompt_translated)
   {
     struct cmdline_term *cl_term_cur;
     struct grub_term_output *cur;
-    grub_wchar_t *unicode_msg;
+    grub_uint32_t *unicode_msg;
     grub_size_t msg_len = grub_strlen (prompt_translated) + 3;
 
     nterms = 0;
@@ -383,7 +383,7 @@ grub_cmdline_get (const char *prompt_translated)
       return 0;
     cl_term_cur = cl_terms;
 
-    unicode_msg = grub_malloc (msg_len * sizeof (grub_wchar_t));
+    unicode_msg = grub_malloc (msg_len * sizeof (grub_uint32_t));
     if (!unicode_msg)
       return 0;;
     msg_len = grub_utf8_to_ucs4 (unicode_msg, msg_len - 1,
@@ -447,7 +447,7 @@ grub_cmdline_get (const char *prompt_translated)
            int restore;
            char *insertu8;
            char *bufu8;
-           grub_wchar_t c;
+           grub_uint32_t c;
 
            c = buf[lpos];
            buf[lpos] = '\0';
@@ -481,10 +481,10 @@ grub_cmdline_get (const char *prompt_translated)
              {
                grub_size_t insertlen;
                grub_ssize_t t;
-               grub_wchar_t *insert;
+               grub_uint32_t *insert;
 
                insertlen = grub_strlen (insertu8);
-               insert = grub_malloc ((insertlen + 1) * sizeof (insert[0]));
+               insert = grub_malloc ((insertlen + 1) * sizeof (grub_uint32_t));
                if (!insert)
                  {
                    grub_free (insertu8);
@@ -524,7 +524,7 @@ grub_cmdline_get (const char *prompt_translated)
              grub_free (kill_buf);
 
              kill_buf = grub_malloc ((llen - lpos + 1)
-                                     * sizeof (grub_wchar_t));
+                                     * sizeof (grub_uint32_t));
              if (grub_errno)
                {
                  grub_print_error ();
@@ -533,7 +533,7 @@ grub_cmdline_get (const char *prompt_translated)
              else
                {
                  grub_memcpy (kill_buf, buf + lpos,
-                              (llen - lpos + 1) * sizeof (grub_wchar_t));
+                              (llen - lpos + 1) * sizeof (grub_uint32_t));
                  kill_buf[llen - lpos] = 0;
                }
 
@@ -544,7 +544,7 @@ grub_cmdline_get (const char *prompt_translated)
        case GRUB_TERM_CTRL | 'n':
        case GRUB_TERM_KEY_DOWN:
          {
-           grub_wchar_t *hist;
+           grub_uint32_t *hist;
 
            lpos = 0;
 
@@ -564,7 +564,7 @@ grub_cmdline_get (const char *prompt_translated)
        case GRUB_TERM_KEY_UP:
        case GRUB_TERM_CTRL | 'p':
          {
-           grub_wchar_t *hist;
+           grub_uint32_t *hist;
 
            lpos = 0;
 
@@ -588,7 +588,7 @@ grub_cmdline_get (const char *prompt_translated)
 
              grub_free (kill_buf);
 
-             kill_buf = grub_malloc ((n + 1) * sizeof(grub_wchar_t));
+             kill_buf = grub_malloc ((n + 1) * sizeof(grub_uint32_t));
              if (grub_errno)
                {
                  grub_print_error ();
@@ -596,7 +596,7 @@ grub_cmdline_get (const char *prompt_translated)
                }
              if (kill_buf)
                {
-                 grub_memcpy (kill_buf, buf, n * sizeof(grub_wchar_t));
+                 grub_memcpy (kill_buf, buf, n * sizeof(grub_uint32_t));
                  kill_buf[n] = 0;
                }
 
@@ -634,7 +634,7 @@ grub_cmdline_get (const char *prompt_translated)
        default:
          if (grub_isprint (key))
            {
-             grub_wchar_t str[2];
+             grub_uint32_t str[2];
 
              str[0] = key;
              str[1] = '\0';
@@ -652,7 +652,7 @@ grub_cmdline_get (const char *prompt_translated)
   histpos = 0;
   if (strlen_ucs4 (buf) > 0)
     {
-      grub_wchar_t empty[] = { 0 };
+      grub_uint32_t empty[] = { 0 };
       grub_history_replace (histpos, buf, llen);
       grub_history_add (empty, 0);
     }
index 88510ce248a24b4a53e0b02d5210587919006aef..ad3627351f8f7acd7cc1c28dcfb5951127460e60 100644 (file)
@@ -247,36 +247,17 @@ grub_normal_init_page (struct grub_term_output *term,
  
   grub_term_cls (term);
 
-  if (!grub_term_is_tiny (term))
-    {
-      int msg_len;
-      int posx;
-      const char *msg = _("GNU GRUB  version %s");
-      char *msg_formatted;
-      grub_wchar_t *unicode_msg;
-      grub_wchar_t *last_position;
-      msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION);
-      if (!msg_formatted)
-       return;
+  msg_formatted = grub_xasprintf (msg, PACKAGE_VERSION);
+  if (!msg_formatted)
+    return;
  
-      msg_len = grub_utf8_to_ucs4_alloc (msg_formatted,
-                                        &unicode_msg, &last_position);
-      grub_free (msg_formatted);
+  msg_len = grub_utf8_to_ucs4_alloc (msg_formatted,
+                                    &unicode_msg, &last_position);
+  grub_free (msg_formatted);
  
-      if (msg_len < 0)
-       {
-         return;
-       }
-
-      posx = grub_getstringwidth (unicode_msg, last_position, term);
-      posx = (grub_term_width (term) - posx) / 2;
-      grub_term_gotoxy (term, posx, 1);
-
-      grub_print_ucs4 (unicode_msg, last_position, 0, 0, term);
-      grub_putcode ('\n', term);
-      grub_putcode ('\n', term);
-      grub_free (unicode_msg);
+  if (msg_len < 0)
+    {
+      return;
     }
 
   posx = grub_getstringwidth (unicode_msg, last_position, term);
@@ -426,19 +407,18 @@ grub_normal_reader_init (int nested)
     return grub_errno;
 
   FOR_ACTIVE_TERM_OUTPUTS(term)
-    if (!grub_term_is_tiny (term))
-      {
-       grub_normal_init_page (term, 1);
-       grub_term_setcursor (term, 1);
-
-       if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20)
-         grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term);
-       else
-         grub_print_message_indented (msg_formatted, 0, 0, term);
-       grub_putcode ('\n', term);
-       grub_putcode ('\n', term);
-       grub_putcode ('\n', term);
-      }
+  {
+    grub_normal_init_page (term, 1);
+    grub_term_setcursor (term, 1);
+
+    if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20)
+      grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term);
+    else
+      grub_print_message_indented (msg_formatted, 0, 0, term);
+    grub_putcode ('\n', term);
+    grub_putcode ('\n', term);
+    grub_putcode ('\n', term);
+  }
   grub_free (msg_formatted);
  
   return 0;
index 71f76fc4d398b14cbd6e1d662133599468d379bb..7b2b7bd330cc329ff75391aceab1305c03b2ca9b 100644 (file)
@@ -29,8 +29,8 @@
 struct term_state
 {
   struct term_state *next;
-  const struct grub_unicode_glyph *backlog_glyphs;
-  const grub_wchar_t *backlog_ucs4;
+  struct grub_unicode_glyph *backlog_glyphs;
+  const grub_uint32_t *backlog_ucs4;
   int backlog_fixed_tab;
   grub_size_t backlog_len;
 
@@ -59,7 +59,7 @@ static struct term_state *term_states = NULL;
 static int grub_more;
 
 static void
-putcode_real (grub_wchar_t code, struct grub_term_output *term, int fixed_tab);
+putcode_real (grub_uint32_t code, struct grub_term_output *term, int fixed_tab);
 
 void
 grub_normal_reset_more (void)
@@ -75,7 +75,7 @@ print_more (void)
   char key;
   struct grub_term_coordinate *pos;
   grub_term_output_t term;
-  grub_wchar_t *unicode_str, *unicode_last_position;
+  grub_uint32_t *unicode_str, *unicode_last_position;
 
   pos = grub_term_save_pos ();
 
@@ -146,45 +146,10 @@ enum
     GRUB_CP437_CORNER_UL       = 0xda,
   };
 
-char
-grub_translit (grub_wchar_t in)
+static grub_uint32_t
+map_code (grub_uint32_t in, struct grub_term_output *term)
 {
-  if (!(in & ~0x7f))
-    return in;
-
-  switch (in)
-    {
-    case GRUB_UNICODE_LEFTARROW:
-      return '<';
-               
-    case GRUB_UNICODE_UPARROW:
-      return '^';
-         
-    case GRUB_UNICODE_RIGHTARROW:
-      return '>';
-               
-    case GRUB_UNICODE_DOWNARROW:
-      return 'v';
-                 
-    case GRUB_UNICODE_HLINE:
-      return '-';
-                 
-    case GRUB_UNICODE_VLINE:
-      return '|';
-                 
-    case GRUB_UNICODE_CORNER_UL:
-    case GRUB_UNICODE_CORNER_UR:
-    case GRUB_UNICODE_CORNER_LL:
-    case GRUB_UNICODE_CORNER_LR:
-      return '+';
-    }
-  return '?';
-}
-
-static grub_wchar_t
-map_code (grub_wchar_t in, struct grub_term_output *term)
-{
-  if (!(in & ~0x7f))
+  if (in <= 0x7f)
     return in;
 
   switch (term->flags & GRUB_TERM_CODE_TYPE_MASK)
@@ -215,9 +180,37 @@ map_code (grub_wchar_t in, struct grub_term_output *term)
        case GRUB_UNICODE_CORNER_LR:
          return GRUB_CP437_CORNER_LR;
        }
+      return '?';
     case GRUB_TERM_CODE_TYPE_ASCII:
       /* Better than nothing.  */
-      return grub_translit (in);
+      switch (in)
+       {
+       case GRUB_UNICODE_LEFTARROW:
+         return '<';
+               
+       case GRUB_UNICODE_UPARROW:
+         return '^';
+         
+       case GRUB_UNICODE_RIGHTARROW:
+         return '>';
+               
+       case GRUB_UNICODE_DOWNARROW:
+         return 'v';
+                 
+       case GRUB_UNICODE_HLINE:
+         return '-';
+                 
+       case GRUB_UNICODE_VLINE:
+         return '|';
+                 
+       case GRUB_UNICODE_CORNER_UL:
+       case GRUB_UNICODE_CORNER_UR:
+       case GRUB_UNICODE_CORNER_LL:
+       case GRUB_UNICODE_CORNER_LR:
+         return '+';
+               
+       }
+      return '?';
     }
   return in;
 }
@@ -225,7 +218,7 @@ map_code (grub_wchar_t in, struct grub_term_output *term)
 void
 grub_puts_terminal (const char *str, struct grub_term_output *term)
 {
-  grub_wchar_t *unicode_str, *unicode_last_position;
+  grub_uint32_t *unicode_str, *unicode_last_position;
   grub_error_push ();
   grub_utf8_to_ucs4_alloc (str, &unicode_str,
                           &unicode_last_position);
@@ -470,7 +463,7 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term,
       for (i = -1; i < (int) c->ncomb; i++)
        {
          grub_uint8_t u8[20], *ptr;
-         grub_wchar_t code;
+         grub_uint32_t code;
              
          if (i == -1)
            {
@@ -508,7 +501,7 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term,
 }
 
 static void
-putcode_real (grub_wchar_t code, struct grub_term_output *term, int fixed_tab)
+putcode_real (grub_uint32_t code, struct grub_term_output *term, int fixed_tab)
 {
   struct grub_unicode_glyph c =
     {
@@ -524,7 +517,7 @@ putcode_real (grub_wchar_t code, struct grub_term_output *term, int fixed_tab)
 
 /* Put a Unicode character.  */
 void
-grub_putcode (grub_wchar_t code, struct grub_term_output *term)
+grub_putcode (grub_uint32_t code, struct grub_term_output *term)
 {
   /* Combining character by itself?  */
   if (grub_unicode_get_comb_type (code) != GRUB_UNICODE_COMB_NONE)
@@ -565,8 +558,8 @@ fill_margin (struct grub_term_output *term, int r)
 }
 
 static int
-print_ucs4_terminal (const grub_wchar_t * str,
-                    const grub_wchar_t * last_position,
+print_ucs4_terminal (const grub_uint32_t * str,
+                    const grub_uint32_t * last_position,
                     int margin_left, int margin_right,
                     struct grub_term_output *term,
                     struct term_state *state,
@@ -575,12 +568,12 @@ print_ucs4_terminal (const grub_wchar_t * str,
                     grub_uint32_t contchar,
                     int primitive_wrap, int fill_right, struct grub_term_pos *pos)
 {
-  const grub_wchar_t *ptr;
+  const grub_uint32_t *ptr;
   grub_ssize_t startwidth = dry_run ? 0 : get_startwidth (term, margin_left);
   grub_ssize_t line_width = startwidth;
   grub_ssize_t lastspacewidth = 0;
   grub_ssize_t max_width = get_maxwidth (term, margin_left, margin_right);
-  const grub_wchar_t *line_start = str, *last_space = str - 1;
+  const grub_uint32_t *line_start = str, *last_space = str - 1;
   int lines = 0;
   int i;
   struct term_state local_state;
@@ -642,7 +635,7 @@ print_ucs4_terminal (const grub_wchar_t * str,
 
       if (line_width > max_width || *ptr == '\n')
        {
-         const grub_wchar_t *ptr2;
+         const grub_uint32_t *ptr2;
          int wasn = (*ptr == '\n');
 
          if (wasn)
@@ -740,7 +733,7 @@ print_ucs4_terminal (const grub_wchar_t * str,
       lines++;
   if (!dry_run && !skip_lines && max_lines)
     {
-      const grub_wchar_t *ptr2;
+      const grub_uint32_t *ptr2;
 
       for (ptr2 = line_start; ptr2 < last_position; ptr2++)
        {
@@ -880,8 +873,8 @@ getcharwidth (const struct grub_unicode_glyph *c, void *term)
 }
 
 static int
-print_ucs4_real (const grub_wchar_t * str,
-                const grub_wchar_t * last_position,
+print_ucs4_real (const grub_uint32_t * str,
+                const grub_uint32_t * last_position,
                 int margin_left, int margin_right,
                 struct grub_term_output *term, int backlog,
                 int dry_run, int fixed_tab, unsigned skip_lines,
@@ -995,8 +988,8 @@ grub_print_ucs4_menu (const grub_uint32_t * str,
 }
 
 void
-grub_print_ucs4 (const grub_wchar_t * str,
-                const grub_wchar_t * last_position,
+grub_print_ucs4 (const grub_uint32_t * str,
+                const grub_uint32_t * last_position,
                 int margin_left, int margin_right,
                 struct grub_term_output *term)
 {
@@ -1005,8 +998,8 @@ grub_print_ucs4 (const grub_wchar_t * str,
 }
 
 int
-grub_ucs4_count_lines (const grub_wchar_t * str,
-                      const grub_wchar_t * last_position,
+grub_ucs4_count_lines (const grub_uint32_t * str,
+                      const grub_uint32_t * last_position,
                       int margin_left, int margin_right,
                       struct grub_term_output *term)
 {
@@ -1017,7 +1010,7 @@ grub_ucs4_count_lines (const grub_wchar_t * str,
 void
 grub_xnputs (const char *str, grub_size_t msg_len)
 {
-  grub_wchar_t *unicode_str = NULL, *unicode_last_position;
+  grub_uint32_t *unicode_str = NULL, *unicode_last_position;
   int backlog = 0;
   grub_term_output_t term;
 
index 2be2af224b8a4ad3219fa6f15023212c6075d8e3..8950ecb95ab65f2d7f160e99fefe850a3a4a1de7 100644 (file)
@@ -59,9 +59,7 @@
 #define ALIGN_UP_OVERHEAD(addr, align) ((-(addr)) & ((typeof (addr)) (align) - 1))
 #define ALIGN_DOWN(addr, align) \
        ((addr) & ~((typeof (addr)) align - 1))
-#ifndef GRUB_POSIX
 #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
-#endif
 #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
 
 #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)