Subversion Repositories HelenOS

Rev

Rev 4343 | Rev 4347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4343 Rev 4345
Line 56... Line 56...
56
#include "input.h"
56
#include "input.h"
57
#include "tetris.h"
57
#include "tetris.h"
58
 
58
 
59
#include <async.h>
59
#include <async.h>
60
#include <ipc/console.h>
60
#include <ipc/console.h>
-
 
61
#include <kbd/kbd.h>
61
 
62
 
62
/* return true iff the given timeval is positive */
63
/* return true iff the given timeval is positive */
63
#define TV_POS(tv) \
64
#define TV_POS(tv) \
64
    ((tv)->tv_sec > 0 || ((tv)->tv_sec == 0 && (tv)->tv_usec > 0))
65
    ((tv)->tv_sec > 0 || ((tv)->tv_sec == 0 && (tv)->tv_usec > 0))
65
 
66
 
Line 109... Line 110...
109
        s = &endtv;
110
        s = &endtv;
110
    } else
111
    } else
111
        s = NULL;
112
        s = NULL;
112
 
113
 
113
    if (!lastchar) {
114
    if (!lastchar) {
-
 
115
again:
114
        if (!getchar_inprog) {
116
        if (!getchar_inprog) {
115
            cons_phone = get_cons_phone();
117
            cons_phone = get_console_phone();
116
            getchar_inprog = async_send_2(cons_phone,
118
            getchar_inprog = async_send_2(cons_phone,
117
                CONSOLE_GETKEY, 0, 0, &charcall);
119
                CONSOLE_GETKEY, 0, 0, &charcall);
118
        }
120
        }
119
        if (!s)
121
        if (!s)
120
            async_wait_for(getchar_inprog, &rc);
122
            async_wait_for(getchar_inprog, &rc);
Line 125... Line 127...
125
        }
127
        }
126
        getchar_inprog = 0;
128
        getchar_inprog = 0;
127
        if (rc) {
129
        if (rc) {
128
            stop("end of file, help");
130
            stop("end of file, help");
129
        }
131
        }
-
 
132
        if (IPC_GET_ARG1(charcall) == KE_RELEASE)
-
 
133
            goto again;
-
 
134
 
130
        lastchar = IPC_GET_ARG4(charcall);
135
        lastchar = IPC_GET_ARG4(charcall);
131
    }
136
    }
132
    if (tvp) {
137
    if (tvp) {
133
        /* since there is input, we may not have timed out */
138
        /* since there is input, we may not have timed out */
134
        (void) gettimeofday(&endtv, NULL);
139
        (void) gettimeofday(&endtv, NULL);