# 2.11BSD#431 - /usr/src/games/warp/util.h

##### Variables

    len_last_line_got X
    timebuf           X

##### Macros

    HALFRAND          X
    MD_DIR            X
    MD_FILE           X
    RANDRAND          X
    myrand            X
    rand_mod          X
    roundsleep        X

       1: /* $Header: util.h,v 7.0 86/10/08 15:14:37 lwall Exp $ */
       2:
       3: /* $Log:	util.h,v $
       4:  * Revision 7.0  86/10/08  15:14:37  lwall
       5:  * Split into separate files.  Added amoebas and pirates.
       6:  *
       7:  */
       8:
       9: #if RANDBITS < 15 || defined(lint)
      10: #define rand_mod(m) getpid()
      11: #define RANDRAND 0.0
      12: #define HALFRAND 0
      13: #define myrand() getpid()
      14: #else
      15: #if RANDBITS == 15  /* 15 bits of rand()? */
      16: #define RANDRAND 268435456.0 /* that's 2**28 */
      17: #define HALFRAND 0x4000 /* that's 2**14 */
      18: int rand();
      19: #define myrand() (rand()&32767)
      20: #define rand_mod(m) ((int)((double)myrand() / 32768.0 * ((double)(m))))
      21: /* pick number in 0..m-1 */
      22:
      23: #else
      24:
      25: #if RANDBITS < 31   /* 16 bits of rand()? */
      26: #define RANDRAND 1073741824.0 /* that's 2**30 */
      27: #define HALFRAND 0x8000 /* that's 2**15 */
      28: unsigned rand();
      29: #define myrand() (rand()&65535)
      30: #define rand_mod(m) ((int)((double)myrand() / 65536.0 * ((double)(m))))
      31: /* pick number in 0..m-1 */
      32:
      33: #else       /* assume 31 bits */
      34: #define RANDRAND 1152921504606846976.0 /* that's 2**60 */
      35: #define HALFRAND 0x40000000 /* that's 2**30 */
      36: long rand();
      37: #define myrand() rand()
      38: #define rand_mod(m) ((myrand() / 37) % (m)) /* pick number in 0..m-1 */
      39: /*
      40:  * The reason for the /37 above is that our random number generator yields
      41:  * successive evens and odds, for some reason.  This makes strange star maps.
      42:  */
      43: #endif
      44: #endif
      45: #endif
      46:
      47:
      48:     /* we get fractions of seconds from calling ftime on timebuf */
      49:
      50: #ifdef FTIMER
      51: EXT struct timeb timebuf;
      52: #define roundsleep(x) (ftime(&timebuf),sleep(timebuf.millitm > 500?x+1:x))
      53: #else
      54: #define roundsleep(x) sleep(x)
      55: #endif
      56:
      57: void movc3();
      58: void no_can_do();
      59: int exdis();
      60:
      61: EXT bool waiting INIT(FALSE);       /* are we waiting for subprocess (in doshell)? */
      62:
      63: #ifdef NOTDEF
      64: EXT int len_last_line_got INIT(0);
      65:             /* strlen of some_buf after */
      66:             /*  some_buf = get_a_line(bufptr,buffersize,fp) */
      67: #endif
      68:
      69: #ifdef NOTDEF
      70: /* is the string for makedir a directory name or a filename? */
      71:
      72: #define MD_DIR 0
      73: #define MD_FILE 1
      74: #endif
      75:
      76: void util_init();
      77: char    *safemalloc();
      78: char    *safecpy();
      79: char    *cpytill();
      80: char    *instr();
      81: #ifdef SETUIDGID
      82:     int     eaccess();
      83: #endif
      84: char    *getwd();
      85: void    cat();
      86: void    prexit();
      87: char    *savestr();
      88: char    *getval();

#### Defined variables

len_last_line_got defined in line 64; never used
timebuf defined in line 51; used 2 times

- in line 52(2)

#### Defined macros

HALFRAND defined in line 35; used 8 times

- in /usr/src/games/warp/init.c line 249-250(2), 274-275(2), 281-282(2), 289-290(2)

MD_DIR defined in line 72; never used
MD_FILE defined in line 73; never used
RANDRAND defined in line 34; used 4 times

- in /usr/src/games/warp/init.c line 250, 275, 282, 290

myrand defined in line 37; used 12 times

- in line 20, 30, 38
- in /usr/src/games/warp/init.c line 249-250(2), 274-275(2), 281-282(2), 289-290(2)
- in /usr/src/games/warp/util.c line 76

rand_mod defined in line 38; used 211 times

- in /usr/src/games/warp/init.c line 106-120(7), 137-157(9), 171, 179-183(4), 190-195(4), 207, 213-221(5), 229-231(3), 238-239(2), 245, 265-270(2), 302-308(4), 317, 327-331(2), 337-338(2), 346-347(2), 354-355(2), 362-363(2), 371-372(2), 383-384(2), 393-408(10), 416-426(6), 440, 456, 482-483(2), 492-499(3)
- in /usr/src/games/warp/move.c line 47-48(2), 107-108(2), 177-181(2), 187, 233, 273-285(5), 450, 592-594(2)
- in /usr/src/games/warp/play.c line 65-67(2)
- in /usr/src/games/warp/score.c line 315, 456, 516
- in /usr/src/games/warp/them.c line 59-79(9), 110-113(2), 128, 138-149(4), 188, 200, 230, 261-267(5), 279-284(4), 297-302(2), 348-352(2), 363-368(4), 403-404(2)
- in /usr/src/games/warp/us.c line 58-60(2), 71-73(2), 124-126(2), 150-152(2), 319-321(2), 332-334(2), 353-355(2), 375-377(2)
- in /usr/src/games/warp/weapon.c line 79, 89, 133-134(2), 145-151(5), 168-173(2), 186-187(2), 203, 214-220(4), 230, 236, 250-260(5), 274-277(4), 296-302(4), 315-317(3), 325-332(4), 350-352(3), 370, 383-384(2), 394, 402-403(2), 412-414(3), 531(2), 541

roundsleep defined in line 54; used 9 times

- in /usr/src/games/warp/play.c line 58-60(2)
- in /usr/src/games/warp/score.c line 126, 656
- in /usr/src/games/warp/us.c line 204, 244, 252, 502
- in /usr/src/games/warp/warp.c line 322

#### Usage of this include

util.h used 12 times

- in /usr/src/games/warp/init.c line 31
- in /usr/src/games/warp/intrp.c line 24
- in /usr/src/games/warp/move.c line 25
- in /usr/src/games/warp/play.c line 21
- in /usr/src/games/warp/score.c line 26
- in /usr/src/games/warp/sig.c line 24
- in /usr/src/games/warp/term.c line 24
- in /usr/src/games/warp/them.c line 32
- in /usr/src/games/warp/us.c line 25
- in /usr/src/games/warp/util.c line 22
- in /usr/src/games/warp/warp.c line 131
- in /usr/src/games/warp/weapon.c line 25

Last modified: 1987-06-19 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 676 |