diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-26 22:27:54 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-26 22:27:54 +0300 |
commit | 652a11e5fbe9862a2b8e961b32b9748b3c2c418b (patch) | |
tree | 003fe14ab86a1f521522a8815f22b618ebffd842 /gawkapi.c | |
parent | c3d3c83b0a60454c7b1bc335c022051b58f393e3 (diff) | |
download | egawk-652a11e5fbe9862a2b8e961b32b9748b3c2c418b.tar.gz egawk-652a11e5fbe9862a2b8e961b32b9748b3c2c418b.tar.bz2 egawk-652a11e5fbe9862a2b8e961b32b9748b3c2c418b.zip |
Add set_RT to API and to readdir extension.
Diffstat (limited to 'gawkapi.c')
-rw-r--r-- | gawkapi.c | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -222,9 +222,41 @@ api_register_input_parser(awk_ext_id_t id, awk_input_parser_t *input_parser) { (void) id; + if (input_parser == NULL) + return; + register_input_parser(input_parser); } +/* api_set_RT --- set RT's value */ + +static void +api_set_RT(awk_ext_id_t id, awk_value_t *value) +{ + NODE *n; + + (void) id; + + if (value == NULL) + return; + + switch (value->val_type) { + case AWK_UNDEFINED: + set_RT_to_null(); + break; + case AWK_ARRAY: + case AWK_VALUE_COOKIE: + break; + case AWK_STRING: + case AWK_NUMBER: + case AWK_SCALAR: + n = awk_value_to_node(value); + force_string(n); + set_RT(n->stptr, n->stlen); + unref(n); + } +} + /* Functions to update ERRNO */ /* api_update_ERRNO_int --- update ERRNO with an integer value */ @@ -567,7 +599,6 @@ api_sym_update_scalar(awk_ext_id_t id, awk_value_t *value) { NODE *node = (NODE *) cookie; - NODE *new_value; if (value == NULL || node == NULL @@ -958,6 +989,7 @@ gawk_api_t api_impl = { api_lintwarn, api_register_input_parser, + api_set_RT, api_update_ERRNO_int, api_update_ERRNO_string, |