changeset 33888:cb88e5c589d0 v9.0.2153

patch 9.0.2153: no support to build on OpenVMS Commit: https://github.com/vim/vim/commit/1c8e233cb8357b4f218bfa777f6d81456d0b43a2 Author: Zoltan Arpadffy <zoltan.arpadffy@gmail.com> Date: Tue Dec 5 16:04:23 2023 +0100 patch 9.0.2153: no support to build on OpenVMS Problem: no support to build on OpenVMS Solution: Add OpenVMS X86_64 platform port closes: #13623 Co-authored-by: errael <errael@raelity.com> Co-authored-by: K.Takata <kentkt@csc.jp> Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Dec 2023 15:16:25 +0100
parents d85d11962b82
children a2322ea851be
files runtime/doc/os_vms.txt src/INSTALLvms.txt src/Make_vms.mms src/crypt.c src/gui.h src/macros.h src/map.c src/optionstr.c src/os_vms_conf.h src/proto/crypt.pro src/term.c src/version.c src/vim.h src/xdiff/xmacros.h
diffstat 14 files changed, 178 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/os_vms.txt
+++ b/runtime/doc/os_vms.txt
@@ -44,14 +44,16 @@ You can download precompiled executables
 
 To use the precompiled binary version, you need one of these archives:
 
-  vim-XX-exe-ia64-gui.zip       IA64 GUI/Motif executables
-  vim-XX-exe-ia64-gtk.zip       IA64 GUI/GTK executables
-  vim-XX-exe-ia64-term.zip      IA64 console executables
+  vim-XX-exe-x86-gui.zip	X86_64 GUI/Motif executables
+  vim-XX-exe-x86-term.zip	X86_64 console executables
+  vim-XX-exe-ia64-gui.zip	IA64 GUI/Motif executables
+  vim-XX-exe-ia64-gtk.zip	IA64 GUI/GTK executables
+  vim-XX-exe-ia64-term.zip	IA64 console executables
   vim-XX-exe-axp-gui.zip	Alpha GUI/Motif executables
   vim-XX-exe-axp-gtk.zip	Alpha GUI/GTK executables
-  vim-XX-exe-axp-term.zip       Alpha console executables
+  vim-XX-exe-axp-term.zip	Alpha console executables
   vim-XX-exe-vax-gui.zip	VAX GUI executables
-  vim-XX-exe-vax-term.zip       VAX console executables
+  vim-XX-exe-vax-term.zip	VAX console executables
 
 and of course (optional)
   vim-XX-runtime.zip		runtime files
@@ -59,7 +61,7 @@ and of course (optional)
 The binary archives contain: vim.exe, ctags.exe, xxd.exe files.
 
 For GTK executables you will need GTKLIB that is available for
-Alpha and IA64 platform.
+Alpha and IA64 platforms.
 
 ==============================================================================
 
@@ -71,9 +73,9 @@ See the file [.SRC]INSTALLVMS.TXT.
 
 4. Problems						*vms-problems*
 
-The code has been tested under Open VMS 6.2 - 8.2 on Alpha, VAX and IA64
-platforms with the DEC C compiler. It should work without major problems.
-If your system does not have some include libraries you can tune up in
+The code has been tested under Open VMS 6.2 - 9.2 on Alpha, VAX, IA64 and
+X86_64 platforms with the DEC C compiler. It should work without major problems.
+If your system does not have some include libraries you can tune in the
 OS_VMS_CONF.H file.
 
 If you decided to build Vim with +perl, +python, etc. options, first you need
@@ -88,8 +90,7 @@ VAX C compiler is not fully ANSI C compa
 semantics, therefore you have to use a converter program that will do the lion
 part of the job.  For detailed instructions read file INSTALLvms.txt
 
-MMS_VIM.EXE is built together with VIM.EXE, but for XXD.EXE you should
-change to a subdirectory and build it separately.
+To build XXD.EXE, you should change to the subdirectory and build it separately.
 
 CTAGS is not part of the Vim source distribution anymore, however the OpenVMS
 specific source might contain CTAGS source files as described above.
@@ -206,6 +207,7 @@ Example LOGIN.COM: >
 	$ define/nolog VIM DKA0:[UTIL.VIM81]
 	$ vi*m :== mcr VIM:VIM.EXE
 	$ gv*im:== spawn/nowait/input=NLA0 mcr VIM:VIM.EXE -g -GEOMETRY 80x40
+	$ set term/inq/ins ! inquire the terminal capabilities
 	$ set disp/create/node=192.168.10.202/trans=tcpip
 
 Note: This set-up should be enough, if you are working on a standalone server or
@@ -443,7 +445,12 @@ Terminal entry not found in termcap
     builtin_dumb
 defaulting to 'vt320'
 ---
-The solution is to define the default terminal name: >
+
+Try to force to inquire the terminal capabilities with: >
+
+	$ set term/inquire
+
+If the inquire did not help, the solutions is to define the default terminal name: >
 
 	$ ! unknown terminal name.  Let us use vt320 or ansi instead.
 	$ ! Note: it's case sensitive
@@ -758,7 +765,18 @@ GNU_TOOLS.ZIP package downloadable from 
 
 9. VMS related changes					*vms-changes*
 
-Version 8.2
+Version 9.0 (2023 Nov 27)
+- Vim is ported to the X86_64 architecture
+	- IMPORTANT: because of the getline function name used in stucts like in ex_cmds.h
+	on X86_64 the CRTL_VER is kept under 80500000 level. The proper solution would be
+	to rename the getline function to something else in the struct (and in all places
+	it is used) - and avoiding to use POSIX functions in structs, but this change would
+	impact on all other operating systems. (added the the VMS TODO list)
+	Read more about at https://forum.vmssoftware.com/viewtopic.php?f=38&t=8914&p=20049
+- os_vms_conf.h includes have been reviewed for all architectures
+- added support for the MODIFIED_BY define
+
+Version 8.2 (2020 Feb 6)
 - make all changes needed for clean compile build of v8.2 on VMS on all platforms
 - fix the call mkdir bug (vicente_polo@yahoo.es)
 - test on VSI OpenVMS Alpha and Itanium platforms
@@ -767,17 +785,18 @@ Version 8.2
 - XPM v3.4.11 libraries for IA64, AXP and VAX are added
 - start integrating the new test scripts
 
-Version 8.1
+Version 8.1 (2019 Jan 9)
 - make necessary changes to build v8.1 on VMS
+- GTK1.2.10 on VAX
 
-Version 8.0
+Version 8.0 (2016 Nov 21)
 - solve the 100% cpu usage issue while waiting for a keystroke
 - correct the VMS warnings and errors around handling the INFINITY (used in json.c)
 - minor VMS port related changes
 - correct the make_vms.mms file for 8.0
 - fix [.TESTDIR]make_vms.mms for 8.0
 
-Version 7.4
+Version 7.4 (2013 Aug 10)
 - Undo: VMS can not handle more than one dot in the filenames use "dir/name" -> "dir/_un_name"
   add _un_ at the beginning to keep the extension
 - correct swap file name wildcard handling
@@ -793,7 +812,7 @@ Version 7.4
 - minor compiler warnings fixed
 - CTAGS 5.8 +regex included
 
-Version 7.3
+Version 7.3 (2010 Aug 15)
 - CTAGS 5.8 included
 - VMS compile warnings fixed - floating-point overflow warning corrected on VAX
 - filepath completion corrected - too many chars were escaped in filename
@@ -956,7 +975,7 @@ Version 4.5 (1996 Dec 16)
 10. Authors						*vms-authors*
 
 OpenVMS documentation and executables are maintained by:
-Zoltan Arpadffy <arpadffy@polarhome.com>
+Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
 OpenVMS Vim page: http://www.polarhome.com/vim/
 
 This document uses parts and remarks from earlier authors and contributors
--- a/src/INSTALLvms.txt
+++ b/src/INSTALLvms.txt
@@ -1,7 +1,7 @@
 INSTALLvms.txt - Installation of Vim on OpenVMS
 
-Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-Last change:  2008 Jan 06
+Maintainer:   Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
+Last change:  2023 Nov 29
 
 This file contains instructions for compiling Vim on Openvms.
 If you already have an executable version of Vim, you don't need this.
@@ -40,6 +40,9 @@ 1.1. Visit the Vim ftp site (see ftp://f
 
      where X.X is the version number.
 
+You may want to clone the latest source code from https://github/vim/vim
+Or the last tested on OpenVMS from http://polarhome.com/vim/files/source/vms/
+
 1.2. Expand the three archives.
 
 1.3. Apply patches if they exist.  (Patch files are found in the ftp
@@ -81,7 +84,7 @@ 2.2  Edit vim-X.X/src/Make_vms.mms to cu
 			  NORMAL  - A default selection of features enabled
 				    (OpenVMS default)
 			  HUGE	  - All possible features enabled.
-			  Uncommented - will default to NORMAL
+			  Uncommented - will default to HUGE
 	Default		: MODEL = NORMAL
 
 	Parameter name	: GUI
@@ -117,7 +120,7 @@ 2.2  Edit vim-X.X/src/Make_vms.mms to cu
 	Default		: CCVER = YES
 
 	Parameter name	: DEBUG
-	Description	: Building a debug version
+	Description	: Building a debug version (DVIM.EXE)
 	Options:	: YES - debug version will be built
 			  Uncommented - building normal executable
 	Default		: Uncommented
@@ -163,6 +166,36 @@ 2.2  Edit vim-X.X/src/Make_vms.mms to cu
 			  Uncommented - build without support.
 	Default		: Uncommented
 
+	Parameter name	: VIM_RUBY
+	Description	: Add Ruby support
+	Options:	: YES - Build with support
+			  Uncommented - build without support.
+	Default		: Uncommented
+
+	Parameter name	: VIM_LUA
+	Description	: Add Lua support
+	Options:	: YES - Build with support
+			  Uncommented - build without support.
+	Default		: Uncommented     
+
+	Parameter name	: VIM_MZSCHEME
+	Description	: Add support for FEATURE_MZSCHEM
+	Options:	: YES - Build with support
+			  Uncommented - build without FEATURE_MZSCHEM.
+	Default		: Uncommented
+
+	Parameter name	: VIM_ICONV
+	Description	: Build with using the ICONV library 
+	Options:	: YES - Build with support
+			  Uncommented - build without support.
+	Default		: Uncommented     
+
+	Parameter name	: MODIFIED_BY
+	Description	: Add note if you modified the code
+	Options:	: YES - Build with adding the MODIFIED_BY define
+			  Uncommented - build without the define
+	Default		: Uncommented
+
      You can edit the *_INC and *_LIB qualifiers, but it is really
      not recommended for beginners.
 
@@ -184,6 +217,11 @@ 3.1. If you have MSS on your system, the
 
 	mms /descrip=Make_vms.mms clean
 
+     The build will stop if any error or warning is encontered. In some cases
+     the warnings can be ignored. Use:
+
+     mms /descrip=Make_vms.mms /ignore=warning
+
 4. Compilation VAXC
 
 4.1. VAXC compiler is not fully ANSI C compatible in pre-processor directives
--- a/src/Make_vms.mms
+++ b/src/Make_vms.mms
@@ -2,9 +2,9 @@
 # Makefile for Vim on OpenVMS
 #
 # Maintainer:   Zoltan Arpadffy <arpadffy@polarhome.com>
-# Last change:  2021 Dec 20
+# Last change:  2023 Nov 27
 #
-# This script has been tested on VMS 6.2 to 8.4 on DEC Alpha, VAX and IA64
+# This script has been tested on VMS 6.2 to 9.2 on VAX, ALPHA, IA64 and X86_64
 # with MMS and MMK
 #
 # The following could be built:
@@ -81,7 +81,11 @@ CCVER = YES
 # VIM_MZSCHEME = YES
 
 # Use ICONV
-# VIM_ICONV  = YES
+# VIM_ICONV = YES
+
+# If you modified the source code and plan to distribute the build
+# please, let the users know that.
+# MODIFIED_BY = "name surname <your@email.com>"
 
 ######################################################################
 # Directory, library and include files configuration section.
@@ -104,12 +108,14 @@ PREFIX	=
 OPTIMIZE= /noopt
 CCVER	=
 .ENDIF
-.ELSE		     # AXP and IA64 with DECC
+.ELSE		     # AXP, IA64, X86 with DECC
 CC_DEF  = cc
 PREFIX  = /prefix=all/name=(upper,short)
 OPTIMIZE= /opt
+.IFDEF MMSX86_64 # This is needed because of getline function name used in stucts like ex_cmds.h  
+ARCH_DEF= ,__CRTL_VER_OVERRIDE=80400000
 .ENDIF
-
+.ENDIF
 
 LD_DEF  = link
 C_INC   = [.proto]
@@ -162,9 +168,9 @@ GTK = ""
 # please note: directory should end with . in order to /trans=conc work
 # This value for GTK_DIR is an example.
 GTK_DIR  = DKA0:[WORK.GTK1210.]
-DEFS     = "HAVE_CONFIG_H","FEAT_GUI_GTK"
+DEFS     = ,"HAVE_CONFIG_H","FEAT_GUI_GTK"
 LIBS     = ,OS_VMS_GTK.OPT/OPT
-GUI_FLAG = /float=ieee/ieee=denorm
+GUI_FLAG = /float=ieee/ieee=denorm/WARNINGS=(DISABLE=MACROREDEF)
 GUI_SRC  = gui.c gui_gtk.c gui_gtk_f.c gui_gtk_x11.c gui_beval.c pty.c
 GUI_OBJ  = gui.obj gui_gtk.obj gui_gtk_f.obj gui_gtk_x11.obj gui_beval.obj pty.obj
 GUI_INC  = ,"/gtk_root/gtk","/gtk_root/glib"
@@ -174,15 +180,15 @@ GUI_INC_VER= ,\""/gtk_root/gtk\"",\""/gt
 .ELSE
 MOTIF	 = YES
 .IFDEF XPM
-DEFS     = "HAVE_CONFIG_H","FEAT_GUI_MOTIF","HAVE_XPM"
+DEFS     = ,"HAVE_CONFIG_H","FEAT_GUI_MOTIF","HAVE_XPM"
 XPM_INC  = ,[.xpm.include]
 XPM_LIB  = ,OS_VMS_XPM.OPT/OPT
 .ELSE
-DEFS     = "HAVE_CONFIG_H","FEAT_GUI_MOTIF"
+DEFS     = ,"HAVE_CONFIG_H","FEAT_GUI_MOTIF"
 XPM_INC  =
 .ENDIF
 LIBS     = ,OS_VMS_MOTIF.OPT/OPT
-GUI_FLAG =
+GUI_FLAG = /WARNINGS=(DISABLE=MACROREDEF)
 GUI_SRC  = gui.c gui_motif.c gui_x11.c gui_beval.c gui_xmdlg.c gui_xmebw.c
 GUI_OBJ  = gui.obj gui_motif.obj gui_x11.obj gui_beval.obj gui_xmdlg.obj gui_xmebw.obj
 GUI_INC  =
@@ -195,7 +201,7 @@ GUI_INC_DIR = ,decw$include:
 
 .ELSE
 # Character terminal only executable
-DEFS	 = "HAVE_CONFIG_H"
+DEFS	 = ,"HAVE_CONFIG_H"
 LIBS	 =
 .ENDIF
 
@@ -269,12 +275,18 @@ XDIFF_SRC = xdiffi.c,xemit.c,xprepare.c,
 XDIFF_OBJ = xdiffi.obj,xemit.obj,xprepare.obj,xutils.obj,xhistogram.obj,xpatience.obj
 XDIFF_INC = ,[.xdiff]
 
+.IFDEF MODIFIED_BY 
+DEF_MODIFIED = YES
+.ELSE
+DEF_MODIFIED = NO
+.ENDIF
+
 ######################################################################
 # End of configuration section.
 # Please, do not change anything below without programming experience.
 ######################################################################
 
-MODEL_DEF = "FEAT_$(MODEL)",
+MODEL_DEF = "FEAT_$(MODEL)"
 
 # These go into pathdef.c
 VIMUSER = "''F$EDIT(F$GETJPI(" ","USERNAME"),"TRIM")'"
@@ -284,7 +296,7 @@ VIMHOST = "''F$TRNLNM("SYS$NODE")'''F$TR
 
 ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
  $(TCL_DEF)$(RUBY_DEF)$(LUA_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
- $(ICONV_DEF)) -
+ $(ICONV_DEF)$(ARCH_DEF)) -
  $(CFLAGS)$(GUI_FLAG) -
  /include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC)$(PERL_INC)$(PYTHON_INC) -
  $(TCL_INC)$(XDIFF_INC)$(XPM_INC))
@@ -295,7 +307,7 @@ ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(
 # Otherwise should not be any other difference.
 ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
  $(TCL_DEF)$(RUBY_DEF)$(LUA_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
- $(ICONV_DEF)) -
+ $(ICONV_DEF)$(ARCH_DEF)) -
  $(CFLAGS)$(GUI_FLAG) -
  /include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC_VER)$(PERL_INC)$(PYTHON_INC) -
  $(TCL_INC)$(XDIFF_INC)$(XPM_INC))
@@ -314,6 +326,7 @@ SRC = \
 	buffer.c \
 	bufwrite.c \
 	change.c \
+	channel.c \
 	charset.c \
 	cindent.c \
 	clientserver.c \
@@ -354,6 +367,7 @@ SRC = \
 	if_xcmdsrv.c \
 	indent.c \
 	insexpand.c \
+	job.c \
 	json.c \
 	list.c \
 	locale.c \
@@ -381,6 +395,7 @@ SRC = \
 	popupmenu.c \
 	popupwin.c \
 	profiler.c \
+	pty.c \
 	quickfix.c \
 	regexp.c \
 	register.c \
@@ -390,6 +405,7 @@ SRC = \
 	session.c \
 	sha256.c \
 	sign.c \
+	sound.c \
 	spell.c \
 	spellfile.c \
 	spellsuggest.c \
@@ -397,6 +413,7 @@ SRC = \
 	syntax.c \
 	tag.c \
 	term.c \
+	terminal.c \
 	termlib.c \
 	testing.c \
 	textformat.c \
@@ -439,6 +456,7 @@ OBJ = \
 	buffer.obj \
 	bufwrite.obj \
 	change.obj \
+	channel.obj \
 	charset.obj \
 	cindent.obj \
 	clientserver.obj \
@@ -480,6 +498,7 @@ OBJ = \
 	if_xcmdsrv.obj \
 	indent.obj \
 	insexpand.obj \
+	job.obj \
 	json.obj \
 	list.obj \
 	locale.obj \
@@ -507,6 +526,7 @@ OBJ = \
 	popupmenu.obj \
 	popupwin.obj \
 	profiler.obj \
+	pty.obj \
 	quickfix.obj \
 	regexp.obj \
 	register.obj \
@@ -516,6 +536,7 @@ OBJ = \
 	session.obj \
 	sha256.obj \
 	sign.obj \
+	sound.obj \
 	spell.obj \
 	spellfile.obj \
 	spellsuggest.obj \
@@ -523,6 +544,7 @@ OBJ = \
 	syntax.obj \
 	tag.obj \
 	term.obj \
+	terminal.obj \
 	termlib.obj \
 	testing.obj \
 	textformat.obj \
@@ -560,6 +582,11 @@ all : [.auto]config.h mmk_compat motif_e
 
 [.auto]config.h : $(CONFIG_H)
 	copy/nolog $(CONFIG_H) [.auto]config.h
+	-@ open/append ac [.auto]config.h
+        -@ hash[0,8]=35
+	-@ quotes[0,8]=34
+        -@ if ""$(DEF_MODIFIED)"" .EQS. "YES" then write ac ''hash',"define MODIFIED_BY ",''quotes',$(MODIFIED_BY),''quotes'
+	-@ close ac
 
 mmk_compat :
 	-@ open/write pd pathdef.c
@@ -772,6 +799,7 @@ charset.obj : charset.c vim.h [.auto]con
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
  errors.h globals.h
+channel.obj : channel.c vim.h [.auto]config.h feature.h
 cindent.obj : cindent.c vim.h [.auto]config.h feature.h os_unix.h \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -921,6 +949,7 @@ if_mzsch.obj : if_mzsch.c vim.h [.auto]c
  errors.h globals.h if_mzsch.h
 indent.obj : indent.c vim.h [.auto]config.h feature.h os_unix.h
 insexpand.obj : insexpand.c vim.h [.auto]config.h feature.h os_unix.h
+job.obj : job.c vim.h [.auto]config.h feature.h os_unix.h
 json.obj : json.c vim.h [.auto]config.h feature.h os_unix.h   \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \
  [.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
@@ -1015,6 +1044,7 @@ popupwin.obj : popupwin.c vim.h [.auto]c
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
  errors.h globals.h
+pty.obj : pty.c vim.h [.auto]config.h feature.h os_unix.h
 profiler.obj : profiler.c vim.h [.auto]config.h feature.h os_unix.h \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -1055,6 +1085,7 @@ sign.obj : sign.c vim.h [.auto]config.h 
  ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \
  beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \
  errors.h globals.h
+sound.obj : sound.c vim.h [.auto]config.h feature.h 
 spell.obj : spell.c vim.h [.auto]config.h feature.h os_unix.h \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \
  gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -1081,6 +1112,7 @@ tag.obj : tag.c vim.h [.auto]config.h fe
 term.obj : term.c vim.h [.auto]config.h feature.h os_unix.h   \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \
  [.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
+terminal.obj : terminal.c vim.h [.auto]config.h feature.h os_unix.h
 termlib.obj : termlib.c vim.h [.auto]config.h feature.h os_unix.h   \
  ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \
  [.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -1308,7 +1308,7 @@ crypt_sodium_init(void)
     return sodium_init();
 }
 
-    uint32_t
+    UINT32_T
 crypt_sodium_randombytes_random(void)
 {
     return randombytes_random();
--- a/src/gui.h
+++ b/src/gui.h
@@ -12,15 +12,9 @@
 #endif
 
 #ifdef FEAT_GUI_GTK
-# ifdef VMS // undef MIN and MAX because Intrinsic.h redefines them anyway
-#  ifdef MAX
-#   undef MAX
-#  endif
-#  ifdef MIN
-#   undef MIN
-#  endif
+# ifdef VMS
 #  include "gui_gtk_vms.h"
-# endif // VMS
+# endif
 # include <X11/Intrinsic.h>
 # pragma GCC diagnostic push
 # pragma GCC diagnostic ignored "-Wstrict-prototypes"
--- a/src/macros.h
+++ b/src/macros.h
@@ -278,6 +278,10 @@
      static inline int isnan(double x)
 	{ return x != x; }
 #   endif
+#   if defined(VMS) && defined(X86_64)
+     static inline int isinf(double x)
+        { return !isnan(x) && !finite(x); }
+#   endif
 #   ifndef HAVE_ISINF
      static inline int isinf(double x)
 	{ return !isnan(x) && isnan(x - x); }
--- a/src/map.c
+++ b/src/map.c
@@ -3114,7 +3114,7 @@ did_set_langmap(optset_T *args UNUSED)
 		    {
 			if (p[0] != ',')
 			{
-			    snprintf(args->os_errbuf, args->os_errbuflen,
+			    vim_snprintf(args->os_errbuf, args->os_errbuflen,
 				    _(e_langmap_extra_characters_after_semicolon_str),
 				    p);
 			    return args->os_errbuf;
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -233,7 +233,7 @@ illegal_char(char *errbuf, size_t errbuf
 {
     if (errbuf == NULL)
 	return "";
-    snprintf((char *)errbuf, errbuflen, _(e_illegal_character_str),
+    vim_snprintf((char *)errbuf, errbuflen, _(e_illegal_character_str),
 		    (char *)transchar(c));
     return errbuf;
 }
@@ -1541,7 +1541,7 @@ did_set_complete(optset_T *args)
 	    {
 		if (args->os_errbuf != NULL)
 		{
-		    snprintf((char *)args->os_errbuf, args->os_errbuflen,
+		    vim_snprintf((char *)args->os_errbuf, args->os_errbuflen,
 			    _(e_illegal_character_after_chr), *--s);
 		    return args->os_errbuf;
 		}
@@ -4069,7 +4069,7 @@ did_set_viminfo(optset_T *args)
 	    {
 		if (args->os_errbuf != NULL)
 		{
-		    snprintf(args->os_errbuf, args->os_errbuflen,
+		    vim_snprintf(args->os_errbuf, args->os_errbuflen,
 			    _(e_missing_number_after_angle_str_angle),
 			    transchar_byte(*(s - 1)));
 		    errmsg = args->os_errbuf;
--- a/src/os_vms_conf.h
+++ b/src/os_vms_conf.h
@@ -1,7 +1,14 @@
 /*
  * os_vms_conf.h.  Replaces auto/config.h for VMS
+ *
  */
 
+#if defined(__VMS) || defined(__vms)
+#if !defined(VMS)
+#define VMS
+#endif
+#endif
+
 #define CASE_INSENSITIVE_FILENAME   // Open VMS is case insensitive
 #define SPACE_IN_FILENAME	    // There could be space between user and passwd
 #define FNAME_ILLEGAL "|*#?%"       // Illegal characters in a file name
@@ -25,9 +32,6 @@
 // Define when __DATE__ " " __TIME__ can be used
 #define HAVE_DATE_TIME
 
-// Defined to the size of an int
-#define VIM_SIZEOF_INT  4
-
 // #undef USEBCOPY
 #define USEMEMMOVE
 // #undef USEMEMCPY
@@ -138,8 +142,11 @@
 #undef  HAVE_LSTAT
 #undef  HAVE_STDINT_H
 
+// Default features
+#define FEAT_IPV6
+
 // Hardware specific
-#ifdef  VAX
+#if defined(__VAX) || defined(VAX)
 #undef  HAVE_GETTIMEOFDAY
 #undef  HAVE_USLEEP
 #undef  HAVE_STRCASECMP
@@ -148,27 +155,39 @@
 #undef  HAVE_ISNAN
 #undef  HAVE_XOS_R_H
 #define HAVE_NO_LONG_LONG
+#define VIM_SIZEOF_INT  4
 #define VIM_SIZEOF_LONG 4
 #define LONG_LONG_MIN  (-2147483647-1)
 #define LONG_LONG_MAX  (2147483647)
 #define ULONG_LONG_MAX (4294967295U)
-#else // AXP and IA64
+
+#else // ALPHA, IA64, X86_64
 #define HAVE_GETTIMEOFDAY
 #define HAVE_USLEEP
 #define HAVE_STRCASECMP
 #define HAVE_STRINGS_H
 #define HAVE_SIGSETJMP
 #define HAVE_ISNAN
-#define HAVE_XOS_R_H
-#define HAVE_NO_LONG_LONG
+#undef  HAVE_XOS_R_H
+#undef  HAVE_NO_LONG_LONG
+#define VIM_SIZEOF_INT  4
 #define VIM_SIZEOF_LONG 8
 #define LONG_LONG_MIN  (-9223372036854775807-1)
 #define LONG_LONG_MAX  (9223372036854775807)
 #define ULONG_LONG_MAX (18446744073709551615U)
+
+#if defined(__x86_64) || defined(__x86_64__)
+#if !defined(X86_64)
+#define X86_64
+#endif
+#define HAVE_ISNAN
+#define HAVE_ISINF
+#define HAVE_XOS_R_H
+#endif
 #endif
 
 // Compiler specific
-#ifdef  VAXC
+#if defined(VAXC) || defined(__VAXC)
 #undef  HAVE_SELECT
 #undef  HAVE_FCNTL_H
 #undef  HAVE_UNISTD_H
@@ -202,7 +221,7 @@
 #define XUSE_MTSAFE_API
 #define HAVE_X11
 #define WANT_X11
-#ifdef HAVE_XPM
+#ifdef  HAVE_XPM
 #define HAVE_X11_XPM_H
 #endif
 #define USE_FONTSET
--- a/src/proto/crypt.pro
+++ b/src/proto/crypt.pro
@@ -30,5 +30,5 @@ void crypt_sodium_lock_key(char_u *key);
 int crypt_sodium_munlock(void *const addr, const size_t len);
 void crypt_sodium_randombytes_buf(void *const buf, const size_t size);
 int crypt_sodium_init(void);
-uint32_t crypt_sodium_randombytes_random(void);
+UINT32_T crypt_sodium_randombytes_random(void);
 /* vim: set ft=c : */
--- a/src/term.c
+++ b/src/term.c
@@ -2983,7 +2983,7 @@ term_delete_lines(int line_count)
     OUT_STR(tgoto((char *)T_CDL, 0, line_count));
 }
 
-#if defined(UNIX) || defined(PROTO)
+#if defined(UNIX) || defined(VMS) || defined(PROTO)
     void
 term_enable_mouse(int enable)
 {
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2153,
+/**/
     2152,
 /**/
     2151,
--- a/src/vim.h
+++ b/src/vim.h
@@ -439,7 +439,12 @@ typedef unsigned int u8char_T;	// int is
  * The vimlong_T has sizeof(vimlong_T) >= 2 * sizeof(int).
  * One use is simple handling of overflow in int calculations.
  */
+#if defined(VMS) && defined(VAX)
+// unsupported compiler
+typedef long      vimlong_T;
+#else
 typedef long long vimlong_T;
+#endif
 
 #ifndef UNIX		    // For Unix this is included in os_unix.h
 # include <stdio.h>
@@ -499,6 +504,10 @@ typedef long long vimlong_T;
 # include <wctype.h>
 #endif
 #include <stdarg.h>
+// older compilers do not define va_copy
+#ifndef va_copy
+# define va_copy(dst, src)	((dst) = (src))
+#endif
 
 // for offsetof()
 #include <stddef.h>
--- a/src/xdiff/xmacros.h
+++ b/src/xdiff/xmacros.h
@@ -24,7 +24,7 @@
 #define XMACROS_H
 
 
-#ifdef __hpux
+#if defined(__hpux) || defined(VMS)
 # ifndef SIZE_MAX
 #  define SIZE_MAX ((size_t)(-1))
 # endif