[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-5008-g4d58c155
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-5008-g4d58c155 |
Date: |
Thu, 2 Mar 2023 14:37:33 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-5.2-stable has been updated
via 4d58c1551c6fae952142de6427dbbbe94c1df7e2 (commit)
via 39b80c56897978129ac2a5edc97fe92ea577e86c (commit)
from d5c88fbbbc92b80f424d35e5fd8cf3ede854dd87 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=4d58c1551c6fae952142de6427dbbbe94c1df7e2
commit 4d58c1551c6fae952142de6427dbbbe94c1df7e2
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Mar 2 21:37:06 2023 +0200
Improve doc on input parsers and output wrappers.
diff --git a/ChangeLog b/ChangeLog
index 0ee46a69..9ad1e036 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
| the comment in the code and test/fieldassign.awk. Thanks to
| Yasuhiro Yamada <yamada@gr3.ie> for the report.
+ * gawkapi.h: Add a note at the top pointing to the online
+ documentation, warning that the header file's comments aren't
+ enough. Thanks to Eli Zaretskii <eliz@gnu.org> for the suggestion.
+
2023-02-27 Arnold D. Robbins <arnold@skeeve.com>
* gawkmisc.c: Use #elif. Update copyright year.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index c2ffca29..699d1f37 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,9 @@
+2023-03-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Input Parsers): Clarify and improve some of the
+ prose, some more.
+ (Output Wrappers): Ditto.
+
2023-02-27 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Include Files): Mention that -i and @include are
diff --git a/doc/gawk.info b/doc/gawk.info
index cf15cde5..c7e72bb8 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -26743,14 +26743,24 @@ as follows:
the file, then âfdâ will _not_ be equal to âINVALID_HANDLEâ.
Otherwise, it will.
+ An extension can decide that it doesnât want to use the open file
+ descriptor provided by âgawkâ. In such a case it can close the
+ file and set âfdâ to âINVALID_HANDLEâ, or it can leave it alone
and
+ keep itâs own file descriptor in private data pointed to by the
+ âopaqueâ pointer (see further in this list). In any case, if the
+ file descriptor is valid, it should _not_ just overwrite the value
+ with something else; doing so would cause a resource leak.
+
âstruct stat sbuf;â
If the file descriptor is valid, then âgawkâ will have filled in
this structure via a call to the âfstat()â system call. Otherwise,
if the âlstat()â system call is available, it will use that. If
- âlstat()â is not available, then it uses âstat()â. Getting the
- fileâs information allows extensions to check the type of the file
- even if it could not be opened. This occurs, for example, on
- Windows systems when trying to use âopen()â on a directory.
+ âlstat()â is not available, then it uses âstat()â.
+
+ Getting the fileâs information allows extensions to check the type
+ of the file even if it could not be opened. This occurs, for
+ example, on Windows systems when trying to use âopen()â on a
+ directory.
If âgawkâ was not able to get the file information, then âsbufâ
will be zeroed out. In particular, extension code can check if
@@ -26786,7 +26796,7 @@ may be filled by âXXX_take_control_of()â:
input records. Said function is the core of the input parser. Its
behavior is described in the text following this list.
-âssize_t (*read_func)();â
+âssize_t (*read_func)(int, void *, size_t);â
This function pointer should point to a function that has the same
behavior as the standard POSIX âread()â system call. It is an
alternative to the âget_recordâ pointer. Its behavior is also
@@ -26890,11 +26900,6 @@ does (*note gawkextlib::). In the latter case, code
in a âBEGINFILEâ
rule can look at âFILENAMEâ and âERRNOâ to decide whether or not to
activate your input parser (*note BEGINFILE/ENDFILE::).
- You register your input parser with the following function:
-
-âvoid register_input_parser(awk_input_parser_t *input_parser);â
- Register the input parser pointed to by âinput_parserâ with
âgawkâ.
-
If you would like to override the default field parsing mechanism for
a given record, then you must populate an âawk_fieldwidth_info_tâ
structure, which looks like this:
@@ -26935,6 +26940,11 @@ can be used as an argument to âmalloc()â or in a
union to allocate space
statically. Please refer to the âreaddir_testâ sample extension for an
example.
+ You register your input parser with the following function:
+
+âvoid register_input_parser(awk_input_parser_t *input_parser);â
+ Register the input parser pointed to by âinput_parserâ with
âgawkâ.
+
File: gawk.info, Node: Output Wrappers, Next: Two-way processors, Prev:
Input Parsers, Up: Registration Functions
@@ -27029,11 +27039,12 @@ in the âawk_output_buf_tâ. The data members are
as follows:
The âXXX_can_take_file()â function should make a decision based upon
the ânameâ and âmodeâ fields, and any additional state (such as
âawkâ
-variable values) that is appropriate.
+variable values) that is appropriate. âgawkâ attempts to open the named
+file for writing. The âfpâ member will be âNULLâ only if it fails.
When âgawkâ calls âXXX_take_control_of()â, that function should fill
in the other fields as appropriate, except for âfpâ, which it should
-just use normally.
+just use normally if itâs not âNULLâ.
You register your output wrapper with the following function:
@@ -39785,140 +39796,140 @@ Node: Extension Functions1113097
Node: Exit Callback Functions1118673
Node: Extension Version String1119992
Node: Input Parsers1120687
-Node: Output Wrappers1134797
-Node: Two-way processors1139505
-Node: Printing Messages1141866
-Ref: Printing Messages-Footnote-11143080
-Node: Updating ERRNO1143235
-Node: Requesting Values1144034
-Ref: table-value-types-returned1144787
-Node: Accessing Parameters1145896
-Node: Symbol Table Access1147180
-Node: Symbol table by name1147696
-Ref: Symbol table by name-Footnote-11150907
-Node: Symbol table by cookie1151039
-Ref: Symbol table by cookie-Footnote-11155320
-Node: Cached values1155384
-Ref: Cached values-Footnote-11159028
-Node: Array Manipulation1159185
-Ref: Array Manipulation-Footnote-11160288
-Node: Array Data Types1160325
-Ref: Array Data Types-Footnote-11163147
-Node: Array Functions1163247
-Node: Flattening Arrays1168276
-Node: Creating Arrays1175328
-Node: Redirection API1180178
-Node: Extension API Variables1183199
-Node: Extension Versioning1183924
-Ref: gawk-api-version1184361
-Node: Extension GMP/MPFR Versioning1186149
-Node: Extension API Informational Variables1187855
-Node: Extension API Boilerplate1189016
-Node: Changes from API V11193152
-Node: Finding Extensions1194786
-Node: Extension Example1195361
-Node: Internal File Description1196185
-Node: Internal File Ops1200509
-Ref: Internal File Ops-Footnote-11212067
-Node: Using Internal File Ops1212215
-Ref: Using Internal File Ops-Footnote-11214646
-Node: Extension Samples1214924
-Node: Extension Sample File Functions1216493
-Node: Extension Sample Fnmatch1224631
-Node: Extension Sample Fork1226226
-Node: Extension Sample Inplace1227502
-Node: Extension Sample Ord1231174
-Node: Extension Sample Readdir1232050
-Ref: table-readdir-file-types1232947
-Node: Extension Sample Revout1234085
-Node: Extension Sample Rev2way1234682
-Node: Extension Sample Read write array1235434
-Node: Extension Sample Readfile1238708
-Node: Extension Sample Time1239839
-Node: Extension Sample API Tests1242129
-Node: gawkextlib1242637
-Node: Extension summary1245673
-Node: Extension Exercises1249531
-Node: Language History1250809
-Node: V7/SVR3.11252523
-Node: SVR41254873
-Node: POSIX1256405
-Node: BTL1257830
-Node: POSIX/GNU1258599
-Node: Feature History1265130
-Node: Common Extensions1284248
-Node: Ranges and Locales1285617
-Ref: Ranges and Locales-Footnote-11290418
-Ref: Ranges and Locales-Footnote-21290445
-Ref: Ranges and Locales-Footnote-31290684
-Node: Contributors1290907
-Node: History summary1297112
-Node: Installation1298558
-Node: Gawk Distribution1299522
-Node: Getting1300014
-Node: Extracting1301013
-Node: Distribution contents1302725
-Node: Unix Installation1310805
-Node: Quick Installation1311627
-Node: Compiling with MPFR1314173
-Node: Shell Startup Files1314879
-Node: Additional Configuration Options1316036
-Node: Configuration Philosophy1318423
-Node: Compiling from Git1320925
-Node: Building the Documentation1321484
-Node: Non-Unix Installation1322896
-Node: PC Installation1323372
-Node: PC Binary Installation1324245
-Node: PC Compiling1325150
-Node: PC Using1326328
-Node: Cygwin1330056
-Node: MSYS1331312
-Node: OpenVMS Installation1331944
-Node: OpenVMS Compilation1332625
-Ref: OpenVMS Compilation-Footnote-11334108
-Node: OpenVMS Dynamic Extensions1334170
-Node: OpenVMS Installation Details1335806
-Node: OpenVMS Running1338241
-Node: OpenVMS GNV1342378
-Node: Bugs1343133
-Node: Bug definition1344057
-Node: Bug address1347708
-Node: Usenet1351299
-Node: Performance bugs1352530
-Node: Asking for help1355548
-Node: Maintainers1357539
-Node: Other Versions1358566
-Node: Installation summary1367498
-Node: Notes1368882
-Node: Compatibility Mode1369692
-Node: Additions1370514
-Node: Accessing The Source1371459
-Node: Adding Code1372994
-Node: New Ports1380130
-Node: Derived Files1384640
-Ref: Derived Files-Footnote-11390487
-Ref: Derived Files-Footnote-21390522
-Ref: Derived Files-Footnote-31391139
-Node: Future Extensions1391253
-Node: Implementation Limitations1391925
-Node: Extension Design1393167
-Node: Old Extension Problems1394331
-Ref: Old Extension Problems-Footnote-11395907
-Node: Extension New Mechanism Goals1395968
-Ref: Extension New Mechanism Goals-Footnote-11399464
-Node: Extension Other Design Decisions1399665
-Node: Extension Future Growth1401864
-Node: Notes summary1402488
-Node: Basic Concepts1403701
-Node: Basic High Level1404386
-Ref: figure-general-flow1404668
-Ref: figure-process-flow1405370
-Ref: Basic High Level-Footnote-11408766
-Node: Basic Data Typing1408955
-Node: Glossary1412373
-Node: Copying1445495
-Node: GNU Free Documentation License1483256
-Node: Index1508579
+Node: Output Wrappers1135331
+Node: Two-way processors1140179
+Node: Printing Messages1142540
+Ref: Printing Messages-Footnote-11143754
+Node: Updating ERRNO1143909
+Node: Requesting Values1144708
+Ref: table-value-types-returned1145461
+Node: Accessing Parameters1146570
+Node: Symbol Table Access1147854
+Node: Symbol table by name1148370
+Ref: Symbol table by name-Footnote-11151581
+Node: Symbol table by cookie1151713
+Ref: Symbol table by cookie-Footnote-11155994
+Node: Cached values1156058
+Ref: Cached values-Footnote-11159702
+Node: Array Manipulation1159859
+Ref: Array Manipulation-Footnote-11160962
+Node: Array Data Types1160999
+Ref: Array Data Types-Footnote-11163821
+Node: Array Functions1163921
+Node: Flattening Arrays1168950
+Node: Creating Arrays1176002
+Node: Redirection API1180852
+Node: Extension API Variables1183873
+Node: Extension Versioning1184598
+Ref: gawk-api-version1185035
+Node: Extension GMP/MPFR Versioning1186823
+Node: Extension API Informational Variables1188529
+Node: Extension API Boilerplate1189690
+Node: Changes from API V11193826
+Node: Finding Extensions1195460
+Node: Extension Example1196035
+Node: Internal File Description1196859
+Node: Internal File Ops1201183
+Ref: Internal File Ops-Footnote-11212741
+Node: Using Internal File Ops1212889
+Ref: Using Internal File Ops-Footnote-11215320
+Node: Extension Samples1215598
+Node: Extension Sample File Functions1217167
+Node: Extension Sample Fnmatch1225305
+Node: Extension Sample Fork1226900
+Node: Extension Sample Inplace1228176
+Node: Extension Sample Ord1231848
+Node: Extension Sample Readdir1232724
+Ref: table-readdir-file-types1233621
+Node: Extension Sample Revout1234759
+Node: Extension Sample Rev2way1235356
+Node: Extension Sample Read write array1236108
+Node: Extension Sample Readfile1239382
+Node: Extension Sample Time1240513
+Node: Extension Sample API Tests1242803
+Node: gawkextlib1243311
+Node: Extension summary1246347
+Node: Extension Exercises1250205
+Node: Language History1251483
+Node: V7/SVR3.11253197
+Node: SVR41255547
+Node: POSIX1257079
+Node: BTL1258504
+Node: POSIX/GNU1259273
+Node: Feature History1265804
+Node: Common Extensions1284922
+Node: Ranges and Locales1286291
+Ref: Ranges and Locales-Footnote-11291092
+Ref: Ranges and Locales-Footnote-21291119
+Ref: Ranges and Locales-Footnote-31291358
+Node: Contributors1291581
+Node: History summary1297786
+Node: Installation1299232
+Node: Gawk Distribution1300196
+Node: Getting1300688
+Node: Extracting1301687
+Node: Distribution contents1303399
+Node: Unix Installation1311479
+Node: Quick Installation1312301
+Node: Compiling with MPFR1314847
+Node: Shell Startup Files1315553
+Node: Additional Configuration Options1316710
+Node: Configuration Philosophy1319097
+Node: Compiling from Git1321599
+Node: Building the Documentation1322158
+Node: Non-Unix Installation1323570
+Node: PC Installation1324046
+Node: PC Binary Installation1324919
+Node: PC Compiling1325824
+Node: PC Using1327002
+Node: Cygwin1330730
+Node: MSYS1331986
+Node: OpenVMS Installation1332618
+Node: OpenVMS Compilation1333299
+Ref: OpenVMS Compilation-Footnote-11334782
+Node: OpenVMS Dynamic Extensions1334844
+Node: OpenVMS Installation Details1336480
+Node: OpenVMS Running1338915
+Node: OpenVMS GNV1343052
+Node: Bugs1343807
+Node: Bug definition1344731
+Node: Bug address1348382
+Node: Usenet1351973
+Node: Performance bugs1353204
+Node: Asking for help1356222
+Node: Maintainers1358213
+Node: Other Versions1359240
+Node: Installation summary1368172
+Node: Notes1369556
+Node: Compatibility Mode1370366
+Node: Additions1371188
+Node: Accessing The Source1372133
+Node: Adding Code1373668
+Node: New Ports1380804
+Node: Derived Files1385314
+Ref: Derived Files-Footnote-11391161
+Ref: Derived Files-Footnote-21391196
+Ref: Derived Files-Footnote-31391813
+Node: Future Extensions1391927
+Node: Implementation Limitations1392599
+Node: Extension Design1393841
+Node: Old Extension Problems1395005
+Ref: Old Extension Problems-Footnote-11396581
+Node: Extension New Mechanism Goals1396642
+Ref: Extension New Mechanism Goals-Footnote-11400138
+Node: Extension Other Design Decisions1400339
+Node: Extension Future Growth1402538
+Node: Notes summary1403162
+Node: Basic Concepts1404375
+Node: Basic High Level1405060
+Ref: figure-general-flow1405342
+Ref: figure-process-flow1406044
+Ref: Basic High Level-Footnote-11409440
+Node: Basic Data Typing1409629
+Node: Glossary1413047
+Node: Copying1446169
+Node: GNU Free Documentation License1483930
+Node: Index1509253
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index cd75aae0..f37d86e5 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -36966,11 +36966,20 @@ the file for reading using the @code{open()} system
call. If it was
able to open the file, then @code{fd} will @emph{not} be equal to
@code{INVALID_HANDLE}. Otherwise, it will.
+An extension can decide that it doesn't want to use the open file descriptor
+provided by @command{gawk}. In such a case it can close the file and
+set @code{fd} to @code{INVALID_HANDLE}, or it can leave it alone and
+keep it's own file descriptor in private data pointed to by the
+@code{opaque} pointer (see further in this list). In any case, if
+the file descriptor is valid, it should @emph{not} just overwrite the
+value with something else; doing so would cause a resource leak.
+
@item struct stat sbuf;
If the file descriptor is valid, then @command{gawk} will have filled
in this structure via a call to the @code{fstat()} system call.
Otherwise, if the @code{lstat()} system call is available, it will
use that. If @code{lstat()} is not available, then it uses @code{stat()}.
+
Getting the file's information allows extensions to check the type of
the file even if it could not be opened. This occurs, for example,
on Windows systems when trying to use @code{open()} on a directory.
@@ -37013,7 +37022,7 @@ This function pointer should point to a function that
creates the input
records. Said function is the core of the input parser. Its behavior
is described in the text following this list.
-@item ssize_t (*read_func)();
+@item ssize_t (*read_func)(int, void *, size_t);
This function pointer should point to a function that has the
same behavior as the standard POSIX @code{read()} system call.
It is an alternative to the @code{get_record} pointer. Its behavior
@@ -37127,14 +37136,6 @@ In the latter case, code in a @code{BEGINFILE} rule
can look at @code{FILENAME} and @code{ERRNO} to decide whether or
not to activate your input parser (@pxref{BEGINFILE/ENDFILE}).
-You register your input parser with the following function:
-
-@table @code
-@item void register_input_parser(awk_input_parser_t *input_parser);
-Register the input parser pointed to by @code{input_parser} with
-@command{gawk}.
-@end table
-
If you would like to override the default field parsing mechanism for a given
record, then you must populate an @code{awk_fieldwidth_info_t} structure,
which looks like this:
@@ -37179,6 +37180,14 @@ be used as an argument to @code{malloc()} or in a
union to allocate space
statically. Please refer to the @code{readdir_test} sample extension for an
example.
+You register your input parser with the following function:
+
+@table @code
+@item void register_input_parser(awk_input_parser_t *input_parser);
+Register the input parser pointed to by @code{input_parser} with
+@command{gawk}.
+@end table
+
@node Output Wrappers
@subsubsection Customized Output Wrappers
@cindex customized output wrapper
@@ -37282,10 +37291,12 @@ what it does.
The @code{@var{XXX}_can_take_file()} function should make a decision based
upon the @code{name} and @code{mode} fields, and any additional state
(such as @command{awk} variable values) that is appropriate.
+@command{gawk} attempts to open the named file for writing. The @code{fp}
+member will be @code{NULL} only if it fails.
When @command{gawk} calls @code{@var{XXX}_take_control_of()}, that function
should fill
in the other fields as appropriate, except for @code{fp}, which it should just
-use normally.
+use normally if it's not @code{NULL}.
You register your output wrapper with the following function:
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 219a8929..26344f72 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -35882,11 +35882,20 @@ the file for reading using the @code{open()} system
call. If it was
able to open the file, then @code{fd} will @emph{not} be equal to
@code{INVALID_HANDLE}. Otherwise, it will.
+An extension can decide that it doesn't want to use the open file descriptor
+provided by @command{gawk}. In such a case it can close the file and
+set @code{fd} to @code{INVALID_HANDLE}, or it can leave it alone and
+keep it's own file descriptor in private data pointed to by the
+@code{opaque} pointer (see further in this list). In any case, if
+the file descriptor is valid, it should @emph{not} just overwrite the
+value with something else; doing so would cause a resource leak.
+
@item struct stat sbuf;
If the file descriptor is valid, then @command{gawk} will have filled
in this structure via a call to the @code{fstat()} system call.
Otherwise, if the @code{lstat()} system call is available, it will
use that. If @code{lstat()} is not available, then it uses @code{stat()}.
+
Getting the file's information allows extensions to check the type of
the file even if it could not be opened. This occurs, for example,
on Windows systems when trying to use @code{open()} on a directory.
@@ -35929,7 +35938,7 @@ This function pointer should point to a function that
creates the input
records. Said function is the core of the input parser. Its behavior
is described in the text following this list.
-@item ssize_t (*read_func)();
+@item ssize_t (*read_func)(int, void *, size_t);
This function pointer should point to a function that has the
same behavior as the standard POSIX @code{read()} system call.
It is an alternative to the @code{get_record} pointer. Its behavior
@@ -36043,14 +36052,6 @@ In the latter case, code in a @code{BEGINFILE} rule
can look at @code{FILENAME} and @code{ERRNO} to decide whether or
not to activate your input parser (@pxref{BEGINFILE/ENDFILE}).
-You register your input parser with the following function:
-
-@table @code
-@item void register_input_parser(awk_input_parser_t *input_parser);
-Register the input parser pointed to by @code{input_parser} with
-@command{gawk}.
-@end table
-
If you would like to override the default field parsing mechanism for a given
record, then you must populate an @code{awk_fieldwidth_info_t} structure,
which looks like this:
@@ -36095,6 +36096,14 @@ be used as an argument to @code{malloc()} or in a
union to allocate space
statically. Please refer to the @code{readdir_test} sample extension for an
example.
+You register your input parser with the following function:
+
+@table @code
+@item void register_input_parser(awk_input_parser_t *input_parser);
+Register the input parser pointed to by @code{input_parser} with
+@command{gawk}.
+@end table
+
@node Output Wrappers
@subsubsection Customized Output Wrappers
@cindex customized output wrapper
@@ -36198,10 +36207,12 @@ what it does.
The @code{@var{XXX}_can_take_file()} function should make a decision based
upon the @code{name} and @code{mode} fields, and any additional state
(such as @command{awk} variable values) that is appropriate.
+@command{gawk} attempts to open the named file for writing. The @code{fp}
+member will be @code{NULL} only if it fails.
When @command{gawk} calls @code{@var{XXX}_take_control_of()}, that function
should fill
in the other fields as appropriate, except for @code{fp}, which it should just
-use normally.
+use normally if it's not @code{NULL}.
You register your output wrapper with the following function:
diff --git a/doc/wordlist b/doc/wordlist
index e4563fef..5342b675 100644
--- a/doc/wordlist
+++ b/doc/wordlist
@@ -1128,10 +1128,12 @@ ifdef
ifdocbook
ifhtml
ifinfo
+iflatex
ifndef
ifnotdocbook
ifnothtml
ifnotinfo
+ifnotlatex
ifnotplaintext
ifnottex
ifnotxml
@@ -1691,6 +1693,7 @@ strftime
strlen
strnum
strnums
+strptime
strtod
strtonum
struct
@@ -1749,6 +1752,7 @@ thisopt
thispage
thrudvang
tid
+timeval
timex
titlepage
tlines
diff --git a/gawkapi.h b/gawkapi.h
index 278159c4..8b743c2a 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -98,6 +98,12 @@
* for arrays that will have subarrays as elements; however it is
* a good idea to always do this. This restriction may be relaxed
* in a subsequent revision of the API.
+ *
+ * NOTE: While each routine in the API has a few lines of summary for it
+ * in this header, said summaries are not standalone, adequate documentation.
You
+ * should read the chapter in the gawk manual on writing extensions. Find it
online
+ * at
https://www.gnu.org/software/gawk/manual/html_node/Dynamic-Extensions.html,
+ * or in the Info files distributed with gawk.
*/
/* Allow use in C++ code. */
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=39b80c56897978129ac2a5edc97fe92ea577e86c
commit 39b80c56897978129ac2a5edc97fe92ea577e86c
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Mar 2 21:10:35 2023 +0200
Revert change to Op_field_spec_lhs of 2023-01-23.
diff --git a/ChangeLog b/ChangeLog
index 4bf60db4..0ee46a69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-03-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h (r_interpret): Revert this change of 2023-01-23,
+ it's handled by the fix of 2023-02-27.
+
+ | * interpret.h (r_interpret): Op_assign case, don't unref the
+ | old lhs NODE until after the assignment. See test case in
+ | the comment in the code and test/fieldassign.awk. Thanks to
+ | Yasuhiro Yamada <yamada@gr3.ie> for the report.
+
2023-02-27 Arnold D. Robbins <arnold@skeeve.com>
* gawkmisc.c: Use #elif. Update copyright year.
diff --git a/interpret.h b/interpret.h
index d9f97b1b..70195d96 100644
--- a/interpret.h
+++ b/interpret.h
@@ -879,30 +879,16 @@ mod:
break;
case Op_assign:
- {
- NODE *save_lhs;
-
lhs = POP_ADDRESS();
r = TOP_SCALAR();
- /*
- * 1/2023:
- * The old NODE pointed to by *lhs has to be freed.
- * But we can't free it too early, in case it's both $0
and $1
- * (Test case was gawk 'gsub(/./, "@") && $0=$1'). So
we save
- * the old one, and after the assignment, we free it,
since
- * $0 and $1 have the same stptr value but only $0 has
MALLOC
- * in the flags. Whew!
- */
- save_lhs = *lhs;
+ unref(*lhs);
if (r->type == Node_elem_new) {
DEREF(r);
r = dupnode(Nnull_string);
}
UPREF(r);
UNFIELD(*lhs, r);
- unref(save_lhs);
REPLACE(r);
- }
break;
case Op_subscript_assign:
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 14 +++
doc/ChangeLog | 6 ++
doc/gawk.info | 303 +++++++++++++++++++++++++++++---------------------------
doc/gawk.texi | 31 ++++--
doc/gawktexi.in | 31 ++++--
doc/wordlist | 4 +
gawkapi.h | 6 ++
interpret.h | 16 +--
8 files changed, 230 insertions(+), 181 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-5008-g4d58c155,
Arnold Robbins <=