Changeset 7122bc7 in mainline


Ignore:
Timestamp:
2009-01-01T13:58:05Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fb69f39
Parents:
9805cde
Message:

More console IPC wrapper functions.

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tetris/screen.c

    r9805cde r7122bc7  
    5151#include <string.h>
    5252#include <unistd.h>
    53 #include <io/stream.h>
    5453#include <console.h>
    5554
     
    7473}
    7574
    76 static int con_phone;
    77 
    78 
    7975static void start_standout(void)
    8076{
     
    8985void clear_screen(void)
    9086{
    91         async_msg_0(con_phone, CONSOLE_CLEAR);
     87        console_clear();
    9288        moveto(0, 0);
    9389}
     
    10197
    10298        resume_normal();
    103         async_msg_0(con_phone, CONSOLE_CLEAR);
     99        console_clear();
    104100        curscore = -1;
    105101        memset((char *)curscreen, 0, sizeof(curscreen));
     
    112108scr_init(void)
    113109{
    114         con_phone = get_cons_phone();
    115         async_msg_1(con_phone, CONSOLE_CURSOR_VISIBILITY, 0);
     110        console_cursor_visibility(0);
    116111        resume_normal();
    117112        scr_clear();
     
    120115void moveto(int r, int c)
    121116{
    122         async_msg_2(con_phone, CONSOLE_GOTO, r, c);
     117        console_goto(r, c);
    123118}
    124119
    125120static void fflush(void)
    126121{
    127         async_msg_0(con_phone, CONSOLE_FLUSH);
     122        console_flush();
    128123}
    129124
     
    132127static int get_display_size(winsize_t *ws)
    133128{
    134         return async_req_0_2(con_phone, CONSOLE_GETSIZE, &ws->ws_row,
    135             &ws->ws_col);
     129        return console_get_size(&ws->ws_row, &ws->ws_col);
    136130}
    137131
  • uspace/app/tetris/screen.h

    r9805cde r7122bc7  
    5050
    5151typedef struct {
    52         ipcarg_t ws_row;
    53         ipcarg_t ws_col;
     52        int ws_row;
     53        int ws_col;
    5454} winsize_t;
    5555
  • uspace/lib/libc/generic/console.c

    r9805cde r7122bc7  
    3838#include <console.h>
    3939
     40void console_clear(void)
     41{
     42        int cons_phone = get_cons_phone();
     43        async_msg_0(cons_phone, CONSOLE_CLEAR);
     44}
     45
     46void console_goto(int row, int col)
     47{
     48        int cons_phone = get_cons_phone();
     49        async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
     50}
     51
     52void console_flush(void)
     53{
     54        int cons_phone = get_cons_phone();
     55        async_msg_0(cons_phone, CONSOLE_FLUSH);
     56}
     57
     58int console_get_size(int *rows, int *cols)
     59{
     60        int cons_phone = get_cons_phone();
     61        ipcarg_t r, c;
     62        int rc;
     63
     64        rc = async_req_0_2(cons_phone, CONSOLE_GETSIZE, &r, &c);
     65
     66        *rows = (int) r;
     67        *cols = (int) c;
     68
     69        return rc;
     70}
     71
    4072void console_set_style(int style)
    4173{
    4274        int cons_phone = get_cons_phone();
    43 
    4475        async_msg_1(cons_phone, CONSOLE_SET_STYLE, style);
    4576}
     
    4879{
    4980        int cons_phone = get_cons_phone();
    50 
    5181        async_msg_3(cons_phone, CONSOLE_SET_COLOR, fg_color, bg_color, flags);
    5282}
     
    5585{
    5686        int cons_phone = get_cons_phone();
     87        async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
     88}
    5789
    58         async_msg_2(cons_phone, CONSOLE_SET_RGB_COLOR, fg_color, bg_color);
     90void console_cursor_visibility(int show)
     91{
     92        int cons_phone = get_cons_phone();
     93        async_msg_1(cons_phone, CONSOLE_CURSOR_VISIBILITY, show != 0);
    5994}
    6095
  • uspace/lib/libc/include/console.h

    r9805cde r7122bc7  
    3939#include <console/color.h>
    4040
     41extern void console_clear(void);
     42extern void console_goto(int, int);
     43extern void console_flush(void);
     44extern int console_get_size(int *, int *);
    4145extern void console_set_style(int);
    4246extern void console_set_color(int, int, int);
    4347extern void console_set_rgb_color(int, int);
     48extern void console_cursor_visibility(int);
    4449
    4550#endif
Note: See TracChangeset for help on using the changeset viewer.