From f067a3e9ff9af6fc6f945138527c59b8f3e0c370 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 10 Feb 2019 13:41:45 -0800 Subject: [PATCH 1/2] compiling isaac64.c Revise isaac64.c so that it can be compiled unconditionally and yield nothing if USE_ISAAC64 isn't defined. Necessary for building via vmsbuild.com. --- src/isaac64.c | 33 +++++++++++++++++++++++---------- sys/unix/Makefile.src | 4 ++-- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/isaac64.c b/src/isaac64.c index 6928ff72b..9ccb0db55 100644 --- a/src/isaac64.c +++ b/src/isaac64.c @@ -1,32 +1,42 @@ /*Written by Timothy B. Terriberry (tterribe@xiph.org) 1999-2009 - CC0 (Public domain) - see http://creativecommons.org/publicdomain/zero/1.0/ for details + CC0 (Public domain) - see http://creativecommons.org/publicdomain/zero/1.0/ + for details. Based on the public domain ISAAC implementation by Robert J. Jenkins Jr.*/ + +/* + * Changes for NetHack: + * include config.h; + * skip rest of file if USE_ISAAC64 isn't defined there; + * re-do 'inline' handling. + */ +#include "config.h" + +#ifdef USE_ISAAC64 #include #include #include "isaac64.h" #define ISAAC64_MASK ((uint64_t)0xFFFFFFFFFFFFFFFFULL) -#if (defined(__STDC__) && __STDC_VERSION__ >= 199901L) +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) #define HAS_INLINE +#else +# if (defined(__GNUC__) && __GNUC__ >= 2 && !defined(inline)) +# define inline __inline__ +# endif +#endif +#if !defined(HAS_INLINE) && !defined(inline) +#define inline /*empty*/ #endif /* Extract ISAAC64_SZ_LOG bits (starting at bit 3). */ -#ifdef HAS_INLINE static inline uint32_t lower_bits(uint64_t x) -#else -static uint32_t lower_bits(uint64_t x) -#endif { return (x & ((ISAAC64_SZ-1) << 3)) >>3; } /* Extract next ISAAC64_SZ_LOG bits (starting at bit ISAAC64_SZ_LOG+2). */ -#ifdef HAS_INLINE static inline uint32_t upper_bits(uint64_t y) -#else -static uint32_t upper_bits(uint64_t y) -#endif { return (y >> (ISAAC64_SZ_LOG+3)) & (ISAAC64_SZ-1); } @@ -159,3 +169,6 @@ uint64_t isaac64_next_uint(isaac64_ctx *_ctx,uint64_t _n){ while(((d+_n-1)&ISAAC64_MASK) Date: Sun, 10 Feb 2019 13:54:16 -0800 Subject: [PATCH 2/2] isaac64 on vms Not tested yet... --- doc/fixes36.2 | 3 ++- sys/vms/Makefile.src | 12 +++++++----- sys/vms/vmsbuild.com | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9f63b2e94..20533a886 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.253 $ $NHDT-Date: 1549757225 2019/02/10 00:07:05 $ +$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.254 $ $NHDT-Date: 1549835645 2019/02/10 21:54:05 $ This fixes36.2 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.1 in April 2018. Please note, however, @@ -448,6 +448,7 @@ curses: if the interface code ran out of memory, it would crash rather than curses: when getting multi-character responses from player, support as well as to remove last character entered; also, return to core if ESC is typed when there is no input entered +vms: add compile of isaac64.c to Makefile.src and vmsbuild.com Platform- and/or Interface-Specific Fixes or Features diff --git a/sys/vms/Makefile.src b/sys/vms/Makefile.src index a29367655..86a419a44 100644 --- a/sys/vms/Makefile.src +++ b/sys/vms/Makefile.src @@ -1,10 +1,11 @@ # NetHack Makefile (VMS) - for building nethack itself. -# NetHack 3.6 Makefile.src $NHDT-Date: 1543545915 2018/11/30 02:45:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.32 $ +# NetHack 3.6 Makefile.src $NHDT-Date: 1549835645 2019/02/10 21:54:05 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.33 $ # Copyright (c) 2011 by Robert Patrick Rankin # NetHack may be freely redistributed. See license for details. # Copy this file to [.src]Makefile. and then edit it as needed. -# The default configuration is for building with DEC C (aka Compaq C). +# The default configuration is for building with DEC C (aka Compaq C, +# then HP C). # If you change CC or CFLAGS, make similar changes in [.util]Makefile. # # Note: modifying this Makefile will cause crtl.opt to be rebuilt, @@ -88,9 +89,9 @@ WINOBJ = $(WINTTYOBJ) SYSTEM = SysVMS.timestamp; GAME = $(SRC)nethack.exe; -# RANDOM is defined in vmsconf.h -RANDSRC = random.c -RANDOBJ = random.obj +# RANDOM is defined in vmsconf.h, USE_ISAAC64 might be defined in config.h; +RANDSRC = isaac64.c random.c +RANDOBJ = isaac64.obj,random.obj # ---------------------------------------- # @@ -343,6 +344,7 @@ vmsfiles.obj : $(VMS)vmsfiles.c $(CONFIG_H) vmsmail.obj : $(VMS)vmsmail.c $(CONFIG_H) $(INC)mail.h \ $(INC)wintype.h $(INC)winprocs.h # conditionally used code -- VMS always wants these +isaac64.obj : isaac64.c random.obj : random.c $(HACK_H) random.c : $(SYSSHR)random.c copy $(SYSSHR)random.c random.c diff --git a/sys/vms/vmsbuild.com b/sys/vms/vmsbuild.com index d505ccad9..3b6e82295 100755 --- a/sys/vms/vmsbuild.com +++ b/sys/vms/vmsbuild.com @@ -1,6 +1,6 @@ $ ! vms/vmsbuild.com -- compile and link NetHack 3.6.* [pr] $ version_number = "3.6.2" -$ ! $NHDT-Date: 1542847646 2018/11/22 00:47:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ +$ ! $NHDT-Date: 1549835647 2019/02/10 21:54:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.21 $ $ ! Copyright (c) 2018 by Robert Patrick Rankin $ ! NetHack may be freely redistributed. See license for details. $ ! @@ -262,6 +262,7 @@ $ set default [-.src] $! compile most of the source files: $ c_list = "decl,version,[-.sys.vms]vmsmain,[-.sys.vms]vmsunix" - + ",[-.sys.vms]vmstty,[-.sys.vms]vmsmail" - + + ",[]isaac64" - !already in [.src] + ",[]random,[]tclib,[]pmatchregex" !copied from [-.sys.share] $ gosub compile_list $ c_list = "[-.win.tty]getline,[-.win.tty]termcap" -