aboutsummaryrefslogtreecommitdiffstats
path: root/gawkapi.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-07-26 22:27:54 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-07-26 22:27:54 +0300
commit652a11e5fbe9862a2b8e961b32b9748b3c2c418b (patch)
tree003fe14ab86a1f521522a8815f22b618ebffd842 /gawkapi.c
parentc3d3c83b0a60454c7b1bc335c022051b58f393e3 (diff)
downloadegawk-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.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/gawkapi.c b/gawkapi.c
index a1241dfc..12cd8afc 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -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,