manpagez: man pages & more
info gawk
Home | html | info | man

File: gawk.info,  Node: Accessing Parameters,  Next: Symbol Table Access,  Prev: Requesting Values,  Up: Extension API Description

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
     'count'th argument.  Return true if the actual type matches
     'wanted', and false otherwise.  In the latter case,
     'result->val_type' indicates the actual type (*note Table 17.2:
     table-value-types-returned.).  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.  *Note Array
     Manipulation:: for more information on creating arrays.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.