aboutsummaryrefslogtreecommitdiffstats
path: root/gawkapi.h
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-08-24 13:40:22 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-08-24 13:40:22 +0300
commit759f2234c9bfa689151277fd2215bc0927cfc9c3 (patch)
tree90ea15331ba0d71540047385c93708bd9f966f5a /gawkapi.h
parent8970970f3f3bc3d757fe491e90e608366fb7e604 (diff)
downloadegawk-759f2234c9bfa689151277fd2215bc0927cfc9c3.tar.gz
egawk-759f2234c9bfa689151277fd2215bc0927cfc9c3.tar.bz2
egawk-759f2234c9bfa689151277fd2215bc0927cfc9c3.zip
Add facility to get vesion info from extensions.
Diffstat (limited to 'gawkapi.h')
-rw-r--r--gawkapi.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gawkapi.h b/gawkapi.h
index 3c369a8f..95effd9a 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -576,6 +576,11 @@ typedef struct gawk_api {
* Please call this to free memory when the value is no longer needed.
*/
awk_bool_t (*api_release_value)(awk_ext_id_t id, awk_value_cookie_t vc);
+
+ /*
+ * Register a version string for this extension with gawk.
+ */
+ void (*api_register_ext_version)(awk_ext_id_t id, const char *version);
} gawk_api_t;
#ifndef GAWK /* these are not for the gawk code itself! */
@@ -654,6 +659,9 @@ typedef struct gawk_api {
#define release_value(value) \
(api->api_release_value(ext_id, value))
+#define register_ext_version(version) \
+ (api->api_register_ext_version(ext_id, version))
+
#define emalloc(pointer, type, size, message) \
do { \
if ((pointer = (type) malloc(size)) == 0) \
@@ -748,6 +756,7 @@ static awk_ext_func_t func_table[] = {
{ "name", do_name, 1 },
/* ... */
};
+static const char *ext_version = NULL; /* or ... = "some string" */
/* EITHER: */
@@ -801,6 +810,9 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id) \
} \
} \
\
+ if (ext_version != NULL) \
+ register_ext_version(ext_version); \
+\
return (errors == 0); \
}