summaryrefslogtreecommitdiff
path: root/usr.bin/awk/awk.h
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2023-09-17 14:49:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2023-09-17 14:49:45 +0000
commitc5246d2718cf85e86ceff0c93e17b160815813c4 (patch)
tree1010eb43cacfc5d7357890fc5a58a08c324ce8ae /usr.bin/awk/awk.h
parentc749387d621c11d2c961dce4fefb26b736c15bca (diff)
Update to the One True Awk, 2nd edition (Sep 12, 2023).
This corresponds to the 2nd edition of "The AWK Programming Language" and adds support for UTF-8 and comma-separated value inputs.
Diffstat (limited to 'usr.bin/awk/awk.h')
-rw-r--r--usr.bin/awk/awk.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/awk/awk.h b/usr.bin/awk/awk.h
index 1c389ce8c20..bd491ad2908 100644
--- a/usr.bin/awk/awk.h
+++ b/usr.bin/awk/awk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: awk.h,v 1.28 2022/09/01 15:21:28 millert Exp $ */
+/* $OpenBSD: awk.h,v 1.29 2023/09/17 14:49:44 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -80,6 +80,8 @@ extern char **SUBSEP;
extern Awkfloat *RSTART;
extern Awkfloat *RLENGTH;
+extern bool CSV; /* true for csv input */
+
extern char *record; /* points to $0 */
extern int lineno; /* line number in awk program */
extern int errorflag; /* 1 if error has occurred */
@@ -236,7 +238,8 @@ extern int pairstack[], paircnt;
/* structures used by regular expression matching machinery, mostly b.c: */
-#define NCHARS (256+3) /* 256 handles 8-bit chars; 128 does 7-bit */
+#define NCHARS (1256+3) /* 256 handles 8-bit chars; 128 does 7-bit */
+ /* BUG: some overflows (caught) if we use 256 */
/* watch out in match(), etc. */
#define HAT (NCHARS+2) /* matches ^ in regular expr */
#define NSTATES 32
@@ -247,12 +250,19 @@ typedef struct rrow {
int i;
Node *np;
uschar *up;
+ int *rp; /* rune representation of char class */
} lval; /* because Al stores a pointer in it! */
int *lfollow;
} rrow;
+typedef struct gtt { /* gototab entry */
+ unsigned int ch;
+ unsigned int state;
+} gtt;
+
typedef struct fa {
- unsigned int **gototab;
+ gtt **gototab;
+ int gototab_len;
uschar *out;
uschar *restr;
int **posns;