VMS Build: Restore VAX/VMS host build support

The C RTL on the latest VAX/VMS does not provide a snprintf function.
We provide a 'basic' one which meets the needs of simh as suggested
by Jordi Guillaumes Pons.
This commit is contained in:
Mark Pizzolato 2017-12-09 11:21:38 -08:00
parent 9b1f44f787
commit 6487d319cd
3 changed files with 22 additions and 1 deletions

View file

@ -316,7 +316,7 @@ ATT3B2_SOURCE = $(ATT3B2_DIR)3B2_CPU.C,$(ATT3B2_DIR)3B2_DMAC.C,\
$(ATT3B2_DIR)3B2_IO.C,$(ATT3B2_DIR)3B2_IU.C,\ $(ATT3B2_DIR)3B2_IO.C,$(ATT3B2_DIR)3B2_IU.C,\
$(ATT3B2_DIR)3B2_MMU.C,$(ATT3B2_DIR)3B2_SYS.C,\ $(ATT3B2_DIR)3B2_MMU.C,$(ATT3B2_DIR)3B2_SYS.C,\
$(ATT3B2_DIR)3B2_SYSDEV.C $(ATT3B2_DIR)3B2_SYSDEV.C
ALTAIR_OPTIONS = /INCL=($(SIMH_DIR),$(ATT3B2_DIR))/DEF=($(CC_DEFS)) ATT3B2_OPTIONS = /INCL=($(SIMH_DIR),$(ATT3B2_DIR))/DEF=($(CC_DEFS))
# MITS Altair Simulator Definitions. # MITS Altair Simulator Definitions.
# #

View file

@ -115,6 +115,10 @@
#if defined(_MSC_VER) && (_MSC_VER < 1900) #if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf /* poor man's snprintf which will work most of the time but has different return value */ #define snprintf _snprintf /* poor man's snprintf which will work most of the time but has different return value */
#endif #endif
#if defined(__VAX)
extern int sim_vax_snprintf(char *buf, size_t buf_size, const char *fmt, ...);
#define snprintf sim_vax_snprintf
#endif
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>

View file

@ -599,3 +599,20 @@ free (shmem);
} }
#endif #endif
#if defined(__VAX)
/*
* We privide a 'basic' snprintf, which 'might' overrun a buffer, but
* the actual use cases don't on other platforms and none of the callers
* care about the function return value.
*/
int sim_vax_snprintf(char *buf, size_t buf_size, const char *fmt, ...)
{
va_list arglist;
va_start (arglist, fmt);
vsprintf (buf, fmt, arglist);
va_end (arglist);
return 0;
}
#endif