diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-27 06:32:13 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-27 06:32:13 +0300 |
commit | 9d43b510f74f63806279ce40f65245ea7e5b0d53 (patch) | |
tree | 9ca3e70190325400684cfde33946017a0de334a8 | |
parent | bc1c92f4a9365f799c9c7a78b41a4eb1c40326b7 (diff) | |
download | gawk-9d43b510f74f63806279ce40f65245ea7e5b0d53.tar.gz |
Some more cleanups. Ready to merge!select
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 49 | ||||
-rw-r--r-- | doc/gawk.texi | 10 | ||||
-rw-r--r-- | doc/gawktexi.in | 10 | ||||
-rw-r--r-- | extension/ChangeLog | 4 | ||||
-rw-r--r-- | extension/testext.c | 12 | ||||
-rw-r--r-- | gawkapi.c | 4 | ||||
-rw-r--r-- | io.c | 3 | ||||
-rw-r--r-- | test/ChangeLog | 7 | ||||
-rw-r--r-- | test/Makefile.am | 9 | ||||
-rw-r--r-- | test/Makefile.in | 9 | ||||
-rw-r--r-- | test/defvar.awk | 3 | ||||
-rw-r--r-- | test/defvar.ok | 5 | ||||
-rw-r--r-- | test/testext.ok | 6 |
15 files changed, 81 insertions, 59 deletions
@@ -1,3 +1,8 @@ +2015-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (redirect): Change not_string from int to bool. + * gawkapi.c (api_get_file): Minor stylistic improvements. + 2015-03-24 Andrew J. Schorr <aschorr@telemetry-investments.com> * interpret.h (r_interpret): When Op_K_exit has an argument of diff --git a/doc/ChangeLog b/doc/ChangeLog index 679e1bea..f4a6f19b 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Minor edits. + 2015-03-24 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Minor fixes from Antonio Colombo and new exercise diff --git a/doc/gawk.info b/doc/gawk.info index 6b107344..d0312ec6 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -5451,11 +5451,12 @@ how `awk' works. encounters the end of the file. If there is some error in getting a record, such as a file that cannot be opened, then `getline' returns -1. In this case, `gawk' sets the variable `ERRNO' to a string -describing the error that occurred. If `ERRNO' indicates that the I/O -operation may be retried, and `PROCINFO["input", "RETRY"]' is set, then --2 will be returned instead of -1, and further calls to `getline' may -be attemped. *Note Retrying Input::, for further information about -this feature. +describing the error that occurred. + + If `ERRNO' indicates that the I/O operation may be retried, and +`PROCINFO["INPUT", "RETRY"]' is set, then `getline' returns -2 instead +of -1, and further calls to `getline' may be attemped. *Note Retrying +Input::, for further information about this feature. In the following examples, COMMAND stands for a string value that represents a shell command. @@ -5999,16 +6000,16 @@ This minor node describes a feature that is specific to `gawk'. `getline' returns -1, and subsequent attempts to read from that file result in an end-of-file indication. However, you may optionally instruct `gawk' to allow I/O to be retried when certain errors are -encountered by setting setting a special element in the `PROCINFO' -array (*note Auto-set::): +encountered by setting a special element in the `PROCINFO' array (*note +Auto-set::): PROCINFO["INPUT_NAME", "RETRY"] = 1 When this element exists, `gawk' checks the value of the system `errno' variable when an I/O error occurs. If `errno' indicates a subsequent I/O attempt may succeed, `getline' instead returns -2 and -further calls to `getline' may succeed. This applies to `errno' values -`EAGAIN', `EWOULDBLOCK', `EINTR', or `ETIMEDOUT'. +further calls to `getline' may succeed. This applies to the `errno' +values `EAGAIN', `EWOULDBLOCK', `EINTR', or `ETIMEDOUT'. This feature is useful in conjunction with `PROCINFO["INPUT_NAME", "READ_TIMEOUT"]' or situations where a file descriptor has been @@ -34981,21 +34982,21 @@ Ref: Splitting By Content-Footnote-1236687 Node: Multiple Line236850 Ref: Multiple Line-Footnote-1242731 Node: Getline242910 -Node: Plain Getline245376 -Node: Getline/Variable248016 -Node: Getline/File249165 -Node: Getline/Variable/File250550 -Ref: Getline/Variable/File-Footnote-1252153 -Node: Getline/Pipe252240 -Node: Getline/Variable/Pipe254918 -Node: Getline/Coprocess256049 -Node: Getline/Variable/Coprocess257313 -Node: Getline Notes258052 -Node: Getline Summary260846 -Ref: table-getline-variants261258 -Node: Read Timeout262087 -Ref: Read Timeout-Footnote-1265990 -Node: Retrying Input266048 +Node: Plain Getline245380 +Node: Getline/Variable248020 +Node: Getline/File249169 +Node: Getline/Variable/File250554 +Ref: Getline/Variable/File-Footnote-1252157 +Node: Getline/Pipe252244 +Node: Getline/Variable/Pipe254922 +Node: Getline/Coprocess256053 +Node: Getline/Variable/Coprocess257317 +Node: Getline Notes258056 +Node: Getline Summary260850 +Ref: table-getline-variants261262 +Node: Read Timeout262091 +Ref: Read Timeout-Footnote-1265994 +Node: Retrying Input266052 Node: Command-line directories267238 Node: Input Summary268145 Node: Input Exercises271530 diff --git a/doc/gawk.texi b/doc/gawk.texi index 0c21d923..e9d987f0 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -8115,9 +8115,11 @@ it encounters the end of the file. If there is some error in getting a record, such as a file that cannot be opened, then @code{getline} returns @minus{}1. In this case, @command{gawk} sets the variable @code{ERRNO} to a string describing the error that occurred. + If @code{ERRNO} indicates that the I/O operation may be -retried, and @code{PROCINFO["input", "RETRY"]} is set, then @minus{}2 -will be returned instead of @minus{}1, and further calls to @code{getline} +retried, and @code{PROCINFO["@var{input}", "RETRY"]} is set, +then @code{getline} returns @minus{}2 +instead of @minus{}1, and further calls to @code{getline} may be attemped. @DBXREF{Retrying Input} for further information about this feature. @@ -8797,7 +8799,7 @@ When @command{gawk} encounters an error while reading input, by default @code{getline} returns @minus{}1, and subsequent attempts to read from that file result in an end-of-file indication. However, you may optionally instruct @command{gawk} to allow I/O to be retried when -certain errors are encountered by setting setting a special element in +certain errors are encountered by setting a special element in the @code{PROCINFO} array (@pxref{Auto-set}): @example @@ -8808,7 +8810,7 @@ When this element exists, @command{gawk} checks the value of the system @code{errno} variable when an I/O error occurs. If @code{errno} indicates a subsequent I/O attempt may succeed, @code{getline} instead returns @minus{}2 and -further calls to @code{getline} may succeed. This applies to @code{errno} +further calls to @code{getline} may succeed. This applies to the @code{errno} values @code{EAGAIN}, @code{EWOULDBLOCK}, @code{EINTR}, or @code{ETIMEDOUT}. This feature is useful in conjunction with diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 7aa427aa..178444a4 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -7715,9 +7715,11 @@ it encounters the end of the file. If there is some error in getting a record, such as a file that cannot be opened, then @code{getline} returns @minus{}1. In this case, @command{gawk} sets the variable @code{ERRNO} to a string describing the error that occurred. + If @code{ERRNO} indicates that the I/O operation may be -retried, and @code{PROCINFO["input", "RETRY"]} is set, then @minus{}2 -will be returned instead of @minus{}1, and further calls to @code{getline} +retried, and @code{PROCINFO["@var{input}", "RETRY"]} is set, +then @code{getline} returns @minus{}2 +instead of @minus{}1, and further calls to @code{getline} may be attemped. @DBXREF{Retrying Input} for further information about this feature. @@ -8397,7 +8399,7 @@ When @command{gawk} encounters an error while reading input, by default @code{getline} returns @minus{}1, and subsequent attempts to read from that file result in an end-of-file indication. However, you may optionally instruct @command{gawk} to allow I/O to be retried when -certain errors are encountered by setting setting a special element in +certain errors are encountered by setting a special element in the @code{PROCINFO} array (@pxref{Auto-set}): @example @@ -8408,7 +8410,7 @@ When this element exists, @command{gawk} checks the value of the system @code{errno} variable when an I/O error occurs. If @code{errno} indicates a subsequent I/O attempt may succeed, @code{getline} instead returns @minus{}2 and -further calls to @code{getline} may succeed. This applies to @code{errno} +further calls to @code{getline} may succeed. This applies to the @code{errno} values @code{EAGAIN}, @code{EWOULDBLOCK}, @code{EINTR}, or @code{ETIMEDOUT}. This feature is useful in conjunction with diff --git a/extension/ChangeLog b/extension/ChangeLog index 334c97af..5d1651fd 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +2015-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * testext.c: Move test for deferred variables here. + 2015-03-18 Arnold D. Robbins <arnold@skeeve.com> * configure: Updated to libtool 2.4.6. diff --git a/extension/testext.c b/extension/testext.c index 8a906c67..e2ddbe87 100644 --- a/extension/testext.c +++ b/extension/testext.c @@ -374,6 +374,17 @@ out: return result; } +/* + * 3/2015: This test is no longer strictly necessary, + * since PROCINFO is no longer a deferred variable. + * But we leave it in for safety, anyway. + */ +/* +BEGIN { + print "test_deferred returns", test_deferred() + print "" +} +*/ static awk_value_t * test_deferred(int nargs, awk_value_t *result) { @@ -1037,6 +1048,7 @@ static awk_bool_t init_testext(void) static const char message[] = "hello, world"; /* of course */ static const char message2[] = "i am a scalar"; + /* This is used by the getfile test */ if (sym_lookup("TESTEXT_QUIET", AWK_NUMBER, & value)) return awk_true; @@ -1065,8 +1065,8 @@ api_get_file(awk_ext_id_t id, const char *name, size_t namelen, const char *file save_rule = currule; save_source = source; - while (1) { - if (!pc) + for (;;) { + if (pc == NULL) fatal(_("cannot find end of BEGINFILE rule")); if (pc->opcode == Op_after_beginfile) break; @@ -1070,7 +1070,8 @@ redirect_string(const char *str, size_t explen, bool not_string, struct redirect * redirect(NODE *redir_exp, int redirtype, int *errflg, bool failure_fatal) { - int not_string = ((redir_exp->flags & STRCUR) == 0); + bool not_string = ((redir_exp->flags & STRCUR) == 0); + redir_exp = force_string(redir_exp); return redirect_string(redir_exp->stptr, redir_exp->stlen, not_string, redirtype, errflg, -1, failure_fatal); diff --git a/test/ChangeLog b/test/ChangeLog index 106a88d5..8aedf6f2 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,10 @@ +2015-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am: Remove defvar test and reference to files; test + code moved into extension/testext.c. + * defvar.awk, defvar.ok: Removed. + * testext.ok: Updated. + 2015-03-24 Andrew J. Schorr <aschorr@telemetry-investments.com> * Makefile.am (EXTRA_DIST): Add exitval3.awk and exitval3.ok. diff --git a/test/Makefile.am b/test/Makefile.am index fe06de7a..788fff5e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -178,8 +178,6 @@ EXTRA_DIST = \ dbugeval.ok \ defref.awk \ defref.ok \ - defvar.awk \ - defvar.ok \ delargv.awk \ delargv.ok \ delarpm2.awk \ @@ -1094,7 +1092,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 mbprintf4 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - defvar fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \ + fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \ ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray testext time # List of the tests which should be run with --lint option: @@ -1951,11 +1949,6 @@ testext:: @$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ testext.awk -defvar: - @echo $@ - @$(AWK) -v TESTEXT_QUIET=1 -ltestext -f $(srcdir)/$@.awk $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - getfile: @echo $@ @$(AWK) -v TESTEXT_QUIET=1 -ltestext -f $(srcdir)/$@.awk $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Makefile.in b/test/Makefile.in index fa3598a5..ad27412a 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -435,8 +435,6 @@ EXTRA_DIST = \ dbugeval.ok \ defref.awk \ defref.ok \ - defvar.awk \ - defvar.ok \ delargv.awk \ delargv.ok \ delarpm2.awk \ @@ -1347,7 +1345,7 @@ LOCALE_CHARSET_TESTS = \ mbprintf1 mbprintf2 mbprintf3 mbprintf4 rebt8b2 rtlenmb sort1 sprintfc SHLIB_TESTS = \ - defvar fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \ + fnmatch filefuncs fork fork2 fts functab4 getfile inplace1 inplace2 inplace3 \ ordchr ordchr2 readdir readfile readfile2 revout revtwoway rwarray testext time @@ -2388,11 +2386,6 @@ testext:: @$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ testext.awk -defvar: - @echo $@ - @$(AWK) -v TESTEXT_QUIET=1 -ltestext -f $(srcdir)/$@.awk $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ - @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ - getfile: @echo $@ @$(AWK) -v TESTEXT_QUIET=1 -ltestext -f $(srcdir)/$@.awk $(srcdir)/$@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/defvar.awk b/test/defvar.awk deleted file mode 100644 index 444b81c9..00000000 --- a/test/defvar.awk +++ /dev/null @@ -1,3 +0,0 @@ -BEGIN { - print "test_deferred returns", test_deferred() -} diff --git a/test/defvar.ok b/test/defvar.ok deleted file mode 100644 index 4c85427e..00000000 --- a/test/defvar.ok +++ /dev/null @@ -1,5 +0,0 @@ -fubar = 9 -rumpus = -5 -uid matches 1 -api_major matches 1 -test_deferred returns 1 diff --git a/test/testext.ok b/test/testext.ok index 9dae010f..897a7336 100644 --- a/test/testext.ok +++ b/test/testext.ok @@ -23,6 +23,12 @@ var_test() returned 1, test_var = 42 test_errno() returned 1, ERRNO = No child processes +fubar = 9 +rumpus = -5 +uid matches 1 +api_major matches 1 +test_deferred returns 1 + length of test_array is 10, should be 10 test_array_size: incoming size is 10 test_array_size() returned 1, length is now 0 |