extern.h 17 KB

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