diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-12-14 21:25:20 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-12-14 21:25:20 +0200 |
commit | 0855ef4db6d8e0d1d57776eb273c9de321bfd6cf (patch) | |
tree | 360dc72f0eecdeed3cb15154c55f767fa0508caa /extension | |
parent | 539de0a854fb94fd6ba47e91cee55f22fcd851a3 (diff) | |
download | egawk-0855ef4db6d8e0d1d57776eb273c9de321bfd6cf.tar.gz egawk-0855ef4db6d8e0d1d57776eb273c9de321bfd6cf.tar.bz2 egawk-0855ef4db6d8e0d1d57776eb273c9de321bfd6cf.zip |
Fix lint stuff, arg checking. Add a data pointer. Pass finfo to functions.
Diffstat (limited to 'extension')
-rw-r--r-- | extension/ChangeLog | 17 | ||||
-rw-r--r-- | extension/filefuncs.c | 18 | ||||
-rw-r--r-- | extension/fnmatch.c | 4 | ||||
-rw-r--r-- | extension/fork.c | 12 | ||||
-rw-r--r-- | extension/inplace.c | 8 | ||||
-rw-r--r-- | extension/ordchr.c | 8 | ||||
-rw-r--r-- | extension/readdir.c | 2 | ||||
-rw-r--r-- | extension/readfile.c | 4 | ||||
-rw-r--r-- | extension/revoutput.c | 2 | ||||
-rw-r--r-- | extension/revtwoway.c | 2 | ||||
-rw-r--r-- | extension/rwarray.c | 8 | ||||
-rw-r--r-- | extension/rwarray0.c | 8 | ||||
-rw-r--r-- | extension/testext.c | 56 | ||||
-rw-r--r-- | extension/time.c | 8 |
14 files changed, 87 insertions, 70 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog index edacc2f4..831a15f9 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,19 @@ +2016-12-14 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.c: Update do_xxx to match new API. Update func_table. + * fnmatch.c: Ditto. + * fork.c: Ditto. + * inplace.c: Ditto. + * ordchr.c: Ditto. + * readdir.c: Ditto. + * readfile.c: Ditto. + * revoutput.c: Ditto. + * revtwoway.c: Ditto. + * rwarray.c: Ditto. + * rwarray0.c: Ditto. + * testext.c: Ditto. + * time.c: Ditto. + 2016-12-12 Arnold D. Robbins <arnold@skeeve.com> * filefuncs.c (func_table): Adjust ordering of min and max @@ -14,6 +30,7 @@ * fork.c: Ditto. * inplace.c: Ditto. * ordchr.c: Ditto. + * readdir.c: Ditto. * readfile.c: Ditto. * rwarray.c: Ditto. * rwarray0.c: Ditto. diff --git a/extension/filefuncs.c b/extension/filefuncs.c index de293bee..696a8599 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -153,7 +153,7 @@ int plugin_is_GPL_compatible; /* do_chdir --- provide dynamically loaded chdir() function for gawk */ static awk_value_t * -do_chdir(int nargs, awk_value_t *result) +do_chdir(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t newdir; int ret = -1; @@ -458,7 +458,7 @@ fill_stat_array(const char *name, awk_array_t array, struct stat *sbuf) /* do_stat --- provide a stat() function for gawk */ static awk_value_t * -do_stat(int nargs, awk_value_t *result) +do_stat(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t file_param, array_param; char *name; @@ -503,7 +503,7 @@ do_stat(int nargs, awk_value_t *result) /* do_statvfs --- provide a statvfs() function for gawk */ static awk_value_t * -do_statvfs(int nargs, awk_value_t *result) +do_statvfs(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t file_param, array_param; char *name; @@ -599,7 +599,7 @@ init_filefuncs(void) */ static awk_value_t * -do_fts(int nargs, awk_value_t *result) +do_fts(int nargs, awk_value_t *result, struct awk_ext_func *unused) { fatal(ext_id, _("fts is not supported on this system")); @@ -814,7 +814,7 @@ process(FTS *heirarchy, awk_array_t destarray, int seedot) */ static awk_value_t * -do_fts(int nargs, awk_value_t *result) +do_fts(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t pathlist, flagval, dest; awk_flat_array_t *path_array = NULL; @@ -913,13 +913,13 @@ out: #endif /* ! __MINGW32__ */ static awk_ext_func_t func_table[] = { - { "chdir", do_chdir, 1, 1 }, - { "stat", do_stat, 3, 2 }, + { "chdir", do_chdir, 1, 1, awk_false, NULL }, + { "stat", do_stat, 2, 3, awk_false, NULL }, #ifndef __MINGW32__ - { "fts", do_fts, 3, 3 }, + { "fts", do_fts, 3, 3, awk_false, NULL }, #endif #if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS) - { "statvfs", do_statvfs, 2, 2 }, + { "statvfs", do_statvfs, 2, 2, awk_false, NULL }, #endif }; diff --git a/extension/fnmatch.c b/extension/fnmatch.c index caf64a7b..5382e4bc 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -95,7 +95,7 @@ int plugin_is_GPL_compatible; /* do_fnmatch --- implement the fnmatch interface */ static awk_value_t * -do_fnmatch(int nargs, awk_value_t *result) +do_fnmatch(int nargs, awk_value_t *result, struct awk_ext_func *unused) { #ifdef HAVE_FNMATCH_H static int flags_mask = @@ -194,7 +194,7 @@ init_fnmatch(void) } static awk_ext_func_t func_table[] = { - { "fnmatch", do_fnmatch, 3, 3 }, + { "fnmatch", do_fnmatch, 3, 3, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/fork.c b/extension/fork.c index 064a2a8c..823506dd 100644 --- a/extension/fork.c +++ b/extension/fork.c @@ -71,7 +71,7 @@ array_set_numeric(awk_array_t array, const char *sub, double num) /* do_fork --- provide dynamically loaded fork() builtin for gawk */ static awk_value_t * -do_fork(int nargs, awk_value_t *result) +do_fork(int nargs, awk_value_t *result, struct awk_ext_func *unused) { int ret = -1; @@ -103,7 +103,7 @@ do_fork(int nargs, awk_value_t *result) /* do_waitpid --- provide dynamically loaded waitpid() builtin for gawk */ static awk_value_t * -do_waitpid(int nargs, awk_value_t *result) +do_waitpid(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t pid; int ret = -1; @@ -126,7 +126,7 @@ do_waitpid(int nargs, awk_value_t *result) /* do_wait --- provide dynamically loaded wait() builtin for gawk */ static awk_value_t * -do_wait(int nargs, awk_value_t *result) +do_wait(int nargs, awk_value_t *result, struct awk_ext_func *unused) { int ret; @@ -141,9 +141,9 @@ do_wait(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "fork", do_fork, 0, 0 }, - { "waitpid", do_waitpid, 1, 1 }, - { "wait", do_wait, 0, 0 }, + { "fork", do_fork, 0, 0, awk_false, NULL }, + { "waitpid", do_waitpid, 1, 1, awk_false, NULL }, + { "wait", do_wait, 0, 0, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/inplace.c b/extension/inplace.c index 19ee5605..5457287f 100644 --- a/extension/inplace.c +++ b/extension/inplace.c @@ -118,7 +118,7 @@ invalid_filename(const awk_string_t *filename) /* do_inplace_begin --- start in-place editing */ static awk_value_t * -do_inplace_begin(int nargs, awk_value_t *result) +do_inplace_begin(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename; struct stat sbuf; @@ -201,7 +201,7 @@ do_inplace_begin(int nargs, awk_value_t *result) /* do_inplace_end --- finish in-place editing */ static awk_value_t * -do_inplace_end(int nargs, awk_value_t *result) +do_inplace_end(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, suffix; @@ -262,8 +262,8 @@ do_inplace_end(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "inplace_begin", do_inplace_begin, 2, 2 }, - { "inplace_end", do_inplace_end, 2, 2 }, + { "inplace_begin", do_inplace_begin, 2, 2, awk_false, NULL }, + { "inplace_end", do_inplace_end, 2, 2, awk_false, NULL }, }; static awk_bool_t init_inplace(void) diff --git a/extension/ordchr.c b/extension/ordchr.c index 3722ced8..c7451f6d 100644 --- a/extension/ordchr.c +++ b/extension/ordchr.c @@ -58,7 +58,7 @@ int plugin_is_GPL_compatible; /* do_ord --- return numeric value of first char of string */ static awk_value_t * -do_ord(int nargs, awk_value_t *result) +do_ord(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t str; double ret = -1; @@ -77,7 +77,7 @@ do_ord(int nargs, awk_value_t *result) /* do_chr --- turn numeric value into a string */ static awk_value_t * -do_chr(int nargs, awk_value_t *result) +do_chr(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t num; unsigned int ret = 0; @@ -102,8 +102,8 @@ do_chr(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "ord", do_ord, 1, 1 }, - { "chr", do_chr, 1, 1 }, + { "ord", do_ord, 1, 1, awk_false, NULL }, + { "chr", do_chr, 1, 1, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/readdir.c b/extension/readdir.c index 6106a44b..39acba68 100644 --- a/extension/readdir.c +++ b/extension/readdir.c @@ -316,7 +316,7 @@ init_readdir() } static awk_ext_func_t func_table[] = { - { NULL, NULL, 0 } + { NULL, NULL, 0, 0, awk_false, NULL } }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/readfile.c b/extension/readfile.c index cc9a4c14..b453da21 100644 --- a/extension/readfile.c +++ b/extension/readfile.c @@ -98,7 +98,7 @@ done: /* do_readfile --- read a file into memory */ static awk_value_t * -do_readfile(int nargs, awk_value_t *result) +do_readfile(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename; int ret; @@ -238,7 +238,7 @@ init_readfile() } static awk_ext_func_t func_table[] = { - { "readfile", do_readfile, 1, 1 }, + { "readfile", do_readfile, 1, 1, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/revoutput.c b/extension/revoutput.c index 84d0aaa5..5862ed6e 100644 --- a/extension/revoutput.c +++ b/extension/revoutput.c @@ -134,7 +134,7 @@ init_revoutput() } static awk_ext_func_t func_table[] = { - { NULL, NULL, 0 } + { NULL, NULL, 0, 0, awk_false, NULL } }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/revtwoway.c b/extension/revtwoway.c index 82fabb2b..ac4e22cf 100644 --- a/extension/revtwoway.c +++ b/extension/revtwoway.c @@ -336,7 +336,7 @@ init_revtwoway() } static awk_ext_func_t func_table[] = { - { NULL, NULL, 0 } + { NULL, NULL, 0, 0, awk_false, NULL } }; /* define the dl_load function using the boilerplate macro */ diff --git a/extension/rwarray.c b/extension/rwarray.c index 8c3200ea..00ded7bf 100644 --- a/extension/rwarray.c +++ b/extension/rwarray.c @@ -99,7 +99,7 @@ static awk_bool_t read_value(FILE *fp, awk_value_t *value); /* do_writea --- write an array */ static awk_value_t * -do_writea(int nargs, awk_value_t *result) +do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; FILE *fp = NULL; @@ -251,7 +251,7 @@ write_value(FILE *fp, awk_value_t *val) /* do_reada --- read an array */ static awk_value_t * -do_reada(int nargs, awk_value_t *result) +do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; FILE *fp = NULL; @@ -464,8 +464,8 @@ read_value(FILE *fp, awk_value_t *value) } static awk_ext_func_t func_table[] = { - { "writea", do_writea, 2, 2 }, - { "reada", do_reada, 2, 2 }, + { "writea", do_writea, 2, 2, awk_false, NULL }, + { "reada", do_reada, 2, 2, awk_false, NULL }, }; diff --git a/extension/rwarray0.c b/extension/rwarray0.c index 35e0a702..faa73783 100644 --- a/extension/rwarray0.c +++ b/extension/rwarray0.c @@ -95,7 +95,7 @@ static awk_bool_t read_value(int fd, awk_value_t *value); /* do_writea --- write an array */ static awk_value_t * -do_writea(int nargs, awk_value_t *result) +do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; int fd = -1; @@ -247,7 +247,7 @@ write_value(int fd, awk_value_t *val) /* do_reada --- read an array */ static awk_value_t * -do_reada(int nargs, awk_value_t *result) +do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, array; int fd = -1; @@ -459,8 +459,8 @@ read_value(int fd, awk_value_t *value) } static awk_ext_func_t func_table[] = { - { "writea", do_writea, 2, 2 }, - { "reada", do_reada, 2, 2 }, + { "writea", do_writea, 2, 2, awk_false, NULL }, + { "reada", do_reada, 2, 2, awk_false, NULL }, }; diff --git a/extension/testext.c b/extension/testext.c index 227714e1..bf342182 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -107,7 +107,7 @@ BEGIN { } */ static awk_value_t * -dump_array_and_delete(int nargs, awk_value_t *result) +dump_array_and_delete(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value, value2, value3; awk_flat_array_t *flat_array; @@ -201,7 +201,7 @@ BEGIN { */ static awk_value_t * -try_modify_environ(int nargs, awk_value_t *result) +try_modify_environ(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value, index, newvalue; awk_flat_array_t *flat_array; @@ -290,7 +290,7 @@ BEGIN { */ static awk_value_t * -var_test(int nargs, awk_value_t *result) +var_test(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value, value2; awk_value_t *valp; @@ -357,7 +357,7 @@ BEGIN { } */ static awk_value_t * -test_errno(int nargs, awk_value_t *result) +test_errno(int nargs, awk_value_t *result, struct awk_ext_func *unused) { assert(result != NULL); make_number(0.0, result); @@ -386,7 +386,7 @@ BEGIN { } */ static awk_value_t * -test_deferred(int nargs, awk_value_t *result) +test_deferred(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t arr; awk_value_t index, value; @@ -465,7 +465,7 @@ BEGIN { */ static awk_value_t * -test_array_size(int nargs, awk_value_t *result) +test_array_size(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value; size_t count = 0; @@ -529,7 +529,7 @@ BEGIN { } */ static awk_value_t * -test_array_elem(int nargs, awk_value_t *result) +test_array_elem(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t array, index, index2, value; @@ -617,7 +617,7 @@ BEGIN { */ static awk_value_t * -test_array_param(int nargs, awk_value_t *result) +test_array_param(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t new_array; awk_value_t arg0; @@ -660,7 +660,7 @@ BEGIN { } */ static awk_value_t * -print_do_lint(int nargs, awk_value_t *result) +print_do_lint(int nargs, awk_value_t *result, struct awk_ext_func *unused) { assert(result != NULL); make_number(0.0, result); @@ -696,7 +696,7 @@ BEGIN { /* test_scalar --- test scalar cookie */ static awk_value_t * -test_scalar(int nargs, awk_value_t *result) +test_scalar(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t new_value, new_value2; awk_value_t the_scalar; @@ -743,7 +743,7 @@ BEGIN { /* test_scalar_reserved --- test scalar cookie on special variable */ static awk_value_t * -test_scalar_reserved(int nargs, awk_value_t *result) +test_scalar_reserved(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t new_value; awk_value_t the_scalar; @@ -796,7 +796,7 @@ BEGIN { /* test_indirect_vars --- test that access to NR, NF, get correct vales */ static awk_value_t * -test_indirect_vars(int nargs, awk_value_t *result) +test_indirect_vars(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t value; char *name = "NR"; @@ -844,7 +844,7 @@ BEGIN { /* test_get_file --- test that we can create a file */ static awk_value_t * -test_get_file(int nargs, awk_value_t *result) +test_get_file(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, alias; int fd; @@ -882,7 +882,7 @@ test_get_file(int nargs, awk_value_t *result) /* do_get_file --- provide access to get_file API */ static awk_value_t * -do_get_file(int nargs, awk_value_t *result) +do_get_file(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t filename, filetype, fd, res; const awk_input_buf_t *ibuf; @@ -1024,20 +1024,20 @@ static void at_exit2(void *data, int exit_status) } static awk_ext_func_t func_table[] = { - { "dump_array_and_delete", dump_array_and_delete, 2, 2 }, - { "try_modify_environ", try_modify_environ, 0, 0 }, - { "var_test", var_test, 1, 1 }, - { "test_deferred", test_deferred, 0, 0 }, - { "test_errno", test_errno, 0, 0 }, - { "test_array_size", test_array_size, 1, 1 }, - { "test_array_elem", test_array_elem, 2, 2 }, - { "test_array_param", test_array_param, 1, 1 }, - { "print_do_lint", print_do_lint, 0, 0 }, - { "test_scalar", test_scalar, 1, 1 }, - { "test_scalar_reserved", test_scalar_reserved, 0, 0 }, - { "test_indirect_vars", test_indirect_vars, 0, 0 }, - { "test_get_file", test_get_file, 2, 2 }, - { "get_file", do_get_file, 4, 4 }, + { "dump_array_and_delete", dump_array_and_delete, 2, 2, awk_false, NULL }, + { "try_modify_environ", try_modify_environ, 0, 0, awk_false, NULL }, + { "var_test", var_test, 1, 1, awk_false, NULL }, + { "test_deferred", test_deferred, 0, 0, awk_false, NULL }, + { "test_errno", test_errno, 0, 0, awk_false, NULL }, + { "test_array_size", test_array_size, 1, 1, awk_false, NULL }, + { "test_array_elem", test_array_elem, 2, 2, awk_false, NULL }, + { "test_array_param", test_array_param, 1, 1, awk_false, NULL }, + { "print_do_lint", print_do_lint, 0, 0, awk_false, NULL }, + { "test_scalar", test_scalar, 1, 1, awk_false, NULL }, + { "test_scalar_reserved", test_scalar_reserved, 0, 0, awk_false, NULL }, + { "test_indirect_vars", test_indirect_vars, 0, 0, awk_false, NULL }, + { "test_get_file", test_get_file, 2, 2, awk_false, NULL }, + { "get_file", do_get_file, 4, 4, awk_false, NULL }, }; /* init_testext --- additional initialization function */ diff --git a/extension/time.c b/extension/time.c index 67002752..01be7784 100644 --- a/extension/time.c +++ b/extension/time.c @@ -103,7 +103,7 @@ int plugin_is_GPL_compatible; * on the platform */ static awk_value_t * -do_gettimeofday(int nargs, awk_value_t *result) +do_gettimeofday(int nargs, awk_value_t *result, struct awk_ext_func *unused) { double curtime; @@ -150,7 +150,7 @@ do_gettimeofday(int nargs, awk_value_t *result) * did not complete successfully (perhaps interrupted) */ static awk_value_t * -do_sleep(int nargs, awk_value_t *result) +do_sleep(int nargs, awk_value_t *result, struct awk_ext_func *unused) { awk_value_t num; double secs; @@ -206,8 +206,8 @@ do_sleep(int nargs, awk_value_t *result) } static awk_ext_func_t func_table[] = { - { "gettimeofday", do_gettimeofday, 0, 0 }, - { "sleep", do_sleep, 1, 1 }, + { "gettimeofday", do_gettimeofday, 0, 0, awk_false, NULL }, + { "sleep", do_sleep, 1, 1, awk_false, NULL }, }; /* define the dl_load function using the boilerplate macro */ |