User Command COMPARE (Dyalog)
COMPARE is a command used to compare 2 scripts or versions of scripts.
COMPARE is one of the SALT commands made into a user command.
SALT scripts are Unicode text files that can be compared just like any other text file.
There are several third party programs that can compare 2 files. This command is able to call them.
The command accepts an argument which is a path to either one or two scripts. The paths may be absolute or relative. In the latter case the 'workdir' settings (see UserCommands/SALT/Settings for details) will be used to find the items.
If the path is unique COMPARE will compare the last 2 versions of the script unless the -version switch is set.
COMPARE accepts a series of switches to alter its functionality:
-version takes one or two values that specifies the versions to compare.
If the version is unique and there are 2 files, the same versions of each file are compared.
If the version is unique and there is only one file the last version of the file is compare to the one specified.
If there are 2 version numbers and 2 files the versions of their corresponding file are compared.
If there are 2 version numbers and 1 file the two versions of that file are compared.
If the version number is 'ws' then the object that the script file defines is compared to the last version of the script.
-permanent will set the current compare settings (see UserCommands/SALT/Compare for details) in the registry
-use takes a value that specifies the comparison program to use to compare the scripts
If no external program is used to compare then APL itself is used and the following 2 switches are allowed:
-trim will trim the ends of each line so they align properly before comparison
-zone takes a value that specifies how many lines are shown before and after each group of differences
Each group of differences is shown with a few lines (the "zone", default 2) before and after, like this:
 line 2/before
← and this one was removed
 line 1,after
 and line 2 after
]COMPARE \my\own\function -version=4 7 ]COMPARE \my\own\function -version=ws -trim ]COMPARE my\script -use=C:\Program Files\Beyond Compare 3\Bcompare.exe -permanent
This script is part of the Dyalog product. For that reason this page is immutable.
The script is version 1.0 from 2007