From 9e220f113836953f502136055cd34915b633a73a Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 4 Jun 2011 04:29:00 -0700 Subject: [PATCH] Cleaned up VMS builds using various versions of the Dec/Compaq/HP C compilers --- descrip.mms | 28 +++++++++++++++++++--- scp.c | 2 +- scp.h | 3 +++ sim_fio.c | 67 ++++------------------------------------------------- 4 files changed, 33 insertions(+), 67 deletions(-) diff --git a/descrip.mms b/descrip.mms index 679ee658..eb25362d 100644 --- a/descrip.mms +++ b/descrip.mms @@ -57,6 +57,13 @@ # # On AXP the AXP PCAP components are built and used to provide network # support for the VAX and PDP11 simulators. +# +# The AXP PCAP components can only be built using a version of the +# DEC/Compaq/HP Compiler version V6.5-001 or later. To build using an +# older compiler, networking support must be disabled. Use... +# +# MMK/MACRO=(NONETWORK=1) +# # The PCAP-VMS components are presumed (by this procedure) to be located # in a directory at the same level as the directory containing the # simh source files. For example, if these exist here: @@ -156,14 +163,25 @@ BLD_DIR = SYS$DISK:[.BIN.VMS.LIB.BLD-$(ARCH)] # Check To Make Sure We Have SYS$DISK:[.BIN] & SYS$DISK:[.LIB] Directory. # .FIRST - @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(F$GETSYI("VERSION").LES."V8.0").AND.("$(NOASYNCH)".EQS."")) THEN WRITE SYS$OUTPUT "*** WARNING **** Build should be invoked with /MACRO=NOASYNCH=1 on this platform" - @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(F$GETSYI("VERSION").LES."V8.0").AND.("$(NOASYNCH)".EQS."")) THEN EXIT %x10000000 + @ IF "".NES."''CC'" THEN DELETE/SYMBOL/GLOBAL CC + @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(F$GETSYI("VERSION").LTS."V8.0").AND.("$(NOASYNCH)".EQS."")) THEN WRITE SYS$OUTPUT "*** WARNING **** Build should be invoked with /MACRO=NOASYNCH=1 on this platform" + @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(F$GETSYI("VERSION").LTS."V8.0").AND.("$(NOASYNCH)".EQS."")) THEN EXIT %x10000000 + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN DEFINE/USER SYS$OUTPUT CC_VERSION.DAT + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN CC/VERSION + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN OPEN /READ VERSION CC_VERSION.DAT + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN READ VERSION CC_VERSION + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN CLOSE VERSION + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN DELETE CC_VERSION.DAT; + @ IF (F$GETSYI("ARCH_NAME").EQS."Alpha") THEN CC_VERSION = F$ELEMENT(2," ",CC_VERSION) + @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(CC_VERSION.LTS."V6.5-001").AND.("$(NONETWORK)".EQS."")) THEN WRITE SYS$OUTPUT "*** WARNING **** C Compiler is: ''CC_VERSION'" + @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(CC_VERSION.LTS."V6.5-001").AND.("$(NONETWORK)".EQS."").AND.(F$GETSYI("VERSION").GES."V8.0")) THEN WRITE SYS$OUTPUT "*** WARNING **** Build should be invoked with /MACRO=NONETWORK=1 with this compiler" + @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(CC_VERSION.LTS."V6.5-001").AND.("$(NONETWORK)".EQS."").AND.(F$GETSYI("VERSION").LTS."V8.0")) THEN WRITE SYS$OUTPUT "*** WARNING **** Build should be invoked with /MACRO=(NONETWORK=1,NOASYNCH=1) with this compiler" + @ IF ((F$GETSYI("ARCH_NAME").EQS."Alpha").AND.(CC_VERSION.LTS."V6.5-001").AND.("$(NONETWORK)".EQS."")) THEN EXIT %x10000000 @ IF (F$SEARCH("SYS$DISK:[]BIN.DIR").EQS."") THEN CREATE/DIRECTORY $(BIN_DIR) @ IF (F$SEARCH("SYS$DISK:[.BIN]VMS.DIR").EQS."") THEN CREATE/DIRECTORY $(LIB_DIR) @ IF (F$SEARCH("SYS$DISK:[.BIN.VMS]LIB.DIR").EQS."") THEN CREATE/DIRECTORY $(LIB_DIR) @ IF (F$SEARCH("SYS$DISK:[.BIN.VMS.LIB]BLD-$(ARCH).DIR").EQS."") THEN CREATE/DIRECTORY $(BLD_DIR) @ IF (F$SEARCH("$(BLD_DIR)*.*").NES."") THEN DELETE/NOLOG/NOCONFIRM $(BLD_DIR)*.*;* - @ IF "".NES."''CC'" THEN DELETE/SYMBOL/GLOBAL CC # Core SIMH File Definitions. # @@ -200,6 +218,9 @@ PCAP_VCI = SYS$COMMON:[SYS$LDR]PCAPVCM.EXE # PCAP is not available on OpenVMS VAX or IA64 right now # .IFDEF MMSALPHA +.IFDEF NONETWORK +# Network Capabilities disabled +.ELSE PCAP_EXECLET = $(PCAP_VCI) PCAP_INC = ,$(PCAP_DIR) PCAP_LIBD = $(PCAP_LIB) @@ -207,6 +228,7 @@ PCAP_LIBR = ,$(PCAP_LIB)/LIB/SYSEXE PCAP_DEFS = ,"USE_NETWORK=1" PCAP_SIMH_INC = /INCL=($(PCAP_DIR)) .ENDIF +.ENDIF # MITS Altair Simulator Definitions. # diff --git a/scp.c b/scp.c index 02aa8423..3b57c2af 100644 --- a/scp.c +++ b/scp.c @@ -5172,7 +5172,7 @@ if (sim_deb && (dptr->dctrl & dbits)) { #if defined (_WIN32) #define vsnprintf _vsnprintf #endif -#if defined (__DECC) && defined (__VMS) && defined (__VAX) +#if defined (__DECC) && defined (__VMS) && (defined (__VAX) || (__CRTL_VER <= 70311000)) #define NO_vsnprintf #endif #if defined( NO_vsnprintf) diff --git a/scp.h b/scp.h index 349ba10f..52cf2b9f 100644 --- a/scp.h +++ b/scp.h @@ -122,6 +122,9 @@ t_stat sim_string_to_stat (char *cptr, t_stat *cond); t_stat sim_cancel_step (void); void sim_debug_u16 (uint32 dbits, DEVICE* dptr, const char* const* bitdefs, uint16 before, uint16 after, int terminate); +#if defined (__DECC) && defined (__VMS) && (defined (__VAX) || (__DECC_VER < 60590001)) +#define CANT_USE_MACRO_VA_ARGS 1 +#endif #ifdef CANT_USE_MACRO_VA_ARGS #define _sim_debug sim_debug void sim_debug (uint32 dbits, DEVICE* dptr, const char* fmt, ...); diff --git a/sim_fio.c b/sim_fio.c index b9a91ecb..671e8f39 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -23,6 +23,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Robert M Supnik. + 03-Jun-11 MP Simplified VMS 64b support and made more portable 02-Feb-11 MP Added sim_fsize_ex and sim_fsize_name_ex returning t_addr Added export of sim_buf_copy_swapped and sim_buf_swap_data 28-Jun-07 RMS Added VMS IA64 support (from Norm Lastovica) @@ -227,77 +228,17 @@ return fopen (file, mode); /* 64b VMS */ -#if (defined (__ALPHA) || defined (__ia64)) && defined (VMS) /* 64b VMS */ +#if (defined (__ALPHA) || defined (__ia64)) && defined (VMS) && (__DECC_VER >= 60590001) #define _SIM_IO_FSEEK_EXT_ 1 -static t_int64 fpos_t_to_int64 (fpos_t *pos) -{ -unsigned short *w = (unsigned short *) pos; /* endian dep! */ -t_int64 result; - -result = w[1]; -result <<= 16; -result += w[0]; -result <<= 9; -result += w[2]; -return result; -} - -static void int64_to_fpos_t (t_int64 ipos, fpos_t *pos, size_t mbc) -{ -unsigned short *w = (unsigned short *) pos; -int bufsize = mbc << 9; - -w[3] = 0; -w[2] = (unsigned short) (ipos % bufsize); -ipos -= w[2]; -ipos >>= 9; -w[0] = (unsigned short) ipos; -ipos >>= 16; -w[1] = (unsigned short) ipos; -if ((w[2] == 0) && (w[0] || w[1])) { - w[2] = bufsize; - w[0] -= mbc; - } -return; -} - int sim_fseek (FILE *st, t_addr offset, int whence) { -t_addr fileaddr; -fpos_t filepos; - -switch (whence) { - - case SEEK_SET: - fileaddr = offset; - break; - - case SEEK_END: - if (_fseeki64 (st, 0, SEEK_END)) - return (-1); - case SEEK_CUR: - if (fgetpos (st, &filepos)) - return (-1); - fileaddr = fpos_t_to_int64 (&filepos); - fileaddr = fileaddr + offset; - break; - - default: - errno = EINVAL; - return (-1); - } - -int64_to_fpos_t (fileaddr, &filepos, 127); -return fsetpos (st, &filepos); +return fseeko (st, (off_t)offset, whence); } static t_addr _sim_ftell (FILE *st) { -fpos_t fileaddr; -if (fgetpos (st, &fileaddr)) - return (-1); -return (t_addr)fpos_t_to_int64 (&fileaddr); +return (t_addr)(ftello (st)); } #endif