From f9ff7769b7b38973bf7447b8ca596435ccf77b67 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Wed, 7 Feb 2018 14:16:47 -0500 Subject: Fix bug printing +"01" in regular and MPFR mode. --- ChangeLog | 10 ++++++++++ interpret.h | 3 +++ mpfr.c | 14 ++++++++++++++ test/ChangeLog | 5 +++++ test/Makefile.am | 12 ++++++++++-- test/Makefile.in | 17 +++++++++++++++-- test/Maketests | 5 +++++ test/mpfruplus.ok | 3 +++ test/uplus.awk | 5 +++++ test/uplus.ok | 3 +++ 10 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 test/mpfruplus.ok create mode 100644 test/uplus.awk create mode 100644 test/uplus.ok diff --git a/ChangeLog b/ChangeLog index 4c3b12f0..a5fd076d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2018-02-07 Andrew J. Schorr + + Print +"01" should print "1", not "01". + * interpret.h (Op_unary_plus): Need to make a new number node that does + not contain the original string representation. The logic is copied + from Op_unary_minus. + * mpfr.c (mpg_interpret): Add new case for Op_unary_plus based on + the Op_unary_minus logic. We need a fresh number node that does not + contain the string. + 2018-01-28 Arnold D. Robbins * config.guess, config.sub: Updated. diff --git a/interpret.h b/interpret.h index 2ee68112..96e2c890 100644 --- a/interpret.h +++ b/interpret.h @@ -621,6 +621,9 @@ mod: case Op_unary_plus: // Force argument to be numeric t1 = TOP_NUMBER(); + r = make_number(t1->numbr); + DEREF(t1); + REPLACE(r); break; case Op_store_sub: diff --git a/mpfr.c b/mpfr.c index 1c4a2b9b..0c962c67 100644 --- a/mpfr.c +++ b/mpfr.c @@ -1682,6 +1682,20 @@ mod: REPLACE(r); break; + case Op_unary_plus: + t1 = TOP_NUMBER(); + if (is_mpg_float(t1)) { + r = mpg_float(); + tval = mpfr_set(r->mpg_numbr, t1->mpg_numbr, ROUND_MODE); + IEEE_FMT(r->mpg_numbr, tval); + } else { + r = mpg_integer(); + mpz_set(r->mpg_i, t1->mpg_i); + } + DEREF(t1); + REPLACE(r); + break; + case Op_assign_plus: case Op_assign_minus: case Op_assign_times: diff --git a/test/ChangeLog b/test/ChangeLog index 27817e24..c239ba24 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2018-02-07 Andrew J. Schorr + + * Makefile.am (uplus, mpfruplus): Add new tests. + * uplus.awk, uplus.ok, mpfruplus.ok: New files. + 2018-02-05 Arnold D. Robbins * Makefile.am (MPFR_TESTS): Sort tests and use backslash diff --git a/test/Makefile.am b/test/Makefile.am index e154338c..1100cb4c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -676,6 +676,7 @@ EXTRA_DIST = \ mpfrsqrt.ok \ mpfrstrtonum.awk \ mpfrstrtonum.ok \ + mpfruplus.ok \ mpgforcenum.awk \ mpgforcenum.ok \ mtchi18n.awk \ @@ -1176,6 +1177,8 @@ EXTRA_DIST = \ uparrfs.awk \ uparrfs.in \ uparrfs.ok \ + uplus.awk \ + uplus.ok \ valgrind.awk \ watchpoint1.awk \ watchpoint1.in \ @@ -1251,7 +1254,7 @@ BASIC_TESTS = \ splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \ subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \ tradanch tweakfld \ - uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \ + uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ zero2 zeroe0 zeroflag @@ -1299,7 +1302,7 @@ MACHINE_TESTS = double1 double2 fmtspcl intformat MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \ mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ - mpfrstrtonum mpgforcenum + mpfrstrtonum mpgforcenum mpfruplus LOCALE_CHARSET_TESTS = \ asort asorti backbigs1 backsmalls1 backsmalls2 \ @@ -2123,6 +2126,11 @@ mpfrstrtonum: @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfruplus: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/uplus.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + mpgforcenum: @echo $@ @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 diff --git a/test/Makefile.in b/test/Makefile.in index 99047fef..3de436f0 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -934,6 +934,7 @@ EXTRA_DIST = \ mpfrsqrt.ok \ mpfrstrtonum.awk \ mpfrstrtonum.ok \ + mpfruplus.ok \ mpgforcenum.awk \ mpgforcenum.ok \ mtchi18n.awk \ @@ -1434,6 +1435,8 @@ EXTRA_DIST = \ uparrfs.awk \ uparrfs.in \ uparrfs.ok \ + uplus.awk \ + uplus.ok \ valgrind.awk \ watchpoint1.awk \ watchpoint1.in \ @@ -1508,7 +1511,7 @@ BASIC_TESTS = \ splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \ subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \ tradanch tweakfld \ - uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs \ + uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \ wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ zero2 zeroe0 zeroflag @@ -1552,7 +1555,7 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht MACHINE_TESTS = double1 double2 fmtspcl intformat MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \ mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ - mpfrstrtonum mpgforcenum + mpfrstrtonum mpgforcenum mpfruplus LOCALE_CHARSET_TESTS = \ asort asorti backbigs1 backsmalls1 backsmalls2 \ @@ -2563,6 +2566,11 @@ mpfrstrtonum: @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +mpfruplus: + @echo $@ + @$(AWK) -M -f "$(srcdir)"/uplus.awk > _$@ 2>&1 + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + mpgforcenum: @echo $@ @$(AWK) -M -f "$(srcdir)"/$@.awk > _$@ 2>&1 @@ -3946,6 +3954,11 @@ uparrfs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +uplus: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + wjposer1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 314aaaec..e449dd30 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1037,6 +1037,11 @@ uparrfs: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +uplus: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + wjposer1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/mpfruplus.ok b/test/mpfruplus.ok new file mode 100644 index 00000000..9f6e83e2 --- /dev/null +++ b/test/mpfruplus.ok @@ -0,0 +1,3 @@ +1 +1 +-1 diff --git a/test/uplus.awk b/test/uplus.awk new file mode 100644 index 00000000..3220f7fd --- /dev/null +++ b/test/uplus.awk @@ -0,0 +1,5 @@ +BEGIN { + print "01" + 0 + print +"01" + print -"01" +} diff --git a/test/uplus.ok b/test/uplus.ok new file mode 100644 index 00000000..9f6e83e2 --- /dev/null +++ b/test/uplus.ok @@ -0,0 +1,3 @@ +1 +1 +-1 -- cgit v1.2.3 From 9286ef6a6e2817a8fa126e6d6a83ec16678a812d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 7 Feb 2018 22:06:14 +0200 Subject: Update zh_CN translation. --- po/ChangeLog | 4 +++ po/zh_CN.po | 104 ++++++++++++++++++----------------------------------------- 2 files changed, 35 insertions(+), 73 deletions(-) diff --git a/po/ChangeLog b/po/ChangeLog index e2491c18..575b488e 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,7 @@ +2018-02-07 Arnold D. Robbins + + * zh_CN.po: Updated. + 2018-02-04 Arnold D. Robbins * pt_BR.po: Updated. diff --git a/po/zh_CN.po b/po/zh_CN.po index 36942acf..6c27feed 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -8,10 +8,10 @@ # msgid "" msgstr "" -"Project-Id-Version: gawk 4.1.64\n" +"Project-Id-Version: gawk 4.2.0e\n" "Report-Msgid-Bugs-To: bug-gawk@gnu.org\n" "POT-Creation-Date: 2018-01-28 20:07+0200\n" -"PO-Revision-Date: 2017-09-16 13:10+0200\n" +"PO-Revision-Date: 2018-02-05 19:53+0100\n" "Last-Translator: Tianze Wang \n" "Language-Team: Chinese (simplified) \n" "Language: zh_CN\n" @@ -516,8 +516,7 @@ msgid "division by zero attempted in `%%'" msgstr "在“%%”中试图除 0" #: awkgram.y:5552 -msgid "" -"cannot assign a value to the result of a field post-increment expression" +msgid "cannot assign a value to the result of a field post-increment expression" msgstr "无法将值赋给字段后增表达式" #: awkgram.y:5555 @@ -767,8 +766,7 @@ msgstr "substr:开始坐标 %g 超出字符串尾部" #: builtin.c:1863 #, c-format -msgid "" -"substr: length %g at start index %g exceeds length of first argument (%lu)" +msgid "substr: length %g at start index %g exceeds length of first argument (%lu)" msgstr "substr:在开始坐标 %2$g 下长度 %1$g 超出第一个参数的长度 (%3$lu)" #: builtin.c:1936 @@ -1007,8 +1005,7 @@ msgstr "intdiv:试图除0" #: builtin.c:4080 #, c-format -msgid "" -"typeof detected invalid flags combination `%s'; please file a bug report." +msgid "typeof detected invalid flags combination `%s'; please file a bug report." msgstr "typeof 函数发现一个无效的选项组合“%s”;请向开发者汇报此错误。" #: builtin.c:4095 @@ -1122,14 +1119,11 @@ msgid "non-zero integer value" msgstr "非零整数值" #: command.y:819 -msgid "" -"backtrace [N] - print trace of all or N innermost (outermost if N < 0) " -"frames." +msgid "backtrace [N] - print trace of all or N innermost (outermost if N < 0) frames." msgstr "backtrace [N] - 显示所有或最近 N 层 (若 N < 0,则显示最远 N 层) 调用。" #: command.y:821 -msgid "" -"break [[filename:]N|function] - set breakpoint at the specified location." +msgid "break [[filename:]N|function] - set breakpoint at the specified location." msgstr "break [[文件名:]N|函数] - 在指定处设置断点。" #: command.y:823 @@ -1137,9 +1131,7 @@ msgid "clear [[filename:]N|function] - delete breakpoints previously set." msgstr "clear [[文件名:]N|函数] - 删除之前设置的断点。" #: command.y:825 -msgid "" -"commands [num] - starts a list of commands to be executed at a " -"breakpoint(watchpoint) hit." +msgid "commands [num] - starts a list of commands to be executed at a breakpoint(watchpoint) hit." msgstr "commands [编号] - 在断点 (监视点) 处执行一系列命令。" #: command.y:827 @@ -1203,12 +1195,8 @@ msgid "ignore N COUNT - set ignore-count of breakpoint number N to COUNT." msgstr "ignore N 次数 - 设置忽略断点 N 的次数。" #: command.y:857 -msgid "" -"info topic - source|sources|variables|functions|break|frame|args|locals|" -"display|watch." -msgstr "" -"info 主题 - 查看 info 信息,主题可以为 source|sources|variables|functions|" -"break|frame|args|locals|display|watch。" +msgid "info topic - source|sources|variables|functions|break|frame|args|locals|display|watch." +msgstr "info 主题 - 查看 info 信息,主题可以为 source|sources|variables|functions|break|frame|args|locals|display|watch。" #: command.y:859 msgid "list [-|+|[filename:]lineno|function|range] - list specified line(s)." @@ -1219,8 +1207,7 @@ msgid "next [COUNT] - step program, proceeding through subroutine calls." msgstr "next [次数] - 单步运行程序,并且步过子调用。" #: command.y:863 -msgid "" -"nexti [COUNT] - step one instruction, but proceed through subroutine calls." +msgid "nexti [COUNT] - step one instruction, but proceed through subroutine calls." msgstr "nexti [次数] - 单运行一步指令,但步过其子调用。" #: command.y:865 @@ -1256,8 +1243,7 @@ msgid "set var = value - assign value to a scalar variable." msgstr "set 变量 = 值 - 给标量变量赋值。" #: command.y:883 -msgid "" -"silent - suspends usual message when stopped at a breakpoint/watchpoint." +msgid "silent - suspends usual message when stopped at a breakpoint/watchpoint." msgstr "silent - 在断点/监视点处中断时,隐藏常规消息。" #: command.y:885 @@ -1285,9 +1271,7 @@ msgid "undisplay [N] - remove variable(s) from automatic display list." msgstr "undisplay [N] - 从自动显示列表中移除指定变量。" #: command.y:897 -msgid "" -"until [[filename:]N|function] - execute until program reaches a different " -"line or line N within current frame." +msgid "until [[filename:]N|function] - execute until program reaches a different line or line N within current frame." msgstr "until [[文件名:]N|函数] - 在当前层中执行,在下一行或第 N 行处暂停。" #: command.y:899 @@ -1303,12 +1287,8 @@ msgid "watch var - set a watchpoint for a variable." msgstr "watch 变量 - 为变量设置监视点。" #: command.y:905 -msgid "" -"where [N] - (same as backtrace) print trace of all or N innermost (outermost " -"if N < 0) frames." -msgstr "" -"where [N] - (与backtrace相同) 显示所有或最近 N 层 (若 N < 0,则显示最远 N " -"层) 调用。" +msgid "where [N] - (same as backtrace) print trace of all or N innermost (outermost if N < 0) frames." +msgstr "where [N] - (与backtrace相同) 显示所有或最近 N 层 (若 N < 0,则显示最远 N 层) 调用。" #: command.y:1016 debug.c:401 gawkapi.c:258 msg.c:137 #, c-format @@ -1993,8 +1973,7 @@ msgstr "load_ext:无法打开库“%s”(%s)\n" #: ext.c:66 #, c-format -msgid "" -"load_ext: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n" +msgid "load_ext: library `%s': does not define `plugin_is_GPL_compatible' (%s)\n" msgstr "load_ext:库“%s”:未定义“plugin_is_GPL_compatible”(%s)\n" #: ext.c:72 @@ -2436,9 +2415,7 @@ msgstr "awk_value_to_node:数值类型“%d”无效" #: gawkapi.c:520 #, c-format -msgid "" -"node_to_awk_value: detected invalid numeric flags combination `%s'; please " -"file a bug report." +msgid "node_to_awk_value: detected invalid numeric flags combination `%s'; please file a bug report." msgstr "node_to_awk_value:发现一个无效的选项组合“%s”;请向开发者汇报此错误。" #: gawkapi.c:548 @@ -2451,9 +2428,7 @@ msgstr "node_to_awk_value:值为空" #: gawkapi.c:607 gawkapi.c:641 gawkapi.c:668 gawkapi.c:701 #, c-format -msgid "" -"node_to_awk_value detected invalid flags combination `%s'; please file a bug " -"report." +msgid "node_to_awk_value detected invalid flags combination `%s'; please file a bug report." msgstr "node_to_awk_value 发现了一个无效的选项组合“%s”;请向开发者汇报此错误。" #: gawkapi.c:1072 @@ -2518,8 +2493,7 @@ msgstr "“%s”重定向中的表达式是空字符串" #: io.c:796 #, c-format -msgid "" -"filename `%.*s' for `%s' redirection may be result of logical expression" +msgid "filename `%.*s' for `%s' redirection may be result of logical expression" msgstr "“%3$s”重定向中的文件名“%2$.*1$s”可能是逻辑表达式的结果" #: io.c:844 @@ -2544,8 +2518,7 @@ msgstr "无法为输入打开管道“%s”(%s)" #: io.c:950 #, c-format -msgid "" -"get_file socket creation not supported on this platform for `%s' with fd %d" +msgid "get_file socket creation not supported on this platform for `%s' with fd %d" msgstr "此平台不支持使用 get_file 创建文件描述符为 %2$d 的套接字“%1$s”" #: io.c:961 @@ -2564,8 +2537,7 @@ msgid "can't redirect to `%s' (%s)" msgstr "无法重定向到“%s”(%s)" #: io.c:1153 -msgid "" -"reached system limit for open files: starting to multiplex file descriptors" +msgid "reached system limit for open files: starting to multiplex file descriptors" msgstr "打开的文件数达到系统限制:开始复用文件描述符" #: io.c:1169 @@ -2720,9 +2692,8 @@ msgid "close of slave pty failed (%s)" msgstr "关闭从 pty 失败(%s)" #: io.c:2245 -#, fuzzy msgid "could not create child process or open pty" -msgstr "无法为“%s”创建子进程(fork:%s)" +msgstr "无法创建子进程或打开 pty" #: io.c:2333 io.c:2401 io.c:2613 io.c:2645 #, c-format @@ -2785,8 +2756,7 @@ msgstr "register_output_parser:指针为空" #: io.c:3201 #, c-format -msgid "" -"output wrapper `%s' conflicts with previously installed output wrapper `%s'" +msgid "output wrapper `%s' conflicts with previously installed output wrapper `%s'" msgstr "输出解析器“%s”与之前设置的“%s”相冲突" #: io.c:3208 @@ -2800,9 +2770,7 @@ msgstr "register_output_processor:指针为空" #: io.c:3258 #, c-format -msgid "" -"two-way processor `%s' conflicts with previously installed two-way processor " -"`%s'" +msgid "two-way processor `%s' conflicts with previously installed two-way processor `%s'" msgstr "双向处理器“%s”与之前设置的“%s”相冲突" #: io.c:3267 @@ -3010,7 +2978,6 @@ msgstr "\t-Y\t\t--parsedebug\n" #. address for translation bugs. #. no-wrap #: main.c:627 -#, fuzzy msgid "" "\n" "To report bugs, see node `Bugs' in `gawk.info'\n" @@ -3025,6 +2992,7 @@ msgstr "" "Problems and Bugs”一节。您也可以在\n" "https://www.gnu.org/software/gawk/manual/html_node/Bugs.html\n" "中找到相同的信息。\n" +"请勿在群组 comp.lang.awk 上提交错误报告。\n" "\n" #: main.c:634 @@ -3080,9 +3048,7 @@ msgstr "" msgid "" "You should have received a copy of the GNU General Public License\n" "along with this program. If not, see http://www.gnu.org/licenses/.\n" -msgstr "" -"你应该收到程序附带的一份 GNU 通用公共许可证(GPL)。如果没有收到,请参看 " -"http://www.gnu.org/licenses/ 。\n" +msgstr "你应该收到程序附带的一份 GNU 通用公共许可证(GPL)。如果没有收到,请参看 http://www.gnu.org/licenses/ 。\n" #: main.c:725 msgid "-Ft does not set FS to tab in POSIX awk" @@ -3239,9 +3205,7 @@ msgstr "“\\x”转义序列中没有十六进制数" #: node.c:611 #, c-format -msgid "" -"hex escape \\x%.*s of %d characters probably not interpreted the way you " -"expect" +msgid "hex escape \\x%.*s of %d characters probably not interpreted the way you expect" msgstr "十六进制转义符 \\x%.*s 表示的 %d 个字符可能不会被如期望情况解释" #: node.c:626 @@ -3250,9 +3214,7 @@ msgid "escape sequence `\\%c' treated as plain `%c'" msgstr "转义序列“\\%c”被当作单纯的“%c”" #: node.c:762 -msgid "" -"Invalid multibyte data detected. There may be a mismatch between your data " -"and your locale." +msgid "Invalid multibyte data detected. There may be a mismatch between your data and your locale." msgstr "检测到了无效的多字节数据。可能你的数据和区域设置不匹配。" #: posix/gawkmisc.c:177 @@ -3528,8 +3490,7 @@ msgstr "无法弹出 main 的上下文" #~ msgid "extension: cannot open library `%s' (%s)" #~ msgstr "extension:无法打开库“%s”(%s)" -#~ msgid "" -#~ "extension: library `%s': does not define `plugin_is_GPL_compatible' (%s)" +#~ msgid "extension: library `%s': does not define `plugin_is_GPL_compatible' (%s)" #~ msgstr "extension:库“%s”:未定义“plugin_is_GPL_compatible”(%s)" #~ msgid "extension: library `%s': cannot call function `%s' (%s)" @@ -3679,8 +3640,7 @@ msgstr "无法弹出 main 的上下文" #~ msgid "xor(%lf, %lf): fractional values will be truncated" #~ msgstr "xor(%lf, %lf): 小数部分会被截断" -#~ msgid "" -#~ "for loop: array `%s' changed size from %ld to %ld during loop execution" +#~ msgid "for loop: array `%s' changed size from %ld to %ld during loop execution" #~ msgstr "for loop: 数组“%s”在循环执行时大小从 %ld 改变为 %ld" #~ msgid "`break' outside a loop is not portable" @@ -3701,9 +3661,7 @@ msgstr "无法弹出 main 的上下文" #~ msgid "statement has no effect" #~ msgstr "表达式无任何作用" -#~ msgid "" -#~ "concatenation: side effects in one expression have changed the length of " -#~ "another!" +#~ msgid "concatenation: side effects in one expression have changed the length of another!" #~ msgstr "concatenation: 一个表达式的额外效应已改变另一个的长度!" #~ msgid "assignment used in conditional context" -- cgit v1.2.3 From 4197063335d758d0eacb8b4cb74b232ad596c784 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 8 Feb 2018 07:28:16 +0200 Subject: Update doc w.r.t. cygwin binary mode. --- doc/ChangeLog | 7 +++ doc/gawk.info | 130 +++++++++++++++++++++++++++++++------------------------- doc/gawk.texi | 16 ++++++- doc/gawktexi.in | 16 ++++++- 4 files changed, 108 insertions(+), 61 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a8e3368f..a1fd0c82 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2018-02-08 Arnold D. Robbins + + * gawktexi.in: Clarify binary mode is default on Cygwin, + improve section on using on PCs to refer to MinGW and DJGPP. + Thanks for the report to a contributor who wishes to + remain anonymous. + 2018-01-28 Arnold D. Robbins * wordlist: Updated. diff --git a/doc/gawk.info b/doc/gawk.info index b2726536..8d4643ee 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -29150,8 +29150,12 @@ File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Compiling, Up: PC In B.3.1.3 Using 'gawk' on PC Operating Systems ............................................ -Under MS-Windows, the Cygwin and MinGW environments support both the -'|&' operator and TCP/IP networking (*note TCP/IP Networking::). +Information in this section applies to the MinGW and DJGPP ports of +'gawk'. *Note Cygwin:: for information about the Cygwin port. + + Under MS-Windows, the MinGW environment supports both the '|&' +operator and TCP/IP networking (*note TCP/IP Networking::). The DJGPP +environment does not support '|&'. The MS-Windows version of 'gawk' searches for program files as described in *note AWKPATH Variable::. However, semicolons (rather than @@ -29239,6 +29243,14 @@ Cygwin is the same as for a Unix system: on Cygwin takes considerably longer. However, it does finish, and then the 'make' proceeds as usual. + Recent versions of Cygwin open all files in binary mode. This means +that you should use 'RS = "\r?\n"' in order to be able to handle +standard MS-Windows text files with carriage-return plus line-feed line +endings. + + The Cygwin environment supports both the '|&' operator and TCP/IP +networking (*note TCP/IP Networking::). +  File: gawk.info, Node: MSYS, Prev: Cygwin, Up: PC Installation @@ -33022,7 +33034,7 @@ Index * /inet/... special files (gawk): TCP/IP Networking. (line 6) * /inet4/... special files (gawk): TCP/IP Networking. (line 6) * /inet6/... special files (gawk): TCP/IP Networking. (line 6) -* ; (semicolon), AWKPATH variable and: PC Using. (line 9) +* ; (semicolon), AWKPATH variable and: PC Using. (line 13) * ; (semicolon), separating statements in actions: Statements/Lines. (line 90) * ; (semicolon), separating statements in actions <1>: Action Overview. @@ -33351,7 +33363,7 @@ Index * awka compiler for awk: Other Versions. (line 73) * AWKLIBPATH environment variable: AWKLIBPATH Variable. (line 6) * AWKPATH environment variable: AWKPATH Variable. (line 6) -* AWKPATH environment variable <1>: PC Using. (line 9) +* AWKPATH environment variable <1>: PC Using. (line 13) * awkprof.out file: Profiling. (line 6) * awksed.awk program: Simple Sed. (line 25) * awkvars.out file: Options. (line 94) @@ -33445,7 +33457,7 @@ Index * bindtextdomain() function (gawk), portability and: I18N Portability. (line 33) * BINMODE variable: User-modified. (line 15) -* BINMODE variable <1>: PC Using. (line 16) +* BINMODE variable <1>: PC Using. (line 20) * bit-manipulation functions: Bitwise Functions. (line 6) * bits2str() user-defined function: Bitwise Functions. (line 69) * bitwise AND: Bitwise Functions. (line 40) @@ -33628,7 +33640,7 @@ Index * common extensions, /dev/stderr special file: Special FD. (line 48) * common extensions, /dev/stdin special file: Special FD. (line 48) * common extensions, /dev/stdout special file: Special FD. (line 48) -* common extensions, BINMODE variable: PC Using. (line 16) +* common extensions, BINMODE variable: PC Using. (line 20) * common extensions, delete to delete entire arrays: Delete. (line 39) * common extensions, func keyword: Definition Syntax. (line 99) * common extensions, length() applied to an array: String Functions. @@ -33935,7 +33947,7 @@ Index * differences in awk and gawk, BINMODE variable: User-modified. (line 15) * differences in awk and gawk, BINMODE variable <1>: PC Using. - (line 16) + (line 20) * differences in awk and gawk, close() function: Close Files And Pipes. (line 81) * differences in awk and gawk, close() function <1>: Close Files And Pipes. @@ -34169,7 +34181,7 @@ Index * extensions, common, /dev/stderr special file: Special FD. (line 48) * extensions, common, /dev/stdin special file: Special FD. (line 48) * extensions, common, /dev/stdout special file: Special FD. (line 48) -* extensions, common, BINMODE variable: PC Using. (line 16) +* extensions, common, BINMODE variable: PC Using. (line 20) * extensions, common, delete to delete entire arrays: Delete. (line 39) * extensions, common, fflush() function: I/O Functions. (line 43) * extensions, common, func keyword: Definition Syntax. (line 99) @@ -34477,7 +34489,7 @@ Index * gawk, line continuation in: Conditional Exp. (line 34) * gawk, LINT variable in: User-modified. (line 90) * gawk, list of contributors to: Contributors. (line 6) -* gawk, MS-Windows version of: PC Using. (line 9) +* gawk, MS-Windows version of: PC Using. (line 13) * gawk, newlines in: Statements/Lines. (line 12) * gawk, octal numbers and: Nondecimal-numbers. (line 41) * gawk, predefined variables and: Built-in Variables. (line 14) @@ -35493,12 +35505,12 @@ Index * search and replace in strings: String Functions. (line 89) * search in string: String Functions. (line 155) * search paths: Programs Exercises. (line 70) -* search paths <1>: PC Using. (line 9) +* search paths <1>: PC Using. (line 13) * search paths <2>: VMS Running. (line 57) * search paths, for loadable extensions: AWKLIBPATH Variable. (line 6) * search paths, for source files: AWKPATH Variable. (line 6) * search paths, for source files <1>: Programs Exercises. (line 70) -* search paths, for source files <2>: PC Using. (line 9) +* search paths, for source files <2>: PC Using. (line 13) * search paths, for source files <3>: VMS Running. (line 57) * searching, files for regular expressions: Egrep Program. (line 6) * searching, for words: Dupword Program. (line 6) @@ -35506,7 +35518,7 @@ Index * sed utility <1>: Simple Sed. (line 6) * sed utility <2>: Glossary. (line 16) * seeding random number generator: Numeric Functions. (line 64) -* semicolon (;), AWKPATH variable and: PC Using. (line 9) +* semicolon (;), AWKPATH variable and: PC Using. (line 13) * semicolon (;), separating statements in actions: Statements/Lines. (line 90) * semicolon (;), separating statements in actions <1>: Action Overview. @@ -36522,52 +36534,52 @@ Node: PC Installation1174500 Node: PC Binary Installation1175338 Node: PC Compiling1175773 Node: PC Using1176890 -Node: Cygwin1179935 -Node: MSYS1180705 -Node: VMS Installation1181206 -Node: VMS Compilation1181997 -Ref: VMS Compilation-Footnote-11183226 -Node: VMS Dynamic Extensions1183284 -Node: VMS Installation Details1184969 -Node: VMS Running1187222 -Node: VMS GNV1191501 -Node: VMS Old Gawk1192236 -Node: Bugs1192707 -Node: Bug address1193370 -Node: Usenet1196162 -Node: Maintainers1196939 -Node: Other Versions1198200 -Node: Installation summary1204962 -Node: Notes1206164 -Node: Compatibility Mode1207029 -Node: Additions1207811 -Node: Accessing The Source1208736 -Node: Adding Code1210173 -Node: New Ports1216392 -Node: Derived Files1220880 -Ref: Derived Files-Footnote-11226526 -Ref: Derived Files-Footnote-21226561 -Ref: Derived Files-Footnote-31227159 -Node: Future Extensions1227273 -Node: Implementation Limitations1227931 -Node: Extension Design1229114 -Node: Old Extension Problems1230268 -Ref: Old Extension Problems-Footnote-11231786 -Node: Extension New Mechanism Goals1231843 -Ref: Extension New Mechanism Goals-Footnote-11235207 -Node: Extension Other Design Decisions1235396 -Node: Extension Future Growth1237509 -Node: Old Extension Mechanism1238345 -Node: Notes summary1240108 -Node: Basic Concepts1241290 -Node: Basic High Level1241971 -Ref: figure-general-flow1242253 -Ref: figure-process-flow1242938 -Ref: Basic High Level-Footnote-11246239 -Node: Basic Data Typing1246424 -Node: Glossary1249752 -Node: Copying1281590 -Node: GNU Free Documentation License1319133 -Node: Index1344253 +Node: Cygwin1180105 +Node: MSYS1181204 +Node: VMS Installation1181705 +Node: VMS Compilation1182496 +Ref: VMS Compilation-Footnote-11183725 +Node: VMS Dynamic Extensions1183783 +Node: VMS Installation Details1185468 +Node: VMS Running1187721 +Node: VMS GNV1192000 +Node: VMS Old Gawk1192735 +Node: Bugs1193206 +Node: Bug address1193869 +Node: Usenet1196661 +Node: Maintainers1197438 +Node: Other Versions1198699 +Node: Installation summary1205461 +Node: Notes1206663 +Node: Compatibility Mode1207528 +Node: Additions1208310 +Node: Accessing The Source1209235 +Node: Adding Code1210672 +Node: New Ports1216891 +Node: Derived Files1221379 +Ref: Derived Files-Footnote-11227025 +Ref: Derived Files-Footnote-21227060 +Ref: Derived Files-Footnote-31227658 +Node: Future Extensions1227772 +Node: Implementation Limitations1228430 +Node: Extension Design1229613 +Node: Old Extension Problems1230767 +Ref: Old Extension Problems-Footnote-11232285 +Node: Extension New Mechanism Goals1232342 +Ref: Extension New Mechanism Goals-Footnote-11235706 +Node: Extension Other Design Decisions1235895 +Node: Extension Future Growth1238008 +Node: Old Extension Mechanism1238844 +Node: Notes summary1240607 +Node: Basic Concepts1241789 +Node: Basic High Level1242470 +Ref: figure-general-flow1242752 +Ref: figure-process-flow1243437 +Ref: Basic High Level-Footnote-11246738 +Node: Basic Data Typing1246923 +Node: Glossary1250251 +Node: Copying1282089 +Node: GNU Free Documentation License1319632 +Node: Index1344752  End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 9b4d392e..d99e33bb 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -39745,9 +39745,14 @@ type @samp{make mingw32}. @cindex operating systems, PC, @command{gawk} on @cindex PC operating systems, @command{gawk} on -Under MS-Windows, the Cygwin and MinGW environments support +Information in this section applies to the MinGW and +DJGPP ports of @command{gawk}. @xref{Cygwin} for information +about the Cygwin port. + +Under MS-Windows, the MinGW environment supports both the @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}). +The DJGPP environment does not support @samp{|&}. @cindex search paths @cindex search paths, for source files @@ -39873,6 +39878,15 @@ When compared to GNU/Linux on the same system, the @samp{configure} step on Cygwin takes considerably longer. However, it does finish, and then the @samp{make} proceeds as usual. +Recent versions of Cygwin open all files in binary mode. This means +that you should use @samp{RS = "\r?\n"} in order to be able to +handle standard MS-Windows text files with carriage-return plus +line-feed line endings. + +The Cygwin environment supports +both the @samp{|&} operator and TCP/IP networking +(@pxref{TCP/IP Networking}). + @node MSYS @appendixsubsubsec Using @command{gawk} In The MSYS Environment diff --git a/doc/gawktexi.in b/doc/gawktexi.in index ce7d62ca..d0317ce3 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -38719,9 +38719,14 @@ type @samp{make mingw32}. @cindex operating systems, PC, @command{gawk} on @cindex PC operating systems, @command{gawk} on -Under MS-Windows, the Cygwin and MinGW environments support +Information in this section applies to the MinGW and +DJGPP ports of @command{gawk}. @xref{Cygwin} for information +about the Cygwin port. + +Under MS-Windows, the MinGW environment supports both the @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}). +The DJGPP environment does not support @samp{|&}. @cindex search paths @cindex search paths, for source files @@ -38847,6 +38852,15 @@ When compared to GNU/Linux on the same system, the @samp{configure} step on Cygwin takes considerably longer. However, it does finish, and then the @samp{make} proceeds as usual. +Recent versions of Cygwin open all files in binary mode. This means +that you should use @samp{RS = "\r?\n"} in order to be able to +handle standard MS-Windows text files with carriage-return plus +line-feed line endings. + +The Cygwin environment supports +both the @samp{|&} operator and TCP/IP networking +(@pxref{TCP/IP Networking}). + @node MSYS @appendixsubsubsec Using @command{gawk} In The MSYS Environment -- cgit v1.2.3 From c326b7dfa00760f7127912053fad544b0b79da23 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Thu, 8 Feb 2018 08:36:02 -0500 Subject: Fix extension pkgextensiondir installation location. --- extension/ChangeLog | 8 ++++++++ extension/configure | 2 +- extension/configure.ac | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/extension/ChangeLog b/extension/ChangeLog index b811e6ca..83d43729 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,11 @@ +2018-02-08 Andrew J. Schorr + + * configure.ac (pkgextensiondir): This must be set to + '${libdir}/gawk'${EXTENSIONDIR} to match gawk's value. + The previous value of '${pkglibdir}'${EXTENSIONDIR} was incorrect, + because it was putting the extensions in the gawk-extensions + libdir subdirectory, instead of the gawk subdirectory. + 2018-02-02 Arnold D. Robbins * filefuncs.3am, fnmatch.3am, fork.3am, inplace.3am, diff --git a/extension/configure b/extension/configure index 084334e1..2ace2d86 100755 --- a/extension/configure +++ b/extension/configure @@ -12595,7 +12595,7 @@ CC=$lt_save_CC -pkgextensiondir='${pkglibdir}'${EXTENSIONDIR} +pkgextensiondir='${libdir}/gawk'${EXTENSIONDIR} if test "$GCC" = yes diff --git a/extension/configure.ac b/extension/configure.ac index e8b242a0..2b913364 100644 --- a/extension/configure.ac +++ b/extension/configure.ac @@ -56,7 +56,9 @@ dnl AC_PROG_INSTALL dnl use the same definition as the main configure script. dnl EXTENSIONDIR is exported if it was set there. -AC_SUBST([pkgextensiondir], ['${pkglibdir}'${EXTENSIONDIR}]) +dnl N.B. We must use ${libdir}/gawk instead of $pkglibdir because $pkglibdir +dnl is set to ${libdir}/gawk-extensions, which is not what we want. +AC_SUBST([pkgextensiondir], ['${libdir}/gawk'${EXTENSIONDIR}]) if test "$GCC" = yes then -- cgit v1.2.3 From c1e55fde1a4bb72a0627ab37fe5ba1493cbf91eb Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 9 Feb 2018 11:31:25 +0200 Subject: Small fix in sockets if only loopback interface is up. --- ChangeLog | 7 +++++++ io.c | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a5fd076d..b467eb23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2018-02-09 Arnold D. Robbins + + * io.c (socketopen): Rearrange assigning the flags to use + AI_ADDRCONFIG only if family is AF_UNSPEC. Thanks to + Houder for the report and initial + code suggestion. + 2018-02-07 Andrew J. Schorr Print +"01" should print "1", not "01". diff --git a/io.c b/io.c index befc20a1..f09c4a02 100644 --- a/io.c +++ b/io.c @@ -1579,10 +1579,23 @@ socketopen(int family, int type, const char *localpname, int any_remote_host = (strcmp(remotehostname, "0") == 0); memset(& lhints, '\0', sizeof (lhints)); - lhints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; + lhints.ai_socktype = type; lhints.ai_family = family; + /* + * If only the loopback interface is up and hints.ai_flags has + * AI_ADDRCONFIG, getaddrinfo() will succeed and return all wildcard + * addresses, but only if hints.ai_family == AF_UNSPEC + * + * Do return the wildcard address in case the loopback interface + * is the only one that is up (and + * hints.ai_family == either AF_INET4 or AF_INET6) + */ + lhints.ai_flags = AI_PASSIVE; + if (lhints.ai_family == AF_UNSPEC) + lhints.ai_flags |= AI_ADDRCONFIG; + lerror = getaddrinfo(NULL, localpname, & lhints, & lres); if (lerror) { if (strcmp(localpname, "0") != 0) { -- cgit v1.2.3