xref: /dragonfly/games/hack/hack.h (revision 3f5e28f4)
1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.h - version 1.0.3 */
3 /* $DragonFly: src/games/hack/hack.h,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
4 
5 #include "config.h"
6 #include <fcntl.h>
7 #include <signal.h>
8 #include <stdarg.h>
9 #include <stdbool.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <unistd.h>
14 
15 #ifndef BSD
16 #define	index	strchr
17 #define	rindex	strrchr
18 #endif /* BSD */
19 
20 #define	Null(type)	((struct type *) 0)
21 
22 #include	"def.objclass.h"
23 
24 typedef struct {
25 	xchar x,y;
26 } coord;
27 
28 #include	"def.monst.h"	/* uses coord */
29 #include	"def.gold.h"
30 #include	"def.trap.h"
31 #include	"def.obj.h"
32 #include	"def.flag.h"
33 #include	"def.mkroom.h"
34 #include	"def.wseg.h"
35 
36 #define	plur(x)	(((x) == 1) ? "" : "s")
37 
38 #define	BUFSZ	256	/* for getlin buffers */
39 #define	PL_NSIZ	32	/* name of player, ghost, shopkeeper */
40 
41 #include	"def.rm.h"
42 #include	"def.permonst.h"
43 
44 extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */
45 
46 #define	newstring(x)	(char *) alloc((unsigned)(x))
47 #include "hack.onames.h"
48 
49 #define ON 1
50 #define OFF 0
51 
52 extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg,
53 	*uleft, *uright, *fcobj;
54 extern struct obj *uchain;	/* defined iff PUNISHED */
55 extern struct obj *uball;	/* defined if PUNISHED */
56 
57 struct prop {
58 #define	TIMEOUT		007777	/* mask */
59 #define	LEFT_RING	W_RINGL	/* 010000L */
60 #define	RIGHT_RING	W_RINGR	/* 020000L */
61 #define	INTRINSIC	040000L
62 #define	LEFT_SIDE	LEFT_RING
63 #define	RIGHT_SIDE	RIGHT_RING
64 #define	BOTH_SIDES	(LEFT_SIDE | RIGHT_SIDE)
65 	long p_flgs;
66 	void (*p_tofn)(void);	/* called after timeout */
67 };
68 
69 struct you {
70 	xchar ux, uy;
71 	schar dx, dy, dz;	/* direction of move (or zap or ... ) */
72 #ifdef QUEST
73 	schar di;		/* direction of FF */
74 	xchar ux0, uy0;		/* initial position FF */
75 #endif /* QUEST */
76 	xchar udisx, udisy;	/* last display pos */
77 	char usym;		/* usually '@' */
78 	schar uluck;
79 #define	LUCKMAX		10	/* on moonlit nights 11 */
80 #define	LUCKMIN		(-10)
81 	int last_str_turn:3;	/* 0: none, 1: half turn, 2: full turn */
82 				/* +: turn right, -: turn left */
83 	unsigned udispl:1;	/* @ on display */
84 	unsigned ulevel:4;	/* 1 - 14 */
85 #ifdef QUEST
86 	unsigned uhorizon:7;
87 #endif /* QUEST */
88 	unsigned utrap:3;	/* trap timeout */
89 	unsigned utraptype:1;	/* defined if utrap nonzero */
90 #define	TT_BEARTRAP	0
91 #define	TT_PIT		1
92 	unsigned uinshop:6;	/* used only in shk.c - (roomno+1) of shop */
93 
94 
95 /* perhaps these #define's should also be generated by makedefs */
96 #define	TELEPAT		LAST_RING		/* not a ring */
97 #define	Telepat		u.uprops[TELEPAT].p_flgs
98 #define	FAST		(LAST_RING+1)		/* not a ring */
99 #define	Fast		u.uprops[FAST].p_flgs
100 #define	CONFUSION	(LAST_RING+2)		/* not a ring */
101 #define	Confusion	u.uprops[CONFUSION].p_flgs
102 #define	INVIS		(LAST_RING+3)		/* not a ring */
103 #define	Invis		u.uprops[INVIS].p_flgs
104 #define Invisible	(Invis && !See_invisible)
105 #define	GLIB		(LAST_RING+4)		/* not a ring */
106 #define	Glib		u.uprops[GLIB].p_flgs
107 #define	PUNISHED	(LAST_RING+5)		/* not a ring */
108 #define	Punished	u.uprops[PUNISHED].p_flgs
109 #define	SICK		(LAST_RING+6)		/* not a ring */
110 #define	Sick		u.uprops[SICK].p_flgs
111 #define	BLIND		(LAST_RING+7)		/* not a ring */
112 #define	Blind		u.uprops[BLIND].p_flgs
113 #define	WOUNDED_LEGS	(LAST_RING+8)		/* not a ring */
114 #define Wounded_legs	u.uprops[WOUNDED_LEGS].p_flgs
115 #define STONED		(LAST_RING+9)		/* not a ring */
116 #define Stoned		u.uprops[STONED].p_flgs
117 #define PROP(x) (x-RIN_ADORNMENT)       /* convert ring to index in uprops */
118 	unsigned umconf:1;
119 	const char *usick_cause;
120 	struct prop uprops[LAST_RING+10];
121 
122 	unsigned uswallow:1;		/* set if swallowed by a monster */
123 	unsigned uswldtim:4;		/* time you have been swallowed */
124 	unsigned uhs:3;			/* hunger state - see hack.eat.c */
125 	schar ustr,ustrmax;
126 	schar udaminc;
127 	schar uac;
128 	int uhp,uhpmax;
129 	long int ugold,ugold0,uexp,urexp;
130 	int uhunger;			/* refd only in eat.c and shk.c */
131 	int uinvault;
132 	struct monst *ustuck;
133 	int nr_killed[CMNUM+2];		/* used for experience bookkeeping */
134 };
135 
136 extern struct you u;
137 
138 extern const char *traps[];
139 extern char vowels[];
140 
141 extern xchar curx,cury;	/* cursor location on screen */
142 
143 extern coord bhitpos;	/* place where thrown weapon falls to the ground */
144 
145 extern xchar seehx,seelx,seehy,seely; /* where to see*/
146 extern const char *save_cm, *killer, *nomovemsg;
147 
148 extern xchar dlevel, maxdlevel; /* dungeon level */
149 
150 extern long moves;
151 
152 extern int multi;
153 
154 extern char lock[];
155 
156 extern const char *occtxt;
157 extern const char *hu_stat[];
158 
159 #define DIST(x1,y1,x2,y2)       (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2)))
160 
161 #define	PL_CSIZ		20	/* sizeof pl_character */
162 #define	MAX_CARR_CAP	120	/* so that boulders can be heavier */
163 #define	MAXLEVEL	40
164 #define	FAR	(COLNO+2)	/* position outside screen */
165 
166 extern schar xdir[], ydir[];
167 extern int hackpid, locknum, doorindex, done_stopprint;
168 extern char mlarge[], pl_character[PL_CSIZ], genocided[60], fut_geno[60];
169 extern char *hname, morc, plname[PL_NSIZ], sdir[];
170 extern boolean level_exists[], restoring, in_mklev;
171 extern struct permonst pm_eel, pm_ghost;
172 extern void (*afternmv)(void);
173 extern struct monst *mydogs;
174 extern bool (*occupation)(void);
175 
176 /* Non-static function prototypes */
177 
178 /* alloc.c */
179 void	*alloc(size_t);
180 
181 /* hack.apply.c */
182 int	doapply(void);
183 int	holetime(void);
184 void	dighole(void);
185 
186 /* hack.bones.c */
187 void	savebones(void);
188 int	getbones(void);
189 
190 /* hack.c */
191 void	unsee(void);
192 void	seeoff(bool);
193 void	domove(void);
194 int	dopickup(void);
195 void	pickup(int);
196 void	lookaround(void);
197 bool	monster_nearby(void);
198 bool	cansee(xchar, xchar);
199 int	sgn(int);
200 void	setsee(void);
201 void	nomul(int);
202 int	abon(void);
203 int	dbon(void);
204 void	losestr(int);
205 void	losehp(int, const char *);
206 void	losehp_m(int, struct monst *);
207 void	losexp(void);
208 int	inv_weight(void);
209 long	newuexp(void);
210 
211 /* hack.cmd.c */
212 void	rhack(const char *);
213 bool	movecmd(char);
214 bool	getdir(bool);
215 void	confdir(void);
216 #ifdef QUEST
217 void	finddir(void);
218 #endif
219 bool	isok(int, int);
220 
221 /* hack.do.c */
222 int		 dodrop(void);
223 void		 dropx(struct obj *);
224 int		 doddrop(void);
225 int		 dodown(void);
226 int		 doup(void);
227 void		 goto_level(int, bool);
228 int		 donull(void);
229 int		 dopray(void);
230 int		 dothrow(void);
231 struct obj	*splitobj(struct obj *, int);
232 void		 more_experienced(int, int);
233 void		 set_wounded_legs(long, int);
234 void		 heal_legs(void);
235 
236 /* hack.do_name.c */
237 coord	 getpos(int, const char *);
238 int	 do_mname(void);
239 int	 ddocall(void);
240 void	 docall(struct obj *);
241 char	*monnam(struct monst *);
242 char	*Monnam(struct monst *);
243 char	*amonnam(struct monst *, const char *);
244 char	*Amonnam(struct monst *, const char *);
245 char	*Xmonnam(struct monst *);
246 
247 /* hack.do_wear.c */
248 int		 doremarm(void);
249 int		 doremring(void);
250 bool		 armoroff(struct obj *);
251 int		 doweararm(void);
252 int		 dowearring(void);
253 void		 ringoff(struct obj *);
254 void		 find_ac(void);
255 void		 glibr(void);
256 struct obj	*some_armor(void);
257 void		 corrode_armor(void);
258 
259 /* hack.dog.c */
260 void	makedog(void);
261 void	losedogs(void);
262 void	keepdogs(void);
263 void	fall_down(struct monst *);
264 int	dog_move(struct monst *, int);
265 int	inroom(xchar, xchar);
266 bool	tamedog(struct monst *, struct obj *);
267 
268 /* hack.eat.c */
269 void	init_uhunger(void);
270 int	doeat(void);
271 void	gethungry(void);
272 void	morehungry(int);
273 void	lesshungry(int);
274 bool	poisonous(struct obj *);
275 
276 /* hack.end.c */
277 void	 done1(int);
278 void	 done_in_by(struct monst *);
279 void	 done(const char *);
280 void	 clearlocks(void);
281 #ifdef NOSAVEONHANGUP
282 void	 hangup(int);
283 #endif
284 char	*eos(char *);
285 void	 charcat(char *, char);
286 void	 prscore(int, char **);
287 
288 /* hack.engrave.c */
289 bool	sengr_at(const char *, xchar, xchar);
290 void	u_wipe_engr(int);
291 void	wipe_engr_at(xchar, xchar, xchar);
292 void	read_engr_at(int, int);
293 void	make_engr_at(int, int, const char *);
294 int	doengrave(void);
295 void	save_engravings(int);
296 void	rest_engravings(int);
297 
298 /* hack.fight.c */
299 int	hitmm(struct monst *, struct monst *);
300 void	mondied(struct monst *);
301 int	fightm(struct monst *);
302 bool	thitu(int, int, const char *);
303 bool	hmon(struct monst *, struct obj *, int);
304 bool	attack(struct monst *);
305 
306 /* hack.invent.c */
307 struct obj	*addinv(struct obj *);
308 void		 useup(struct obj *);
309 void		 freeinv(struct obj *);
310 void		 delobj(struct obj *);
311 void		 freeobj(struct obj *);
312 void		 freegold(struct gold *);
313 void		 deltrap(struct trap *);
314 struct monst	*m_at(int, int);
315 struct obj	*o_at(int, int);
316 struct obj	*sobj_at(int, int, int);
317 bool		 carried(struct obj *);
318 bool		 carrying(int);
319 struct obj	*o_on(unsigned int, struct obj *);
320 struct trap	*t_at(int, int);
321 struct gold	*g_at(int, int);
322 struct obj	*getobj(const char *, const char *);
323 int		 ggetobj(const char *, int (*)(struct obj *), int);
324 int		 askchain(struct obj *, char *, int, int (*)(struct obj *),
325 			  bool (*)(struct obj *), int);
326 void		 prinv(struct obj *);
327 int		 ddoinv(void);
328 int		 dotypeinv(void);
329 int		 dolook(void);
330 void		 stackobj(struct obj *);
331 int		 doprgold(void);
332 int		 doprwep(void);
333 int		 doprarm(void);
334 int		 doprring(void);
335 bool		 digit(char);
336 
337 /* hack.ioctl.c */
338 void	getioctls(void);
339 void	setioctls(void);
340 #ifdef SUSPEND
341 int	dosuspend(void);
342 #endif
343 
344 /* hack.lev.c */
345 void	savelev(int, xchar);
346 void	bwrite(int, char *, unsigned int);
347 void	saveobjchn(int, struct obj *);
348 void	savemonchn(int, struct monst *);
349 void	getlev(int, int, xchar);
350 void	mread(int, char *, unsigned int);
351 void	mklev(void);
352 
353 /* hack.main.c */
354 void	glo(int);
355 void	askname(void);
356 void	impossible(const char *, ...);
357 void	stop_occupation(void);
358 
359 /* hack.makemon.c */
360 struct monst	*makemon(struct permonst *, int, int);
361 coord		 enexto(xchar, xchar);
362 bool		 goodpos(int, int);
363 void		 rloc(struct monst *);
364 struct monst	*mkmon_at(char, int, int);
365 
366 /* hack.mhitu.c */
367 bool	mhitu(struct monst *);
368 bool	hitu(struct monst *, int);
369 
370 /* hack.mklev.c */
371 void	makelevel(void);
372 void	mktrap(int, int, struct mkroom *);
373 
374 /* hack.mkmaze.c */
375 void	makemaz(void);
376 coord	mazexy(void);
377 
378 /* hack.mkobj.c */
379 struct obj	*mkobj_at(int, int, int);
380 void		 mksobj_at(int, int, int);
381 struct obj	*mkobj(int);
382 struct obj	*mksobj(int);
383 bool		 letter(char);
384 int		 weight(struct obj *);
385 void		 mkgold(long, int, int);
386 
387 /* hack.mkshop.c */
388 #ifndef QUEST
389 void	mkshop(void);
390 void	mkzoo(int);
391 void	mkswamp(void);
392 #endif
393 
394 /* hack.mon.c */
395 void	movemon(void);
396 void	justswld(struct monst *, const char *);
397 void	youswld(struct monst *, int, int, const char *);
398 bool	dochug(struct monst *);
399 int	m_move(struct monst *, int);
400 int	mfndpos(struct monst *, coord *, int *, int);
401 int	dist(int, int);
402 void	poisoned(const char *, const char *);
403 void	mondead(struct monst *);
404 void	replmon(struct monst *, struct monst *);
405 void	relmon(struct monst *);
406 void	monfree(struct monst *);
407 void	unstuck(struct monst *);
408 void	killed(struct monst *);
409 void	kludge(const char *, const char *);
410 void	rescham(void);
411 bool	newcham(struct monst *, struct permonst *);
412 void	mnexto(struct monst *);
413 void	setmangry(struct monst *);
414 bool	canseemon(struct monst *);
415 
416 /* hack.o_init.c */
417 int	letindex(char);
418 void	init_objects(void);
419 int	probtype(char);
420 void	oinit(void);
421 void	savenames(int);
422 void	restnames(int);
423 int	dodiscovered(void);
424 
425 /* hack.objnam.c */
426 char		*typename(int);
427 char		*xname(struct obj *);
428 char		*doname(struct obj *);
429 void		 setan(const char *, char *);
430 char		*aobjnam(struct obj *, const char *);
431 char		*Doname(struct obj *);
432 struct obj	*readobjnam(char *);
433 
434 /* hack.options.c */
435 void	initoptions(void);
436 int	doset(void);
437 
438 /* hack.pager.c */
439 int	dowhatis(void);
440 void	set_whole_screen(void);
441 #ifdef NEWS
442 bool	readnews(void);
443 #endif
444 void	set_pager(int);
445 bool	page_line(const char *);
446 void	cornline(int, const char *);
447 int	dohelp(void);
448 bool	page_file(const char *, bool);
449 #ifdef UNIX
450 #ifdef SHELL
451 int	dosh(void);
452 #endif /* SHELL */
453 bool	child(bool);
454 #endif /* UNIX */
455 
456 /* hack.potion.c */
457 int	dodrink(void);
458 void	pluslvl(void);
459 void	strange_feeling(struct obj *, const char *);
460 void	potionhit(struct monst *, struct obj *);
461 void	potionbreathe(struct obj *);
462 int	dodip(void);
463 
464 /* hack.pri.c */
465 void	swallowed(void);
466 void	panic(const char *, ...);
467 void	atl(int, int, char);
468 void	on_scr(int, int);
469 void	tmp_at(schar, schar);
470 void	Tmp_at(schar, schar);
471 void	setclipped(void);
472 void	at(xchar, xchar, char);
473 void	prme(void);
474 int	doredraw(void);
475 void	docrt(void);
476 void	docorner(int, int);
477 void	curs_on_u(void);
478 void	pru(void);
479 void	prl(int, int);
480 char	news0(xchar, xchar);
481 void	newsym(int, int);
482 void	mnewsym(int, int);
483 void	nosee(int, int);
484 #ifndef QUEST
485 void	prl1(int, int);
486 void	nose1(int, int);
487 #endif
488 bool	vism_at(int, int);
489 void	unpobj(struct obj *);
490 void	seeobjs(void);
491 void	seemons(void);
492 void	pmon(struct monst *);
493 void	unpmon(struct monst *);
494 void	nscr(void);
495 void	bot(void);
496 #ifdef WAN_PROBING
497 void	mstatusline(struct monst *);
498 #endif
499 void	cls(void);
500 
501 /* hack.read.c */
502 int	doread(void);
503 int	identify(struct obj *);
504 void	litroom(bool);
505 
506 /* hack.rip.c */
507 void	outrip(void);
508 
509 /* hack.rumors.c */
510 void	outrumor(void);
511 
512 /* hack.save.c */
513 int		 dosave(void);
514 #ifndef NOSAVEONHANGUP
515 void		 hangup(int);
516 #endif
517 bool		 dorecover(int);
518 struct obj	*restobjchn(int);
519 struct monst	*restmonchn(int);
520 
521 /* hack.search.c */
522 int	findit(void);
523 int	dosearch(void);
524 int	doidtrap(void);
525 void	wakeup(struct monst *);
526 void	seemimic(struct monst *);
527 
528 /* hack.shk.c */
529 #ifdef QUEST
530 void		 obfree(struct obj *, struct obj *);
531 int		 inshop(void);
532 void		 shopdig(void);
533 void		 addtobill(void);
534 void		 subfrombill(void);
535 void		 splitbill(void);
536 int		 dopay(void);
537 void		 paybill(void);
538 int		 doinvbill(void);
539 void		 shkdead(void);
540 int		 shkcatch(void);
541 int		 shk_move(void);
542 void		 replshk(struct monst *, struct monst *);
543 const char	*shkname(void);
544 #else
545 char		*shkname(struct monst *);
546 void		 shkdead(struct monst *);
547 void		 replshk(struct monst *, struct monst *);
548 int		 inshop(void);
549 void		 obfree(struct obj *, struct obj *);
550 int		 dopay(void);
551 void		 paybill(void);
552 void		 addtobill(struct obj *);
553 void		 splitbill(struct obj *, struct obj *);
554 void		 subfrombill(struct obj *);
555 int		 doinvbill(int);
556 bool		 shkcatch(struct obj *);
557 int		 shk_move(struct monst *);
558 void		 shopdig(int);
559 #endif
560 bool		 online(int, int);
561 bool		 follower(struct monst *);
562 
563 /* hack.shknam.c */
564 void	findname(char *, char);
565 
566 /* hack.steal.c */
567 long	somegold(void);
568 void	stealgold(struct monst *);
569 bool	steal(struct monst *);
570 void	mpickobj(struct monst *, struct obj *);
571 bool	stealamulet(struct monst *);
572 void	relobj(struct monst *, int);
573 
574 /* hack.termcap.c */
575 void	startup(void);
576 void	start_screen(void);
577 void	end_screen(void);
578 void	curs(int, int);
579 void	cl_end(void);
580 void	clear_screen(void);
581 void	home(void);
582 void	standoutbeg(void);
583 void	standoutend(void);
584 void	backsp(void);
585 void	bell(void);
586 void	cl_eos(void);
587 
588 /* hack.timeout.c */
589 void	p_timeout(void);
590 
591 /* hack.topl.c */
592 int	doredotopl(void);
593 void	remember_topl(void);
594 void	addtopl(const char *);
595 void	more(void);
596 void	cmore(const char *);
597 void	clrlin(void);
598 void	pline(const char *, ...);
599 void	vpline(const char *, va_list);
600 void	putsym(char);
601 void	putstr(const char *);
602 
603 /* hack.track.c */
604 void	 initrack(void);
605 void	 settrack(void);
606 coord	*gettrack(int, int);
607 
608 /* hack.trap.c */
609 struct trap	*maketrap(int, int, int);
610 void		 dotrap(struct trap *);
611 int		 mintrap(struct monst *);
612 void		 selftouch(const char *);
613 void		 float_up(void);
614 void		 float_down(void);
615 void		 tele(void);
616 int		 dotele(void);
617 void		 placebc(int);
618 void		 unplacebc(void);
619 void		 level_tele(void);
620 void		 drown(void);
621 
622 /* hack.tty.c */
623 void	 gettty(void);
624 void	 settty(const char *);
625 void	 setftty(void);
626 void	 error(const char *, ...);
627 void	 getlin(char *);
628 void	 getret(void);
629 void	 cgetret(const char *);
630 void	 xwaitforspace(const char *);
631 char	*parse(void);
632 char	 readchar(void);
633 void	 end_of_input(void);
634 
635 /* hack.u_init.c */
636 void	u_init(void);
637 void	plnamesuffix(void);
638 
639 /* hack.unix.c */
640 void	 setrandom(void);
641 int	 getyear(void);
642 char	*getdate(void);
643 int	 phase_of_the_moon(void);
644 bool	 night(void);
645 bool	 midnight(void);
646 void	 gethdate(const char *);
647 bool	 uptodate(int);
648 void	 getlock(void);
649 #ifdef MAIL
650 void	 getmailstatus(void);
651 void	 ckmailstatus(void);
652 void	 readmail(void);
653 #endif
654 void	 regularize(char *);
655 
656 /* hack.vault.c */
657 void	setgd(void);
658 int	gd_move(void);
659 void	replgd(struct monst *, struct monst *);
660 void	invault(void);
661 #ifdef QUEST
662 void	gddead(struct monst *);
663 #else
664 void	gddead(void);
665 #endif
666 
667 /* hack.version.c */
668 int	doversion(void);
669 
670 /* hack.wield.c */
671 void	setuwep(struct obj *);
672 int	dowield(void);
673 void	corrode_weapon(void);
674 bool	chwepon(struct obj *, int);
675 
676 /* hack.wizard.c */
677 void	amulet(void);
678 bool	wiz_hit(struct monst *);
679 void	inrange(struct monst *);
680 
681 /* hack.worm.c */
682 #ifndef NOWORM
683 bool	getwn(struct monst *);
684 void	initworm(struct monst *);
685 void	worm_move(struct monst *);
686 void	worm_nomove(struct monst *);
687 void	wormdead(struct monst *);
688 void	wormhit(struct monst *);
689 void	wormsee(unsigned int);
690 void	pwseg(struct wseg *);
691 void	cutworm(struct monst *, xchar, xchar, uchar);
692 #endif
693 
694 /* hack.worn.c */
695 void	setworn(struct obj *, long);
696 void	setnotworn(struct obj *);
697 
698 /* hack.zap.c */
699 int		 dozap(void);
700 const char	*exclam(int);
701 void		 hit(const char *, struct monst *, const char *);
702 void		 miss(const char *, struct monst *);
703 struct monst	*bhit(int, int, int, char,
704 		      void (*)(struct monst *, struct obj *),
705 		      bool (*)(struct obj *, struct obj *), struct obj *);
706 struct monst	*boomhit(int, int);
707 void		 buzz(int, xchar, xchar, int, int);
708 void		 fracture_rock(struct obj *);
709 
710 /* rnd.c */
711 int	rn1(int, int);
712 int	rn2(int);
713 int	rnd(int);
714 int	d(int, int);
715