From 724ac2670c2cffceaab653ffa032e8730d3e285f Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Fri, 5 Sep 2003 14:59:53 +0000 Subject: [PATCH] more overlay bits Although the overlay stuff is destined to be removed someday, this patch just makes the use of STATIC_DCL, STATIC_OVL consistent in the trunk. [As a side pointless experiment, I was able to build a working 8086 port of 3.4.2 after this change that worked correctly in limited testing right up until it came time to enter Ft. Ludios., where it couldn't allocated the required amount of memory.] --- src/cmd.c | 4 ++-- src/dlb.c | 52 ++++++++++++++++++++++++------------------ src/do_name.c | 4 ++-- src/hacklib.c | 4 ++-- src/invent.c | 4 ++-- src/objnam.c | 12 +++++----- src/read.c | 41 +++++++++++++++------------------ src/rect.c | 4 ++-- src/region.c | 4 ++-- src/shk.c | 4 ++-- src/sounds.c | 12 +++++----- sys/msdos/Makefile.MSC | 6 ++--- sys/msdos/schema3.MSC | 46 ++++++++++++++++++++++++++++++++++++- 13 files changed, 123 insertions(+), 74 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 554ff26fe..8c532b4ce 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -212,7 +212,7 @@ int xtime; #ifdef REDO -static char NDECL(popch); +STATIC_DCL char NDECL(popch); /* Provide a means to redo the last command. The flag `in_doagain' is set * to true while redoing the command. This flag is tested in commands that @@ -224,7 +224,7 @@ static char NDECL(popch); static char pushq[BSIZE], saveq[BSIZE]; static NEARDATA int phead, ptail, shead, stail; -static char +STATIC_OVL char popch() { /* If occupied, return '\0', letting tgetch know a character should * be read from the keyboard. If the character read is not the diff --git a/src/dlb.c b/src/dlb.c index 5d423263e..b71f78a36 100644 --- a/src/dlb.c +++ b/src/dlb.c @@ -11,6 +11,14 @@ #define DATAPREFIX 4 +#if defined(OVERLAY) +# define STATIC_DCL extern +# define STATIC_OVL +#else /* !OVERLAY */ +# define STATIC_DCL static +# define STATIC_OVL static +#endif /* OVERLAY */ + #ifdef DLB /* * Data librarian. Present a STDIO-like interface to NetHack while @@ -53,18 +61,18 @@ extern FILE *FDECL(fopen_datafile, (const char *,const char *,int)); #define MAX_LIBS 4 static library dlb_libs[MAX_LIBS]; -static boolean FDECL(readlibdir,(library *lp)); -static boolean FDECL(find_file,(const char *name, library **lib, long *startp, +STATIC_DCL boolean FDECL(readlibdir,(library *lp)); +STATIC_DCL boolean FDECL(find_file,(const char *name, library **lib, long *startp, long *sizep)); -static boolean NDECL(lib_dlb_init); -static void NDECL(lib_dlb_cleanup); -static boolean FDECL(lib_dlb_fopen,(dlb *, const char *, const char *)); -static int FDECL(lib_dlb_fclose,(dlb *)); -static int FDECL(lib_dlb_fread,(char *, int, int, dlb *)); -static int FDECL(lib_dlb_fseek,(dlb *, long, int)); -static char *FDECL(lib_dlb_fgets,(char *, int, dlb *)); -static int FDECL(lib_dlb_fgetc,(dlb *)); -static long FDECL(lib_dlb_ftell,(dlb *)); +STATIC_DCL boolean NDECL(lib_dlb_init); +STATIC_DCL void NDECL(lib_dlb_cleanup); +STATIC_DCL boolean FDECL(lib_dlb_fopen,(dlb *, const char *, const char *)); +STATIC_DCL int FDECL(lib_dlb_fclose,(dlb *)); +STATIC_DCL int FDECL(lib_dlb_fread,(char *, int, int, dlb *)); +STATIC_DCL int FDECL(lib_dlb_fseek,(dlb *, long, int)); +STATIC_DCL char *FDECL(lib_dlb_fgets,(char *, int, dlb *)); +STATIC_DCL int FDECL(lib_dlb_fgetc,(dlb *)); +STATIC_DCL long FDECL(lib_dlb_ftell,(dlb *)); /* not static because shared with dlb_main.c */ boolean FDECL(open_library,(const char *lib_name, library *lp)); @@ -117,7 +125,7 @@ extern char *FDECL(eos, (char *)); * * Return TRUE on success, FALSE on failure. */ -static boolean +STATIC_OVL boolean readlibdir(lp) library *lp; /* library pointer to fill in */ { @@ -165,7 +173,7 @@ readlibdir(lp) * Look for the file in our directory structure. Return 1 if successful, * 0 if not found. Fill in the size and starting position. */ -static boolean +STATIC_OVL boolean find_file(name, lib, startp, sizep) const char *name; library **lib; @@ -228,7 +236,7 @@ close_library(lp) * Open the library file once using stdio. Keep it open, but * keep track of the file position. */ -static boolean +STATIC_OVL boolean lib_dlb_init() { /* zero out array */ @@ -245,7 +253,7 @@ lib_dlb_init() return TRUE; } -static void +STATIC_OVL void lib_dlb_cleanup() { int i; @@ -255,7 +263,7 @@ lib_dlb_cleanup() close_library(&dlb_libs[i]); } -static boolean +STATIC_OVL boolean lib_dlb_fopen(dp, name, mode) dlb *dp; const char *name, *mode; @@ -275,7 +283,7 @@ lib_dlb_fopen(dp, name, mode) return FALSE; /* failed */ } -static int +STATIC_OVL int lib_dlb_fclose(dp) dlb *dp; { @@ -283,7 +291,7 @@ lib_dlb_fclose(dp) return 0; } -static int +STATIC_OVL int lib_dlb_fread(buf, size, quan, dp) char *buf; int size, quan; @@ -310,7 +318,7 @@ lib_dlb_fread(buf, size, quan, dp) return nread; } -static int +STATIC_OVL int lib_dlb_fseek(dp, pos, whence) dlb *dp; long pos; @@ -330,7 +338,7 @@ lib_dlb_fseek(dp, pos, whence) return 0; } -static char * +STATIC_OVL char * lib_dlb_fgets(buf, len, dp) char *buf; int len; @@ -362,7 +370,7 @@ lib_dlb_fgets(buf, len, dp) return buf; } -static int +STATIC_OVL int lib_dlb_fgetc(dp) dlb *dp; { @@ -373,7 +381,7 @@ lib_dlb_fgetc(dp) } -static long +STATIC_OVL long lib_dlb_ftell(dp) dlb *dp; { diff --git a/src/do_name.c b/src/do_name.c index 27815639b..7c7ed5c25 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -5,12 +5,12 @@ #include "hack.h" STATIC_DCL void FDECL(do_oname, (struct obj *)); -static void FDECL(getpos_help, (BOOLEAN_P,const char *)); +STATIC_DCL void FDECL(getpos_help, (BOOLEAN_P,const char *)); extern const char what_is_an_unknown_object[]; /* from pager.c */ /* the response for '?' help request in getpos() */ -static void +STATIC_OVL void getpos_help(force, goal) boolean force; const char *goal; diff --git a/src/hacklib.c b/src/hacklib.c index 8cba8ca9c..f94a9528c 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -425,7 +425,7 @@ fuzzymatch(s1, s2, ignore_chars, caseblind) #if defined(AMIGA) && !defined(AZTEC_C) && !defined(__SASC_60) && !defined(_DCC) && !defined(__GNUC__) extern struct tm *FDECL(localtime,(time_t *)); #endif -static struct tm *NDECL(getlt); +STATIC_DCL struct tm *NDECL(getlt); void setrandom() @@ -455,7 +455,7 @@ setrandom() #endif } -static struct tm * +STATIC_OVL struct tm * getlt() { time_t date; diff --git a/src/invent.c b/src/invent.c index f1853aff2..791ed3d72 100644 --- a/src/invent.c +++ b/src/invent.c @@ -17,7 +17,7 @@ STATIC_DCL boolean FDECL(taking_off, (const char *)); STATIC_DCL boolean FDECL(putting_on, (const char *)); STATIC_PTR int FDECL(ckunpaid,(struct obj *)); STATIC_PTR int FDECL(ckvalidcat,(struct obj *)); -static char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *)); +STATIC_DCL char FDECL(display_pickinv, (const char *,BOOLEAN_P, long *)); STATIC_DCL boolean FDECL(this_type_only, (struct obj *)); STATIC_DCL void NDECL(dounpaid); STATIC_DCL struct obj *FDECL(find_unpaid,(struct obj *,struct obj **)); @@ -1644,7 +1644,7 @@ find_unpaid(list, last_found) * inventory and return a count as well as a letter. If out_cnt is not null, * any count returned from the menu selection is placed here. */ -static char +STATIC_OVL char display_pickinv(lets, want_reply, out_cnt) register const char *lets; boolean want_reply; diff --git a/src/objnam.c b/src/objnam.c index 216052cd9..0e1e51082 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -10,9 +10,9 @@ #define NUMOBUF 12 STATIC_DCL char *FDECL(strprepend,(char *,const char *)); -static boolean FDECL(wishymatch, (const char *,const char *,BOOLEAN_P)); -static char *NDECL(nextobuf); -static void FDECL(add_erosion_words, (struct obj *, char *)); +STATIC_DCL boolean FDECL(wishymatch, (const char *,const char *,BOOLEAN_P)); +STATIC_DCL char *NDECL(nextobuf); +STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *)); struct Jitem { int item; @@ -62,7 +62,7 @@ register const char *pref; } /* manage a pool of BUFSZ buffers, so callers don't have to */ -static char * +STATIC_OVL char * nextobuf() { static char NEARDATA bufs[NUMOBUF][BUFSZ]; @@ -497,7 +497,7 @@ register struct obj *obj; (obj->known || obj->otyp == AMULET_OF_YENDOR)); } -static void +STATIC_OVL void add_erosion_words(obj,prefix) struct obj *obj; char *prefix; @@ -1606,7 +1606,7 @@ const char *oldstr; } /* compare user string against object name string using fuzzy matching */ -static boolean +STATIC_OVL boolean wishymatch(u_str, o_str, retry_inverted) const char *u_str; /* from user, so might be variant spelling */ const char *o_str; /* from objects[], so is in canonical form */ diff --git a/src/read.c b/src/read.c index 6042afa0c..c0ca11c11 100644 --- a/src/read.c +++ b/src/read.c @@ -21,15 +21,15 @@ static NEARDATA const char readable[] = { ALL_CLASSES, SCROLL_CLASS, SPBOOK_CLASS, 0 }; static const char all_count[] = { ALLOW_COUNT, ALL_CLASSES, 0 }; -static void FDECL(wand_explode, (struct obj *)); -static void NDECL(do_class_genocide); -static void FDECL(stripspe,(struct obj *)); -static void FDECL(p_glow1,(struct obj *)); -static void FDECL(p_glow2,(struct obj *,const char *)); -static void FDECL(randomize,(int *, int)); -static void FDECL(forget_single_object, (int)); -static void FDECL(forget, (int)); -static void FDECL(maybe_tame, (struct monst *,struct obj *)); +STATIC_DCL void FDECL(wand_explode, (struct obj *)); +STATIC_DCL void NDECL(do_class_genocide); +STATIC_DCL void FDECL(stripspe,(struct obj *)); +STATIC_DCL void FDECL(p_glow1,(struct obj *)); +STATIC_DCL void FDECL(p_glow2,(struct obj *,const char *)); +STATIC_DCL void FDECL(randomize,(int *, int)); +STATIC_DCL void FDECL(forget_single_object, (int)); +STATIC_DCL void FDECL(forget, (int)); +STATIC_DCL void FDECL(maybe_tame, (struct monst *,struct obj *)); STATIC_PTR void FDECL(set_lit, (int,int,genericptr_t)); @@ -149,8 +149,7 @@ doread() } return(1); } - -static void +STATIC_OVL void stripspe(obj) register struct obj *obj; { @@ -164,16 +163,14 @@ register struct obj *obj; } else pline(nothing_happens); } } - -static void +STATIC_OVL void p_glow1(otmp) register struct obj *otmp; { Your("%s %s briefly.", xname(otmp), otense(otmp, Blind ? "vibrate" : "glow")); } - -static void +STATIC_OVL void p_glow2(otmp,color) register struct obj *otmp; register const char *color; @@ -426,7 +423,7 @@ int curse_bless; /* Forget known information about this object class. */ -static void +STATIC_OVL void forget_single_object(obj_id) int obj_id; { @@ -444,7 +441,7 @@ forget_single_object(obj_id) #if 0 /* here if anyone wants it.... */ /* Forget everything known about a particular object class. */ -static void +STATIC_OVL void forget_objclass(oclass) int oclass; { @@ -458,7 +455,7 @@ forget_objclass(oclass) /* randomize the given list of numbers 0 <= i < count */ -static void +STATIC_OVL void randomize(indices, count) int *indices; int count; @@ -595,7 +592,7 @@ forget_levels(percent) * howmuch & ALL_MAP = forget whole map * howmuch & ALL_SPELLS = forget all spells */ -static void +STATIC_OVL void forget(howmuch) int howmuch; { @@ -626,7 +623,7 @@ int howmuch; } /* monster is hit by scroll of taming's effect */ -static void +STATIC_OVL void maybe_tame(mtmp, sobj) struct monst *mtmp; struct obj *sobj; @@ -1309,7 +1306,7 @@ register struct obj *sobj; return(0); } -static void +STATIC_OVL void wand_explode(obj) register struct obj *obj; { @@ -1432,7 +1429,7 @@ do_it: vision_full_recalc = 1; /* delayed vision recalculation */ } -static void +STATIC_OVL void do_class_genocide() { int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0; diff --git a/src/rect.c b/src/rect.c index dc6be73ff..8aa5add5c 100644 --- a/src/rect.c +++ b/src/rect.c @@ -6,7 +6,7 @@ int FDECL(get_rect_ind, (NhRect *)); -static boolean FDECL(intersect, (NhRect *,NhRect *,NhRect *)); +STATIC_DCL boolean FDECL(intersect, (NhRect *,NhRect *,NhRect *)); /* * In this file, we will handle the various rectangle functions we @@ -93,7 +93,7 @@ rnd_rect() * otherwise returns FALSE */ -static boolean +STATIC_OVL boolean intersect(r1, r2, r3) NhRect *r1, *r2, *r3; { diff --git a/src/region.c b/src/region.c index d3b5a6b0d..3c1926c71 100644 --- a/src/region.c +++ b/src/region.c @@ -43,7 +43,7 @@ boolean FDECL(enter_force_field, (genericptr,genericptr)); NhRegion *FDECL(create_force_field, (XCHAR_P,XCHAR_P,int,int)); #endif -static void FDECL(reset_region_mids, (NhRegion *)); +STATIC_DCL void FDECL(reset_region_mids, (NhRegion *)); static callback_proc callbacks[] = { #define INSIDE_GAS_CLOUD 0 @@ -750,7 +750,7 @@ boolean ghostly; /* If a bones file restore */ } /* update monster IDs for region being loaded from bones; `ghostly' implied */ -static void +STATIC_OVL void reset_region_mids(reg) NhRegion *reg; { diff --git a/src/shk.c b/src/shk.c index c32e812d8..eb80d46e2 100644 --- a/src/shk.c +++ b/src/shk.c @@ -63,7 +63,7 @@ STATIC_DCL void FDECL(dropped_container, (struct obj *, struct monst *, STATIC_DCL void FDECL(add_to_billobjs, (struct obj *)); STATIC_DCL void FDECL(bill_box_content, (struct obj *, BOOLEAN_P, BOOLEAN_P, struct monst *)); -static boolean FDECL(rob_shop, (struct monst *)); +STATIC_DCL boolean FDECL(rob_shop, (struct monst *)); /* invariants: obj->unpaid iff onbill(obj) [unless bp->useup] @@ -453,7 +453,7 @@ xchar x, y; /* shop merchandise has been taken; pay for it with any credit available; return false if the debt is fully covered by credit, true otherwise */ -static boolean +STATIC_OVL boolean rob_shop(shkp) struct monst *shkp; { diff --git a/src/sounds.c b/src/sounds.c index f0b7dfda8..9628a7572 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -10,12 +10,12 @@ # endif #endif -static int FDECL(domonnoise,(struct monst *)); -static int NDECL(dochat); -static int FDECL(mon_in_room, (struct monst *,int)); +STATIC_DCL int FDECL(domonnoise,(struct monst *)); +STATIC_DCL int NDECL(dochat); +STATIC_DCL int FDECL(mon_in_room, (struct monst *,int)); /* this easily could be a macro, but it might overtax dumb compilers */ -static int +STATIC_OVL int mon_in_room(mon, rmtyp) struct monst *mon; int rmtyp; @@ -412,7 +412,7 @@ register struct monst *mtmp; } } -static int +STATIC_OVL int domonnoise(mtmp) register struct monst *mtmp; { @@ -822,7 +822,7 @@ dotalk() return result; } -static int +STATIC_OVL int dochat() { register struct monst *mtmp; diff --git a/sys/msdos/Makefile.MSC b/sys/msdos/Makefile.MSC index 53d418a83..af70b7b34 100644 --- a/sys/msdos/Makefile.MSC +++ b/sys/msdos/Makefile.MSC @@ -459,19 +459,19 @@ envchk: ! ENDIF ! IF ("$(CL)"=="") @echo CL Environment variable is defined as follows: - SET CL=/AL $(MC) /Oo /Gy /Gs /Gt14 /Zp1 /W0 /I$(INCL) /I$(MSYS) /I$(WSHR) /nologo /c + SET CL=/AL $(MC) /Oo /Gy /Gs /Gt10 /Gf /Zp1 /W0 /I$(INCL) /I$(MSYS) /I$(WSHR) /nologo /c ! ELSE @echo Warning CL Environment variable is defined: @echo CL=$(CL) @echo Overriding that definition as follows: - SET CL=/AL $(MC) /Oo /Gy /Gs /Gt14 /Zp1 /W0 /I$(INCL) /I$(MSYS) /I$(WSHR) /nologo /c + SET CL=/AL $(MC) /Oo /Gy /Gs /Gt10 /Gf /Zp1 /W0 /I$(INCL) /I$(MSYS) /I$(WSHR) /nologo /c ! ENDIF # The main target. $(GAMEFILE) : $(LNKOPT) $(ALLOBJ) @echo Linking.... - $(LINK) $(LFLAGS) /SE:1000 /DYNAMIC:2135 /NOE /ST:6000 @<<$(GAME).lnk + $(LINK) $(LFLAGS) /SE:1000 /DYNAMIC:2160 /NOE /ST:6000 @<<$(GAME).lnk $(ALLOBJ:^ =+^ ) $(GAMEFILE) diff --git a/sys/msdos/schema3.MSC b/sys/msdos/schema3.MSC index df254e9e0..4cc6fc701 100644 --- a/sys/msdos/schema3.MSC +++ b/sys/msdos/schema3.MSC @@ -426,4 +426,48 @@ functions:389 _missum functions:390 _mixtype _mk_artifact functions:391 _makesingular functions:392 _maketrap _makevtele _makewish - +functions:393 _add_erosion_words +; +functions:395 _display_pickinv +functions:396 _do_class_genocide +functions:397 _dochat +functions:398 _domonnoise +; +; +; +; +functions:403 _find_file +functions:404 _forget +functions:405 _forget_single_object +functions:406 _getlt +functions:407 _getpos_help +; +; +; +functions:411 _lib_dlb_cleanup +functions:412 _lib_dlb_fclose +functions:413 _lib_dlb_fgetc +functions:414 _lib_dlb_fgets +functions:415 _lib_dlb_fopen +functions:416 _lib_dlb_fread +functions:417 _lib_dlb_fseek +functions:418 _lib_dlb_ftell +functions:419 _lib_dlb_init +functions:420 _maybe_tame +; +functions:422 _mon_in_room +functions:423 _nextobuf +functions:424 _p_glow1 +functions:425 _p_glow2 +functions:426 _popch +functions:427 _randomize +functions:428 _readlibdir +functions:429 _reset_region_mids +functions:430 _rob_shop +functions:431 _stripspe +; +; +; +functions:435 _wand_explode +functions:436 _wishymatch +functions:437 _You_buf -- 2.40.0