summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2023-09-11 20:29:01 -0700
committerArnold D. Robbins <arnold@skeeve.com>2023-09-11 20:29:01 -0700
commit6bf18508200b38465dd772b1cb2dcec15a046dbe (patch)
tree409a2ed773b20bc7b6ca89db0700e7f617d6f200
parentc152e2d2d601f37b6a8dd354c27e2cb81e7ccca5 (diff)
downloadgawk-6bf18508200b38465dd772b1cb2dcec15a046dbe.tar.gz
Add do_csv API variable and documentation thereof.
-rw-r--r--ChangeLog10
-rw-r--r--NEWS5
-rw-r--r--doc/ChangeLog6
-rw-r--r--doc/gawk.info221
-rw-r--r--doc/gawk.texi11
-rw-r--r--doc/gawktexi.in11
-rw-r--r--gawkapi.c15
-rw-r--r--gawkapi.h8
8 files changed, 171 insertions, 116 deletions
diff --git a/ChangeLog b/ChangeLog
index 17aa32f..bfee4b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,16 @@
* field.c (do_split): Fix some whitespace.
+ Unrelated: Add do_csv variable to the API.
+
+ * gawkapi.h: Bump major version to 4, minor version back to zero.
+ (DO_FLAGS_SIZE): Increase to 7.
+ (gawk_do_csv, do_csv): New macros.
+ * gawkapi.c (init_ext_api): Init the do_csv element. Replace
+ numeric indices with symbolic ones.
+ * NEWS: Updated for do_csv in the API, and the major and
+ minor API versions.
+
2023-09-01 Miguel Pineiro Jr <mpj@pineiro.cc>
Fix the handling of zero-length matches in multibyte locales.
diff --git a/NEWS b/NEWS
index 1ddb72c..0cf9243 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,11 @@ Changes from 5.2.2 to 5.3.0
given code point is converted to its corresponding multibyte encoding
for storage inside gawk. See the manual.
+5. Because of the additional `do_csv' variable in the API, which breaks
+ binary compatibility, the API major version was updated to 4 and
+ the minor version was reset to zero. The API remains source code
+ compatible; that is, existing extensions should only require recompilation.
+
Changes from 5.2.2 to 5.2.x
---------------------------
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 42abba9..15969b9 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -4,6 +4,12 @@
did CSV parsing. Whew.
* awkcard.in: Ditto.
+ Unrelated:
+ * gawktexi.in (Extension API Informational Variables):
+ Document do_csv variable in API.
+ (Feature History): Mention do_csv API variable and also
+ PROCINFO["CSV"].
+
2023-09-11 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Feature History): Note the --csv option in
diff --git a/doc/gawk.info b/doc/gawk.info
index 66fef53..0cabdeb 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -28546,6 +28546,9 @@ The API provides access to several variables that describe whether the
corresponding command-line options were enabled when ‘gawk’ was invoked.
The variables are:
+‘do_csv’
+ This variable is true if ‘gawk’ was invoked with ‘--csv’ option.
+
‘do_debug’
This variable is true if ‘gawk’ was invoked with ‘--debug’ option.
@@ -31055,6 +31058,12 @@ unfortunately. It added the following features:
• Comma separated value (CSV) field splitting and the ‘--csv’
command-line option (*note Comma Separated Fields::).
+ • ‘PROCINFO["CSV"]’ exists if ‘gawk’ was invoked with ‘--csv’ (*note
+ Auto-set::).
+
+ • The ‘do_csv’ API information variable (*note Extension API
+ Informational Variables::).
+
• The ability to make ‘gawk’ buffer output to pipes (*note
Noflush::).
@@ -40226,112 +40235,112 @@ Node: Extension Versioning1198696
Ref: gawk-api-version1199133
Node: Extension GMP/MPFR Versioning1200921
Node: Extension API Informational Variables1202627
-Node: Extension API Boilerplate1203788
-Node: Changes from API V11207924
-Node: Finding Extensions1209558
-Node: Extension Example1210133
-Node: Internal File Description1210957
-Node: Internal File Ops1215281
-Ref: Internal File Ops-Footnote-11226839
-Node: Using Internal File Ops1226987
-Ref: Using Internal File Ops-Footnote-11229418
-Node: Extension Samples1229696
-Node: Extension Sample File Functions1231265
-Node: Extension Sample Fnmatch1239403
-Node: Extension Sample Fork1240998
-Node: Extension Sample Inplace1242274
-Node: Extension Sample Ord1245946
-Node: Extension Sample Readdir1246822
-Ref: table-readdir-file-types1247611
-Node: Extension Sample Revout1248972
-Node: Extension Sample Rev2way1249569
-Node: Extension Sample Read write array1250321
-Node: Extension Sample Readfile1253595
-Node: Extension Sample Time1254726
-Node: Extension Sample API Tests1257016
-Node: gawkextlib1257524
-Node: Extension summary1260560
-Node: Extension Exercises1264418
-Node: Language History1265696
-Node: V7/SVR3.11267410
-Node: SVR41269760
-Node: POSIX1271292
-Node: BTL1272717
-Node: POSIX/GNU1273486
-Node: Feature History1280017
-Node: Common Extensions1299624
-Node: Ranges and Locales1301101
-Ref: Ranges and Locales-Footnote-11305902
-Ref: Ranges and Locales-Footnote-21305929
-Ref: Ranges and Locales-Footnote-31306168
-Node: Contributors1306391
-Node: History summary1312596
-Node: Installation1314042
-Node: Gawk Distribution1315006
-Node: Getting1315498
-Node: Extracting1316497
-Node: Distribution contents1318209
-Node: Unix Installation1326289
-Node: Quick Installation1327111
-Node: Compiling with MPFR1329657
-Node: Shell Startup Files1330363
-Node: Additional Configuration Options1331520
-Node: Configuration Philosophy1333907
-Node: Compiling from Git1336409
-Node: Building the Documentation1336968
-Node: Non-Unix Installation1338380
-Node: PC Installation1338856
-Node: PC Binary Installation1339729
-Node: PC Compiling1340634
-Node: PC Using1341812
-Node: Cygwin1345540
-Node: MSYS1346796
-Node: OpenVMS Installation1347428
-Node: OpenVMS Compilation1348109
-Ref: OpenVMS Compilation-Footnote-11349592
-Node: OpenVMS Dynamic Extensions1349654
-Node: OpenVMS Installation Details1351290
-Node: OpenVMS Running1353725
-Node: OpenVMS GNV1357862
-Node: Bugs1358617
-Node: Bug definition1359541
-Node: Bug address1363192
-Node: Usenet1366783
-Node: Performance bugs1368014
-Node: Asking for help1371032
-Node: Maintainers1373023
-Node: Other Versions1374050
-Node: Installation summary1383393
-Node: Notes1384777
-Node: Compatibility Mode1385587
-Node: Additions1386409
-Node: Accessing The Source1387354
-Node: Adding Code1388889
-Node: New Ports1396025
-Node: Derived Files1400535
-Ref: Derived Files-Footnote-11406382
-Ref: Derived Files-Footnote-21406417
-Ref: Derived Files-Footnote-31407034
-Node: Future Extensions1407148
-Node: Implementation Limitations1407820
-Node: Extension Design1409062
-Node: Old Extension Problems1410226
-Ref: Old Extension Problems-Footnote-11411802
-Node: Extension New Mechanism Goals1411863
-Ref: Extension New Mechanism Goals-Footnote-11415359
-Node: Extension Other Design Decisions1415560
-Node: Extension Future Growth1417759
-Node: Notes summary1418383
-Node: Basic Concepts1419596
-Node: Basic High Level1420281
-Ref: figure-general-flow1420563
-Ref: figure-process-flow1421270
-Ref: Basic High Level-Footnote-11424671
-Node: Basic Data Typing1424860
-Node: Glossary1428278
-Node: Copying1461400
-Node: GNU Free Documentation License1499161
-Node: Index1524484
+Node: Extension API Boilerplate1203880
+Node: Changes from API V11208016
+Node: Finding Extensions1209650
+Node: Extension Example1210225
+Node: Internal File Description1211049
+Node: Internal File Ops1215373
+Ref: Internal File Ops-Footnote-11226931
+Node: Using Internal File Ops1227079
+Ref: Using Internal File Ops-Footnote-11229510
+Node: Extension Samples1229788
+Node: Extension Sample File Functions1231357
+Node: Extension Sample Fnmatch1239495
+Node: Extension Sample Fork1241090
+Node: Extension Sample Inplace1242366
+Node: Extension Sample Ord1246038
+Node: Extension Sample Readdir1246914
+Ref: table-readdir-file-types1247703
+Node: Extension Sample Revout1249064
+Node: Extension Sample Rev2way1249661
+Node: Extension Sample Read write array1250413
+Node: Extension Sample Readfile1253687
+Node: Extension Sample Time1254818
+Node: Extension Sample API Tests1257108
+Node: gawkextlib1257616
+Node: Extension summary1260652
+Node: Extension Exercises1264510
+Node: Language History1265788
+Node: V7/SVR3.11267502
+Node: SVR41269852
+Node: POSIX1271384
+Node: BTL1272809
+Node: POSIX/GNU1273578
+Node: Feature History1280109
+Node: Common Extensions1299925
+Node: Ranges and Locales1301402
+Ref: Ranges and Locales-Footnote-11306203
+Ref: Ranges and Locales-Footnote-21306230
+Ref: Ranges and Locales-Footnote-31306469
+Node: Contributors1306692
+Node: History summary1312897
+Node: Installation1314343
+Node: Gawk Distribution1315307
+Node: Getting1315799
+Node: Extracting1316798
+Node: Distribution contents1318510
+Node: Unix Installation1326590
+Node: Quick Installation1327412
+Node: Compiling with MPFR1329958
+Node: Shell Startup Files1330664
+Node: Additional Configuration Options1331821
+Node: Configuration Philosophy1334208
+Node: Compiling from Git1336710
+Node: Building the Documentation1337269
+Node: Non-Unix Installation1338681
+Node: PC Installation1339157
+Node: PC Binary Installation1340030
+Node: PC Compiling1340935
+Node: PC Using1342113
+Node: Cygwin1345841
+Node: MSYS1347097
+Node: OpenVMS Installation1347729
+Node: OpenVMS Compilation1348410
+Ref: OpenVMS Compilation-Footnote-11349893
+Node: OpenVMS Dynamic Extensions1349955
+Node: OpenVMS Installation Details1351591
+Node: OpenVMS Running1354026
+Node: OpenVMS GNV1358163
+Node: Bugs1358918
+Node: Bug definition1359842
+Node: Bug address1363493
+Node: Usenet1367084
+Node: Performance bugs1368315
+Node: Asking for help1371333
+Node: Maintainers1373324
+Node: Other Versions1374351
+Node: Installation summary1383694
+Node: Notes1385078
+Node: Compatibility Mode1385888
+Node: Additions1386710
+Node: Accessing The Source1387655
+Node: Adding Code1389190
+Node: New Ports1396326
+Node: Derived Files1400836
+Ref: Derived Files-Footnote-11406683
+Ref: Derived Files-Footnote-21406718
+Ref: Derived Files-Footnote-31407335
+Node: Future Extensions1407449
+Node: Implementation Limitations1408121
+Node: Extension Design1409363
+Node: Old Extension Problems1410527
+Ref: Old Extension Problems-Footnote-11412103
+Node: Extension New Mechanism Goals1412164
+Ref: Extension New Mechanism Goals-Footnote-11415660
+Node: Extension Other Design Decisions1415861
+Node: Extension Future Growth1418060
+Node: Notes summary1418684
+Node: Basic Concepts1419897
+Node: Basic High Level1420582
+Ref: figure-general-flow1420864
+Ref: figure-process-flow1421571
+Ref: Basic High Level-Footnote-11424972
+Node: Basic Data Typing1425161
+Node: Glossary1428579
+Node: Copying1461701
+Node: GNU Free Documentation License1499462
+Node: Index1524785

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 547dadd..32f902e 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -39191,6 +39191,9 @@ whether the corresponding command-line options were enabled when
@command{gawk} was invoked. The variables are:
@table @code
+@item do_csv
+This variable is true if @command{gawk} was invoked with @option{--csv} option.
+
@item do_debug
This variable is true if @command{gawk} was invoked with @option{--debug} option.
@@ -42576,6 +42579,14 @@ command-line option
(@pxref{Comma Separated Fields}).
@item
+@code{PROCINFO["CSV"]} exists if @command{gawk} was invoked
+with @option{--csv} (@pxref{Auto-set}).
+
+@item
+The @code{do_csv} API information variable
+(@pxref{Extension API Informational Variables}).
+
+@item
The ability to make @command{gawk} buffer output to pipes
(@pxref{Noflush}).
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index ea64d88..f968c41 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -38071,6 +38071,9 @@ whether the corresponding command-line options were enabled when
@command{gawk} was invoked. The variables are:
@table @code
+@item do_csv
+This variable is true if @command{gawk} was invoked with @option{--csv} option.
+
@item do_debug
This variable is true if @command{gawk} was invoked with @option{--debug} option.
@@ -41456,6 +41459,14 @@ command-line option
(@pxref{Comma Separated Fields}).
@item
+@code{PROCINFO["CSV"]} exists if @command{gawk} was invoked
+with @option{--csv} (@pxref{Auto-set}).
+
+@item
+The @code{do_csv} API information variable
+(@pxref{Extension API Informational Variables}).
+
+@item
The ability to make @command{gawk} buffer output to pipes
(@pxref{Noflush}).
diff --git a/gawkapi.c b/gawkapi.c
index ab95159..20d131a 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 2012-2019, 2021, 2022, the Free Software Foundation, Inc.
+ * Copyright (C) 2012-2019, 2021, 2022, 2023, the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -1600,12 +1600,13 @@ void
init_ext_api()
{
/* force values to 1 / 0 */
- api_impl.do_flags[0] = (do_lint ? 1 : 0);
- api_impl.do_flags[1] = (do_traditional ? 1 : 0);
- api_impl.do_flags[2] = (do_profile ? 1 : 0);
- api_impl.do_flags[3] = (do_sandbox ? 1 : 0);
- api_impl.do_flags[4] = (do_debug ? 1 : 0);
- api_impl.do_flags[5] = (do_mpfr ? 1 : 0);
+ api_impl.do_flags[gawk_do_lint] = (do_lint ? 1 : 0);
+ api_impl.do_flags[gawk_do_traditional] = (do_traditional ? 1 : 0);
+ api_impl.do_flags[gawk_do_profile] = (do_profile ? 1 : 0);
+ api_impl.do_flags[gawk_do_sandbox] = (do_sandbox ? 1 : 0);
+ api_impl.do_flags[gawk_do_debug] = (do_debug ? 1 : 0);
+ api_impl.do_flags[gawk_do_mpfr] = (do_mpfr ? 1 : 0);
+ api_impl.do_flags[gawk_do_csv] = (do_csv ? 1 : 0);
}
/* update_ext_api --- update the variables in the API that can change */
diff --git a/gawkapi.h b/gawkapi.h
index 3047c75..bf3aba9 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -303,8 +303,8 @@ typedef struct awk_two_way_processor {
awk_const struct awk_two_way_processor *awk_const next; /* for use by gawk */
} awk_two_way_processor_t;
-#define gawk_api_major_version 3
-#define gawk_api_minor_version 2
+#define gawk_api_major_version 4
+#define gawk_api_minor_version 0
/* Current version of the API. */
enum {
@@ -497,7 +497,7 @@ typedef struct gawk_api {
* Currently only do_lint is prone to change, but we reserve
* the right to allow the others to do so also.
*/
-#define DO_FLAGS_SIZE 6
+#define DO_FLAGS_SIZE 7
awk_const int do_flags[DO_FLAGS_SIZE];
/* Use these as indices into do_flags[] array to check the values */
#define gawk_do_lint 0
@@ -506,6 +506,7 @@ typedef struct gawk_api {
#define gawk_do_sandbox 3
#define gawk_do_debug 4
#define gawk_do_mpfr 5
+#define gawk_do_csv 6
/* Next, registration functions: */
@@ -869,6 +870,7 @@ typedef struct gawk_api {
#define do_sandbox (api->do_flags[gawk_do_sandbox])
#define do_debug (api->do_flags[gawk_do_debug])
#define do_mpfr (api->do_flags[gawk_do_mpfr])
+#define do_csv (api->do_flags[gawk_do_csv])
#define get_argument(count, wanted, result) \
(api->api_get_argument(ext_id, count, wanted, result))