| 1 |
|
| 2 |
Compiling GAWK on VMS: |
| 3 |
|
| 4 |
There's a DCL command procedure that will issue all the necessary |
| 5 |
CC and LINK commands, and there's also a Makefile for use with the MMS |
| 6 |
utility. From the source directory, use either |
| 7 |
|$ @[.VMS]VMSBUILD.COM |
| 8 |
or |
| 9 |
|$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS gawk |
| 10 |
or |
| 11 |
|$ MMK/DESCRIPTION=[.VMS]DESCRIP.MMS gawk |
| 12 |
|
| 13 |
Note that on IA64 and Alpha the case of the target may be important. |
| 14 |
MMS has had problems on ODS-5 volumes. MMK does not have these issues. |
| 15 |
MMK is available free from https://github.com/endlesssoftware/mmk. |
| 16 |
The most recent builds of gawk on VMS used MMK. |
| 17 |
|
| 18 |
The vmsbuild.com script is no longer being tested. |
| 19 |
|
| 20 |
DEC C -- use either vmsbuild.com or descrip.mms as is. |
| 21 |
DEC C is also known as Compaq C and HP C. |
| 22 |
|
| 23 |
With the end of HPE Hobbyist OpenVMS licenses as of 2022, only |
| 24 |
builds with VMS Software Inc. (VSI) Community Licenses are being tested. |
| 25 |
|
| 26 |
Builds have been using: |
| 27 |
VSI C x86-64 V7.6-001 (GEM 50YAN) on OpenVMS x86_64 V9.2-3 |
| 28 |
HP C V7.3-020 on OpenVMS IA64 V8.4-2L3 |
| 29 |
HP C V7.3-010 on OpenVMS Alpha V8.4-2L1 |
| 30 |
|
| 31 |
Compiling dynamic extensions on VMS: |
| 32 |
|
| 33 |
GAWK comes with some dynamic extensions. The extensions that have been |
| 34 |
ported to VMS can be built using one of the following commands. |
| 35 |
|
| 36 |
|$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS extensions |
| 37 |
or |
| 38 |
|$ MMK/DESCRIPTION=[.VMS]DESCRIP.MMS extensions |
| 39 |
|
| 40 |
GAWK uses AWKLIBPATH as either an environment variable or a logical name |
| 41 |
to find the dynamic extensions. |
| 42 |
|
| 43 |
Dynamic extensions need to be compiled with the same compiler options for |
| 44 |
floating point, pointer size, and symbol name handling as gawk. |
| 45 |
Alpha and Itanium should use IEEE floating point. The pointer size is 32 bits, |
| 46 |
and the symbol name handling is to be exact case with CRC shortening for |
| 47 |
symbols longer than 32 bits. |
| 48 |
|
| 49 |
Currently dynamic extensions have only been tested to work on VMS 8.3 and later |
| 50 |
on x86_64, Alpha and Itanium. |
| 51 |
|
| 52 |
Compile time are macros needed to be defined before the first VMS supplied |
| 53 |
header file is included. Usually this will be done with a config.h file. |
| 54 |
|
| 55 |
#if (__CRTL_VER >= 70200000) && !defined (__VAX) |
| 56 |
#define _LARGEFILE 1 |
| 57 |
#endif |
| 58 |
|
| 59 |
#ifndef __VAX |
| 60 |
#ifdef __CRTL_VER |
| 61 |
#if __CRTL_VER >= 80200000 |
| 62 |
#define _USE_STD_STAT 1 |
| 63 |
#endif |
| 64 |
#endif |
| 65 |
#endif |
| 66 |
|
| 67 |
Alpha and Itanium: |
| 68 |
|
| 69 |
/name=(as_is,short) |
| 70 |
/float=ieee/ieee_mode=denorm_results |
| 71 |
|
| 72 |
Testing GAWK on VMS: |
| 73 |
|
| 74 |
After you build gawk, you can test it with the [.vms]vmstest.com procedure. |
| 75 |
The procedure takes a parameter that is either for a list of tests or |
| 76 |
a specific test. The parameter clean cleans up files left over from running |
| 77 |
the tests. |
| 78 |
|
| 79 |
$ set def [.test] |
| 80 |
$ @[-.vms]vmstest.com bigtest |
| 81 |
$ @[-.vms]vmstest.com clean |
| 82 |
$ set def [-] |
| 83 |
|
| 84 |
To test the dynamic extensions on VMS 8.3 and later, use: |
| 85 |
|
| 86 |
$ set def [.test] |
| 87 |
$ @[-.vms]vmstest.com extension |
| 88 |
$ @[-.vms]vmstest.com clean |
| 89 |
$ set def [-] |
| 90 |
|
| 91 |
|
| 92 |
Installing GAWK on VMS: |
| 93 |
|
| 94 |
All that's needed is a 'foreign' command, which is a DCL symbol |
| 95 |
whose value begins with a dollar sign. |
| 96 |
|$ GAWK :== $device:[directory]GAWK |
| 97 |
(Substitute the actual location of gawk.exe for 'device:[directory]'.) |
| 98 |
That symbol should be placed in the user's login.com or in the system- |
| 99 |
wide sylogin.com procedure so that it will be defined every time the |
| 100 |
user logs on. |
| 101 |
|
| 102 |
If your gawk was installed by a PCSI kit into the GNV$GNU: directory tree, |
| 103 |
the program will be known as GNV$GNU:[bin]gnv$gawk.exe and the help file |
| 104 |
will be GNV$GNU:[vms_help]gawk.hlp. The GNV$GNU:[vms_bin]gawk_verb.cld can be |
| 105 |
used to add GAWK and the alias AWK to a DCL command table. |
| 106 |
|
| 107 |
Optionally, the help entry can be loaded into a VMS help library. |
| 108 |
|$ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP |
| 109 |
(You may want to substitute a site-specific help library rather than |
| 110 |
the standard VMS library 'HELPLIB'.) After loading the help text, |
| 111 |
|$ HELP GAWK |
| 112 |
will provide information about both the gawk implementation and the |
| 113 |
awk programming language. |
| 114 |
|
| 115 |
The logical name AWK_LIBRARY can designate a default location |
| 116 |
for awk program files. For the '-f' option, if the specified filename |
| 117 |
has no device or directory path information in it, Gawk will look in |
| 118 |
the current directory first, then in the directory specified by the |
| 119 |
translation of AWK_LIBRARY if it the file wasn't found. If the file |
| 120 |
still isn't found, then ".awk" will be appended and the file access |
| 121 |
will be re-tried. If AWK_LIBRARY is not defined, that portion of the |
| 122 |
file search will fail benignly. |
| 123 |
|
| 124 |
|
| 125 |
Running GAWK on VMS: |
| 126 |
|
| 127 |
Command line parsing and quoting conventions are significantly |
| 128 |
different on VMS, so examples in _The_GAWK_Manual_ or the awk book |
| 129 |
often need minor changes. They *are* minor though, and all the awk |
| 130 |
programs should run correctly. |
| 131 |
|
| 132 |
Here are a couple of trivial tests: |
| 133 |
|$ gawk -- "BEGIN {print ""Hello, World!""}" |
| 134 |
|$ gawk -"W" version !could also be -"W version" or "-W version" |
| 135 |
Note that upper- and mixed-case text must be quoted. |
| 136 |
|
| 137 |
The VMS port of Gawk includes a DCL-style interface in addition |
| 138 |
to the original shell-style interface. See the help entry for details. |
| 139 |
One side-effect of dual command line parsing is that if there's only a |
| 140 |
single parameter (as in the quoted string program above), the command |
| 141 |
becomes ambiguous. To work-around this, the normally optional "--" |
| 142 |
flag is required to force shell rather than DCL parsing. If any other |
| 143 |
dash-type options (or multiple parameters such as data files to be |
| 144 |
processed) are present, there is no ambiguity and "--" can be omitted. |
| 145 |
|
| 146 |
The logical name AWKPATH can be used to override the default |
| 147 |
search path of "SYS$DISK:[],AWK_LIBRARY:" when looking for awk program |
| 148 |
files specified by the '-f' option. The format of AWKPATH is a comma- |
| 149 |
separated list of directory specifications. When defining it, the |
| 150 |
value should be quoted so that it retains a single translation, not a |
| 151 |
multi-translation RMS search list. |
| 152 |
|
| 153 |
The exit status from Gawk is encoded in the the VMS $status exit |
| 154 |
value so that the severity bits are set as expected and the original |
| 155 |
Gawk exit value can be extracted. |
| 156 |
|
| 157 |
To extract the actual gawk exit code from the VMS status use: |
| 158 |
unix_status = (vms_status .and. &x7f8) / 8 |
| 159 |
|
| 160 |
The exit value is encoded to comply with VMS coding standards and |
| 161 |
will have the C_FACILITY_NO of 0x350000 with the constant 0xA000 |
| 162 |
added to the number shifted over by 3 bits to make room for the |
| 163 |
severity codes. |
| 164 |
|
| 165 |
The Gawk exit value of 1 will result in the VMS status having the |
| 166 |
ERROR severity status set. The Gawk exit value of 2 will result in |
| 167 |
the FATAL severity status set. All other Gawk exit values will have |
| 168 |
the Success severity status set. |
| 169 |
|
| 170 |
This change was needed to provide all Gawk exit values to VMS programs and |
| 171 |
for compatibility with programs written in C and the GNV environment. |
| 172 |
|
| 173 |
Older versions of Gawk incorrectly mostly passed through the Gawk |
| 174 |
status values instead of encoding them. DCL scripts that were checking |
| 175 |
the severity values will probably not need changing. DCL scripts that |
| 176 |
were checking the exact exit status will need an update. |
| 177 |
|
| 178 |
Gawk needs the SYS$TIMEZONE_RULE or TZ logical name to be defined or it |
| 179 |
will output times in GMT. |
| 180 |
|
| 181 |
The vmstest.com script needs SYS$TIMEZONE_NAME to be defined to match |
| 182 |
the SYS$TIMEZONE_RULE. Older versions of VMS do not define these logical |
| 183 |
names. |
| 184 |
|
| 185 |
TO DO Items (not in order of priority) |
| 186 |
|
| 187 |
1. With the system() function, the status for DCL commands are not being |
| 188 |
returned. |
| 189 |
2. Need gawk to accept logical names GNV$AWKPATH, GNV$AWKLIB, and |
| 190 |
GNV$AWK_LIBRARY in addtion to the unprefixed names. This will allow |
| 191 |
system wide default values to be set by an installation kit. |
| 192 |
|
| 193 |
3. Need to fix the gawk.cld file to not require a parameter for the options |
| 194 |
that do not use the parameter. |