VSI Pascal provides routines that give information about variable-length parameter lists.
1 – ARGUMENT
The ARGUMENT function specifies an argument in a variable-length parameter list that was created using the LIST attribute. Syntax: ARGUMENT( parameter-name, n ) The 'parameter-name' argument specifies the name of a parameter declared with the LIST attribute. The 'n' specifies a positive integer value that identifies the argument. The first argument in a list is always 1. An error occurs if the value supplied for 'n' is less than 1, or exceeds the ARGUMENT_LIST_LENGTH parameter (which indicates the total number of arguments). If the LIST parameter is a value parameter, ARGUMENT indicates the corresponding value in the argument list. If the LIST parameter is a VAR parameter, ARGUMENT is a reference to the corresponding variable in the argument list.
2 – ARGUMENT_LIST_LENGTH
The ARGUMENT_LIST_LENGTH function returns an integer value representing the number of arguments in a variable-length parameter list that was created using the LIST attribute. Syntax: ARGUMENT_LIST_LENGTH( parameter-name ) The 'parameter-name' argument specifies the name of the parameter declared with the LIST attribute. When creating a variable-length parameter list, you can place the LIST attribute on only the last formal parameter. When you call the routine, you can specify any number of actual parameters, or arguments, that correspond to the last formal parameter declared with LIST.
3 – PRESENT
The PRESENT function returns a Boolean value that indicates whether the actual argument list of a routine contains an argument that corresponds to a formal parameter. (The PRESENT function is usually used to supply a default value or to take a default action when the argument for a parameter is omitted.) Syntax: PRESENT (parameter-name) The 'parameter-name' parameter is the name of a formal parameter with the TRUNCATE attribute. The 'parameter-name' must be the name of a formal parameter of the function from which PRESENT is called, or from a subroutine of that function. The function result indicates whether the argument list of the containing routine specifies an actual argument corresponding to an optional parameter. Parameters that do not have the TRUNCATE attribute and also do not follow a parameter with the TRUNCATE attribute in the formal parameter list, are allowed; in their case, the PRESENT function always returns TRUE. Default parameters are considered to be present in the argument list, and the PRESENT function returns TRUE when passed the name of a parameter with a default value.