Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.

  >  Docs Center  >  Using IDL  >  Checking Arguments


Checking Arguments

Checking Arguments

IDL allows a user to provide any number of arguments, of any type, to system functions and procedures. IDL checks for a valid number of arguments but the routine itself must check the validity of types. This task consists of examining the argv argument to the routine checking the type and flags field of each argument for suitability. The IDL_StoreScalar() function (see “Storing Scalar Values”) can be very useful in checking write-only arguments.

A number of macros exist in order to simplify testing of variable attributes. All of these macros accept a single argument—the VPTR to the argument in question. The macros check for a desired condition and use the IDL_Message() function with the IDL_MSG_LONGJMP action to return to the interpreter if an argument type doesn’t agree. Some of these macros overlap, and some are contradictory. You should select the smallest set that covers your requirements for each argument. For an example that uses one of these macros, see Example: A Complete Numerical Routine Example (FZ_ROOTS2).


The argument must not be of type IDL_TYP_UNDEF. This condition is usually imposed if the argument is intended to provide some input information to the routine.


The argument must not be a constant. This condition should be specified if your routine intends to change the value of the argument.


The argument must not be a constant or a temporary variable (i.e., the argument must be a named variable). Specify this condition if you intend to return a value in the argument. Returning a value in a temporary variable is pointless because the interpreter will remove it from the stack as soon as the routine completes, causing it to be freed for re-use.

The IDL_VarCopy() and IDL_StoreScalar() functions automatically check their destination and issue an error if it is an expression. Therefore, if you are using one of these functions to write the new value into the argument variable, you do not need to perform this check first.


The argument cannot be a file variable as returned by the IDL ASSOC function. Most system routines exclude file variables—they are handled by a small set of existing routines. This check is also handled by the IDL_ENSURE_SIMPLE macro, which also excludes structure variables.


The argument cannot be a structure.


The argument cannot be IDL_TYP_COMPLEX.


The argument cannot be IDL_TYP_STRING.


The argument cannot be a scalar.


The argument must be an array.


The argument must be an object reference heap variable.


The argument must be a pointer heap variable.


The argument must be a scalar.


The argument must be IDL_TYP_STRING.


The argument cannot be a file variable, a structure variable, a pointer heap variable, or an object reference heap variable.


The argument must be IDL_TYP_STRUCT.

© 2018 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us