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 b26ee24c..51374d9f 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -264,7 +264,7 @@ typedef struct awk_two_way_processor {
/* Current version of the API. */
enum {
GAWK_API_MAJOR_VERSION = 1,
- GAWK_API_MINOR_VERSION = 0
+ GAWK_API_MINOR_VERSION = 1
};
/* A number of typedefs related to different types of values. */
@@ -665,6 +665,21 @@ 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);
+
+ /*
+ * 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! */
@@ -742,6 +757,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))