aboutsummaryrefslogtreecommitdiffstats
path: root/gawkapi.h
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2012-06-24 18:43:49 -0400
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2012-06-24 18:43:49 -0400
commit6139211362667682c3022a72321e0cd8945b6592 (patch)
tree89c416965651a0d24204ce0633aa82a182c96203 /gawkapi.h
parent37cd3566b9b74c43d5f11f1cba8dec147a25e474 (diff)
downloadegawk-6139211362667682c3022a72321e0cd8945b6592.tar.gz
egawk-6139211362667682c3022a72321e0cd8945b6592.tar.bz2
egawk-6139211362667682c3022a72321e0cd8945b6592.zip
Hide private parts of IOBUF from extensions.
Diffstat (limited to 'gawkapi.h')
-rw-r--r--gawkapi.h44
1 files changed, 9 insertions, 35 deletions
diff --git a/gawkapi.h b/gawkapi.h
index 3325c454..1954a5e4 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -49,40 +49,14 @@
extern "C" {
#endif
-/* struct used for reading records and managing buffers */
-typedef struct iobuf {
- const char *name; /* filename */
- int fd; /* file descriptor */
- struct stat sbuf; /* stat buf */
- char *buf; /* start data buffer */
- char *off; /* start of current record in buffer */
- char *dataend; /* first byte in buffer to hold new data,
- NULL if not read yet */
- char *end; /* end of buffer */
- size_t readsize; /* set from fstat call */
- size_t size; /* buffer size */
- ssize_t count; /* amount read last time */
- size_t scanoff; /* where we were in the buffer when we had
- to regrow/refill */
- /*
- * No argument prototype on read_func. See get_src_buf()
- * in awkgram.y.
- */
- ssize_t (*read_func)();
-
- void *opaque; /* private data for open hooks */
- int (*get_record)(char **out, struct iobuf *, int *errcode);
- void (*close_func)(struct iobuf *); /* open and close hooks */
-
- int errcode;
-
- int flag;
-# define IOP_IS_TTY 1
-# define IOP_NOFREE_OBJ 2
-# define IOP_AT_EOF 4
-# define IOP_CLOSED 8
-# define IOP_AT_START 16
-} IOBUF;
+/* portions of IOBUF that should be accessible to extension functions: */
+typedef struct iobuf_public {
+ const char *name; /* filename */
+ int fd; /* file descriptor */
+ void *opaque; /* private data for open hooks */
+ int (*get_record)(char **out, struct iobuf_public *, int *errcode);
+ void (*close_func)(struct iobuf_public *);
+} IOBUF_PUBLIC;
#define GAWK_API_MAJOR_VERSION 0
#define GAWK_API_MINOR_VERSION 0
@@ -257,7 +231,7 @@ typedef struct gawk_api {
void (*api_lintwarn)(awk_ext_id_t id, const char *format, ...);
/* Register an open hook; for opening files read-only */
- void (*register_open_hook)(awk_ext_id_t id, void* (*open_func)(IOBUF *));
+ void (*register_open_hook)(awk_ext_id_t id, void* (*open_func)(IOBUF_PUBLIC *));
/* Functions to update ERRNO */
void (*update_ERRNO_int)(awk_ext_id_t id, int errno_val);