Changeset 86029498 in mainline


Ignore:
Timestamp:
2006-06-02T21:53:26Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
59ed572
Parents:
2408969
Message:

Small changes to tetris.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/async.c

    r2408969 r86029498  
    286286       
    287287        assert(PS_connection);
     288
     289        if (usecs < 0) /* TODO: let it get through the ipc_call once */
     290                return 0;
    288291
    289292        futex_down(&async_futex);
     
    656659        connection_t *conn;
    657660
     661        /* TODO: Let it go through the event read at least once */
     662        if (timeout < 0)
     663                return ETIMEOUT;
     664
    658665        futex_down(&async_futex);
    659666        if (msg->done) {
  • libc/include/sys/time.h

    r2408969 r86029498  
    3434#define DST_NONE 0
    3535
    36 typedef sysarg_t time_t;
    37 typedef sysarg_t suseconds_t;
     36typedef long time_t;
     37typedef long suseconds_t;
    3838
    3939struct timeval {
  • tetris/input.c

    r2408969 r86029498  
    4242#include <sys/types.h>
    4343#include <sys/time.h>
     44#include <stdio.h>
    4445
    4546#include <errno.h>
     
    9192        int rc;
    9293
    93 #define NILTZ ((struct timezone *)0)
    94 
    9594        /*
    9695         * Someday, select() will do this for us.
     
    9998         */
    10099        if (tvp) {
    101                 (void) gettimeofday(&starttv, NILTZ);
     100                (void) gettimeofday(&starttv, NULL);
    102101                endtv = *tvp;
    103102                s = &endtv;
     
    108107                if (!getchar_inprog)
    109108                        getchar_inprog = async_send_2(1,CONSOLE_GETCHAR,0,0,&charcall);
    110                 if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) {
     109                if (!s)
     110                        async_wait_for(getchar_inprog, &rc);
     111                else if (async_wait_timeout(getchar_inprog, &rc, s->tv_usec) == ETIMEOUT) {
    111112                        tvp->tv_sec = 0;
    112113                        tvp->tv_usec = 0;
     
    121122        if (tvp) {
    122123                /* since there is input, we may not have timed out */
    123                 (void) gettimeofday(&endtv, NILTZ);
     124                (void) gettimeofday(&endtv, NULL);
    124125                TV_SUB(&endtv, &starttv);
    125126                TV_SUB(tvp, &endtv);    /* adjust *tvp by elapsed time */
  • tetris/screen.c

    r2408969 r86029498  
    160160                char smallscr[55];
    161161
    162                 (void)snprintf(smallscr, sizeof(smallscr),
     162                snprintf(smallscr, sizeof(smallscr),
    163163                    "the screen is too small (must be at least %dx%d)",
    164164                    MINROWS, MINCOLS);
     
    204204        if (score != curscore) {
    205205                moveto(0, 0);
    206                 (void) printf("Score: %d", score);
     206                printf("Score: %d", score);
    207207                curscore = score;
    208208        }
     
    252252                        *sp = so;
    253253                        if (i != ccol) {
     254                                if (cur_so) {
     255                                        resume_normal();
     256                                        cur_so = 0;
     257                                }
    254258                                moveto(RTOD(j), CTOD(i));
    255259                        }
     
    262266                        }
    263267                        putstr("  ");
     268
    264269                        ccol = i + 1;
    265270                        /*
     
    282287                }
    283288        }
    284         resume_normal();
    285 
     289        if (cur_so)
     290                resume_normal();
    286291        fflush();
    287292}
Note: See TracChangeset for help on using the changeset viewer.