Skip to content

Commit 82c38fe

Browse files
committed
patch 8.2.2294: VMS: a few remaining problems
Problem: VMS: a few remaining problems. Solution: Add VMS specific changes. Add Lua support. (Zoltan Arpadffy)
1 parent bb0956f commit 82c38fe

9 files changed

Lines changed: 110 additions & 54 deletions

File tree

src/Make_vms.mms

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Makefile for Vim on OpenVMS
33
#
44
# Maintainer: Zoltan Arpadffy <[email protected]>
5-
# Last change: 2020 Dec 30
5+
# Last change: 2021 Jan 04
66
#
77
# This script has been tested on VMS 6.2 to 8.4 on DEC Alpha, VAX and IA64
88
# with MMS and MMK
@@ -38,18 +38,18 @@ MODEL = HUGE
3838
# GUI or terminal mode executable.
3939
# Comment out if you want just the character terminal mode only.
4040
# GUI with Motif
41-
GUI = YES
41+
# GUI = YES
4242

4343
# GUI with GTK
4444
# If you have GTK installed you might want to enable this option.
4545
# NOTE: you will need to properly define GTK_DIR below
46-
# NOTE: since Vim 7.3 GTK 2+ is used that is not ported to VMS,
47-
# therefore this option should not be used
46+
# NOTE: since Vim 7.3 GTK 2+ is used that is not ported to VMS,
47+
# therefore this option should not be used
4848
# GTK = YES
4949

5050
# GUI/Motif with XPM
5151
# If you have XPM installed you might want to build Motif version with toolbar
52-
XPM = YES
52+
# XPM = YES
5353

5454
# Comment out if you want the compiler version with :ver command.
5555
# NOTE: This part can make some complications if you're using some
@@ -59,7 +59,7 @@ CCVER = YES
5959

6060
# Uncomment if want a debug version. Resulting executable is DVIM.EXE
6161
# Development purpose only! Normally, it should not be defined. !!!
62-
# DEBUG = YES
62+
# DEBUG = YES
6363

6464
# Languages support for Perl, Python, TCL etc.
6565
# If you don't need it really, leave them behind the comment.
@@ -68,6 +68,7 @@ CCVER = YES
6868
# VIM_PERL = YES
6969
# VIM_PYTHON = YES
7070
# VIM_RUBY = YES
71+
# VIM_LUA = YES
7172

7273
# X Input Method. For entering special languages like chinese and
7374
# Japanese.
@@ -180,7 +181,7 @@ XPM_INC = ,[.xpm.include]
180181
XPM_LIB = ,OS_VMS_XPM.OPT/OPT
181182
.ELSE
182183
DEFS = "HAVE_CONFIG_H","FEAT_GUI_MOTIF"
183-
XPM_INC =
184+
XPM_INC =
184185
.ENDIF
185186
LIBS = ,OS_VMS_MOTIF.OPT/OPT
186187
GUI_FLAG =
@@ -237,6 +238,15 @@ RUBY_LIB = ,OS_VMS_RUBY.OPT/OPT
237238
RUBY_INC =
238239
.ENDIF
239240

241+
.IFDEF VIM_LUA
242+
# LUA related setup.
243+
LUA_DEF = ,"FEAT_LUA"
244+
LUA_SRC = if_lua.c
245+
LUA_OBJ = if_lua.obj
246+
LUA_LIB = ,OS_VMS_LUA.OPT/OPT
247+
LUA_INC = ,LUA$ROOT:[INCLUDE]
248+
.ENDIF
249+
240250
.IFDEF VIM_XIM
241251
# XIM related setup.
242252
.IFDEF GUI
@@ -247,7 +257,7 @@ XIM_DEF = ,"FEAT_XIM"
247257
.IFDEF VIM_MZSCHEME
248258
# MZSCHEME related setup
249259
MZSCH_DEF = ,"FEAT_MZSCHEME"
250-
MZSCH_SRC = if_mzsch.c
260+
MZSCH_SRC = if_mzsch.c
251261
MZSCH_OBJ = if_mzsch.obj
252262
.ENDIF
253263

@@ -258,7 +268,7 @@ ICONV_DEF = ,"USE_ICONV"
258268

259269
# XDIFF related setup.
260270
XDIFF_SRC = xdiffi.c,xemit.c,xprepare.c,xutils.c,xhistogram.c,xpatience.c
261-
XDIFF_OBJ = xdiffi.obj,xemit.obj,xprepare.obj,xutils.obj,xhistogram.obj,xpatience.obj
271+
XDIFF_OBJ = xdiffi.obj,xemit.obj,xprepare.obj,xutils.obj,xhistogram.obj,xpatience.obj
262272
XDIFF_INC = ,[.xdiff]
263273

264274
######################################################################
@@ -275,7 +285,7 @@ VIMHOST = "''F$TRNLNM("SYS$NODE")'''F$TRNLNM("UCX$INET_HOST")'.''F$TRNLNM("UCX$I
275285
.SUFFIXES : .obj .c
276286

277287
ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
278-
$(TCL_DEF)$(RUBY_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
288+
$(TCL_DEF)$(RUBY_DEF)$(LUA_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
279289
$(ICONV_DEF)) -
280290
$(CFLAGS)$(GUI_FLAG) -
281291
/include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC)$(PERL_INC)$(PYTHON_INC) -
@@ -286,14 +296,14 @@ ALL_CFLAGS = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
286296
# as $(GUI_INC) - replaced with $(GUI_INC_VER)
287297
# Otherwise should not be any other difference.
288298
ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) -
289-
$(TCL_DEF)$(RUBY_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
299+
$(TCL_DEF)$(RUBY_DEF)$(LUA_DEF)$(XIM_DEF)$(TAG_DEF)$(MZSCH_DEF) -
290300
$(ICONV_DEF)) -
291301
$(CFLAGS)$(GUI_FLAG) -
292302
/include=($(C_INC)$(GUI_INC_DIR)$(GUI_INC_VER)$(PERL_INC)$(PYTHON_INC) -
293303
$(TCL_INC)$(XDIFF_INC)$(XPM_INC))
294304

295305
ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) $(XPM_LIB)\
296-
$(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB)
306+
$(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB) $(LUA_LIB)
297307

298308
SRC = \
299309
arabic.c \
@@ -408,6 +418,7 @@ SRC = \
408418
$(PYTHON_SRC) \
409419
$(TCL_SRC) \
410420
$(RUBY_SRC) \
421+
$(LUA_SRC) \
411422
$(MZSCH_SRC) \
412423
$(XDIFF_SRC)
413424

@@ -525,11 +536,12 @@ OBJ = \
525536
$(PYTHON_OBJ) \
526537
$(TCL_OBJ) \
527538
$(RUBY_OBJ) \
539+
$(LUA_OBJ) \
528540
$(MZSCH_OBJ) \
529541
$(XDIFF_OBJ)
530542

531543
# Default target is making the executable
532-
all : [.auto]config.h mmk_compat motif_env gtk_env perl_env python_env tcl_env ruby_env $(TARGET)
544+
all : [.auto]config.h mmk_compat motif_env gtk_env perl_env python_env tcl_env ruby_env lua_env $(TARGET)
533545
! $@
534546

535547
[.auto]config.h : $(CONFIG_H)
@@ -611,7 +623,7 @@ motif_env :
611623
.ENDIF
612624
.IFDEF MMSIA64
613625
-@ write opt_file "[.xpm.vms.ia64]libxpm.olb/lib"
614-
.ENDIF
626+
.ENDIF
615627
-@ close opt_file
616628
.ELSE
617629
-@ write sys$output "using DECW/Motif environment."
@@ -709,11 +721,24 @@ ruby_env :
709721
-@ !
710722
.ENDIF
711723

724+
.IFDEF VIM_LUA
725+
lua_env :
726+
-@ write sys$output "using LUA environment:"
727+
-@ write sys$output " include path: ""$(LUA_INC)"""
728+
-@ write sys$output "creating OS_VMS_LUA.OPT file."
729+
-@ open/write opt_file OS_VMS_LUA.OPT
730+
-@ write opt_file "LUA$ROOT:[LIB]LUA$SHR.EXE /share"
731+
-@ close opt_file
732+
.ELSE
733+
lua_env :
734+
-@ !
735+
.ENDIF
736+
712737
arabic.obj : arabic.c vim.h
713738
arglist.obj : arglist.c vim.h [.auto]config.h feature.h os_unix.h
714739
autocmd.obj : autocmd.c vim.h [.auto]config.h feature.h os_unix.h
715740
blowfish.obj : blowfish.c vim.h [.auto]config.h feature.h os_unix.h
716-
blob.obj : blob.c vim.h [.auto]config.h feature.h os_unix.h
741+
blob.obj : blob.c vim.h [.auto]config.h feature.h os_unix.h
717742
buffer.obj : buffer.c vim.h [.auto]config.h feature.h os_unix.h \
718743
ascii.h keymap.h term.h macros.h structs.h regexp.h \
719744
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
@@ -873,7 +898,7 @@ if_xcmdsrv.obj : if_xcmdsrv.c vim.h [.auto]config.h feature.h os_unix.h \
873898
if_mzsch.obj : if_mzsch.c vim.h [.auto]config.h feature.h os_unix.h \
874899
ascii.h keymap.h term.h macros.h option.h structs.h \
875900
regexp.h gui.h beval.h [.proto]gui_beval.pro ex_cmds.h proto.h \
876-
errors.h globals.h if_mzsch.h
901+
errors.h globals.h if_mzsch.h
877902
indent.obj : indent.c vim.h [.auto]config.h feature.h os_unix.h
878903
insexpand.obj : insexpand.c vim.h [.auto]config.h feature.h os_unix.h
879904
json.obj : json.c vim.h [.auto]config.h feature.h os_unix.h \
@@ -1167,6 +1192,8 @@ if_ruby.obj : if_ruby.c vim.h [.auto]config.h feature.h os_unix.h \
11671192
ascii.h keymap.h term.h macros.h structs.h regexp.h \
11681193
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
11691194
errors.h globals.h version.h
1195+
if_lua.obj : if_lua.c vim.h [.auto]config.h feature.h os_unix.h \
1196+
errors.h globals.h version.h
11701197
beval.obj : beval.c vim.h [.auto]config.h feature.h os_unix.h \
11711198
ascii.h keymap.h term.h macros.h structs.h regexp.h \
11721199
gui.h beval.h option.h ex_cmds.h proto.h \
@@ -1186,4 +1213,4 @@ xemit.obj : [.xdiff]xemit.c [.xdiff]xinclude.h [.auto]config.h vim.h feature.h o
11861213
xprepare.obj : [.xdiff]xprepare.c [.xdiff]xinclude.h [.auto]config.h vim.h feature.h os_unix.h
11871214
xutils.obj : [.xdiff]xutils.c [.xdiff]xinclude.h [.auto]config.h vim.h feature.h os_unix.h
11881215
xhistogram.obj : [.xdiff]xhistogram.c [.xdiff]xinclude.h [.auto]config.h vim.h feature.h os_unix.h
1189-
xpatience.obj : [.xdiff]xpatience.c [.xdiff]xinclude.h [.auto]config.h vim.h feature.h os_unix.h
1216+
xpatience.obj : [.xdiff]xpatience.c [.xdiff]xinclude.h [.auto]config.h vim.h feature.h os_unix.h

src/fileio.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@
1616
#if defined(__TANDEM)
1717
# include <limits.h> // for SSIZE_MAX
1818
#endif
19-
#if defined(UNIX) && defined(FEAT_EVAL)
19+
#if (defined(UNIX) || defined(VMS)) && defined(FEAT_EVAL)
2020
# include <pwd.h>
2121
# include <grp.h>
2222
#endif
23+
#if defined(VMS) && defined(HAVE_XOS_R_H)
24+
# include <x11/xos_r.h>
25+
#endif
2326

2427
// Is there any system that doesn't have access()?
2528
#define USE_MCH_ACCESS
@@ -338,7 +341,7 @@ readfile(
338341

339342
if (!read_stdin && !read_buffer && !read_fifo)
340343
{
341-
#ifdef UNIX
344+
#if defined(UNIX) || defined(VMS)
342345
/*
343346
* On Unix it is possible to read a directory, so we have to
344347
* check for it before the mch_open().
@@ -4623,11 +4626,13 @@ create_readdirex_item(char_u *path, char_u *name)
46234626
q = (char_u*)pw->pw_name;
46244627
if (dict_add_string(item, "user", q) == FAIL)
46254628
goto theend;
4629+
# if !defined(VMS) || (defined(VMS) && defined(HAVE_XOS_R_H))
46264630
gr = getgrgid(st.st_gid);
46274631
if (gr == NULL)
46284632
q = (char_u*)"";
46294633
else
46304634
q = (char_u*)gr->gr_name;
4635+
# endif
46314636
if (dict_add_string(item, "group", q) == FAIL)
46324637
goto theend;
46334638
}

src/gui_xmebw.c

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@
6969
_XmDrawHighlight(a, b, c, d, e, f, g, h, LineSolid)
7070
#endif
7171

72+
// Older VMS systems do not have xos_r.h and cannot haldle XtProcessLocking
73+
#if defined(VMS)
74+
# if defined(HAVE_XOS_R_H)
75+
# define XTPROCESS_LOCK XtProcessLock()
76+
# define XTPROCESS_UNLOCK XtProcessUnlock()
77+
# else
78+
# define XTPROCESS_LOCK
79+
# define XTPROCESS_UNLOCK
80+
# endif
81+
#else
82+
# define XTPROCESS_LOCK XtProcessLock()
83+
# define XTPROCESS_UNLOCK XtProcessUnlock()
84+
#endif
85+
7286
/*
7387
* Motif internals we have to cheat around with.
7488
*/
@@ -714,9 +728,9 @@ draw_label(XmEnhancedButtonWidget eb, XEvent *event, Region region)
714728
{
715729
XtExposeProc expose;
716730

717-
XtProcessLock();
731+
XTPROCESS_LOCK;
718732
expose = xmLabelClassRec.core_class.expose;
719-
XtProcessUnlock();
733+
XTPROCESS_UNLOCK;
720734
(*expose)((Widget) eb, event, region);
721735
}
722736

@@ -809,9 +823,9 @@ Enter(Widget wid,
809823
_XmPrimitiveEnter((Widget) eb, event, NULL, NULL);
810824
if (eb->pushbutton.armed == TRUE)
811825
{
812-
XtProcessLock();
826+
XTPROCESS_LOCK;
813827
expose = XtClass(eb)->core_class.expose;
814-
XtProcessUnlock();
828+
XTPROCESS_UNLOCK;
815829
(*expose) (wid, event, (Region) NULL);
816830
}
817831

@@ -887,9 +901,9 @@ Leave(Widget wid,
887901
{
888902
XtExposeProc expose;
889903
eb->pushbutton.armed = FALSE;
890-
XtProcessLock();
904+
XTPROCESS_LOCK;
891905
expose = XtClass(eb)->core_class.expose;
892-
XtProcessUnlock();
906+
XTPROCESS_UNLOCK;
893907
(*expose) (wid, event, (Region)NULL);
894908
draw_unhighlight(eb);
895909
draw_pixmap(eb, event, NULL);
@@ -973,9 +987,9 @@ set_size(XmEnhancedButtonWidget newtb)
973987
// Invoke Label's Resize procedure.
974988
{
975989
XtWidgetProc resize;
976-
XtProcessLock();
990+
XTPROCESS_LOCK;
977991
resize = xmLabelClassRec.core_class.resize;
978-
XtProcessUnlock();
992+
XTPROCESS_UNLOCK;
979993

980994
(* resize) ((Widget) newtb);
981995
}
@@ -988,9 +1002,9 @@ Initialize(Widget rq, Widget ebw, ArgList args UNUSED, Cardinal *n UNUSED)
9881002
XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)ebw;
9891003
XtWidgetProc resize;
9901004

991-
XtProcessLock();
1005+
XTPROCESS_LOCK;
9921006
resize = xmLabelClassRec.core_class.resize;
993-
XtProcessUnlock();
1007+
XTPROCESS_UNLOCK;
9941008

9951009
// Create a bitmap for stippling (Drawable resources are cheap).
9961010
if (STIPPLE_BITMAP == None)

src/macros.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@
161161
# define mch_fstat(n, p) fstat((n), (p))
162162
# undef HAVE_LSTAT // VMS does not have lstat()
163163
# define mch_stat(n, p) stat(vms_fixfilename(n), (p))
164-
# define mch_rmdir(n) rmdir(vms_fixfilename(n))
165164
#else
166165
# ifndef MSWIN
167166
# define mch_access(n, p) access((n), (p))

src/os_unix.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@
7373
// always use unlink() to remove files
7474
#ifndef PROTO
7575
# ifdef VMS
76-
# define mch_remove(x) delete((char *)(x))
77-
# define vim_mkdir(x, y) mkdir((char *)(x), y)
76+
# define vim_mkdir(x, y) mkdir((char *)vms_fixfilename(x), y)
77+
# define mch_rmdir(x) delete((char *)vms_fixfilename(x))
78+
# define mch_remove(x) delete((char *)vms_fixfilename(x))
7879
# else
7980
# define vim_mkdir(x, y) mkdir((char *)(x), y)
8081
# define mch_rmdir(x) rmdir((char *)(x))

src/os_vms.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,18 @@ vms_fixfilename(void *instring)
672672
else if (strchr(instring,'"') == NULL) // password in the path?
673673
{
674674
// Seems it is a regular file, let guess that it is pure Unix fspec
675-
if (decc$to_vms(instring, vms_fspec_proc, 0, 0) <= 0)
676-
// No... it must be mixed
675+
if ( (strchr(instring,'[') == NULL) && (strchr(instring,'<') == NULL) &&
676+
(strchr(instring,']') == NULL) && (strchr(instring,'>') == NULL) &&
677+
(strchr(instring,':') == NULL) )
678+
{
679+
// It must be a truly unix fspec
680+
decc$to_vms(instring, vms_fspec_proc, 0, 0);
681+
}
682+
else
683+
{
684+
// It is a mixed fspec
677685
vms_unix_mixed_filespec(instring, buf);
686+
}
678687
}
679688
else
680689
// we have a password in the path

src/os_vms_conf.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
#undef HAVE_FCHDIR
148148
#undef HAVE_LSTAT
149149
#undef HAVE_STDINT_H
150-
#undef HAVE_XOS_R_H
151150

152151
// Hardware specific
153152
#ifdef VAX
@@ -157,25 +156,25 @@
157156
#undef HAVE_STRINGS_H
158157
#undef HAVE_SIGSETJMP
159158
#undef HAVE_ISNAN
159+
#undef HAVE_XOS_R_H
160160
#define HAVE_NO_LONG_LONG
161161
#define VIM_SIZEOF_LONG 4
162-
#define LONG_LONG_MIN (-2147483647-1)
163-
#define LONG_LONG_MAX (2147483647)
162+
#define LONG_LONG_MIN (-2147483647-1)
163+
#define LONG_LONG_MAX (2147483647)
164164
#define ULONG_LONG_MAX (4294967295U)
165-
#undef XTHREADS
166165
#else // AXP and IA64
167166
#define HAVE_GETTIMEOFDAY
168167
#define HAVE_USLEEP
169168
#define HAVE_STRCASECMP
170169
#define HAVE_STRINGS_H
171170
#define HAVE_SIGSETJMP
172171
#define HAVE_ISNAN
172+
#define HAVE_XOS_R_H
173173
#define HAVE_NO_LONG_LONG
174174
#define VIM_SIZEOF_LONG 8
175-
#define LONG_LONG_MIN (-9223372036854775807-1)
176-
#define LONG_LONG_MAX (9223372036854775807)
175+
#define LONG_LONG_MIN (-9223372036854775807-1)
176+
#define LONG_LONG_MAX (9223372036854775807)
177177
#define ULONG_LONG_MAX (18446744073709551615U)
178-
#define XTHREADS
179178
#endif
180179

181180
// Compiler specific

0 commit comments

Comments
 (0)