diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-05-25 01:37:44 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-05-25 01:37:44 +0300 |
commit | 44d5655584bfa914c127f177919a7069e6cff841 (patch) | |
tree | e161e7792f09897b4129843a466e35d8e841bac6 | |
parent | 5a66b6c262a2953af85465b1ec6c2d47bacec7cd (diff) | |
download | egawk-44d5655584bfa914c127f177919a7069e6cff841.tar.gz egawk-44d5655584bfa914c127f177919a7069e6cff841.tar.bz2 egawk-44d5655584bfa914c127f177919a7069e6cff841.zip |
Add nonfatal error message facility to extension API.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 251 | ||||
-rw-r--r-- | doc/gawk.texi | 5 | ||||
-rw-r--r-- | doc/gawktexi.in | 5 | ||||
-rw-r--r-- | gawkapi.c | 19 | ||||
-rw-r--r-- | gawkapi.h | 5 |
8 files changed, 172 insertions, 127 deletions
@@ -1,3 +1,10 @@ +2016-05-25 Manuel Collado <mcollado2011@gmail.com>. + + * gawkapi.c (api_nonfatal): New function. + (api_impl): Include it. + * gawkapi.h (struct gawk_api): Add api_nonfatal member. + (nonfatal): New macro. + 2016-05-12 Arnold Robbins <arnold@skeeve.com> * str_array.c (str_lookup): Remove MAYBE_NUM from subscript flags. @@ -78,6 +78,9 @@ Changes from 4.1.x to 4.2.0 disable optimizations so that the output program is the same as the original input program. +20. The extension API now provides a mechanism for generating nonfatal + error messages. + Changes from 4.1.3 to 4.1.4 --------------------------- diff --git a/doc/ChangeLog b/doc/ChangeLog index 5d5d358e..32106614 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2016-05-25 Manuel Collado <mcollado2011@gmail.com>. + + * gawktexi.in: Document new 'nonfatal' API function. + 2016-05-25 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Typo fix in extension section, thanks to diff --git a/doc/gawk.info b/doc/gawk.info index 3060e5ce..17310b1c 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -24183,6 +24183,9 @@ extension ID received from 'gawk' when the extension was loaded:(1) 'void fatal(awk_ext_id_t id, const char *format, ...);' Print a message and then cause 'gawk' to exit immediately. +'void nonfatal(awk_ext_id_t id, const char *format, ...);' + Print a nonfatal error message. + 'void warning(awk_ext_id_t id, const char *format, ...);' Print a warning message. @@ -26622,7 +26625,7 @@ File: gawk.info, Node: Extension summary, Next: Extension Exercises, Prev: ga exit callbacks, a version string, input parsers, output wrappers, and two-way processors) - * Printing fatal, warning, and "lint" warning messages + * Printing fatal, nonfatal, warning, and "lint" warning messages * Updating 'ERRNO', or unsetting it @@ -35694,128 +35697,128 @@ Node: Input Parsers966765 Node: Output Wrappers976650 Node: Two-way processors981162 Node: Printing Messages983426 -Ref: Printing Messages-Footnote-1984500 -Node: Updating ERRNO984653 -Node: Requesting Values985392 -Ref: table-value-types-returned986129 -Node: Accessing Parameters987012 -Node: Symbol Table Access988247 -Node: Symbol table by name988759 -Node: Symbol table by cookie990780 -Ref: Symbol table by cookie-Footnote-1994929 -Node: Cached values994993 -Ref: Cached values-Footnote-1998494 -Node: Array Manipulation998585 -Ref: Array Manipulation-Footnote-1999676 -Node: Array Data Types999713 -Ref: Array Data Types-Footnote-11002371 -Node: Array Functions1002463 -Node: Flattening Arrays1006321 -Node: Creating Arrays1013229 -Node: Redirection API1017998 -Node: Extension API Variables1020829 -Node: Extension Versioning1021462 -Ref: gawk-api-version1021899 -Node: Extension API Informational Variables1023655 -Node: Extension API Boilerplate1024719 -Node: Finding Extensions1028533 -Node: Extension Example1029092 -Node: Internal File Description1029890 -Node: Internal File Ops1033970 -Ref: Internal File Ops-Footnote-11045732 -Node: Using Internal File Ops1045872 -Ref: Using Internal File Ops-Footnote-11048255 -Node: Extension Samples1048529 -Node: Extension Sample File Functions1050058 -Node: Extension Sample Fnmatch1057707 -Node: Extension Sample Fork1059194 -Node: Extension Sample Inplace1060412 -Node: Extension Sample Ord1063622 -Node: Extension Sample Readdir1064458 -Ref: table-readdir-file-types1065347 -Node: Extension Sample Revout1066152 -Node: Extension Sample Rev2way1066741 -Node: Extension Sample Read write array1067481 -Node: Extension Sample Readfile1069423 -Node: Extension Sample Time1070518 -Node: Extension Sample API Tests1071866 -Node: gawkextlib1072358 -Node: Extension summary1074805 -Node: Extension Exercises1078497 -Node: Language History1079994 -Node: V7/SVR3.11081650 -Node: SVR41083802 -Node: POSIX1085236 -Node: BTL1086615 -Node: POSIX/GNU1087344 -Node: Feature History1093206 -Node: Common Extensions1107576 -Node: Ranges and Locales1108859 -Ref: Ranges and Locales-Footnote-11113475 -Ref: Ranges and Locales-Footnote-21113502 -Ref: Ranges and Locales-Footnote-31113737 -Node: Contributors1113958 -Node: History summary1119527 -Node: Installation1120907 -Node: Gawk Distribution1121851 -Node: Getting1122335 -Node: Extracting1123296 -Node: Distribution contents1124934 -Node: Unix Installation1131028 -Node: Quick Installation1131710 -Node: Shell Startup Files1134124 -Node: Additional Configuration Options1135202 -Node: Configuration Philosophy1137007 -Node: Non-Unix Installation1139376 -Node: PC Installation1139834 -Node: PC Binary Installation1141154 -Node: PC Compiling1143006 -Ref: PC Compiling-Footnote-11146030 -Node: PC Testing1146139 -Node: PC Using1147319 -Node: Cygwin1151433 -Node: MSYS1152203 -Node: VMS Installation1152704 -Node: VMS Compilation1153495 -Ref: VMS Compilation-Footnote-11154724 -Node: VMS Dynamic Extensions1154782 -Node: VMS Installation Details1156467 -Node: VMS Running1158720 -Node: VMS GNV1162999 -Node: VMS Old Gawk1163734 -Node: Bugs1164205 -Node: Other Versions1168402 -Node: Installation summary1174986 -Node: Notes1176044 -Node: Compatibility Mode1176909 -Node: Additions1177691 -Node: Accessing The Source1178616 -Node: Adding Code1180051 -Node: New Ports1186270 -Node: Derived Files1190758 -Ref: Derived Files-Footnote-11196243 -Ref: Derived Files-Footnote-21196278 -Ref: Derived Files-Footnote-31196876 -Node: Future Extensions1196990 -Node: Implementation Limitations1197648 -Node: Extension Design1198831 -Node: Old Extension Problems1199985 -Ref: Old Extension Problems-Footnote-11201503 -Node: Extension New Mechanism Goals1201560 -Ref: Extension New Mechanism Goals-Footnote-11204924 -Node: Extension Other Design Decisions1205113 -Node: Extension Future Growth1207226 -Node: Old Extension Mechanism1208062 -Node: Notes summary1209825 -Node: Basic Concepts1211007 -Node: Basic High Level1211688 -Ref: figure-general-flow1211970 -Ref: figure-process-flow1212655 -Ref: Basic High Level-Footnote-11215956 -Node: Basic Data Typing1216141 -Node: Glossary1219469 -Node: Copying1251415 -Node: GNU Free Documentation License1288954 -Node: Index1314072 +Ref: Printing Messages-Footnote-1984597 +Node: Updating ERRNO984750 +Node: Requesting Values985489 +Ref: table-value-types-returned986226 +Node: Accessing Parameters987109 +Node: Symbol Table Access988344 +Node: Symbol table by name988856 +Node: Symbol table by cookie990877 +Ref: Symbol table by cookie-Footnote-1995026 +Node: Cached values995090 +Ref: Cached values-Footnote-1998591 +Node: Array Manipulation998682 +Ref: Array Manipulation-Footnote-1999773 +Node: Array Data Types999810 +Ref: Array Data Types-Footnote-11002468 +Node: Array Functions1002560 +Node: Flattening Arrays1006418 +Node: Creating Arrays1013326 +Node: Redirection API1018095 +Node: Extension API Variables1020926 +Node: Extension Versioning1021559 +Ref: gawk-api-version1021996 +Node: Extension API Informational Variables1023752 +Node: Extension API Boilerplate1024816 +Node: Finding Extensions1028630 +Node: Extension Example1029189 +Node: Internal File Description1029987 +Node: Internal File Ops1034067 +Ref: Internal File Ops-Footnote-11045829 +Node: Using Internal File Ops1045969 +Ref: Using Internal File Ops-Footnote-11048352 +Node: Extension Samples1048626 +Node: Extension Sample File Functions1050155 +Node: Extension Sample Fnmatch1057804 +Node: Extension Sample Fork1059291 +Node: Extension Sample Inplace1060509 +Node: Extension Sample Ord1063719 +Node: Extension Sample Readdir1064555 +Ref: table-readdir-file-types1065444 +Node: Extension Sample Revout1066249 +Node: Extension Sample Rev2way1066838 +Node: Extension Sample Read write array1067578 +Node: Extension Sample Readfile1069520 +Node: Extension Sample Time1070615 +Node: Extension Sample API Tests1071963 +Node: gawkextlib1072455 +Node: Extension summary1074902 +Node: Extension Exercises1078604 +Node: Language History1080101 +Node: V7/SVR3.11081757 +Node: SVR41083909 +Node: POSIX1085343 +Node: BTL1086722 +Node: POSIX/GNU1087451 +Node: Feature History1093313 +Node: Common Extensions1107683 +Node: Ranges and Locales1108966 +Ref: Ranges and Locales-Footnote-11113582 +Ref: Ranges and Locales-Footnote-21113609 +Ref: Ranges and Locales-Footnote-31113844 +Node: Contributors1114065 +Node: History summary1119634 +Node: Installation1121014 +Node: Gawk Distribution1121958 +Node: Getting1122442 +Node: Extracting1123403 +Node: Distribution contents1125041 +Node: Unix Installation1131135 +Node: Quick Installation1131817 +Node: Shell Startup Files1134231 +Node: Additional Configuration Options1135309 +Node: Configuration Philosophy1137114 +Node: Non-Unix Installation1139483 +Node: PC Installation1139941 +Node: PC Binary Installation1141261 +Node: PC Compiling1143113 +Ref: PC Compiling-Footnote-11146137 +Node: PC Testing1146246 +Node: PC Using1147426 +Node: Cygwin1151540 +Node: MSYS1152310 +Node: VMS Installation1152811 +Node: VMS Compilation1153602 +Ref: VMS Compilation-Footnote-11154831 +Node: VMS Dynamic Extensions1154889 +Node: VMS Installation Details1156574 +Node: VMS Running1158827 +Node: VMS GNV1163106 +Node: VMS Old Gawk1163841 +Node: Bugs1164312 +Node: Other Versions1168509 +Node: Installation summary1175093 +Node: Notes1176151 +Node: Compatibility Mode1177016 +Node: Additions1177798 +Node: Accessing The Source1178723 +Node: Adding Code1180158 +Node: New Ports1186377 +Node: Derived Files1190865 +Ref: Derived Files-Footnote-11196350 +Ref: Derived Files-Footnote-21196385 +Ref: Derived Files-Footnote-31196983 +Node: Future Extensions1197097 +Node: Implementation Limitations1197755 +Node: Extension Design1198938 +Node: Old Extension Problems1200092 +Ref: Old Extension Problems-Footnote-11201610 +Node: Extension New Mechanism Goals1201667 +Ref: Extension New Mechanism Goals-Footnote-11205031 +Node: Extension Other Design Decisions1205220 +Node: Extension Future Growth1207333 +Node: Old Extension Mechanism1208169 +Node: Notes summary1209932 +Node: Basic Concepts1211114 +Node: Basic High Level1211795 +Ref: figure-general-flow1212077 +Ref: figure-process-flow1212762 +Ref: Basic High Level-Footnote-11216063 +Node: Basic Data Typing1216248 +Node: Glossary1219576 +Node: Copying1251522 +Node: GNU Free Documentation License1289061 +Node: Index1314179 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 5f5c4e2e..9948b0f1 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -33023,6 +33023,9 @@ that parameter. More's the pity.} @item void fatal(awk_ext_id_t id, const char *format, ...); Print a message and then cause @command{gawk} to exit immediately. +@item void nonfatal(awk_ext_id_t id, const char *format, ...); +Print a nonfatal error message. + @item void warning(awk_ext_id_t id, const char *format, ...); Print a warning message. @@ -35816,7 +35819,7 @@ output wrappers, and two-way processors) @item -Printing fatal, warning, and ``lint'' warning messages +Printing fatal, nonfatal, warning, and ``lint'' warning messages @item Updating @code{ERRNO}, or unsetting it diff --git a/doc/gawktexi.in b/doc/gawktexi.in index fac37bd1..3182366d 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -32114,6 +32114,9 @@ that parameter. More's the pity.} @item void fatal(awk_ext_id_t id, const char *format, ...); Print a message and then cause @command{gawk} to exit immediately. +@item void nonfatal(awk_ext_id_t id, const char *format, ...); +Print a nonfatal error message. + @item void warning(awk_ext_id_t id, const char *format, ...); Print a warning message. @@ -34907,7 +34910,7 @@ output wrappers, and two-way processors) @item -Printing fatal, warning, and ``lint'' warning messages +Printing fatal, nonfatal, warning, and ``lint'' warning messages @item Updating @code{ERRNO}, or unsetting it @@ -198,7 +198,21 @@ api_fatal(awk_ext_id_t id, const char *format, ...) va_end(args); } -/* api_warning --- print a warning message and exit */ +/* api_nonfatal --- print a non fatal error message */ + +static void +api_nonfatal(awk_ext_id_t id, const char *format, ...) +{ + va_list args; + + (void) id; + + va_start(args, format); + err(false, _("error: "), format, args); + va_end(args); +} + +/* api_warning --- print a warning message */ static void api_warning(awk_ext_id_t id, const char *format, ...) @@ -1222,6 +1236,9 @@ gawk_api_t api_impl = { /* Find/open a file */ api_get_file, + + /* Print nonfatal error message */ + api_nonfatal, }; /* init_ext_api --- init the extension API */ @@ -710,6 +710,10 @@ typedef struct gawk_api { */ const awk_input_buf_t **ibufp, const awk_output_buf_t **obufp); + + /* Print nonfatal error message */ + void (*api_nonfatal)(awk_ext_id_t id, const char *format, ...); + } gawk_api_t; #ifndef GAWK /* these are not for the gawk code itself! */ @@ -731,6 +735,7 @@ typedef struct gawk_api { (api->api_set_argument(ext_id, count, new_array)) #define fatal api->api_fatal +#define nonfatal api->api_nonfatal #define warning api->api_warning #define lintwarn api->api_lintwarn |