diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-17 23:13:14 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-17 23:13:14 +0300 |
commit | 0907dd281b71fb440c83fc53e6b4c7312f1c1f47 (patch) | |
tree | 4b68597c9c69c9d8af03213989b3edfa951477e5 /gawkapi.h | |
parent | 7e99da1009403952ec84ade1cad199b59927f735 (diff) | |
download | egawk-0907dd281b71fb440c83fc53e6b4c7312f1c1f47.tar.gz egawk-0907dd281b71fb440c83fc53e6b4c7312f1c1f47.tar.bz2 egawk-0907dd281b71fb440c83fc53e6b4c7312f1c1f47.zip |
Add AWK_VALUE_COOKIE. And performance speedup.
Diffstat (limited to 'gawkapi.h')
-rw-r--r-- | gawkapi.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -95,6 +95,7 @@ typedef enum { AWK_STRING, AWK_ARRAY, AWK_SCALAR, /* opaque access to a variable */ + AWK_VALUE_COOKIE, /* for updating to a previously created value */ } awk_valtype_t; /* @@ -112,6 +113,9 @@ typedef void *awk_array_t; /* Scalars can be represented as an opaque type. */ typedef void *awk_scalar_t; +/* Any value can be stored as a cookie. */ +typedef void *awk_value_cookie_t; + /* * An awk value. The val_type tag indicates what * is in the union. @@ -123,11 +127,13 @@ typedef struct { double d; awk_array_t a; awk_scalar_t scl; + awk_value_cookie_t vc; } u; #define str_value u.s #define num_value u.d #define array_cookie u.a #define scalar_cookie u.scl +#define value_cookie u.vc } awk_value_t; /* @@ -414,6 +420,11 @@ typedef struct gawk_api { awk_bool_t (*api_release_flattened_array)(awk_ext_id_t id, awk_array_t a_cookie, awk_flat_array_t *data); + + awk_bool_t (*api_create_value)(awk_ext_id_t id, awk_value_t *value, + awk_value_cookie_t *result); + + awk_bool_t (*api_release_value)(awk_ext_id_t id, awk_value_cookie_t vc); } gawk_api_t; #ifndef GAWK /* these are not for the gawk code itself! */ @@ -483,6 +494,12 @@ typedef struct gawk_api { #define release_flattened_array(array, data) \ (api->api_release_flattened_array(ext_id, array, data)) +#define create_value(value, result) \ + (api->api_create_value(ext_id, value,result)) + +#define release_value(value) \ + (api->api_release_value(ext_id, value)) + #define emalloc(pointer, type, size, message) \ do { \ if ((pointer = (type) malloc(size)) == 0) \ |