Changeset f25b73d6 in mainline


Ignore:
Timestamp:
2006-05-29T17:09:10Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
79460ae
Parents:
854387b
Message:

Started porting tetris.

Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • init/init.c

    r854387b rf25b73d6  
    4545#include <ipc/fb.h>
    4646#include <async.h>
    47 #include <time.h>
     47#include <sys/time.h>
    4848
    4949int a;
  • libc/generic/time.c

    r854387b rf25b73d6  
    2727 */
    2828
    29 #include <time.h>
     29#include <sys/time.h>
    3030#include <unistd.h>
    3131#include <ipc/ipc.h>
  • libc/include/async.h

    r854387b rf25b73d6  
    44#include <ipc/ipc.h>
    55#include <psthread.h>
    6 #include <time.h>
     6#include <sys/time.h>
    77
    88typedef ipc_callid_t aid_t;
  • libc/include/time.h

    r854387b rf25b73d6  
    3030#define __libc_TIME_H__
    3131
    32 #include <types.h>
    33 
    34 #define DST_NONE 0
    35 
    36 typedef sysarg_t time_t;
    37 typedef sysarg_t suseconds_t;
    38 
    39 struct timeval {
    40         time_t         tv_sec;        /* seconds */
    41         suseconds_t    tv_usec;  /* microseconds */
    42 };
    43 
    44 struct timezone {
    45         int  tz_minuteswest; /* minutes W of Greenwich */
    46         int  tz_dsttime;     /* type of dst correction */
    47 };
    48 
    49 int gettimeofday(struct timeval *tv, struct timezone *tz);
    50 
    5132#endif
  • tetris/Makefile

    r854387b rf25b73d6  
    1 #       $OpenBSD: Makefile,v 1.7 2002/05/31 03:46:35 pjanzen Exp $
     1LIBC_PREFIX = ../libc
     2SOFTINT_PREFIX = ../softint
     3include $(LIBC_PREFIX)/Makefile.toolchain
    24
    3 PROG=   tetris
    4 SRCS=   input.c screen.c shapes.c scores.c tetris.c
    5 MAN=    tetris.6
    6 DPADD=  ${LIBCURSES}
    7 LDADD=  -lcurses
    8 BINMODE=2555
     5LIBS = $(LIBC_PREFIX)/libc.a
    96
    10 beforeinstall:
    11         @if [ ! -f ${DESTDIR}/var/games/tetris.scores ]; then \
    12             ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 664 \
    13                 /dev/null ${DESTDIR}/var/games/tetris.scores ; \
    14         else \
    15                 true ; \
    16         fi
     7OUTPUT = tetris
     8SOURCES = shapes.c tetris.c scores.c input.c screen.c
     9OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
    1710
    18 .include <bsd.prog.mk>
     11.PHONY: all clean depend disasm
     12
     13all: $(OUTPUT)
     14
     15-include Makefile.depend
     16
     17depend:
     18        $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
     19
     20$(OUTPUT): $(OBJECTS) $(LIBS)
     21        $(LD) -T $(LIBC_PREFIX)/arch/$(ARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map
     22
     23clean:
     24        -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend *.o
     25disasm:
     26        $(OBJDUMP) -d $(OUTPUT) >$(OUTPUT).disasm
     27
     28%.o: %.S
     29        $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
     30
     31%.o: %.s
     32        $(AS) $(AFLAGS) $< -o $@
     33
     34%.o: %.c
     35        $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
  • tetris/tetris.c

    r854387b rf25b73d6  
    5151
    5252#include <err.h>
    53 #include <signal.h>
     53//#include <signal.h>
    5454#include <stdio.h>
    5555#include <stdlib.h>
     
    6868long    fallrate;
    6969int     score;
    70 gid_t   gid, egid;
     70//gid_t gid, egid;
    7171char    key_msg[100];
    7272int     showpreview, classic;
     
    166166        keys = "jkl pq";
    167167
    168         gid = getgid();
    169         egid = getegid();
    170         setegid(gid);
     168//      gid = getgid();
     169//      egid = getegid();
     170//      setegid(gid);
    171171
    172172        classic = showpreview = 0;
    173         while ((ch = getopt(argc, argv, "ck:l:ps")) != -1)
    174                 switch(ch) {
    175                 case 'c':
    176                         /*
    177                          * this means:
    178                          *      - rotate the other way;
    179                          *      - no reverse video.
    180                          */
    181                         classic = 1;
    182                         break;
    183                 case 'k':
    184                         if (strlen(keys = optarg) != 6)
    185                                 usage();
    186                         break;
    187                 case 'l':
    188                         level = (int)strtonum(optarg, MINLEVEL, MAXLEVEL,
    189                             &errstr);
    190                         if (errstr)
    191                                 errx(1, "level must be from %d to %d",
    192                                     MINLEVEL, MAXLEVEL);
    193                         break;
    194                 case 'p':
    195                         showpreview = 1;
    196                         break;
    197                 case 's':
    198                         showscores(0);
    199                         exit(0);
    200                 default:
    201                         usage();
    202                 }
    203 
    204         argc -= optind;
    205         argv += optind;
    206 
    207         if (argc)
    208                 usage();
     173
     174/*      while ((ch = getopt(argc, argv, "ck:l:ps")) != -1) */
     175/*              switch(ch) { */
     176/*              case 'c': */
     177/*                      /\* */
     178/*                       * this means: */
     179/*                       *      - rotate the other way; */
     180/*                       *      - no reverse video. */
     181/*                       *\/ */
     182/*                      classic = 1; */
     183/*                      break; */
     184/*              case 'k': */
     185/*                      if (strlen(keys = optarg) != 6) */
     186/*                              usage(); */
     187/*                      break; */
     188/*              case 'l': */
     189/*                      level = (int)strtonum(optarg, MINLEVEL, MAXLEVEL, */
     190/*                          &errstr); */
     191/*                      if (errstr) */
     192/*                              errx(1, "level must be from %d to %d", */
     193/*                                  MINLEVEL, MAXLEVEL); */
     194/*                      break; */
     195/*              case 'p': */
     196/*                      showpreview = 1; */
     197/*                      break; */
     198/*              case 's': */
     199/*                      showscores(0); */
     200/*                      exit(0); */
     201/*              default: */
     202/*                      usage(); */
     203/*              } */
     204
     205/*      argc -= optind; */
     206/*      argv += optind; */
     207
     208/*      if (argc) */
     209/*              usage(); */
    209210
    210211        fallrate = 1000000 / level;
     
    228229                key_write[4], key_write[5]);
    229230
    230         (void)signal(SIGINT, onintr);
     231//      (void)signal(SIGINT, onintr);
    231232        scr_init();
    232233        setup_board();
     
    358359}
    359360
    360 void
    361 onintr(int signo)
    362 {
    363         scr_clear();            /* XXX signal race */
    364         scr_end();              /* XXX signal race */
    365         _exit(0);
    366 }
     361/* void */
     362/* onintr(int signo) */
     363/* { */
     364/*      scr_clear();            /\* XXX signal race *\/ */
     365/*      scr_end();              /\* XXX signal race *\/ */
     366/*      _exit(0); */
     367/* } */
    367368
    368369void
  • tetris/tetris.h

    r854387b rf25b73d6  
    168168
    169169extern int      score;          /* the obvious thing */
    170 extern gid_t    gid, egid;
     170//extern gid_t  gid, egid;
    171171
    172172extern char     key_msg[100];
Note: See TracChangeset for help on using the changeset viewer.