summaryrefslogtreecommitdiff
path: root/gawkapi.c
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.c
parent8970970f3f3bc3d757fe491e90e608366fb7e604 (diff)
downloadgawk-759f2234c9bfa689151277fd2215bc0927cfc9c3.tar.gz
Add facility to get vesion info from extensions.
Diffstat (limited to 'gawkapi.c')
-rw-r--r--gawkapi.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gawkapi.c b/gawkapi.c
index 8fd20472..fe6eefc2 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -980,6 +980,33 @@ api_release_value(awk_ext_id_t id, awk_value_cookie_t value)
return true;
}
+/*
+ * Register a version string for this extension with gawk.
+ */
+
+static struct version_info {
+ const char *version;
+ struct version_info *next;
+};
+
+static struct version_info *vi_head;
+
+/* api_register_ext_version --- add an extension version string to the list */
+
+static void
+api_register_ext_version(awk_ext_id_t id, const char *version)
+{
+
+ struct version_info *info;
+
+ (void) id;
+
+ emalloc(info, struct version_info *, sizeof(struct version_info), "register_ext_version");
+ info->version = version;
+ info->next = vi_head;
+ vi_head = info;
+}
+
gawk_api_t api_impl = {
GAWK_API_MAJOR_VERSION, /* major and minor versions */
GAWK_API_MINOR_VERSION,
@@ -1021,6 +1048,8 @@ gawk_api_t api_impl = {
api_create_value,
api_release_value,
+
+ api_register_ext_version,
};
/* init_ext_api --- init the extension API */
@@ -1052,3 +1081,14 @@ set_constant()
{
fatal(_("cannot assign to defined constant"));
}
+
+/* print_ext_versions --- print the list */
+
+extern void
+print_ext_versions(void)
+{
+ struct version_info *p;
+
+ for (p = vi_head; p != NULL; p = p->next)
+ printf("%s\n", p->version);
+}