Hello Jane
Morten is quite right in what he says: we do not provide nor intend to provide a
language mechanism to find the workspace version number. However, this UNIX programmer has one or two tricks up his sleeve that will allow you to get that information, albeit in a slightly roundabout way !
The location of the version number is documented in the
magic file which is supplied with our UNIX products; this allows the UNIX
file command to display information about Dyalog APL file types.
Look at the 2↑2↓ of the first few bytes of a saved workspace. They tell you the workspace major/minor number. You would have to ⎕save a workspace from your current interpreter in order to tell what the current version number is.
(Update 2011-11-17)
2↑4↓ reveals the major and minor numbers of the version of the interpreter which wrote the workspace to file. It is conceivable that the workspace version might be increased during the life of a version of Dyalog APL - you cannot therefore guarantee that an interpreter with the same major/minor version number as appears in the file will be able to )LOAD that workspace, but I am not aware of an instance of this happening once a version has been put on general release.
I've included the contents of the magic file which is supplied with our AIX-based releases: the 1st column specifies which byte in the file, the 3rd column the values, and the 4th column the description. The magic ">" tells you that it's a continuation line, so a file starting with 0x aa 03 01 02 would be a workspace with type (aka version) 1.2. Be careful of byte swapping though !
As Morten points out, we reserve the right to change the location of this information, and the workspace version number is NOT a totally reliable indicator of the ability of two versions of APL to share workspaces.
Also (and this is solely for our Linux users) the version of the magic file which comes with the operating system contains an outdated version of the Dyalog magic numbers; you should always use
file -m $DYALOG/magic, or incorporate the $DYALOG/magic entries with into the operating system-supplied one.
Code: Select all
# Dyalog: file(1) magic for Dyalog APL V12.1
0 short 0xaa03 Dyalog APL
>2 byte x workspace type %d
>3 byte x subtype %d
>7 byte &0x28=0x00 32-bit
>7 byte &0x28=0x20 64-bit
>7 byte &0x0c=0x00 classic
>7 byte &0x0c=0x04 unicode
>7 byte &0x88=0x00 big-endian
>7 byte &0x88=0x80 little-endian
0 byte 0xaa Dyalog APL
>1 byte 0x00 aplcore
>1 byte 0x01 component file 32-bit non-journaled non-checksummed
>1 byte 0x02 external variable exclusive
>1 byte 0x06 external variable shared
>1 byte 0x07 session
>1 byte 0x08 mapped file 32-bit
>1 byte 0x09 component file 64-bit non-journaled non-checksummed
>1 byte 0x0a mapped file 64-bit
>1 byte 0x0b component file 32-bit level 1 journaled non-checksummed
>1 byte 0x0c component file 64-bit level 1 journaled non-checksummed
>1 byte 0x0d component file 32-bit level 1 journaled checksummed
>1 byte 0x0e component file 64-bit level 1 journaled checksummed
>1 byte 0x0f component file 32-bit level 2 journaled checksummed
>1 byte 0x10 component file 64-bit level 2 journaled checksummed
>1 byte 0x11 component file 32-bit level 3 journaled checksummed
>1 byte 0x12 component file 64-bit level 3 journaled checksummed
>1 byte 0x13 component file 32-bit non-journaled checksummed
>1 byte 0x14 component file 64-bit non-journaled checksummed
>1 byte 0x80 DDB
0 short 0x6060 Dyalog APL transfer