aboutsummaryrefslogtreecommitdiffstats
path: root/gawkapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'gawkapi.h')
-rw-r--r--gawkapi.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/gawkapi.h b/gawkapi.h
index d8215450..dbe7fdf8 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -263,7 +263,7 @@ typedef struct awk_two_way_processor {
/* Current version of the API. */
enum {
GAWK_API_MAJOR_VERSION = 1,
- GAWK_API_MINOR_VERSION = 1
+ GAWK_API_MINOR_VERSION = 2
};
/* A number of typedefs related to different types of values. */
@@ -674,6 +674,21 @@ typedef struct gawk_api {
void *(*api_calloc)(size_t nmemb, size_t size);
void *(*api_realloc)(void *ptr, size_t size);
void (*api_free)(void *ptr);
+
+ /*
+ * Look up a file. If the name is NULL or name_len is 0, it returns
+ * data for the currently open input file corresponding to FILENAME
+ * (and it will not access the filetype or typelen arguments, so those
+ * may be undefined).
+ * If the file is not already open, it tries to open it.
+ * The "filetype" argument should be one of:
+ * ">", ">>", "<", "|>", "|<", and "|&"
+ */
+ const awk_input_buf_t *(*api_get_file)(awk_ext_id_t id,
+ const char *name,
+ size_t name_len,
+ const char *filetype,
+ size_t typelen);
} gawk_api_t;
#ifndef GAWK /* these are not for the gawk code itself! */
@@ -756,6 +771,9 @@ typedef struct gawk_api {
#define release_value(value) \
(api->api_release_value(ext_id, value))
+#define get_file(name, namelen, filetype, typelen) \
+ (api->api_get_file(ext_id, name, namelen, filetype, typelen))
+
#define register_ext_version(version) \
(api->api_register_ext_version(ext_id, version))