Next: , Previous: , Up: API Description   [Contents][Index]

17.4.10 Accessing and Updating Parameters

Two functions give you access to the arguments (parameters) passed to your extension function. They are:

awk_bool_t get_argument(size_t count,
                        awk_valtype_t wanted,
                        awk_value_t *result);

Fill in the awk_value_t structure pointed to by result with the countth argument. Return true if the actual type matches wanted, and false otherwise. In the latter case, result->val_type indicates the actual type (see Table 17.2). Counts are zero-based—the first argument is numbered zero, the second one, and so on. wanted indicates the type of value expected.

awk_bool_t set_argument(size_t count, awk_array_t array);

Convert a parameter that was undefined into an array; this provides call by reference for arrays. Return false if count is too big, or if the argument’s type is not undefined. See Array Manipulation for more information on creating arrays.