diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 275 | ||||
-rw-r--r-- | doc/gawk.texi | 14 | ||||
-rw-r--r-- | doc/gawktexi.in | 14 | ||||
-rw-r--r-- | extension/ChangeLog | 4 | ||||
-rw-r--r-- | extension/filefuncs.c | 2 | ||||
-rw-r--r-- | gawkapi.h | 2 | ||||
-rw-r--r-- | interpret.h | 12 |
9 files changed, 177 insertions, 159 deletions
@@ -1,3 +1,11 @@ +2016-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (awk_ext_func_t): Put max back before min. Restores + source compatibility, although there will be compile warnings + because of the 3rd argument for the C function being missing. + * interpret.h (Op_ext_builtin): Used size_t instead of int for + the various variables. Add a check that max expected > 0. + 2016-12-14 Arnold D. Robbins <arnold@skeeve.com> MAJOR BREAKING API CHANGE. diff --git a/doc/ChangeLog b/doc/ChangeLog index 61c4f942..f68e4ce0 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2016-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Update description of awk_ext_func_t structure, + again. + 2016-12-14 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Update description of awk_ext_func_t structure. diff --git a/doc/gawk.info b/doc/gawk.info index c197aa14..2269c821 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -23862,8 +23862,8 @@ Extension functions are described by the following record: awk_value_t *(*const function)(int num_actual_args, awk_value_t *result, struct awk_ext_func *finfo); - const size_t min_required_args; const size_t max_expected_args; + const size_t min_required_args; awk_bool_t suppress_lint; void *data; /* opaque pointer to any extra state */ } awk_ext_func_t; @@ -23896,16 +23896,17 @@ Extension functions are described by the following record: The function must return the value of 'result'. This is for the convenience of the calling code inside 'gawk'. -'const size_t min_required_args;' - This is the minimum number of arguments the function expects to - receive. If called with fewer arguments, 'gawk' prints a fatal - error message and exits. - 'const size_t max_expected_args;' This is the maximum number of arguments the function expects to receive. If called with more arguments than this, and if lint checking has been enabled, then 'gawk' prints a warning message. - For more information, see the next item in this list. + For more information, see the entry for 'suppress_lint', later in + this list. + +'const size_t min_required_args;' + This is the minimum number of arguments the function expects to + receive. If called with fewer arguments, 'gawk' prints a fatal + error message and exits. 'awk_bool_t suppress_lint;' This flag tells 'gawk' not to print a lint message if lint checking @@ -35782,135 +35783,135 @@ Ref: Memory Allocation Functions-Footnote-1966474 Node: Constructor Functions966573 Node: Registration Functions968318 Node: Extension Functions969003 -Node: Exit Callback Functions972816 -Node: Extension Version String974066 -Node: Input Parsers974729 -Node: Output Wrappers984611 -Node: Two-way processors989123 -Node: Printing Messages991388 -Ref: Printing Messages-Footnote-1992559 -Node: Updating ERRNO992712 -Node: Requesting Values993451 -Ref: table-value-types-returned994188 -Node: Accessing Parameters995071 -Node: Symbol Table Access996306 -Node: Symbol table by name996818 -Node: Symbol table by cookie998839 -Ref: Symbol table by cookie-Footnote-11002991 -Node: Cached values1003055 -Ref: Cached values-Footnote-11006562 -Node: Array Manipulation1006653 -Ref: Array Manipulation-Footnote-11007744 -Node: Array Data Types1007781 -Ref: Array Data Types-Footnote-11010439 -Node: Array Functions1010531 -Node: Flattening Arrays1014389 -Node: Creating Arrays1021297 -Node: Redirection API1026066 -Node: Extension API Variables1028897 -Node: Extension Versioning1029530 -Ref: gawk-api-version1029967 -Node: Extension API Informational Variables1031723 -Node: Extension API Boilerplate1032787 -Node: Finding Extensions1036601 -Node: Extension Example1037160 -Node: Internal File Description1037958 -Node: Internal File Ops1042038 -Ref: Internal File Ops-Footnote-11053800 -Node: Using Internal File Ops1053940 -Ref: Using Internal File Ops-Footnote-11056323 -Node: Extension Samples1056597 -Node: Extension Sample File Functions1058126 -Node: Extension Sample Fnmatch1065775 -Node: Extension Sample Fork1067262 -Node: Extension Sample Inplace1068480 -Node: Extension Sample Ord1071690 -Node: Extension Sample Readdir1072526 -Ref: table-readdir-file-types1073415 -Node: Extension Sample Revout1074220 -Node: Extension Sample Rev2way1074809 -Node: Extension Sample Read write array1075549 -Node: Extension Sample Readfile1077491 -Node: Extension Sample Time1078586 -Node: Extension Sample API Tests1079934 -Node: gawkextlib1080426 -Node: Extension summary1082873 -Node: Extension Exercises1086575 -Node: Language History1088073 -Node: V7/SVR3.11089729 -Node: SVR41091881 -Node: POSIX1093315 -Node: BTL1094694 -Node: POSIX/GNU1095423 -Node: Feature History1101285 -Node: Common Extensions1115655 -Node: Ranges and Locales1116938 -Ref: Ranges and Locales-Footnote-11121554 -Ref: Ranges and Locales-Footnote-21121581 -Ref: Ranges and Locales-Footnote-31121816 -Node: Contributors1122037 -Node: History summary1127597 -Node: Installation1128977 -Node: Gawk Distribution1129921 -Node: Getting1130405 -Node: Extracting1131366 -Node: Distribution contents1133004 -Node: Unix Installation1139089 -Node: Quick Installation1139771 -Node: Shell Startup Files1142185 -Node: Additional Configuration Options1143263 -Node: Configuration Philosophy1145068 -Node: Non-Unix Installation1147437 -Node: PC Installation1147897 -Node: PC Binary Installation1148735 -Node: PC Compiling1149170 -Node: PC Using1150287 -Node: Cygwin1153332 -Node: MSYS1154102 -Node: VMS Installation1154603 -Node: VMS Compilation1155394 -Ref: VMS Compilation-Footnote-11156623 -Node: VMS Dynamic Extensions1156681 -Node: VMS Installation Details1158366 -Node: VMS Running1160619 -Node: VMS GNV1164898 -Node: VMS Old Gawk1165633 -Node: Bugs1166104 -Node: Bug address1166767 -Node: Usenet1169164 -Node: Maintainers1169939 -Node: Other Versions1171315 -Node: Installation summary1177899 -Node: Notes1178934 -Node: Compatibility Mode1179799 -Node: Additions1180581 -Node: Accessing The Source1181506 -Node: Adding Code1182941 -Node: New Ports1189160 -Node: Derived Files1193648 -Ref: Derived Files-Footnote-11199133 -Ref: Derived Files-Footnote-21199168 -Ref: Derived Files-Footnote-31199766 -Node: Future Extensions1199880 -Node: Implementation Limitations1200538 -Node: Extension Design1201721 -Node: Old Extension Problems1202875 -Ref: Old Extension Problems-Footnote-11204393 -Node: Extension New Mechanism Goals1204450 -Ref: Extension New Mechanism Goals-Footnote-11207814 -Node: Extension Other Design Decisions1208003 -Node: Extension Future Growth1210116 -Node: Old Extension Mechanism1210952 -Node: Notes summary1212715 -Node: Basic Concepts1213897 -Node: Basic High Level1214578 -Ref: figure-general-flow1214860 -Ref: figure-process-flow1215545 -Ref: Basic High Level-Footnote-11218846 -Node: Basic Data Typing1219031 -Node: Glossary1222359 -Node: Copying1254306 -Node: GNU Free Documentation License1291845 -Node: Index1316963 +Node: Exit Callback Functions972844 +Node: Extension Version String974094 +Node: Input Parsers974757 +Node: Output Wrappers984639 +Node: Two-way processors989151 +Node: Printing Messages991416 +Ref: Printing Messages-Footnote-1992587 +Node: Updating ERRNO992740 +Node: Requesting Values993479 +Ref: table-value-types-returned994216 +Node: Accessing Parameters995099 +Node: Symbol Table Access996334 +Node: Symbol table by name996846 +Node: Symbol table by cookie998867 +Ref: Symbol table by cookie-Footnote-11003019 +Node: Cached values1003083 +Ref: Cached values-Footnote-11006590 +Node: Array Manipulation1006681 +Ref: Array Manipulation-Footnote-11007772 +Node: Array Data Types1007809 +Ref: Array Data Types-Footnote-11010467 +Node: Array Functions1010559 +Node: Flattening Arrays1014417 +Node: Creating Arrays1021325 +Node: Redirection API1026094 +Node: Extension API Variables1028925 +Node: Extension Versioning1029558 +Ref: gawk-api-version1029995 +Node: Extension API Informational Variables1031751 +Node: Extension API Boilerplate1032815 +Node: Finding Extensions1036629 +Node: Extension Example1037188 +Node: Internal File Description1037986 +Node: Internal File Ops1042066 +Ref: Internal File Ops-Footnote-11053828 +Node: Using Internal File Ops1053968 +Ref: Using Internal File Ops-Footnote-11056351 +Node: Extension Samples1056625 +Node: Extension Sample File Functions1058154 +Node: Extension Sample Fnmatch1065803 +Node: Extension Sample Fork1067290 +Node: Extension Sample Inplace1068508 +Node: Extension Sample Ord1071718 +Node: Extension Sample Readdir1072554 +Ref: table-readdir-file-types1073443 +Node: Extension Sample Revout1074248 +Node: Extension Sample Rev2way1074837 +Node: Extension Sample Read write array1075577 +Node: Extension Sample Readfile1077519 +Node: Extension Sample Time1078614 +Node: Extension Sample API Tests1079962 +Node: gawkextlib1080454 +Node: Extension summary1082901 +Node: Extension Exercises1086603 +Node: Language History1088101 +Node: V7/SVR3.11089757 +Node: SVR41091909 +Node: POSIX1093343 +Node: BTL1094722 +Node: POSIX/GNU1095451 +Node: Feature History1101313 +Node: Common Extensions1115683 +Node: Ranges and Locales1116966 +Ref: Ranges and Locales-Footnote-11121582 +Ref: Ranges and Locales-Footnote-21121609 +Ref: Ranges and Locales-Footnote-31121844 +Node: Contributors1122065 +Node: History summary1127625 +Node: Installation1129005 +Node: Gawk Distribution1129949 +Node: Getting1130433 +Node: Extracting1131394 +Node: Distribution contents1133032 +Node: Unix Installation1139117 +Node: Quick Installation1139799 +Node: Shell Startup Files1142213 +Node: Additional Configuration Options1143291 +Node: Configuration Philosophy1145096 +Node: Non-Unix Installation1147465 +Node: PC Installation1147925 +Node: PC Binary Installation1148763 +Node: PC Compiling1149198 +Node: PC Using1150315 +Node: Cygwin1153360 +Node: MSYS1154130 +Node: VMS Installation1154631 +Node: VMS Compilation1155422 +Ref: VMS Compilation-Footnote-11156651 +Node: VMS Dynamic Extensions1156709 +Node: VMS Installation Details1158394 +Node: VMS Running1160647 +Node: VMS GNV1164926 +Node: VMS Old Gawk1165661 +Node: Bugs1166132 +Node: Bug address1166795 +Node: Usenet1169192 +Node: Maintainers1169967 +Node: Other Versions1171343 +Node: Installation summary1177927 +Node: Notes1178962 +Node: Compatibility Mode1179827 +Node: Additions1180609 +Node: Accessing The Source1181534 +Node: Adding Code1182969 +Node: New Ports1189188 +Node: Derived Files1193676 +Ref: Derived Files-Footnote-11199161 +Ref: Derived Files-Footnote-21199196 +Ref: Derived Files-Footnote-31199794 +Node: Future Extensions1199908 +Node: Implementation Limitations1200566 +Node: Extension Design1201749 +Node: Old Extension Problems1202903 +Ref: Old Extension Problems-Footnote-11204421 +Node: Extension New Mechanism Goals1204478 +Ref: Extension New Mechanism Goals-Footnote-11207842 +Node: Extension Other Design Decisions1208031 +Node: Extension Future Growth1210144 +Node: Old Extension Mechanism1210980 +Node: Notes summary1212743 +Node: Basic Concepts1213925 +Node: Basic High Level1214606 +Ref: figure-general-flow1214888 +Ref: figure-process-flow1215573 +Ref: Basic High Level-Footnote-11218874 +Node: Basic Data Typing1219059 +Node: Glossary1222387 +Node: Copying1254334 +Node: GNU Free Documentation License1291873 +Node: Index1316991 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index c482f8d2..a419a668 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -32802,8 +32802,8 @@ typedef struct awk_ext_func @{ @ @ @ @ awk_value_t *(*const function)(int num_actual_args, @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *result, @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ struct awk_ext_func *finfo); -@ @ @ @ const size_t min_required_args; @ @ @ @ const size_t max_expected_args; +@ @ @ @ const size_t min_required_args; @ @ @ @ awk_bool_t suppress_lint; @ @ @ @ void *data; /* opaque pointer to any extra state */ @} awk_ext_func_t; @@ -32840,16 +32840,16 @@ this function. The called function may access data within it as desired, or not. The function must return the value of @code{result}. This is for the convenience of the calling code inside @command{gawk}. -@item const size_t min_required_args; -This is the minimum number of arguments the function expects to receive. -If called with fewer arguments, @command{gawk} prints a fatal error -message and exits. - @item const size_t max_expected_args; This is the maximum number of arguments the function expects to receive. If called with more arguments than this, and if lint checking has been enabled, then @command{gawk} prints a warning message. For more -information, see the next item in this list. +information, see the entry for @code{suppress_lint}, later in this list. + +@item const size_t min_required_args; +This is the minimum number of arguments the function expects to receive. +If called with fewer arguments, @command{gawk} prints a fatal error +message and exits. @item awk_bool_t suppress_lint; This flag tells @command{gawk} not to print a lint message if lint diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 7f7a7b26..987c541d 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -31816,8 +31816,8 @@ typedef struct awk_ext_func @{ @ @ @ @ awk_value_t *(*const function)(int num_actual_args, @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *result, @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ struct awk_ext_func *finfo); -@ @ @ @ const size_t min_required_args; @ @ @ @ const size_t max_expected_args; +@ @ @ @ const size_t min_required_args; @ @ @ @ awk_bool_t suppress_lint; @ @ @ @ void *data; /* opaque pointer to any extra state */ @} awk_ext_func_t; @@ -31854,16 +31854,16 @@ this function. The called function may access data within it as desired, or not. The function must return the value of @code{result}. This is for the convenience of the calling code inside @command{gawk}. -@item const size_t min_required_args; -This is the minimum number of arguments the function expects to receive. -If called with fewer arguments, @command{gawk} prints a fatal error -message and exits. - @item const size_t max_expected_args; This is the maximum number of arguments the function expects to receive. If called with more arguments than this, and if lint checking has been enabled, then @command{gawk} prints a warning message. For more -information, see the next item in this list. +information, see the entry for @code{suppress_lint}, later in this list. + +@item const size_t min_required_args; +This is the minimum number of arguments the function expects to receive. +If called with fewer arguments, @command{gawk} prints a fatal error +message and exits. @item awk_bool_t suppress_lint; This flag tells @command{gawk} not to print a lint message if lint diff --git a/extension/ChangeLog b/extension/ChangeLog index 831a15f9..0642a955 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2016-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * filefuncs.c: Update func_table again. + 2016-12-14 Arnold D. Robbins <arnold@skeeve.com> * filefuncs.c: Update do_xxx to match new API. Update func_table. diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 696a8599..394de504 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -914,7 +914,7 @@ out: static awk_ext_func_t func_table[] = { { "chdir", do_chdir, 1, 1, awk_false, NULL }, - { "stat", do_stat, 2, 3, awk_false, NULL }, + { "stat", do_stat, 3, 2, awk_false, NULL }, #ifndef __MINGW32__ { "fts", do_fts, 3, 3, awk_false, NULL }, #endif @@ -392,8 +392,8 @@ typedef struct awk_ext_func { awk_value_t *(*const function)(int num_actual_args, awk_value_t *result, struct awk_ext_func *finfo); - const size_t min_required_args; const size_t max_expected_args; + const size_t min_required_args; awk_bool_t suppress_lint; void *data; /* opaque pointer to any extra state */ } awk_ext_func_t; diff --git a/interpret.h b/interpret.h index 79e7228e..7a8db88d 100644 --- a/interpret.h +++ b/interpret.h @@ -955,18 +955,18 @@ arrayfor: case Op_ext_builtin: { - int arg_count = pc->expr_count; + size_t arg_count = pc->expr_count; awk_ext_func_t *f = pc[1].c_func; - int min_req = f->min_required_args; - int max_expect = f->max_expected_args; + size_t min_req = f->min_required_args; + size_t max_expect = f->max_expected_args; awk_value_t result; if (arg_count < min_req) - fatal(_("%s: called with %d arguments, expecting at least %d"), + fatal(_("%s: called with %lu arguments, expecting at least %lu"), pc[1].func_name, arg_count, min_req); - if (do_lint && ! f->suppress_lint && arg_count > max_expect) - lintwarn(_("%s: called with %d arguments, expecting no more than %d"), + if (do_lint && max_expect > 0 && arg_count > max_expect && ! f->suppress_lint) + lintwarn(_("%s: called with %lu arguments, expecting no more than %lu"), pc[1].func_name, arg_count, max_expect); PUSH_CODE(pc); |