Changeset b27eb71 in mainline


Ignore:
Timestamp:
2009-04-05T09:17:02Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9db4079
Parents:
f2b8cdc
Message:

Make ega-fb and serial-fb aware of UCS.

Location:
uspace/srv/fb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fb/ega.c

    rf2b8cdc rb27eb71  
    8484
    8585static unsigned attr_to_ega_style(const attrs_t *a);
     86static uint8_t ega_glyph(wchar_t ch);
    8687
    8788static void clrscr(void)
     
    144145}
    145146
    146 static void printchar(char c, unsigned int row, unsigned int col)
    147 {
    148         scr_addr[(row * scr_width + col) * 2] = c;
     147static void printchar(wchar_t c, unsigned int row, unsigned int col)
     148{
     149        scr_addr[(row * scr_width + col) * 2] = ega_glyph(c);
    149150        scr_addr[(row * scr_width + col) * 2 + 1] = style;
    150151       
     
    173174                        dp = &scr_addr[2 * ((y + j) * scr_width + (x + i))];
    174175
    175                         dp[0] = field->character;
     176                        dp[0] = ega_glyph(field->character);
    176177                        dp[1] = attr_to_ega_style(&field->attrs);
    177178                }
     
    249250}
    250251
     252static uint8_t ega_glyph(wchar_t ch)
     253{
     254        if (ch >= 0 && ch < 128)
     255                return ch;
     256
     257        return '?';
     258}
     259
    251260static void ega_client_connection(ipc_callid_t iid, ipc_call_t *icall)
    252261{
     
    254263        ipc_callid_t callid;
    255264        ipc_call_t call;
    256         char c;
     265        wchar_t c;
    257266        unsigned int row, col, w, h;
    258267        int bg_color, fg_color, attr;
  • uspace/srv/fb/serial_console.c

    rf2b8cdc rb27eb71  
    5454
    5555static void serial_sgr(const unsigned int mode);
     56void serial_putchar(wchar_t ch);
    5657
    5758static int scr_width;
    5859static int scr_height;
    5960static bool color = true;       /** True if producing color output. */
     61static bool utf8 = false;       /** True if producing UTF8 output. */
    6062static putc_function_t putc_function;
    6163
     
    105107void serial_putchar(wchar_t ch)
    106108{
    107         (*putc_function)(ch);
     109        uint8_t buf[STR_BOUNDS(1)];
     110        size_t offs;
     111        size_t i;
     112
     113        if (utf8 != true) {
     114                if (ch >= 0 && ch < 128)
     115                        (*putc_function)((uint8_t) ch);
     116                else
     117                        (*putc_function)('?');
     118                return;
     119        }
     120
     121        offs = 0;
     122        if (chr_encode(ch, buf, &offs, STR_BOUNDS(1)) == EOK) {
     123                for (i = 0; i < offs; i++)
     124                        (*putc_function)(buf[i]);
     125        } else {
     126                (*putc_function)('?');
     127        }
     128
    108129}
    109130
Note: See TracChangeset for help on using the changeset viewer.