Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

Language Enhancements


The following enhancements have been made to the core language for the 6.1 release:

Ability to Query and Selectively Restore SAVE File Contents

The new IDL_Savefile object provides complete query and restore capabilities for IDL SAVE files (created with the SAVE procedure). Using IDL_Savefile, you can retrieve information about the number and size of the various items contained in a SAVE file (variables, common blocks, routines, etc). Individual items can be selectively restored from the SAVE file.

Use IDL_Savefile instead of the RESTORE procedure when you need to obtain detailed information on the items contained within a SAVE file without first restoring it, or when you wish to restore only selected items. Use RESTORE when you want to restore everything from the SAVE file using a simple interface.

For more information, see IDL_Savefile.

Access to Non-local Scope Variables

Three new functions allow you to examine or alter variables located outside the local scope of the currently executing function or procedure. Programs, usually those with graphical user interfaces that import and export data from the caller's scope need to be able to access the user's data variables directly, without requiring them to explicitly pass those variables to the application as parameters. The new SCOPE_VARFETCH function is used to access those variables, while SCOPE_VARNAME is used to obtain the correct names with which to refer to the variables. The iTools are examples of programs that need to be able to perform such operations. Using these new functions also allows you to retrieve variable values in IDL Virtual Machine applications, removing the need to use the EXECUTE function. See SCOPE_LEVEL, SCOPE_VARFETCH, and SCOPE_VARNAME for additional information.

In addition, you can retrieve information about variables in a particular scope using the LEVEL keyword to the HELP procedure. See HELP for additional information.

New DESCRIPTION Keyword to SAVE and RESTORE

The new DESCRIPTION keyword to the SAVE procedure allows you to associate a descriptive string value with a SAVE file. The value of the DESCRIPTION string can be used by IDL programs to identify data; it can also be used as an aid in managing large collections of data or routines. See RESTORE or SAVE for additional information.

Enhancements to SIZE

The new FILE_OFFSET keyword to the SIZE function allows you to retrieve the ASSOC file offset for the specified expression. The SNAME keyword allows you to retrieve the name of the structure definition for the specified expression, if it is a named structure. See SIZE for additional information.

Default Thread Pool Configuration

The new IDL_CPU_TPOOL_NTHREADS environment variable allows you to set the default number of threads used by IDL in thread pool computations at startup. Set this environment variable to a value greater than 0 to specify the number of threads IDL should use. On systems shared by multiple users, you may wish to set this environment variable so that IDL uses the specified number of threads instead of defaulting to the number of CPUs present in the underlying hardware.

Easy Restoration of !CPU System Variable Values

Two new keywords to the CPU procedure provide the ability to set the !CPU system variable to previously defined sets of values. The RESET keyword loads the !CPU system variable with the values loaded when IDL starts up. The RESTORE keyword loads the values contained in a structure of type !CPU into the !CPU system variable. See CPU for additional information.

Enhancements to Formatted I/O

IDL's explicitly formatted input/output subsystem has been enhanced with the following new features:

New B Format Code

A new integer format code, B, has been added to IDL's formatting engine. The B format code is used to read and write binary values. The syntax for the B format code is similar to the other integer format codes (I, O, and Z):

[n]B[-][w][.m] 

where:

n
is an optional repeat count (1 £ n) specifying the number of times the format code should be processed. If n is not specified, a repeat count of one is used.
-
is an optional flag that specifies that string or numeric values should be output with the text left-justified. Normally, output is right-justified.
w
is an optional width specification (0 £ £ 256). The variable w specifies the number of digits to be transferred.
m
is an optional minimum number (1 £ £ 256) of nonblank digits to be shown on output. The field is zero-filled on the left if necessary. If m is omitted or zero, the output is padded with blanks to achieve the specified width.
Note - The m parameter is ignored if w is zero.

See B, I, O, and Z Format Codes for complete details.

The B format code can also be used in C printf-style quoted strings, using the syntax "%b".

For example, the following IDL statements:

PRINT, FORMAT='(B)', 3000 
PRINT, FORMAT='(B15)', 3000 
PRINT, FORMAT='(B14.14)', 3000 
PRINT, FORMAT='(B0)', 3000 
PRINT, FORMAT='(%"%15b")', 3000 

Produce the following output:

    101110111000 
   101110111000 
00101110111000 
101110111000 
   101110111000 

Width Flags

+ Flag

The "+" character can be included before the width value of a numeric format code (B, D, E, F, G, I, O, Z or any of the numeric calendar formatting codes) to specify that positive numbers should be output with a "+" prefix. Normally, negative numbers are output with a "-" prefix and positive numbers have no sign prefix. Non-decimal numeric codes (B, O, and Z) allow the specification of the "+" flag, but ignore it.

See Syntax of Format Codes for complete details.

For example, the following the following IDL statements:

PRINT, FORMAT='(I0, ", ", I0)', -200, 200 
PRINT, FORMAT='(I+0, ", ", I+0)', -200, 200 

Produce the following output:

-200, 200 
-200, +200 
- Flag

The "-" character can be included before the width value of a string or numeric format code (A, B, D, E, F, G, I, O, Z or any of the calendar formatting codes) to specify that the output text should be left-justified rather than right-justified.

See Syntax of Format Codes for complete details.

For example, the following the following IDL statements:

PRINT, FORMAT='(I)', 234 
PRINT, FORMAT='(I-)', 234 

Produce the following output:

    234 
234 
Zero Padding

If the width specification of a numeric format code (B, D, E, F, G, I, O, Z or any of the numeric calendar formatting codes) begins with the numeral zero, IDL will pad the value with zeroes rather than blanks. For example:

PRINT, FORMAT='(I08)', 300 

produces the following output:

00000300 

When padding values with zeroes, note the following:

  1. If you specify the "-" flag to left-justify the output, specifying a leading zero in the width parameter has no effect, since there are no unused spaces to the left of the output value.
  2. If you specify an explicit minimum width value (via the m width parameter) for an integer format code, specifying a leading zero in the width parameter has no effect, since the output value is already padded with zeroes on the left to create an output value of the specified minimum width.

See Syntax of Format Codes for complete details.

Natural-Width Output of Floating-Point Values

The floating-point format codes (F, D, E, G, and CSF) all accept width specifications of the form [w.d] where w is an optional width specification (0 £ £ 256) specifying the number of digits to be transferred and d is an optional width specification (1 £ d < w) specifying either the number of positions after the decimal point (F, D, E, and CSF format codes) or the number of significant digits displayed (G format code).

Setting w to 0 (zero) means that you are requesting "natural width" output, meaning that the output contains no leading or trailing whitespace. In previous releases, if w was 0, IDL would ignore the value of d for the F, D, E, and CSF format codes. Now, if w is 0 and d is supplied for these codes, IDL will generate natural width output with the specified number of digits after the decimal point.

The behavior of the G format code has not changed. The d field specifies the number of significant digits of output, and as in previous releases, the value of d is used even when a natural width output is specified.

Enhancements to FILE_SEARCH

The new WINDOWS_SHORT_NAMES keyword to the FILE_SEARCH function provides greater control over how FILE_SEARCH matches Microsoft Windows "8.3 short names". See FILE_SEARCH for additional information.

Enhancement to CREATE_STRUCT

The new NAME keyword to the CREATE_STRUCT function allows you to create a named structure. This can be especially useful in an IDL Virtual Machine application. You can instantiate a structure defined in a SAVE file by passing in a string containing the structure name, avoiding the need to use the EXECUTE function. See CREATE_STRUCT for additional information.


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]