1/*	$NetBSD: extern.h,v 1.19 2021/05/02 12:50:44 rillig Exp $	*/
2
3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Christos Zoulas.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31#ifndef _EXTERN_H_
32#define _EXTERN_H_
33#include <stdarg.h>
34#include <stdio.h>
35
36/* alloc.c */
37void *alloc(size_t);
38
39/* hack.apply.c */
40int doapply(void);
41int holetime(void);
42void dighole(void);
43
44/* hack.bones.c */
45void savebones(void);
46int getbones(void);
47
48/* hack.c */
49void unsee(void);
50void seeoff(int);
51void domove(void);
52int dopickup(void);
53void pickup(int);
54void lookaround(void);
55int monster_nearby(void);
56int rroom(int, int);
57int cansee(xchar, xchar);
58int sgn(int);
59void setsee(void);
60void nomul(int);
61int abon(void);
62int dbon(void);
63void losestr(int);
64void losehp(int, const char *);
65void losehp_m(int, struct monst *);
66void losexp(void);
67int inv_weight(void);
68long newuexp(void);
69
70/* hack.cmd.c */
71void rhack(const char *);
72int movecmd(int);
73int getdir(boolean);
74void confdir(void);
75int finddir(void);
76int isroom(int, int);
77int isok(int, int);
78
79/* hack.do.c */
80int dodrop(void);
81void dropx(struct obj *);
82int doddrop(void);
83int dodown(void);
84int doup(void);
85void goto_level(int, boolean);
86int donull(void);
87int dopray(void);
88int dothrow(void);
89struct obj *splitobj(struct obj *, int);
90void more_experienced(int, int);
91void set_wounded_legs(long, int);
92void heal_legs(void);
93
94/* hack.do_name.c */
95coord getpos(int, const char *);
96int do_mname(void);
97int ddocall(void);
98void docall(struct obj *);
99char *monnam(struct monst *);
100char *Monnam(struct monst *);
101char *amonnam(struct monst *, const char *);
102char *Amonnam(struct monst *, const char *);
103char *Xmonnam(struct monst *);
104
105/* hack.do_wear.c */
106int doremarm(void);
107int doremring(void);
108int armoroff(struct obj *);
109int doweararm(void);
110int dowearring(void);
111void ringoff(struct obj *);
112void find_ac(void);
113void glibr(void);
114struct obj *some_armor(void);
115void corrode_armor(void);
116
117/* hack.dog.c */
118void makedog(void);
119void losedogs(void);
120void keepdogs(void);
121void fall_down(struct monst *);
122int dog_move(struct monst *, int);
123int inroom(xchar, xchar);
124int tamedog(struct monst *, struct obj *);
125
126/* hack.eat.c */
127void init_uhunger(void);
128int doeat(void);
129void gethungry(void);
130void morehungry(int);
131void lesshungry(int);
132int poisonous(struct obj *);
133
134/* hack.end.c */
135int dodone(void);
136void done1(int);
137void done_in_by(struct monst *);
138void done(const char *);
139void clearlocks(void);
140void hang_up(int) __dead;
141char *eos(char *);
142void charcat(char *, int);
143void prscore(int, char **);
144
145/* hack.engrave.c */
146int sengr_at(const char *, xchar, xchar);
147void u_wipe_engr(int);
148void wipe_engr_at(xchar, xchar, xchar);
149void read_engr_at(int, int);
150void make_engr_at(int, int, const char *);
151int doengrave(void);
152void save_engravings(int);
153void rest_engravings(int);
154
155/* hack.fight.c */
156int hitmm(struct monst *, struct monst *);
157void mondied(struct monst *);
158int fightm(struct monst *);
159int thitu(int, int, const char *);
160boolean hmon(struct monst *, struct obj *, int);
161int attack(struct monst *);
162
163/* hack.invent.c */
164struct obj *addinv(struct obj *);
165void useup(struct obj *);
166void freeinv(struct obj *);
167void delobj(struct obj *);
168void freeobj(struct obj *);
169void freegold(struct gold *);
170void deltrap(struct trap *);
171struct monst *m_at(int, int);
172struct obj *o_at(int, int);
173struct obj *sobj_at(int, int, int);
174int carried(struct obj *);
175int carrying(int);
176struct obj *o_on(unsigned int, struct obj *);
177struct trap *t_at(int, int);
178struct gold *g_at(int, int);
179struct obj *getobj(const char *, const char *);
180int ggetobj(const char *, int (*fn)(struct obj *), int);
181int askchain(struct obj *, char *, int, int (*)(struct obj *),
182    int (*)(struct obj *), int);
183void prinv(struct obj *);
184int ddoinv(void);
185int dotypeinv(void);
186int dolook(void);
187void stackobj(struct obj *);
188int doprgold(void);
189int doprwep(void);
190int doprarm(void);
191int doprring(void);
192int digit(int);
193
194/* hack.ioctl.c */
195void getioctls(void);
196void setioctls(void);
197int dosuspend(void);
198
199/* hack.lev.c */
200void savelev(int, xchar);
201void bwrite(int, const void *, size_t);
202void saveobjchn(int, struct obj *);
203void savemonchn(int, struct monst *);
204void getlev(int, int, xchar);
205void mread(int, void *, size_t);
206void mklev(void);
207
208/* hack.main.c */
209void glo(int);
210void askname(void);
211void impossible(const char *, ...) __printflike(1, 2);
212void stop_occupation(void);
213
214/* hack.makemon.c */
215struct monst *makemon(const struct permonst *, int, int);
216coord enexto(xchar, xchar);
217int goodpos(int, int);
218void rloc(struct monst *);
219struct monst *mkmon_at(int, int, int);
220
221/* hack.mhitu.c */
222int mhitu(struct monst *);
223int hitu(struct monst *, int);
224
225/* hack.mklev.c */
226struct mkroom;
227void makelevel(void);
228void mktrap(int, int, struct mkroom *);
229
230/* hack.mkmaze.c */
231void makemaz(void);
232coord mazexy(void);
233
234/* hack.mkobj.c */
235struct obj *mkobj_at(int, int, int);
236void mksobj_at(int, int, int);
237struct obj *mkobj(int);
238struct obj *mksobj(int);
239int letter(int);
240int weight(struct obj *);
241void mkgold(long, int, int);
242
243/* hack.mkshop.c */
244void mkshop(void);
245void mkzoo(int);
246void mkswamp(void);
247
248/* hack.mon.c */
249void movemon(void);
250void justswld(struct monst *, const char *);
251void youswld(struct monst *, int, unsigned int, const char *);
252int dochug(struct monst *);
253int m_move(struct monst *, int);
254int mfndpos(struct monst *, coord[9 ], int[9 ], int);
255int dist(int, int);
256void poisoned(const char *, const char *);
257void mondead(struct monst *);
258void replmon(struct monst *, struct monst *);
259void relmon(struct monst *);
260void monfree(struct monst *);
261void unstuck(struct monst *);
262void killed(struct monst *);
263void kludge(const char *, const char *);
264void rescham(void);
265int newcham(struct monst *, const struct permonst *);
266void mnexto(struct monst *);
267void setmangry(struct monst *);
268int canseemon(struct monst *);
269
270/* hack.monst.c */
271
272/* hack.o_init.c */
273int letindex(int);
274void init_objects(void);
275int probtype(int);
276void oinit(void);
277void savenames(int);
278void restnames(int);
279int dodiscovered(void);
280
281/* hack.objnam.c */
282char *typename(int);
283char *xname(struct obj *);
284char *doname(struct obj *);
285void setan(const char *, char *, size_t);
286char *aobjnam(struct obj *, const char *);
287char *Doname(struct obj *);
288struct obj *readobjnam(char *);
289
290/* hack.options.c */
291void initoptions(void);
292int doset(void);
293
294/* hack.pager.c */
295int dowhatis(void);
296void set_whole_screen(void);
297int readnews(void);
298void set_pager(int);
299int page_line(const char *);
300void cornline(int, const char *);
301int dohelp(void);
302int dosh(void);
303
304/* hack.potion.c */
305int dodrink(void);
306void pluslvl(void);
307void strange_feeling(struct obj *, const char *);
308void potionhit(struct monst *, struct obj *);
309void potionbreathe(struct obj *);
310int dodip(void);
311
312/* hack.pri.c */
313void swallowed(void);
314void panic(const char *, ...) __printflike(1, 2);
315void atl(int, int, int);
316void on_scr(int, int);
317void tmp_at(schar, schar);
318void Tmp_at(schar, schar);
319void setclipped(void) __dead;
320void at(xchar, xchar, int);
321void prme(void);
322int doredraw(void);
323void docrt(void);
324void docorner(int, int);
325void curs_on_u(void);
326void pru(void);
327void prl(int, int);
328char news0(xchar, xchar);
329void newsym(int, int);
330void mnewsym(int, int);
331void nosee(int, int);
332void prl1(int, int);
333void nose1(int, int);
334int vism_at(int, int);
335void pobj(struct obj *);
336void unpobj(struct obj *);
337void seeobjs(void);
338void seemons(void);
339void pmon(struct monst *);
340void unpmon(struct monst *);
341void nscr(void);
342void bot(void);
343void mstatusline(struct monst *);
344void cls(void);
345
346/* hack.read.c */
347int doread(void);
348void litroom(boolean);
349
350/* hack.rip.c */
351void outrip(void);
352
353/* hack.rumors.c */
354void outrumor(void);
355
356/* hack.save.c */
357int dosave(void);
358int dorecover(int);
359struct obj *restobjchn(int);
360struct monst *restmonchn(int);
361
362/* hack.search.c */
363int findit(void);
364int dosearch(void);
365int doidtrap(void);
366void wakeup(struct monst *);
367void seemimic(struct monst *);
368
369/* hack.shk.c */
370void obfree(struct obj *, struct obj *);
371void paybill(void);
372char *shkname(struct monst *);
373void shkdead(struct monst *);
374void replshk(struct monst *, struct monst *);
375int inshop(void);
376int dopay(void);
377struct bill_x;
378void addtobill(struct obj *);
379void splitbill(struct obj *, struct obj *);
380void subfrombill(struct obj *);
381int doinvbill(int);
382int shkcatch(struct obj *);
383int shk_move(struct monst *);
384void shopdig(int);
385int online(int, int);
386int follower(struct monst *);
387
388/* hack.shknam.c */
389void findname(char *, int);
390
391/* hack.steal.c */
392long somegold(void);
393void stealgold(struct monst *);
394int steal(struct monst *);
395void mpickobj(struct monst *, struct obj *);
396int stealamulet(struct monst *);
397void relobj(struct monst *, int);
398
399/* hack.termcap.c */
400void startup(void);
401void startscreen(void);
402void endscreen(void);
403void curs(int, int);
404void cl_end(void);
405void clearscreen(void);
406void home(void);
407void standoutbeg(void);
408void standoutend(void);
409void backsp(void);
410void sound_bell(void);
411void delay_output(void);
412void cl_eos(void);
413
414/* hack.timeout.c */
415void timeout(void);
416
417/* hack.topl.c */
418int doredotopl(void);
419void remember_topl(void);
420void addtopl(const char *);
421void more(void);
422void cmore(const char *);
423void clrlin(void);
424void pline(const char *, ...) __printflike(1, 2);
425void vpline(const char *, va_list) __printflike(1, 0);
426void putsym(int);
427void putstr(const char *);
428
429/* hack.track.c */
430void initrack(void);
431void settrack(void);
432coord *gettrack(int, int);
433
434/* hack.trap.c */
435struct trap *maketrap(int, int, int);
436void dotrap(struct trap *);
437int mintrap(struct monst *);
438void selftouch(const char *);
439void float_up(void);
440void float_down(void);
441void tele(void);
442int dotele(void);
443void placebc(int);
444void unplacebc(void);
445void level_tele(void);
446void drown(void);
447
448/* hack.tty.c */
449void gettty(void);
450void settty(const char *);
451void setftty(void);
452void error(const char *, ...) __printflike(1, 2) __dead;
453void getlin(char *);
454void getret(void);
455void cgetret(const char *);
456void xwaitforspace(const char *);
457char *parse(void);
458char readchar(void);
459void end_of_input(void) __dead;
460
461/* hack.u_init.c */
462void u_init(void);
463struct trobj;
464void plnamesuffix(void);
465
466/* hack.unix.c */
467void setrandom(void);
468int getyear(void);
469char *getdatestr(void);
470int phase_of_the_moon(void);
471int night(void);
472int midnight(void);
473void gethdate(char *);
474int uptodate(int);
475void getlock(void);
476void getmailstatus(void);
477void ckmailstatus(void);
478void newmail(void);
479void mdrush(struct monst *, boolean);
480void readmail(void);
481void regularize(char *);
482
483/* hack.vault.c */
484void setgd(void);
485int gd_move(void);
486void gddead(void);
487void replgd(struct monst *, struct monst *);
488void invault(void);
489
490/* hack.version.c */
491int doversion(void);
492
493/* hack.wield.c */
494void setuwep(struct obj *);
495int dowield(void);
496void corrode_weapon(void);
497int chwepon(struct obj *, int);
498
499/* hack.wizard.c */
500void amulet(void);
501int wiz_hit(struct monst *);
502void inrange(struct monst *);
503
504/* hack.worm.c */
505#ifndef NOWORM
506int getwn(struct monst *);
507void initworm(struct monst *);
508void worm_move(struct monst *);
509void worm_nomove(struct monst *);
510void wormdead(struct monst *);
511void wormhit(struct monst *);
512void wormsee(unsigned);
513struct wseg;
514void pwseg(struct wseg *);
515void cutworm(struct monst *, xchar, xchar, uchar);
516#endif
517
518/* hack.worn.c */
519void setworn(struct obj *, long);
520void setnotworn(struct obj *);
521
522/* hack.zap.c */
523int dozap(void);
524const char *exclam(int);
525void hit(const char *, struct monst *, const char *);
526void miss(const char *, struct monst *);
527struct monst *bhit(int, int, int, int,
528    void (*)(struct monst *, struct obj *),
529    int (*)(struct obj *, struct obj *),
530    struct obj *);
531struct monst *boomhit(int, int);
532void buzz(int, xchar, xchar, int, int);
533void fracture_rock(struct obj *);
534
535/* rnd.c */
536int rn1(int, int);
537int rn2(int);
538int rnd(int);
539int d(int, int);
540#endif /* _EXTERN_H_ */
541