aboutsummaryrefslogtreecommitdiffstats
path: root/gawkapi.h
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2017-03-06 09:20:33 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2017-03-06 09:20:33 -0500
commitd6406b66add5652130385942a7e05ebc9ea799ce (patch)
tree4b7e1eedc5185b67d9eb78f5ecbe6e715037376f /gawkapi.h
parent62fe07b69e522c909aad303b31443cc3c9bdf6c0 (diff)
downloadegawk-d6406b66add5652130385942a7e05ebc9ea799ce.tar.gz
egawk-d6406b66add5652130385942a7e05ebc9ea799ce.tar.bz2
egawk-d6406b66add5652130385942a7e05ebc9ea799ce.zip
Add a 6th argument to the API get_record function instead of having a separate field_width array pointer in the input buf.
Diffstat (limited to 'gawkapi.h')
-rw-r--r--gawkapi.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/gawkapi.h b/gawkapi.h
index 6d552b8f..6fa022ca 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -146,21 +146,24 @@ typedef struct awk_input {
* than zero, gawk will automatically update the ERRNO variable based
* on the value of *errcode (e.g., setting *errcode = errno should do
* the right thing).
- */
- int (*get_record)(char **out, struct awk_input *iobuf, int *errcode,
- char **rt_start, size_t *rt_len);
-
- /*
- * If this pointer is non-NULL, then this record should be parsed
- * using the supplied field widths instead of the default gawk
- * field parsing mechanism. The field_width array should have
+ *
+ * If field_width is non-NULL, then its value will be initialized
+ * to NULL, and the function may set it to point to an array of
+ * integers supplying field width information to override the default
+ * gawk field parsing mechanism. The field_width array should have
* at least 2*NF+1 elements, and the value of field_width[2*NF]
* must be negative. The first entry field_width[0] should contain
* the number of bytes to skip before $1; field_width[1] contains
* the number of bytes in $1. Note that these values are specified
- * in bytes, not (potentially multi-byte) characters!
+ * in bytes, not (potentially multi-byte) characters! And note that this
+ * array will not be copied by gawk; it must persist at least until the
+ * next call to get_record or close_func. Note that field_width will
+ * be NULL when getline is assigning the results to a variable, thus
+ * field parsing is not needed.
*/
- const int *field_width;
+ int (*get_record)(char **out, struct awk_input *iobuf, int *errcode,
+ char **rt_start, size_t *rt_len,
+ const int **field_width);
/*
* No argument prototype on read_func to allow for older systems