summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-12-29 19:38:09 +0200
committerArnold D. Robbins <arnold@skeeve.com>2013-12-29 19:38:09 +0200
commita26ea21bba35f0118c7d5c4414c6f6c7fa74b16b (patch)
tree94991ccaf7e818be602a349a66530640158fb765
parent434a743610b2856078b120cb50bfe92155f8c49c (diff)
downloadgawk-a26ea21bba35f0118c7d5c4414c6f6c7fa74b16b.tar.gz
Enable compiling extensions on VMS.
-rw-r--r--extension/ChangeLog6
-rw-r--r--extension/filefuncs.c27
-rw-r--r--extension/fnmatch.c14
-rw-r--r--extension/gawkdirfd.h4
-rw-r--r--test/ChangeLog4
-rw-r--r--test/fts.awk24
-rw-r--r--vms/ChangeLog5
-rw-r--r--vms/descrip.mms91
8 files changed, 172 insertions, 3 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 328d58ba..c0e1fbb0 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-29 John E. Malmberg <wb8tyw@qsl.net>
+
+ * gawkdirfd.h: Adjust include for VMS.
+ * filefuncs.c: Make it compile on VMS.
+ * fnmatch.c: Make it compile on VMS.
+
2013-12-21 Mike Frysinger <vapier@gentoo.org>
* configure.ac: Remove MirBSD and OS/390 hack to create
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 61cadfec..a6e99e8e 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -36,6 +36,33 @@
#define _BSD_SOURCE
+#ifdef __VMS
+#if (__CRTL_VER >= 70200000) && !defined (__VAX)
+#define _LARGEFILE 1
+#endif
+
+#ifndef __VAX
+#ifdef __CRTL_VER
+#if __CRTL_VER >= 80200000
+#define _USE_STD_STAT 1
+#endif
+#endif
+#endif
+#define _POSIX_C_SOURCE 1
+#define _XOPEN_SOURCE 1
+#include <stat.h>
+#ifndef S_ISVTX
+#define S_ISVTX (0)
+#endif
+#ifndef major
+#define major(s) (s)
+#endif
+#ifndef minor
+#define minor(s) (0)
+#endif
+#endif
+
+
#include <stdio.h>
#include <assert.h>
#include <errno.h>
diff --git a/extension/fnmatch.c b/extension/fnmatch.c
index a67bc25f..a85bcc78 100644
--- a/extension/fnmatch.c
+++ b/extension/fnmatch.c
@@ -45,15 +45,29 @@
#define _(msgid) gettext(msgid)
#define N_(msgid) msgid
+#ifdef __VMS
+#define __iswctype iswctype
+#define __btowc btowc
+#endif
+
#define _GNU_SOURCE 1 /* use GNU extensions if they're there */
#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
#else
+#ifdef __VMS
+#include "fnmatch.h" /* version that comes with gawk */
+#else
#include "../missing_d/fnmatch.h" /* version that comes with gawk */
#endif
+#define HAVE_FNMATCH_H
+#endif
#ifndef HAVE_FNMATCH
+#ifdef __VMS
+#include "fnmatch.c" /* ditto */
+#else
#include "../missing_d/fnmatch.c" /* ditto */
+#endif
#define HAVE_FNMATCH
#endif
diff --git a/extension/gawkdirfd.h b/extension/gawkdirfd.h
index a3a2b6a6..d1edf65f 100644
--- a/extension/gawkdirfd.h
+++ b/extension/gawkdirfd.h
@@ -35,7 +35,11 @@
* Unlike the main gawk code base, this include is NOT dependant
* upon MinGW or EMX.
*/
+#ifndef __VMS
#include "../nonposix.h"
+#else
+#include "nonposix.h"
+#endif
#ifndef DIR_TO_FD
# define DIR_TO_FD(d) (FAKE_FD_VALUE)
diff --git a/test/ChangeLog b/test/ChangeLog
index 378c6ae3..dd73cbc6 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2013-12-29 John E. Malmberg <wb8tyw@qsl.net>
+
+ * fts.awk: Adjust for VMS.
+
2013-12-10 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am: Remove instances of "" that were incorrect.
diff --git a/test/fts.awk b/test/fts.awk
index a1b49cbd..d2e55cab 100644
--- a/test/fts.awk
+++ b/test/fts.awk
@@ -3,8 +3,19 @@
BEGIN {
Level = 0
- system("rm -fr d1 d2")
- system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2")
+ os = ""
+ if (ENVIRON["AWKLIBPATH"] == "sys$disk:[-]") {
+ os = "VMS"
+ system("create/dir/prot=o:rwed [.d1]")
+ system("create/dir/prot=o:rwed [.d2]")
+ system("copy fts.awk [.d1]f1")
+ system("copy fts.awk [.d1]f2")
+ system("copy fts.awk [.d2]f1")
+ system("copy fts.awk [.d2]f2")
+ } else {
+ system("rm -fr d1 d2")
+ system("mkdir d1 d2 ; touch d1/f1 d1/f2 d2/f1 d2/f2")
+ }
pathlist[1] = "d1"
pathlist[2] = "d2"
flags = FTS_PHYSICAL
@@ -19,7 +30,14 @@ BEGIN {
traverse(data2)
close(output)
- system("rm -fr d1 d2")
+ if (os == "VMS") {
+ system("delete [.d1]*.*;*")
+ system("delete [.d2]*.*;*")
+ system("delete d1.dir;*")
+ system("delete d2.dir;*")
+ } else {
+ system("rm -fr d1 d2")
+ }
}
function indent( i)
diff --git a/vms/ChangeLog b/vms/ChangeLog
index 504967fd..7e6c7311 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-29 John E. Malmberg <wb8tyw@qsl.net>
+
+ * descrip.mms: Build the dynamic extensions that will work.
+ Alpha and Itanium only.
+
2013-12-23 John E. Malmberg <wb8tyw@qsl.net>
* gawkmisc.vms: Fix program name calculation on VAX.
diff --git a/vms/descrip.mms b/vms/descrip.mms
index 2000e680..f53db272 100644
--- a/vms/descrip.mms
+++ b/vms/descrip.mms
@@ -76,6 +76,7 @@ CFLOAT = /float=ieee/ieee_mode=denorm_results
CNAME = /NAME=(AS_IS,SHORT)
CC = cc/DECC/Prefix=All/NESTED_INCLUDE=NONE$(CFLOAT)
CFLAGS = /Incl=([],[.vms])/Obj=[]/Def=($(CDEFS))$(CNAME) $(CCFLAGS)
+CEFLAGS = /Incl=([],[.vms],[.missing_d],[.extension])$(CNAME) $(CCFLAGS)
LIBS = # DECC$SHR instead of VAXCRTL, no special link option needed
.endif !VAXC
.endif !GNUC
@@ -240,6 +241,96 @@ $(VMSCMD) : $(VMSDIR)gawk.cld
install.help : $(VMSDIR)gawk.hlp
library/help $(HELPLIB) $< /log
+
+# Build dynamic extensions - Alpha/Itanium only.
+.ifdef __VAX__
+# VAX not complete yet.
+plug_opt = [.VMS.VAX]gawk_plugin_xfer.opt
+.else
+plug_opt = [.vms]gawk_plugin.opt
+.endif
+
+ext_gawkdirfd_h = [.extension]gawkdirfd.h config.h nonposix.h
+
+extensions : filefuncs.exe fnmatch.exe inplace.exe ordchr.exe readdir.exe \
+ revoutput.exe revtwoway.exe rwarray.exe testext.exe time.exe
+
+filefuncs.exe : filefuncs.obj stack.obj gawkfts.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), stack.obj, gawkfts.obj, \
+ $(plug_opt)/opt
+
+fnmatch.exe : fnmatch.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+inplace.exe : inplace.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+ordchr.exe : ordchr.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+readdir.exe : readdir.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+revoutput.exe : revoutput.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+revtwoway.exe : revtwoway.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+rwarray.exe : rwarray.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+testext.exe : testext.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+time.exe : time.obj $(plug_opt)
+ link/share=$(MMS$TARGET) $(MMS$SOURCE), $(plug_opt)/opt
+
+stack.obj : [.extension]stack.c config.h gawkapi.h \
+ [.extension]gawkfts.h, [.extension]stack.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+gawkfts.obj : [.extension]gawkfts.c config.h [.extension]gawkfts.h \
+ $(ext_gawkdirfd_h)
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H, ZOS_USS, "fchdir(x)=(-1)") \
+ /object=$(MMS$TARGET) $(MMS$SOURCE)
+
+filefuncs.obj : [.extension]filefuncs.c config.h gawkapi.h \
+ [.extension]gawkfts.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+fnmatch.obj : [.extension]fnmatch.c config.h gawkapi.h \
+ [.missing_d]fnmatch.h [.missing_d]fnmatch.c
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+inplace.obj : [.extension]inplace.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+ordchr.obj : [.extension]ordchr.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+readdir.obj : [.extension]readdir.c config.h gawkapi.h \
+ $(ext_gawkdirfd_h)
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H, HAVE_DIRENT_H) \
+ /object=$(MMS$TARGET) $(MMS$SOURCE)
+
+revoutput.obj : [.extension]revoutput.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+revtwoway.obj : [.extension]revtwoway.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H, HAVE_GETDTABLESIZE) \
+ /object=$(MMS$TARGET) $(MMS$SOURCE)
+
+rwarray.obj : [.extension]rwarray.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+testext.obj : [.extension]testext.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+time.obj : [.extension]time.c config.h gawkapi.h
+ $(CC)$(CEFLAGS)/define=(HAVE_CONFIG_H)/object=$(MMS$TARGET) $(MMS$SOURCE)
+
+
# miscellaneous other targets
tidy :
- if f$search("*.*;-1").nes."" then purge