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


17.4.9 Requesting Values

All of the functions that return values from gawk work in the same way. You pass in an awk_valtype_t value to indicate what kind of value you expect. If the actual value matches what you requested, the function returns true and fills in the awk_value_t result. Otherwise, the function returns false, and the val_type member indicates the type of the actual value. You may then print an error message or reissue the request for the actual value type, as appropriate. This behavior is summarized in Table 17.2.

Type of Actual Value
StringStrnumNumberRegexBoolArrayUndefined
StringStringStringStringStringStringfalsefalse
StrnumfalseStrnumStrnumfalsefalsefalsefalse
NumberNumberNumberNumberfalseNumberfalsefalse
TypeRegexfalsefalsefalseRegexfalsefalsefalse
RequestedBoolfalsefalsefalsefalseBoolfalsefalse
ArrayfalsefalsefalsefalsefalseArrayfalse
ScalarScalarScalarScalarScalarScalarfalsefalse
UndefinedStringStrnumNumberRegexBoolArrayUndefined
Value cookiefalsefalsefalsefalsefalsefalsefalse

Table 17.2: API value types returned