|BYTE, SHORT, LONG, FLOAT, and DOUBLE numeric types and arrays||All of these types seem to work fine. The corresponding variable is stored as a PDL in the hash element with the same name as the original variable in the file. Arrays are byteswapped as needed and are read in so that the dim list has the same indexing order within PDL as it did within IDL.|
|STRINGs and arrays of STRINGs||String types are stored as Perl list refs, in the hash element with the same name as the original variable in the file.|
|Structures||Structures are stored as hash refs. The elements of the hash may be accessed as values within the hash.|
|Common blocks||Variables that are notated as being in a common block are read as normal. Common-block names are collected in the special hash value +common, which contains a hash each keyword of which is the name of a common block and each value of which is an array of variable names.|
|COMPLEX numbers||These could be implemented as 2-arrays or as PDL::Complex values, but arent yet.|
|PTR types||These could be implemented as perl refs but currently arent.|
|writing||Maybe one day but why bother writing a broken file format? NetCDF is better.|
|Compiled code||Decompiling IDL code is a violation of the IDL end-user license. To implement this, someone who does not hold an IDL license would have to reverse-engineer a set of .SAV files sent to that person by someone else with an IDL license.|
|Objects||IDL objects contain compiled code.|
$a = ridl(foo.sav);
Read an IDL save file from a file.
Upon successful completion, $a is a hash ref containing all of the variables that are present in the save file, indexed by original variable name.
IDL identifiers are case insensitive; theyre all converted to upper-case in the hash that gets returned. This may be adjustable at a future date. Furthermore, because IDL identifiers cant contain special characters, some fields that start with + are used to store metadata about the file itself.
Numeric arrays are stored as PDLs, structures are stored as hashes, and string and structure arrays are stored as perl lists. Named structure types dont exist in perl in the same way that they do in IDL, so named structures are described in the structs field of the global metadata. Anonymous structures are treated as simple hashes. Named structures are also simple hashes, but they also contain a field +name that refers to the name of the structure type.
THIS CODE IS PROVIDED WITH NO WARRANTY and may be distributed and/or modified under the same terms as PDL itself.
This code is based on the analysis of the IDL save file format published by Craig Markwardt in 2002.
IDL is a trademark of Research Systems Incorporated (RSI). The PDL development team, and authors of this code, are not affiliated with RSI.
|perl v5.20.3||IDL (3)||2015-08-12|