From f2b6d100d8958a9c811c950f113a0ce38a25d484 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 6 Dec 2016 22:06:26 +0200 Subject: Add min_required and max_expected arg counts to API. --- awk.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'awk.h') diff --git a/awk.h b/awk.h index 55746927..4f04fc83 100644 --- a/awk.h +++ b/awk.h @@ -778,6 +778,10 @@ typedef struct exp_instruction { void (*aptr)(void); struct exp_instruction *xi; struct break_point *bpt; + struct { + uint16_t mr; // minimum required + uint16_t me; // maximum expected + } fa; // function args } x; short source_line; @@ -793,6 +797,9 @@ typedef struct exp_instruction { #define expr_count x.xl +#define min_required x.fa.mr +#define max_expected x.fa.me + #define target_continue d.di #define target_jmp d.di #define target_break x.xi -- cgit v1.2.3 From 539de0a854fb94fd6ba47e91cee55f22fcd851a3 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 12 Dec 2016 21:54:57 +0200 Subject: Improve handling of min and max args for extension functions. --- awk.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'awk.h') diff --git a/awk.h b/awk.h index 4f04fc83..4e365ba8 100644 --- a/awk.h +++ b/awk.h @@ -778,10 +778,7 @@ typedef struct exp_instruction { void (*aptr)(void); struct exp_instruction *xi; struct break_point *bpt; - struct { - uint16_t mr; // minimum required - uint16_t me; // maximum expected - } fa; // function args + awk_ext_func_t *exf; } x; short source_line; @@ -797,8 +794,7 @@ typedef struct exp_instruction { #define expr_count x.xl -#define min_required x.fa.mr -#define max_expected x.fa.me +#define c_func x.exf #define target_continue d.di #define target_jmp d.di -- cgit v1.2.3 From 0855ef4db6d8e0d1d57776eb273c9de321bfd6cf Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 14 Dec 2016 21:25:20 +0200 Subject: Fix lint stuff, arg checking. Add a data pointer. Pass finfo to functions. --- awk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'awk.h') diff --git a/awk.h b/awk.h index 4e365ba8..854eceaf 100644 --- a/awk.h +++ b/awk.h @@ -767,7 +767,9 @@ typedef struct exp_instruction { NODE *dn; struct exp_instruction *di; NODE *(*fptr)(int); - awk_value_t *(*efptr)(int, awk_value_t *); + awk_value_t *(*efptr)(int num_actual_args, + awk_value_t *result, + struct awk_ext_func *finfo); long dl; char *name; } d; -- cgit v1.2.3