Blame README_d/README.VMS

Packit 575503
Packit 575503
Compiling GAWK on VMS:
Packit 575503
Packit 575503
     There's a DCL command procedure that will issue all the necessary
Packit 575503
CC and LINK commands, and there's also a Makefile for use with the MMS
Packit 575503
utility.  From the source directory, use either
Packit 575503
 |$ @[.VMS]VMSBUILD.COM
Packit 575503
or
Packit 575503
 |$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS gawk
Packit 575503
or
Packit 575503
 |$ MMK/DESCRIPTION=[.VMS]DESCRIP.MMS gawk
Packit 575503
Packit 575503
Note that on IA64 and Alpha the case of the target may be important.
Packit 575503
MMS has had problems on ODS-5 volumes.  MMK does not have these issues.
Packit 575503
MMK is available free from https://github.com/endlesssoftware/mmk.
Packit 575503
The most recent builds of gawk on VMS used MMK.
Packit 575503
Packit 575503
Support of the vmsbuild.com may get dropped in a future release.
Packit 575503
Packit 575503
DEC C  -- use either vmsbuild.com or descrip.mms as is.
Packit 575503
       DEC C is also known as Compaq C and HP C.
Packit 575503
Packit 575503
VAX C  -- use `@vmsbuild VAXC' or `MMS/MACRO=("VAXC")'.  On a system
Packit 575503
        with both VAX C and DEC C installed where DEC C is the default,
Packit 575503
        use `MMS/MACRO=("VAXC","CC=CC/VAXC")' for the MMS variant; for
Packit 575503
        the vmsbuild.com variant, any need for `/VAXC' will be detected
Packit 575503
        automatically.
Packit 575503
        * IMPORTANT NOTE * VAX C should not be used on VAX/VMS 5.5-2 and
Packit 575503
        later.  Use DEC C instead.
Packit 575503
Packit 575503
GNU C  -- use `@vmsbuild GNUC' or `MMS/MACRO=("GNUC")'.  On a system
Packit 575503
        where the GCC command is not already defined, use either
Packit 575503
        `@vmsbuild GNUC DO_GNUC_SETUP' or
Packit 575503
        `MMS/MACRO=("GNUC","DO_GNUC_SETUP")'.
Packit 575503
Packit 575503
Most recent builds are using:
Packit 575503
    OpenVMS VAX 7.3 using DEC C 6.4
Packit 575503
    OpenVMS Alpha 8.3 using HP C V 7.3
Packit 575503
    OpenVMS Alpha 8.4 using HP C V 7.3
Packit 575503
    OpenVMS IA64 8.4 using HP C V 7.3
Packit 575503
Packit 575503
GAWK was originally ported for VMS V4.6 and up.  It has not been tested
Packit 575503
with a release that old for some time.
Packit 575503
Packit 575503
Compiling dynamic extensions on VMS:
Packit 575503
Packit 575503
GAWK comes with some dynamic extensions.  The extensions that have been
Packit 575503
ported to VMS can be built using one of the following commands.
Packit 575503
Packit 575503
 |$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS extensions
Packit 575503
or
Packit 575503
 |$ MMK/DESCRIPTION=[.VMS]DESCRIP.MMS extensions
Packit 575503
Packit 575503
GAWK uses AWKLIBPATH as either an environment variable or a logical name
Packit 575503
to find the dynamic extensions.
Packit 575503
Packit 575503
Dynamic extensions need to be compiled with the same compiler options for
Packit 575503
floating point, pointer size, and symbol name handling as gawk.
Packit 575503
Alpha and Itanium should use IEEE floating point.  The pointer size is 32 bits,
Packit 575503
and the symbol name handling is to be exact case with CRC shortening for
Packit 575503
symbols longer than 32 bits.
Packit 575503
Packit 575503
Currently dynamic extensions have only been tested to work on VMS 8.3 and later
Packit 575503
on both Alpha and Itanium.  Dynamic extensions are not currently working on
Packit 575503
VAX/VMS 7.3.
Packit 575503
Packit 575503
Compile time are macros needed to be defined before the first VMS supplied
Packit 575503
header file is included.  Usually this will be done with a config.h file.
Packit 575503
Packit 575503
#if (__CRTL_VER >= 70200000) && !defined (__VAX)
Packit 575503
#define _LARGEFILE 1
Packit 575503
#endif
Packit 575503
Packit 575503
#ifndef __VAX
Packit 575503
#ifdef __CRTL_VER
Packit 575503
#if __CRTL_VER >= 80200000
Packit 575503
#define _USE_STD_STAT 1
Packit 575503
#endif
Packit 575503
#endif
Packit 575503
#endif
Packit 575503
Packit 575503
Alpha and Itanium:
Packit 575503
Packit 575503
/name=(as_is,short)
Packit 575503
/float=ieee/ieee_mode=denorm_results
Packit 575503
Packit 575503
VAX:
Packit 575503
Packit 575503
/name=(as_is,short)
Packit 575503
Packit 575503
The linker option files are [.vms]gawk_plugin.opt for Alpha and Itanium.
Packit 575503
Packit 575503
As the VAX dynamic plug-in feature is not yet working, the files potentially
Packit 575503
needed for a future VAX plugin are in [.vms.vax] directory of the source.
Packit 575503
Packit 575503
Packit 575503
Testing GAWK on VMS:
Packit 575503
Packit 575503
After you build gawk, you can test it with the [.vms]vmstest.com procedure.
Packit 575503
The procedure takes a parameter that is either for a list of tests or
Packit 575503
a specific test.  The parameter clean cleans up files left over from running
Packit 575503
the tests.
Packit 575503
Packit 575503
  $ set def [.test]
Packit 575503
  $ @[-.vms]vmstest.com bigtest
Packit 575503
  $ @[-.vms]vmstest.com clean
Packit 575503
  $ set def [-]
Packit 575503
Packit 575503
To test the dynamic extensions on VMS 8.3 and later, use:
Packit 575503
Packit 575503
  $ set def [.test]
Packit 575503
  $ @[-.vms]vmstest.com extension
Packit 575503
  $ @[-.vms]vmstest.com clean
Packit 575503
  $ set def [-]
Packit 575503
Packit 575503
Packit 575503
Installing GAWK on VMS:
Packit 575503
Packit 575503
     All that's needed is a 'foreign' command, which is a DCL symbol
Packit 575503
whose value begins with a dollar sign.
Packit 575503
 |$ GAWK :== $device:[directory]GAWK
Packit 575503
(Substitute the actual location of gawk.exe for 'device:[directory]'.)
Packit 575503
That symbol should be placed in the user's login.com or in the system-
Packit 575503
wide sylogin.com procedure so that it will be defined every time the
Packit 575503
user logs on.
Packit 575503
Packit 575503
If your gawk was installed by a PCSI kit into the GNV$GNU: directory tree,
Packit 575503
the program will be known as GNV$GNU:[bin]gnv$gawk.exe and the help file
Packit 575503
will be GNV$GNU:[vms_help]gawk.hlp.  The GNV$GNU:[vms_bin]gawk_verb.cld can be
Packit 575503
used to add GAWK and the alias AWK to a DCL command table.
Packit 575503
Packit 575503
     Optionally, the help entry can be loaded into a VMS help library.
Packit 575503
 |$ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP
Packit 575503
(You may want to substitute a site-specific help library rather than
Packit 575503
the standard VMS library 'HELPLIB'.)  After loading the help text,
Packit 575503
 |$ HELP GAWK
Packit 575503
will provide information about both the gawk implementation and the
Packit 575503
awk programming language.
Packit 575503
Packit 575503
     The logical name AWK_LIBRARY can designate a default location
Packit 575503
for awk program files.  For the '-f' option, if the specified filename
Packit 575503
has no device or directory path information in it, Gawk will look in
Packit 575503
the current directory first, then in the directory specified by the
Packit 575503
translation of AWK_LIBRARY if it the file wasn't found.  If the file
Packit 575503
still isn't found, then ".awk" will be appended and the file access
Packit 575503
will be re-tried.  If AWK_LIBRARY is not defined, that portion of the
Packit 575503
file search will fail benignly.
Packit 575503
Packit 575503
Packit 575503
Running GAWK on VMS:
Packit 575503
Packit 575503
     Command line parsing and quoting conventions are significantly
Packit 575503
different on VMS, so examples in _The_GAWK_Manual_ or the awk book
Packit 575503
often need minor changes.  They *are* minor though, and all the awk
Packit 575503
programs should run correctly.
Packit 575503
Packit 575503
     Here are a couple of trivial tests:
Packit 575503
 |$ gawk -- "BEGIN {print ""Hello, World!""}"
Packit 575503
 |$ gawk -"W" version     !could also be -"W version" or "-W version"
Packit 575503
Note that upper- and mixed-case text must be quoted.
Packit 575503
Packit 575503
     The VMS port of Gawk includes a DCL-style interface in addition
Packit 575503
to the original shell-style interface.  See the help entry for details.
Packit 575503
One side-effect of dual command line parsing is that if there's only a
Packit 575503
single parameter (as in the quoted string program above), the command
Packit 575503
becomes ambiguous.  To work-around this, the normally optional "--"
Packit 575503
flag is required to force shell rather than DCL parsing.  If any other
Packit 575503
dash-type options (or multiple parameters such as data files to be
Packit 575503
processed) are present, there is no ambiguity and "--" can be omitted.
Packit 575503
Packit 575503
     The logical name AWKPATH can be used to override the default
Packit 575503
search path of "SYS$DISK:[],AWK_LIBRARY:" when looking for awk program
Packit 575503
files specified by the '-f' option.  The format of AWKPATH is a comma-
Packit 575503
separated list of directory specifications.  When defining it, the
Packit 575503
value should be quoted so that it retains a single translation, not a
Packit 575503
multi-translation RMS searchlist.
Packit 575503
Packit 575503
     The exit status from Gawk is encoded in the the VMS $status exit
Packit 575503
value so that the severity bits are set as expected and the original
Packit 575503
Gawk exit value can be extracted.
Packit 575503
Packit 575503
To extract the actual gawk exit code from the VMS status use:
Packit 575503
     unix_status = (vms_status .and. &x7f8) / 8
Packit 575503
Packit 575503
The exit value is encoded to comply with VMS coding standards and
Packit 575503
will have the C_FACILITY_NO of 0x350000 with the constant 0xA000
Packit 575503
added to the number shifted over by 3 bits to make room for the
Packit 575503
severity codes.
Packit 575503
Packit 575503
The Gawk exit value of 1 will result in the VMS status having the
Packit 575503
ERROR severity status set.  The Gawk exit value of 2 will result in
Packit 575503
the FATAL severity status set.  All other Gawk exit values will have
Packit 575503
the Success severity status set.
Packit 575503
Packit 575503
This change was needed to provide all Gawk exit values to VMS programs and
Packit 575503
for compatibilty with programs written in C and the GNV environment.
Packit 575503
Packit 575503
Older versions of Gawk incorrectly mostly passed through the Gawk
Packit 575503
status values instead of encoding them.  DCL scripts that were checking
Packit 575503
the severity values will probably not need changing.  DCL scripts that
Packit 575503
were checking the exact exit status will need an update.
Packit 575503
Packit 575503
VAX/VMS floating point uses unbiased rounding.  This is generaly incompatible
Packit 575503
with the expected behavior.  The ofmta test in the test directory will
Packit 575503
fail on VAX.
Packit 575503
Packit 575503
Gawk needs the SYS$TIMEZONE_RULE or TZ logical name to be defined or it
Packit 575503
will output times in GMT.
Packit 575503
Packit 575503
The vmstest.com script needs SYS$TIMEZONE_NAME to be defined to match
Packit 575503
the SYS$TIMEZONE_RULE.  Older versions of VMS do not define these logical
Packit 575503
names.
Packit 575503
Packit 575503
TO DO Items (not in order of priority)
Packit 575503
Packit 575503
1. Implement dynamic plug-ins on VAX.
Packit 575503
Packit 575503
2. With the system() function, the status for DCL commands are not being
Packit 575503
   returned.
Packit 575503
Packit 575503
3. Need gawk to accept logical names GNV$AWKPATH, GNV$AWKLIB, and
Packit 575503
   GNV$AWK_LIBARARY in addtion to the unprefixed names.  This will allow
Packit 575503
   system wide default values to be set by an installation kit.
Packit 575503
Packit 575503
4. Need to fix the gawk.cld file to not require a parameter for the options
Packit 575503
   that do not use the parameter.