Creating Routines that Accept Keywords

As described in Adding System Routines, you must register your system routine before IDL will recognize it. When registering the routine, you indicate that it accepts keyword arguments in one of the following ways:

Routines that accept keywords must perform keyword processing. A routine that does not allow keyword processing knows that its argc argument gives the number of positional arguments, and argv contains only those positional arguments. In contrast, a routine that accepts keywords receives an argc that gives the total number of positional and keyword arguments, and these arguments are delivered in argv mixed together in an undefined order.

The function IDL_KWProcessByOffset() is used to process keywords and separate the positional and keyword arguments. It is passed an array of IDL_KW_PAR structures that give information about the allowed keywords and their attributes. The keyword data resulting from this process is stored in a user defined KW_RESULT structure. Finally, the IDL_KW_FREE macro is used to clean up.

More information about these routines and structures can be found in the following sections.