IDL_KW_PAR

The IDL_KW_PAR struct provides the basic specification for keyword processing. The IDL_KWProcessByOffset() function is passed a null-terminated array of these structures. IDL_KW_PAR structures specify which keywords a routine accepts, the attributes required of them, and the kinds of processing that should be done to them. IDL_KW_PAR structures must be defined in lexical order according to the value of the keyword field.

The definition of IDL_KW_PAR is:

typedef struct { char *keyword;

   UCHAR type;

   unsigned short mask;

   unsigned short flags;

   int *specified;

   char *value;

} IDL_KW_PAR;

where:

keyword

A pointer to a null-terminated string. This is the name of the keyword, and must be entirely upper case. The array of IDL_KW_PAR structures passed to IDL_KWProcessByOffset() must be lexically sorted by the strings pointed to by this field. The final element in the array is signified by setting the keyword field to NULL ((char *) 0).

type

IDL_KWProcessByOffset() automatically converts the keywords to the IDL type specified by the type field. Specify 0 (IDL_TYPE_UNDEF) in cases where ID_KW_VIN or IDL_KW_OUT are specified in the flags field.

mask

The enable mask. This field is ANDed with the mask argument to IDL_KWProcessByOffset() and if the result is non-zero, the keyword is accepted. If the result is 0, the keyword is ignored. This ability allows you to share an array of IDL_KW_PAR structures between several routines, and enable or disable the keywords used by each one.

As an example of this, the IDL graphics and plotting routines have a large number of keywords in common. In addition, each routine has a few keywords that are unique to it. Keywords are implemented using a single shared array of IDL_KW_PAR with appropriate values of the mask field. This technique dramatically reduces the amount of data that would otherwise be required by graphics keyword processing, and makes IDL easier to maintain.

flags

This field specifies special processing instructions. It is a bit mask made by ORing the following values:

specified

NULL, or the offset of the user supplied field within the KW_RESULT structure (kw) of a C int variable that will be set to TRUE (non-zero) or FALSE (0) based on whether the routine was called with the keyword present. The IDL_KW_OFFSETOF() macro should be used to calculate the offset. Setting this field to NULL (0) indicates that this information is not needed.

value

If the keyword is a read-only scalar, this field is the offset of the user supplied field in the KW_RESULT structure (kw) into which the keyword value will be copied. The IDL_KW_OFFSETOF() macro should be used to calculate the offset.

In the case of a read-only array, value is the memory address of an IDL_KW_ARR_DESC_R, structure, which is discussed in The IDL_KW_ARR_DESC_R Structure.

In the case of an input (IDL_KW_VIN) or output (IDL_KW_OUT) variable, this field should contain the offset to the IDL_VPTR field within the user supplied KW_RESULT that will be filled by IDL_KWProcessByOffset() with the address of the keyword argument. The IDL_KW_OFFSETOF() macro should be used to calculate the offset.