/[grub]/grub2/kern/term.c
ViewVC logotype

Diff of /grub2/kern/term.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by marco_g, Thu Aug 4 18:10:50 2005 UTC revision 1.9 by okuji, Sat Aug 20 05:26:51 2005 UTC
# Line 143  grub_putcode (grub_uint32_t code) Line 143  grub_putcode (grub_uint32_t code)
143  void  void
144  grub_putchar (int c)  grub_putchar (int c)
145  {  {
146    static grub_uint32_t code = 0;    static grub_size_t size = 0;
147    static int count = 0;    static grub_uint8_t buf[6];
148      grub_uint32_t code;
149      grub_ssize_t ret;
150    
151    if (count)    buf[size++] = c;
152      ret = grub_utf8_to_ucs4 (&code, buf, size);
153      
154      if (ret > 0)
155      {      {
156        if ((c & 0xc0) != 0x80)        size = 0;
157          {        grub_putcode (code);
           /* invalid */  
           code = '@';  
           count = 0;  
         }  
       else  
         {  
           code <<= 6;  
           code |= (c & 0x3f);  
           count--;  
         }  
158      }      }
159    else    else if (ret < 0)
160      {      {
161        if ((c & 0x80) == 0x00)        size = 0;
162          code = c;        grub_putcode ('?');
163        else if ((c & 0xe0) == 0xc0)      }
164          {  }
           count = 1;  
           code = c & 0x1f;  
         }  
       else if ((c & 0xf0) == 0xe0)  
         {  
           count = 2;  
           code = c & 0x0f;  
         }  
       else if ((c & 0xf8) == 0xf0)  
         {  
           count = 3;  
           code = c & 0x07;  
         }  
       else if ((c & 0xfc) == 0xf8)  
         {  
           count = 4;  
           code = c & 0x03;  
         }  
       else if ((c & 0xfe) == 0xfc)  
         {  
           count = 5;  
           code = c & 0x01;  
         }  
       else  
         /* invalid */  
         code = '?';  
     }    
   
   if (count)  
     /* Not finished yet.  */  
     return;  
165    
166    grub_putcode (code);  /* Return the number of columns occupied by the character code CODE.  */
167    grub_ssize_t
168    grub_getcharwidth (grub_uint32_t code)
169    {
170      return (grub_cur_term->getcharwidth) (code);
171  }  }
172    
173  int  int

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26