Home | History | Annotate | Line # | Download | only in larn
      1  1.22  gmcgarry /* $NetBSD: header.h,v 1.22 2008/08/29 00:37:38 gmcgarry Exp $	 */
      2   1.3   mycroft 
      3  1.11  christos /* header.h		Larn is copyrighted 1986 by Noah Morgan. */
      4   1.1       cgd 
      5   1.8       mrg #include <sys/types.h>
      6   1.8       mrg 
      7   1.1       cgd #define MAXLEVEL 11
      8  1.11  christos /* max # levels in the dungeon			 */
      9   1.1       cgd #define MAXVLEVEL 3
     10  1.11  christos /* max # of levels in the temple of the luran	 */
     11   1.1       cgd #define MAXX 67
     12   1.1       cgd #define MAXY 17
     13   1.1       cgd 
     14   1.1       cgd #define SCORESIZE 10
     15  1.11  christos /* this is the number of people on a scoreboard max */
     16   1.1       cgd #define MAXPLEVEL 100
     17  1.11  christos /* maximum player level allowed		 */
     18   1.1       cgd #define MAXMONST 56
     19  1.11  christos /* maximum # monsters in the dungeon	 */
     20   1.1       cgd #define SPNUM 38
     21  1.16       wiz /* maximum number of spells in existence	 */
     22   1.1       cgd #define MAXSCROLL 28
     23  1.11  christos /* maximum number of scrolls that are possible	 */
     24   1.1       cgd #define MAXPOTION 35
     25  1.11  christos /* maximum number of potions that are possible	 */
     26   1.1       cgd #define TIMELIMIT 30000
     27  1.11  christos /* the maximum number of moves before the game is called */
     28   1.1       cgd #define TAXRATE 1/20
     29  1.11  christos /* the tax rate for the LRS */
     30   1.1       cgd #define MAXOBJ 93
     31  1.11  christos /* the maximum number of objects   n < MAXOBJ */
     32   1.1       cgd 
     33  1.11  christos /* this is the structure definition of the monster data	 */
     34  1.11  christos struct monst {
     35  1.17  dholland 	const char     *name;
     36  1.11  christos 	char            level;
     37  1.11  christos 	short           armorclass;
     38  1.11  christos 	char            damage;
     39  1.11  christos 	char            attack;
     40  1.11  christos 	char            defense;
     41  1.11  christos 	char            genocided;
     42  1.11  christos 	char            intelligence;	/* monsters intelligence -- used to
     43  1.11  christos 					 * choose movement */
     44  1.11  christos 	short           gold;
     45  1.11  christos 	short           hitpoints;
     46  1.11  christos 	unsigned long   experience;
     47  1.11  christos };
     48  1.11  christos 
     49  1.11  christos /* this is the structure definition for the items in the dnd store */
     50  1.11  christos struct _itm {
     51  1.11  christos 	short           price;
     52  1.11  christos 	u_char          obj;
     53  1.11  christos 	u_char          arg;
     54  1.11  christos 	char            qty;
     55  1.11  christos };
     56  1.11  christos 
     57  1.11  christos /* this is the structure that holds the entire dungeon specifications	 */
     58  1.11  christos struct cel {
     59  1.11  christos 	short           hitp;	/* monster's hit points	 */
     60  1.11  christos 	char            mitem;	/* the monster ID			 */
     61  1.11  christos 	char            item;	/* the object's ID			 */
     62  1.11  christos 	short           iarg;	/* the object's argument	 */
     63  1.11  christos 	char            know;	/* have we been here before */
     64  1.11  christos };
     65   1.1       cgd 
     66   1.1       cgd /* this is the structure for maintaining & moving the spheres of annihilation */
     67  1.11  christos struct sphere {
     68  1.11  christos 	struct sphere  *p;	/* pointer to next structure */
     69  1.11  christos 	char            x, y, lev;	/* location of the sphere */
     70  1.11  christos 	char            dir;	/* direction sphere is going in */
     71  1.11  christos 	short           lifetime;	/* duration of the sphere */
     72  1.11  christos };
     73  1.11  christos 
     74  1.11  christos /* defines for the character attribute array	c[]	 */
     75  1.11  christos #define STRENGTH 0		/* characters physical strength not due to
     76  1.11  christos 				 * objects */
     77   1.1       cgd #define INTELLIGENCE 1
     78   1.1       cgd #define WISDOM 2
     79   1.1       cgd #define CONSTITUTION 3
     80   1.1       cgd #define DEXTERITY 4
     81   1.1       cgd #define CHARISMA 5
     82   1.1       cgd #define HPMAX 6
     83   1.1       cgd #define HP 7
     84   1.1       cgd #define GOLD 8
     85   1.1       cgd #define EXPERIENCE 9
     86   1.1       cgd #define LEVEL 10
     87   1.1       cgd #define REGEN 11
     88   1.1       cgd #define WCLASS 12
     89   1.1       cgd #define AC 13
     90   1.1       cgd #define BANKACCOUNT 14
     91   1.1       cgd #define SPELLMAX 15
     92   1.1       cgd #define SPELLS 16
     93   1.1       cgd #define ENERGY 17
     94   1.1       cgd #define ECOUNTER 18
     95   1.1       cgd #define MOREDEFENSES 19
     96   1.1       cgd #define WEAR 20
     97   1.1       cgd #define PROTECTIONTIME 21
     98   1.1       cgd #define WIELD 22
     99   1.1       cgd #define AMULET 23
    100   1.1       cgd #define REGENCOUNTER 24
    101   1.1       cgd #define MOREDAM 25
    102   1.1       cgd #define DEXCOUNT 26
    103   1.1       cgd #define STRCOUNT 27
    104   1.1       cgd #define BLINDCOUNT 28
    105   1.1       cgd #define CAVELEVEL 29
    106   1.1       cgd #define CONFUSE 30
    107   1.1       cgd #define ALTPRO 31
    108   1.1       cgd #define HERO 32
    109   1.1       cgd #define CHARMCOUNT 33
    110   1.1       cgd #define INVISIBILITY 34
    111   1.1       cgd #define CANCELLATION 35
    112   1.1       cgd #define HASTESELF 36
    113   1.1       cgd #define EYEOFLARN 37
    114   1.1       cgd #define AGGRAVATE 38
    115   1.1       cgd #define GLOBE 39
    116   1.1       cgd #define TELEFLAG 40
    117   1.1       cgd #define SLAYING 41
    118   1.1       cgd #define NEGATESPIRIT 42
    119   1.1       cgd #define SCAREMONST 43
    120   1.1       cgd #define AWARENESS 44
    121   1.1       cgd #define HOLDMONST 45
    122   1.1       cgd #define TIMESTOP 46
    123   1.1       cgd #define HASTEMONST 47
    124   1.1       cgd #define CUBEofUNDEAD 48
    125   1.1       cgd #define GIANTSTR 49
    126   1.1       cgd #define FIRERESISTANCE 50
    127   1.1       cgd #define BESSMANN 51
    128   1.1       cgd #define NOTHEFT 52
    129   1.1       cgd #define HARDGAME 53
    130   1.1       cgd #define CPUTIME 54
    131   1.1       cgd #define BYTESIN 55
    132   1.1       cgd #define BYTESOUT 56
    133   1.1       cgd #define MOVESMADE 57
    134   1.1       cgd #define MONSTKILLED 58
    135   1.1       cgd #define SPELLSCAST 59
    136   1.1       cgd #define LANCEDEATH 60
    137   1.1       cgd #define SPIRITPRO 61
    138   1.1       cgd #define UNDEADPRO 62
    139   1.1       cgd #define SHIELD 63
    140   1.1       cgd #define STEALTH 64
    141   1.1       cgd #define ITCHING 65
    142   1.1       cgd #define LAUGHING 66
    143   1.1       cgd #define DRAINSTRENGTH 67
    144   1.1       cgd #define CLUMSINESS 68
    145   1.1       cgd #define INFEEBLEMENT 69
    146   1.1       cgd #define HALFDAM 70
    147   1.1       cgd #define SEEINVISIBLE 71
    148   1.1       cgd #define FILLROOM 72
    149   1.1       cgd #define RANDOMWALK 73
    150  1.11  christos #define SPHCAST 74		/* nz if an active sphere of annihilation */
    151  1.11  christos #define WTW 75			/* walk through walls */
    152  1.11  christos #define STREXTRA 76		/* character strength due to objects or
    153  1.11  christos 				 * enchantments */
    154  1.11  christos #define TMP 77			/* misc scratch space */
    155  1.11  christos #define LIFEPROT 78		/* life protection counter */
    156   1.1       cgd 
    157  1.11  christos /* defines for the objects in the game		 */
    158   1.1       cgd 
    159   1.1       cgd #define OALTAR 1
    160   1.1       cgd #define OTHRONE 2
    161   1.1       cgd #define OORB 3
    162   1.1       cgd #define OPIT 4
    163   1.1       cgd #define OSTAIRSUP 5
    164   1.1       cgd #define OELEVATORUP 6
    165   1.1       cgd #define OFOUNTAIN 7
    166   1.1       cgd #define OSTATUE 8
    167   1.1       cgd #define OTELEPORTER 9
    168   1.1       cgd #define OSCHOOL 10
    169   1.1       cgd #define OMIRROR 11
    170   1.1       cgd #define ODNDSTORE 12
    171   1.1       cgd #define OSTAIRSDOWN 13
    172   1.1       cgd #define OELEVATORDOWN 14
    173   1.1       cgd #define OBANK2 15
    174   1.1       cgd #define OBANK 16
    175   1.1       cgd #define ODEADFOUNTAIN 17
    176   1.1       cgd #define OMAXGOLD 70
    177   1.1       cgd #define OGOLDPILE 18
    178   1.1       cgd #define OOPENDOOR 19
    179   1.1       cgd #define OCLOSEDDOOR 20
    180   1.1       cgd #define OWALL 21
    181   1.1       cgd #define OTRAPARROW 66
    182   1.1       cgd #define OTRAPARROWIV 67
    183   1.1       cgd 
    184   1.1       cgd #define OLARNEYE 22
    185   1.1       cgd 
    186   1.1       cgd #define OPLATE 23
    187   1.1       cgd #define OCHAIN 24
    188   1.1       cgd #define OLEATHER 25
    189   1.1       cgd #define ORING 60
    190   1.1       cgd #define OSTUDLEATHER 61
    191   1.1       cgd #define OSPLINT 62
    192   1.1       cgd #define OPLATEARMOR 63
    193   1.1       cgd #define OSSPLATE 64
    194   1.1       cgd #define OSHIELD 68
    195   1.1       cgd #define OELVENCHAIN 92
    196   1.1       cgd 
    197   1.1       cgd #define OSWORDofSLASHING 26
    198   1.1       cgd #define OHAMMER 27
    199   1.1       cgd #define OSWORD 28
    200   1.1       cgd #define O2SWORD 29
    201   1.1       cgd #define OSPEAR 30
    202   1.1       cgd #define ODAGGER 31
    203   1.1       cgd #define OBATTLEAXE 57
    204   1.1       cgd #define OLONGSWORD 58
    205   1.1       cgd #define OFLAIL 59
    206   1.1       cgd #define OLANCE 65
    207   1.1       cgd #define OVORPAL 90
    208   1.1       cgd #define OSLAYER 91
    209   1.1       cgd 
    210   1.1       cgd #define ORINGOFEXTRA 32
    211   1.1       cgd #define OREGENRING 33
    212   1.1       cgd #define OPROTRING 34
    213   1.1       cgd #define OENERGYRING 35
    214   1.1       cgd #define ODEXRING 36
    215   1.1       cgd #define OSTRRING 37
    216   1.1       cgd #define OCLEVERRING 38
    217   1.1       cgd #define ODAMRING 39
    218   1.1       cgd 
    219   1.1       cgd #define OBELT 40
    220   1.1       cgd 
    221   1.1       cgd #define OSCROLL 41
    222   1.1       cgd #define OPOTION 42
    223   1.1       cgd #define OBOOK 43
    224  1.11  christos #define OCHEST 44
    225   1.1       cgd #define OAMULET 45
    226   1.1       cgd 
    227   1.1       cgd #define OORBOFDRAGON 46
    228   1.1       cgd #define OSPIRITSCARAB 47
    229   1.1       cgd #define OCUBEofUNDEAD 48
    230   1.1       cgd #define ONOTHEFT 49
    231   1.1       cgd 
    232   1.1       cgd #define ODIAMOND 50
    233   1.1       cgd #define ORUBY 51
    234   1.1       cgd #define OEMERALD 52
    235   1.1       cgd #define OSAPPHIRE 53
    236   1.1       cgd 
    237   1.1       cgd #define OENTRANCE 54
    238   1.1       cgd #define OVOLDOWN 55
    239   1.1       cgd #define OVOLUP 56
    240   1.1       cgd #define OHOME 69
    241   1.1       cgd 
    242   1.1       cgd #define OKGOLD 71
    243   1.1       cgd #define ODGOLD 72
    244   1.1       cgd #define OIVDARTRAP 73
    245   1.1       cgd #define ODARTRAP 74
    246   1.1       cgd #define OTRAPDOOR 75
    247   1.1       cgd #define OIVTRAPDOOR 76
    248   1.1       cgd #define OTRADEPOST 77
    249   1.1       cgd #define OIVTELETRAP 78
    250   1.1       cgd #define ODEADTHRONE 79
    251  1.11  christos #define OANNIHILATION 80	/* sphere of annihilation */
    252   1.1       cgd #define OTHRONE2 81
    253  1.11  christos #define OLRS 82			/* Larn Revenue Service */
    254   1.1       cgd #define OCOOKIE 83
    255   1.1       cgd #define OURN 84
    256   1.1       cgd #define OBRASSLAMP 85
    257   1.1       cgd #define OHANDofFEAR 86		/* hand of fear */
    258   1.1       cgd #define OSPHTAILSMAN 87		/* tailsman of the sphere */
    259  1.11  christos #define OWWAND 88		/* wand of wonder */
    260  1.11  christos #define OPSTAFF 89		/* staff of power */
    261   1.1       cgd /* used up to 92 */
    262   1.1       cgd 
    263  1.11  christos /* defines for the monsters as objects		 */
    264   1.1       cgd 
    265  1.11  christos #define BAT 1
    266  1.11  christos #define GNOME 2
    267  1.11  christos #define HOBGOBLIN 3
    268  1.11  christos #define JACKAL 4
    269  1.11  christos #define KOBOLD 5
    270  1.11  christos #define ORC 6
    271   1.1       cgd #define SNAKE 7
    272   1.1       cgd #define CENTIPEDE 8
    273  1.11  christos #define JACULI 9
    274  1.11  christos #define TROGLODYTE 10
    275  1.11  christos #define ANT 11
    276  1.11  christos #define EYE 12
    277   1.1       cgd #define LEPRECHAUN 13
    278  1.11  christos #define NYMPH 14
    279  1.11  christos #define QUASIT 15
    280  1.11  christos #define RUSTMONSTER 16
    281  1.11  christos #define ZOMBIE 17
    282  1.11  christos #define ASSASSINBUG 18
    283  1.11  christos #define BUGBEAR 19
    284  1.11  christos #define HELLHOUND 20
    285  1.11  christos #define ICELIZARD 21
    286  1.11  christos #define CENTAUR 22
    287  1.11  christos #define TROLL 23
    288  1.11  christos #define YETI 24
    289  1.11  christos #define WHITEDRAGON 25
    290  1.11  christos #define ELF 26
    291  1.11  christos #define CUBE 27
    292  1.11  christos #define METAMORPH 28
    293  1.11  christos #define VORTEX 29
    294  1.11  christos #define ZILLER 30
    295  1.11  christos #define VIOLETFUNGI 31
    296  1.11  christos #define WRAITH 32
    297  1.11  christos #define FORVALAKA 33
    298  1.11  christos #define LAMANOBE 34
    299  1.11  christos #define OSEQUIP 35
    300  1.11  christos #define ROTHE 36
    301  1.11  christos #define XORN 37
    302  1.11  christos #define VAMPIRE 38
    303  1.11  christos #define INVISIBLESTALKER 39
    304  1.11  christos #define POLTERGEIST 40
    305  1.11  christos #define DISENCHANTRESS 41
    306  1.11  christos #define SHAMBLINGMOUND 42
    307   1.1       cgd #define YELLOWMOLD 43
    308   1.1       cgd #define UMBERHULK 44
    309   1.1       cgd #define GNOMEKING 45
    310   1.1       cgd #define MIMIC 46
    311   1.1       cgd #define WATERLORD 47
    312   1.1       cgd #define BRONZEDRAGON 48
    313   1.1       cgd #define GREENDRAGON 49
    314   1.1       cgd #define PURPLEWORM 50
    315   1.1       cgd #define XVART 51
    316   1.1       cgd #define SPIRITNAGA 52
    317   1.1       cgd #define SILVERDRAGON 53
    318   1.1       cgd #define PLATINUMDRAGON 54
    319   1.1       cgd #define GREENURCHIN 55
    320   1.1       cgd #define REDDRAGON 56
    321   1.1       cgd #define DEMONLORD 57
    322   1.1       cgd #define DEMONPRINCE 64
    323   1.1       cgd 
    324  1.14       agc #ifndef NULL
    325   1.1       cgd #define NULL 0
    326  1.14       agc #endif
    327  1.11  christos #define BUFBIG	4096		/* size of the output buffer */
    328  1.11  christos #define MAXIBUF	4096		/* size of the input buffer */
    329  1.11  christos #define LOGNAMESIZE 40		/* max size of the players name */
    330  1.11  christos #define PSNAMESIZE 40		/* max size of the process name */
    331   1.1       cgd 
    332   1.1       cgd #ifndef NODEFS
    333  1.11  christos extern char     VERSION, SUBVERSION;
    334  1.19  dholland extern u_char   beenhere[], boldon, cheat, ckpflag;
    335  1.17  dholland extern const char *class[];
    336  1.17  dholland extern u_char   course[];
    337  1.11  christos extern char     diagfile[], helpfile[], ckpfile[], larnlevels[],
    338  1.13  christos 		playerids[], optsfile[1024], psname[], savefilename[],
    339  1.11  christos 		scorefile[];
    340  1.21  dholland extern u_char  *inbuffer;
    341  1.11  christos extern u_char   item[MAXX][MAXY], iven[], know[MAXX][MAXY];
    342  1.17  dholland extern const char *levelname[];
    343  1.17  dholland extern char     logfile[], loginname[], logname[], lastmonst[];
    344  1.11  christos extern u_char  *lpbuf, *lpend;
    345  1.11  christos extern u_char  *lpnt, moved[MAXX][MAXY], mitem[MAXX][MAXY], monstlevel[];
    346  1.11  christos extern char     monstnamelist[], objnamelist[];
    347  1.11  christos extern u_char   nch[], ndgg[], nlpts[], nomove, nosignal, nowelcome;
    348  1.11  christos extern u_char   nplt[], nsw[];
    349  1.17  dholland extern const char *objectname[];
    350  1.17  dholland extern const char *potionhide[], *potionname[];
    351  1.17  dholland extern const char *spelcode[], *spelname[], *spelmes[];
    352  1.17  dholland extern char     aborted[], spelweird[MAXMONST + 8][SPNUM];
    353  1.11  christos extern u_char   potprob[];
    354  1.11  christos extern u_char   predostuff, restorflag, scprob[];
    355  1.11  christos extern u_char   screen[MAXX][MAXY], sex;
    356  1.17  dholland extern const char *speldescript[];
    357  1.17  dholland extern const char *scrollhide[], *scrollname[];
    358  1.11  christos extern u_char   spelknow[];
    359  1.21  dholland extern u_char   splev[], stealth[MAXX][MAXY], wizard;
    360  1.11  christos extern short    diroffx[], diroffy[], hitflag, hit2flag, hit3flag, hitp[MAXX][MAXY];
    361  1.11  christos extern short    iarg[MAXX][MAXY], ivenarg[], lasthx, lasthy, lastnum, lastpx,
    362  1.11  christos                 lastpy;
    363  1.11  christos extern short    nobeep, oldx, oldy, playerx, playery, level;
    364  1.20  dholland extern int      enable_scroll, srcount, yrepcount, userid, wisid,
    365  1.17  dholland 		io_outfd, io_infd;
    366  1.18  dholland extern gid_t    gid, egid;
    367  1.12   thorpej extern long     outstanding_taxes, skill[], gltime, c[], cbak[];
    368  1.12   thorpej extern time_t	initialtime;
    369   1.1       cgd extern unsigned long randx;
    370   1.1       cgd extern struct cel *cell;
    371   1.1       cgd extern struct monst monster[];
    372   1.1       cgd extern struct sphere *spheres;
    373   1.1       cgd extern struct _itm itm[];
    374  1.19  dholland extern int      rmst, lasttime;
    375   1.1       cgd 
    376  1.11  christos /* macro to create scroll #'s with probability of occurrence */
    377   1.1       cgd #define newscroll() (scprob[rund(81)])
    378  1.11  christos /* macro to return a potion # created with probability of occurrence */
    379   1.1       cgd #define newpotion() (potprob[rund(41)])
    380  1.11  christos /* macro to return the + points on created leather armor */
    381   1.1       cgd #define newleather() (nlpts[rund(c[HARDGAME]?13:15)])
    382  1.11  christos /* macro to return the + points on chain armor */
    383   1.1       cgd #define newchain() (nch[rund(10)])
    384  1.11  christos /* macro to return + points on plate armor */
    385   1.1       cgd #define newplate() (nplt[rund(c[HARDGAME]?4:12)])
    386  1.11  christos /* macro to return + points on new daggers */
    387   1.1       cgd #define newdagger() (ndgg[rund(13)])
    388  1.11  christos /* macro to return + points on new swords */
    389   1.1       cgd #define newsword() (nsw[rund(c[HARDGAME]?6:13)])
    390  1.11  christos /* macro to destroy object at present location */
    391   1.1       cgd #define forget() (item[playerx][playery]=know[playerx][playery]=0)
    392  1.11  christos /* macro to wipe out a monster at a location */
    393   1.1       cgd #define disappear(x,y) (mitem[x][y]=know[x][y]=0)
    394   1.1       cgd 
    395   1.1       cgd #ifdef VT100
    396  1.11  christos /* macro to turn on bold display for the terminal */
    397   1.1       cgd #define setbold() (lprcat(boldon?"\33[1m":"\33[7m"))
    398  1.11  christos /* macro to turn off bold display for the terminal */
    399   1.1       cgd #define resetbold() (lprcat("\33[m"))
    400  1.11  christos /* macro to setup the scrolling region for the terminal */
    401   1.1       cgd #define setscroll() (lprcat("\33[20;24r"))
    402  1.11  christos /* macro to clear the scrolling region for the terminal */
    403   1.1       cgd #define resetscroll() (lprcat("\33[;24r"))
    404  1.11  christos /* macro to clear the screen and home the cursor */
    405   1.1       cgd #define clear() (lprcat("\33[2J\33[f"), cbak[SPELLS]= -50)
    406   1.1       cgd #define cltoeoln() lprcat("\33[K")
    407  1.11  christos #else	/* VT100 */
    408  1.11  christos /* defines below are for use in the termcap mode only */
    409   1.1       cgd #define ST_START 1
    410   1.1       cgd #define ST_END   2
    411   1.1       cgd #define BOLD     3
    412   1.1       cgd #define END_BOLD 4
    413   1.1       cgd #define CLEAR    5
    414   1.1       cgd #define CL_LINE  6
    415   1.1       cgd #define CL_DOWN 14
    416   1.1       cgd #define CURSOR  15
    417  1.11  christos /* macro to turn on bold display for the terminal */
    418   1.1       cgd #define setbold() (*lpnt++ = ST_START)
    419  1.11  christos /* macro to turn off bold display for the terminal */
    420   1.1       cgd #define resetbold() (*lpnt++ = ST_END)
    421  1.11  christos /* macro to setup the scrolling region for the terminal */
    422   1.1       cgd #define setscroll() enable_scroll=1
    423  1.11  christos /* macro to clear the scrolling region for the terminal */
    424   1.1       cgd #define resetscroll() enable_scroll=0
    425  1.11  christos /* macro to clear the screen and home the cursor */
    426   1.1       cgd #define clear() (*lpnt++ =CLEAR, cbak[SPELLS]= -50)
    427  1.11  christos /* macro to clear to end of line */
    428   1.1       cgd #define cltoeoln() (*lpnt++ = CL_LINE)
    429  1.11  christos #endif	/* VT100 */
    430   1.1       cgd 
    431  1.11  christos /* macro to output one byte to the output buffer */
    432  1.22  gmcgarry #define lprc(ch) ((lpnt>=lpend)?(void)(*lpnt++ = (ch), lflush()):(void)(*lpnt++ = (ch)))
    433   1.1       cgd 
    434  1.11  christos /* macro to seed the random number generator */
    435  1.15     perry #define seedrand(x) (randx=x)
    436   1.1       cgd #ifdef MACRORND
    437  1.11  christos /* macros to generate random numbers   1<=rnd(N)<=N   0<=rund(N)<=N-1 */
    438   1.1       cgd #define rnd(x)  ((((randx=randx*1103515245+12345)>>7)%(x))+1)
    439   1.1       cgd #define rund(x) ((((randx=randx*1103515245+12345)>>7)%(x))  )
    440  1.11  christos #endif	/* MACRORND */
    441  1.11  christos /* macros for miscellaneous data conversion */
    442   1.1       cgd #define min(x,y) (((x)>(y))?(y):(x))
    443   1.1       cgd #define max(x,y) (((x)>(y))?(x):(y))
    444  1.11  christos #endif	/* NODEFS */
    445