diff options
Diffstat (limited to 'ChangeLog.1')
-rwxr-xr-x | ChangeLog.1 | 8915 |
1 files changed, 8915 insertions, 0 deletions
diff --git a/ChangeLog.1 b/ChangeLog.1 new file mode 100755 index 00000000..172b9028 --- /dev/null +++ b/ChangeLog.1 @@ -0,0 +1,8915 @@ +2019-04-07 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Updated from GNULIB. + +2019-04-05 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (load_casetable): Always use the locale's settings. + (set_IGNORECASE): Don't call load_casetable. + * main.c (main): Call load_casetable if in a single-byte locale. + +2019-03-22 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess: Updated from GNULIB. + +2019-03-17 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Fix test for ZOS_FAIL. + +2019-03-15 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (pc/Makefile.tst): Yet another fix for out- + of-tree builds. Thanks to `make distcheck'. + * configure.ac: Update version for next tar ball. + +2019-03-03 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Fix help message. + +2019-03-01 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (pc/Makefile.tst): Make sure pc/ directory exists + first. Needed for `make distcheck'. Not sure what changed such + that this is only showing up now. + * configure.ac: Update version for next test tarball. + +2019-02-28 Arnold D. Robbins <arnold@skeeve.com> + + * README.cvs: Removed. Six years is long enough. + +2019-02-25 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess: Updated from GNULIB. + +2019-02-25 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated. + +2019-02-25 Arnold D. Robbins <arnold@skeeve.com> + + Small profiling improvements. Suggested by mukti + <ferida.cicatriz@gmail.com>. + + * main.c (parse_args): Add warnings that --profile overrides + --pretty-print. + (main): Move setuid warning to after all the warnings for conflicting + arguments. + * profile.c (pprint): Don't print extra trailing space after return + and exit if no value associated with the statement. + +2019-02-25 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Set ZOS_FAIL if on ZOS to improve test suite on that + platform. + * awk.h (is_valid_identifier): Move declaration outside ifdef DYNAMIC. + * command.y: Fix test for EBCDIC to use USE_EBCDIC. + * custom.h: Remove definitions of __builtin_expect. + * eval.c (update_ERRNO_string): Add untested and disabled code for z/OS + to remove leading IBM error codes. This might one day make more of the + tests pass on z/OS. + +2019-02-20 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (is_valid_identifier): Move declaration outside of + `#if DYNAMIC'. Thanks to Daniel Richard G. + * custom.h (builtin_expect): Remove definitions, now + handled by support/cdefs.h. + +2019-02-17 Arnold D. Robbins <arnold@skeeve.com> + + Fix debugger eval command so that return from a called + user-defined function works. Thanks to Lothar Langer + <lotharla@gmail.com> for the report. + + * awk.h (Op_K_return_from_eval): New opcode. + (parse_program): Add boolean second parameter, `from_eval'. + * awkgram.y (called_from_eval): New variable + (Grammar): Check it for return statements. If true, change the + opcode to Op_K_return_from_eval. + (parse_program): Set called_from_eval to value of from_eval parameter. + * debug.c (pre_execute_code): Change test for Op_K_return to test + for Op_K_return_from_eval. + (do_eval): Call parse_program with second parameter true. + * eval.c (optypetab): Add entry for Op_K_return_from_eval. + * interpret.h (r_interpret): Ditto: can't-happen error. + * main.c (main): Call parse_program with second parameter false. + * NEWS: Updated. + +2019-02-15 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: If profiling, correctly turn `print' into `print $0'. + Thanks to Hermann Peifer for the bug report. + * TODO: Updated. + +2019-02-11 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Update version for next test tarball. + +2019-02-07 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated. + * config.guess, config.rpath, config.sub: Updated from GNULIB. + +2019-02-05 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): Add NEWS.1. + +2019-02-04 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS.1: Rotated in from NEWS. + * NEWS: Shortened to start over again with 5.0 changes. + * ext.c (is_valid_identifier): Move outside of ifdefs so that + DJGPP (and other code) can find it. + +2019-02-03 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (snode): Disallow @/.../ as second param of index, also. + * TODO: Updated. + +2019-02-02 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.c, command.c: Regenerated with Bison 3.3. + * NEWS: Updated. + +2019-02-02 Eli Zaretskii <eliz@gnu.org> + + * debug.c (execvp) [__MINGW32__]: Redirect to w32_execvp. + (restart): No need for MinGW-specific code anymore. + + * nonposix.h: If setlocale is already a defined macro, #undef it + before redefining. This avoids compilation warnings if someone + tries to compile Gawk with Gettext's libintl.h, which redirects + setlocale to its own function. + Reported by Budi <budikusasi@gmail.com>. + + * debug.c [__MINGW32__]: Prototype for w32_execvp. + (restart) [__MINGW32__]: Call w32_execvp instead of execvp. Don't + type-cast d_argv anymore. + +2019-01-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (qualify_name): Return duplicated strings. + (yylex): Qualify names before returning either NAME or FUNC_CALL. + (Grammar): Replace qualified_name non-token with NAME, remove + `qualified_name' production. + +2019-01-27 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am, NEWS, awkgram.y, cint_array.c, custom.h, debug.c, + eval.c, ext.c, gawkapi.c, int_array.c, interpret.h, nonposix.h, + profile.c, re.c, replace.c, str_array.c, symbol.c: Update + copyright year. + +2019-01-26 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (pc/Makefile.tst): Fix to work for out of tree builds. + +2019-01-25 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (UPDATE_YEAR): Bump to 2019. + (usage): Revise help message a little bit. + * configure.ac: Bump version to start a release spiral. + * NEWS: Updated. + +2019-01-24 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): Add new production `qualified_name' which + is NAME + qualification call. Use it everywhere that NAME was + used, except for function parameters. + +2019-01-23 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (adjust_namespace): Check for all upper case + identifiers so we don't get things like awk::NF. + +2019-01-23 Arnold D. Robbins <arnold@skeeve.com> + + * symtab.c (lookup): Remove second `do_qualify' parameter. + Remove calls to `fix_up_namespace'. If name starts with + "awk::" just lookup the compnent name. + Adjust all calls to `lookup' in other files. + (install): Don't use `fix_up_namespace'. + (fix_up_namespace): Remove function. + * awk.h (lookup): Adjust declaration. + +2019-01-23 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (qualify_name): Don't qualify a name if it's + a parameter. + +2019-01-21 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): Use qualify_name for array subscript + expressions. Fixes the last leak in the test suite. + * awk.h (is_all_upper): Declare. + * symbol.c (is_all_upper): Remove static. + * awkgram.y (is_all_upper): Remove. + (Grammar): Clean up `#if 0' code. + +2019-01-20 Arnold D. Robbins <arnold@skeeve.com> + + Restore functionality. + + * awkgram.y (qualify_name): Remove `is_var' param, always check + for all upper case. Adjust all calls. + (Grammar): Do qualify_name for function calls also. + +2019-01-19 Arnold D. Robbins <arnold@skeeve.com> + + Continue fixing memory leaks. + + * awk.h (set_current_namespace): Declare function. + * awkgram.y: Change all assignments of current_namespace to calls + to set_current_namespace. + (is_all_upper, qualify_name): New functions. + (in_function): Change type to bool, and fix usages. + (Grammar): Use qualify_name on variables and function names. + * main.c: Change all assignments of current_namespace to calls + to set_current_namespace. + (set_current_namespace): New function. + * profile.c (pp_namespace): Don't free old current_namespace. Add + comment explaining why. + +2019-01-18 Arnold D. Robbins <arnold@skeeve.com> + + Start fixing memory leaks related to namespaces. + + * awkgram.y (Grammar): At simple_variable -> NAME, qualify names + before lookup/install. + (next_sourcefile): Check if need to free current_namespace before + assigning to it. + (yylex): Fix length of string to be dup'ed before returning + NAME or FUNC_CALL. + (set_namespace): Always free ns->lextok, adjust memory allocations + appropriately. + * main.c (main): Check if need to free current_namespace before + assigning to it. + * profile.c (pp_namespace): Ditto. (This may not be necessary.) + +2019-01-18 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (do_set_var): Add comments before calls to assoc_set. + * interpret.h (r_interpret): For Op_sub_array, deref the subscript + appropriately. Thanks to Andy Schorr for the catch. + +2019-01-15 Arnold D. Robbins <arnold@skeeve.com> + + * array.c (asort_actual): Use assoc_set in 2 places. + * awk.h (assoc_set): Improve leading comment. + * debug.c (do_set_var): Use assoc_set in 2 places. + * field.c (set_element, update_PROCINFO_str, update_PROCINFO_num): + Use assoc_set in each. + * gawkapi.c (api_set_array_element): Use assoc_set. + * interpret.h (r_interpret): Use assoc_set. + * main.c (init_args, load_environ, load_procinfo_argv): + Use assoc_set in each. + * mpfr.c (do_mpfr_intdiv): Use assoc_set in 2 places. + * str_array.c (str_lookup): Fix leading comment. + * symbol.c (install): Use assoc_set. + +2019-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_match, do_intdiv): Remove unused `sub' and `lhs' + variables, since assoc_set is now doing all of the work. + +2019-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (assoc_set): Move the definition lower down because it + needs to be after unref is declared. + * builtin.c (do_match): Use assoc_set in 3 places. + (do_intdiv): Use assoc_set in 2 places. + (do_typeof): Use assoc_set in 2 places. + +2019-01-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (assoc_set): Add new inline function to set an array element + to eliminate code duplication and reduce the chance of memory leaks. + +2019-01-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_typeof): Fix memory leak when populating the + optional array, and make sure to call the astore method. + +2019-01-14 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_intdiv): Add unref of subscripts. + * mpfr.c (do_mpfr_intdiv): Ditto. + Thanks to Andy Schorr for noticing. + +2019-01-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (tokentab): Indicate that typeof may take 2 arguments. + (snode): Add support for typeof's optional 2nd array argument. + * builtin.c (do_typeof): Add support for optional 2nd array arg, + returning flag info for scalars and backend array type for arrays. + +2019-01-09 John E. Malmberg <wb8tyw@qsl.net> + + * awk.h: For non GCC, have __attribute__ definition match + support/regex_internal.h exactly. + +2019-01-08 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h (r_interpret): For a translatable string, only copy + the gettext return value if it's different from the original. + Otherwise, use the original. + +2019-01-07 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Use a struct instead of an array to contain the array methods + for improved code clarity and flexibility. + + * awk.h (array_funcs_t): Define new struct to contain the array + methods. + (NODE): Change type of array_funcs (sub.nodep.l.lp) from `afunc_t *' + to `const array_funcs_t *' (from a pointer to an array of function + methods to a pointer to a struct containing the methods). + (a*_ind): Remove obsolete method array index defines. + (a*): Redefine array methods to use struct members instead of + array elements. + (str_array_func, cint_array_func, int_array_func): Change type + from array of afunc_t to 'const array_funcs_t'. + (register_array_func): Remove global declaration, since this function + is called only inside array.c. + * array.c (null_array_func): Change from array of methods to a struct. + (array_types): Now an array of pointers to array_funcs_t. + (AFUNC): Remove obsolete macro. + (register_array_func): Change scope to static, and change argument + to a pointer to array_funcs_t instead of a pointer to an array of + methods. + (array_init): Modify calls to register_array_func to pass the address + of the new array method structs. + (make_array): Set array_funcs to & null_array_func. + (null_lookup): Modify to use new array method structs. + (assoc_list): Update cint check to use & cint_array_func. + * str_array.c (str_array_func, env_array_func): Change from array of + methods to an array_funcs_t struct. + (env_clear, init_env_array): Set array_funcs to & env_array_func. + * int_array.c (int_array_func): Change from array of methods to an + array_funcs_t struct. + * cint_array.c (cint_array_func): Ditto. + (cint_lookup): When setting xn->array_funcs, must now use &. + (cint_dump): Compare xn->array_funcs to & int_array_func. + +2019-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * array.c (do_delete): If the array is now empty, reset it to the + null implementation to avoid being locked into the backend + optimization previously selected. + +2019-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Remove pointless alength macro/method that uses a needless + function call indirection to access the table_size value. + + * awk.h (alength, alength_ind): Remove these defines, and also renumber + the array_funcs items after that, and use the <blah>_ind define to + define <blah> instead of repeating the hardcoded numeric value. + (NUM_AFUNCS): Remove unused define. + (assoc_length): Redefine to access table_size directly. + (null_length): Remove prototype. + * array.c (null_array_func): Remove null_length entry. + (null_length): Remove obsolete function. + * cint_array.c (cint_array_func): Remove null_length entry. + * int_array.c (int_array_func): Remove null_length entry. + * str_array.c (str_array_func, env_array_func): Remove null_length + entry. + * gawkapi.c (api_flatten_array_typed): Use the assoc_empty macro to + check for an empty array instead of comparing table_size to 0. + * symbol.c (lookup, check_param_names): Ditto. + +2018-12-31 Arnold D. Robbins <arnold@skeeve.com> + + Clean up namespace handling for the profiler. + + * awkgram.y (make_pp_namespace): Remove function, not needed. + (set_namespace): Use estrdup to save the current namespace. + * main.c (main): Before dumping the program, set current_namespace + to awk_namespace. + * profile.c (pprint): Use "awk" for comparison, not "awk::". + (pp_namespace): Just print the name in the @namespace line. + (adjust_namespace): Adjust for the fact that namespaces no longer + have the trailing "::". + +2018-12-30 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (check_qualified_name): Remove declaration. + * awkgram.y (check_qualified_special): Renamed from + check_qualified_name and made static. + * profile.c (pprint): Improve comment on namespace list. + +2018-12-21 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Remove -O only if .developing has 'debug' in it. + +2018-12-18 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (distclean-local): Remove .deps directory. + +2018-12-14 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess: Updated from GNULIB. + +2018-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * TODO: Updated. + +2018-12-12 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac (AC_CHECK_FUNCS): Check for timegm. + * builtin.c (mktime_tz): Remove function; we will use timegm instead. + (do_mktime): Replace 'mktime_tz(& then, "UTC+0")' with 'timegm(& then)'. + * protos.h (timegm): Add timegm proto on systems lacking it. + * replace.c (timegm): Include missing_d/timegm.c if needed. + +2018-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated some. + +2018-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Add new Op_K_namespace opcode for pretty printing. + * awkgram.y (namespace_chain): New variable, list of successive + @namespace directives seen, for the pretty printer. + (namespace_comment): Removed. + (set_namespace): Takes comment as second argument, builds the chain. + (mk_function, append_rule): Adjust to store the chain. + * debug.c (print_ns_list): New function. + (print_instruction): Adjust Op_rule and Op_func to use print_ns_list. + Add case for Op_K_namespace. + * eval.c (optable): Add entry for Op_K_namespace. + (opcode2str, op2str): Edit / add leading comments, respectively. + * profile.c (pp_namespace_list): New function. + (pprint): Adjust code to call pp_namespace_list. + +2018-12-06 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add -ggdb3 to CFLAGS if developing and remove + -O2 from Makefile, extension/Makefile, and support/Makefile. + * config.guess, config.sub: Updated from GNULIB. + +2018-12-06 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (namespace_comment): New variable. + (Grammar): Handle comments after @namespace statements. + (mk_function): Add any comment onto the saved namespace. + (append_rule): Ditto. + * profile.c (pp_namespace): Add second argument for a comment. + Adjust all calls. + +2018-12-02 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (mk_program): Add in leading and trailing comments + when program block is empty. + +2018-11-29 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (first_rule, func_first): Remove unused variables. + (Grammar): Simplify rule for range pattern. + +2018-11-28 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (debug_print_comment): New macro and function. + (load_library): Rework to not try to open the file if pretty printing. + (append_rule): Adjust handling of interblock_comment. + +2018-11-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): In rule for function, set interblock_comment. + (mk_function): Hook interblock_comment onto fi->comment, merge it + with the existing one first, if any. Append trailing_comment. + +2018-11-26 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (platform_name): Add os390. Treat Cygwin and Mac OS X + as POSIX, per discussion with the dev team. + + Unrelated: + + * profile.c (print_comment): Indent for chained comment. + * awkgram.y (load_library): Return early if just pretty printing. + (yylex): Fix handling of ?: and allow_newline etc. + +2018-11-25 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (platform_name): New function returning platform name. + (load_procinfo): Use `platform_name()' to add "platform" element. + Thanks to Eli Zaretskii for the suggestion. + * NEWS: Updated with info about PROCINFO["platform"]. + +2018-11-25 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Updated from GNULIB. + +2018-11-24 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (interblock_comment, pending_comment): New variables. + (Grammar, mk_program, add_rule): Adjust to use them. Changes + handle comments at the outermost level, between blocks and functions. + +2018-11-24 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (arg_assign): Allow assigning strongly typed regexp + constants to variables on the command line and with -v. + Thanks to Peng Yu <pengyu.ut@gmail.com> for the report. + +2018-11-17 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.c, command.c: Updated to Bison 3.2.1. + * NEWS: Updated. + * Makefile.am (pc/Makefile.tst): Make it work for out-of-tree + builds. Thanks to `make distcheck' for the report. + +2018-11-17 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess: Updated from GNULIB. + +2018-11-11 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Improve output for -Z in the help. +2018-11-11 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (outer_comment): New variable. + (Grammar): More changes. We now get the simple case of leading + and trailing comments, but not all the cases. + +2018-11-11 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (trailing_comment): New variable. + (Grammar): For `action', append both trailing comments. This may + change. For `statements', append the value of `trailing_comment' + if set. At `statement := l_brace statements rbrace' save + trailing_comment from r_brace. + (make_braced_statements): Don't append the comment from r_brace + to the statement list. + +2018-10-30 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (NODE): New field: sub.nodep.x.cmnt, holds comment for + expressions being pretty-printed. + * awkgram.y (Grammar): For expression lists, save any comment + that came after a comma in the list. + * profile.c (pp_push): Accept a fourth argument which is any + comment associated with the expression. Either it's there or + it's NULL. Save it in the pp_comment field of the node being pushed. + (tabs, tabs_len, check_indent_level): Made into static globals. + (pprint): Adjust all calls to pp_push(). Fix parenthesization + for casts in string lengthes when indenting. + (pp_list): If a popped item has a comment, include it and the + following indentation in the formatted result. + +2018-10-28 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (include_source): Add second parameter to return + SRCFILE pointer. + (Grammar): For @include, save the comment for later dumping + along with the list of include files. + (make_include_comment): Removed. No longer used. + * profile.c: Update copyright year. + (print_include_list): New function. + (dump_prog): Call it. + +2018-10-24 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Improve output for -Y and add -Z in the help. + +2018-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Updated from GNULIB. + +2018-10-20 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (SRCFILE): Add comment field for comments on @load statements. + * awkgram.y (include_source): Type change to boolean. + (load_library): Type change to boolean, additiona parameter to + bring the SRCFILE struct up to where we can add the comment into it. + (make_include_comment): New function. Not used yet. + (Grammar): Add comment for @load statements. Start on preserving + @include statements and their comments for eventual inclusion + into the pretty-printed code. + * profile.c (print_lib_list): Made a little smarter about printing + the header and indentation. Print the comment if there is one. + +2018-10-17 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (commenttype): Add FOR_COMMENT. + * awkgram.y (Grammar): Handle all the opt_nls cases in + regular for statements. + * debug.c (print_instruction): Print the comments in Op_K_for. + * profile.c (pprint): Handle printing comments. + +2018-10-17 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated. + * awkgram.y (Grammar): Distinguish `print' and `print $0' in + what gets profiled / pretty-printed. + * profile.c (pprint): For case and default, add final newline + if there is no comment to print. + +2018-10-16 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): Improve comment handling for many plain + statements. Improve handling for case and default. + Handle comments in `for (iggy in foo)' loops. + (yylex): After a colon, only allow newline if was part of ?:. + (merge_comments): Improve coding so we don't get two newlines + at the end of a merged comment. + * debug.c (print_instruction): Handle comments for case and default. + Simplify printing of comments. + * profile.c (pprint): Handle comments for case and default. + Remove compiler warning in Op_and/Op_or handling. + +2018-10-14 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): Add comment handling for do...while. + Regularize comments about `else ...'. + * debug.c (print_instruction): Improve handling of comments for + do-while and switch, and in general. + * profile.c (pprint): Revise for do...while. + +2018-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (make_braced_statements): New function. + (Grammar): Use it in the right places instead of inline code. + * debug.c (print_instruction): For Op_comment, fix type string. + * profile.c (pprint): Move tabs and tabs_len to top of function. + For Op_and and Op_or, handle comments. Use new check_indent_level + for Op_and, Op_or and Op_cond_exp. + +2018-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_instruction): For Op_comment, use print_func + instead of fprintf to print the comment type. + +2018-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): For statement -> { statements }, fix comment + handling. For `if' statement add comment support. + * profile.c (pp_print): Print comments associated with `if' and `else'. + +2018-10-09 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (Grammar): Fix handling of empty statement (just a semi- + colon). + (merge_comments): If no chained comment and no second comment, + just return early. + +2018-10-09 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (enum commenttype): New enum. + (NODE): Add it to sub.val. + (EOL_COMMENT, FULL_COMMENT): Replaced with above enum values. + * awkgram.y (Grammar): Finish up handling comments in function headers + and bodies. Get trailing comments at end of program + (get_comment): When doing comments, if we got EOF, push it back so that + multiple comments get merged together. + (merge_comments): Allow second parameter to be NULL. + * profile.c (pp_print): Change to use above enum everywhere. For + Op_K_print_rec produce plain `print' instead of `print $0'. Handle + comments in ?:. Handle printing function comments. + (print_comment): Simplify `after_newline' assignment. Add assertion + that chaining is only two deep. + +2018-10-06 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (action): Improve handling of comments attached + to braces. Helps with function bodies. + +2018-10-04 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (merge_comments): Change return type to void. Adjust calls. + (Grammar): For action, pull comments out of braces and stick + into the list. For function_prologue, get comments from parameters + and ending newline, merge, and save. Wherever nls and opt_nls + are used, be sure to pass their values up via $$. For various + cases that can be empty, explicitly set $$ = NULL. + * profile.c (pprint): Get switch working. Get ?: working. + (print_comment): Print any chained comment. + (pp_func): Start revising. + +2018-10-03 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Range expressions, enable comment stuff. + Switch statement: start on comment handling. + +2018-10-01 Nelson H.F. Beebe <beebe@math.utah.edu> + + * custom.h (__builtin_expect): Define for non-GNU compilers. + +2018-09-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * mpfr.c (force_mpnum): Check that base is 10 also before + computing MPG integer. Found based on bug report from + Luu Vinh Phuc <phuclv90@gmail.com>. + +2018-09-26 Arnold D. Robbins <arnold@skeeve.com> + + Add more lint checks. + + * awk.h (POP_ARRAY): Add boolean parameter to check for untyped + value and include lint warning. + * interpret.h (r_interpret): Adjust all calls to POP_ARRAY. + * field.c (do_split): Improve lint warning text for empty + third argument. + * re.c (make_regexp): Add lint check for '\0' in contents of + regexp to be matched (dynamic or otherwise). + +2018-09-23 Steven Packard <spackard1@bloomberg.net> + + * awk.h: Add `#if !defined(__SUNPRO_C)' around check for non-ANSI + compilers. Needed for some Solaris systems. + +2018-09-21 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (INSTRUCTION): Add comment field to carry + comment around during parsing. + * awkgram.y (merge_comments): New function. + (split_comment, check_comment, comment, prior_comment, + comment_to_save, program_comment, function_comment, + block_comment): Removed. + (grammar): Remove old code and start passing the comment + up via yylval and the newlines in the grammar. + +2018-09-21 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Undo change of 2016-11-28 to make switch + head a separate production, in preparation for revamping + comment handling. + +2018-09-21 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (make_regexp): Handle backslash at end of + input string. Thanks to Anatoly Trosinenko + <anatoly.trosinenko@gmail.com> for the report. + Also, improve the error message when compilation of + the regexp fails. + +2018-09-21 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (fork_and_open_slave_pty): Move an errant close brace + inside the #endif so that gawk will compile on AIX. Thanks to + Fredrik Laurin <fredrik_laurin@yahoo.se> for the report. + +2018-09-18 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Fix typo in gettext version. + + Unrelated: + + * field.c (get_field): Move lint check for field access in an + END rule to top level, make wording more general. + * builtin.c (do_print_rec): Restore check before calling get_field() + and add do_lint to the condition. + + Unrelated: + + * field.c (set_NF): Add lint warning if decrementing NF, which + doesn't work on older Unix awks. + + Unrelated: + + * config.rpath: Sync to GNULIB. + +2018-09-16 gettextize <bug-gnu-gettext@gnu.org> + + * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.8. + * ABOUT-NLS, config.rpath: Updated by gettext 0.19.8.1. + +2018-09-16 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (get_field): Add lint check if accessing $0 inside + an END rule, print a "may not be portable" warning. + * builtin.c (do_print_rec): Call get_field() unconditionally + in order to do lint check. + + Unrelated: + + * awkgram.c, command.c: Updated to Bison 3.1. + * NEWS: Updated. + + Unrelated: + + * Makefile.in, aclocal.m4, configure: Regenerated, using + Automake 1.16.1. + + Unrelated: + + * gettext.h: Synced with that from Gettext 0.19.8.1. + +2018-09-14 Adrian Bunk <bunk@debian.org> + + * awk.h (init_debug, debug_prog): Move prototypes to here from ... + * main.c: ... here. + Thanks to Michael Tautschnig for noticing the type mismatch. + +2018-09-07 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y, debug.c, ext.c, gawkapi.c, gawkapi.h, + io.c: Remove unneeded \n in calls to warning(), fatal(), + and lintwarn(). + * config.guess, config.sub: Updated from GNULIB. + +2018-08-24 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated w.r.t. GNULIB regex routines. + * config.sub: Updated from GNULIB. + +2018-08-17 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Updated from GNULIB. + +2018-08-10 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Updated from GNULIB. + +2018-08-05 John E. Malmberg <wb8tyw@qsl.net> + + * custom.h: Define macros needed for building with gnu regex. + +2018-08-02 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Add lint warning upon encountering escaped + physical newlines in a string. + * node.c (make_str_node): Ditto. + +2018-08-01 John E. Malmberg <wb8tyw@qsl.net> + + * custom.h: Include fp.h on OpenVMS. + Workaround for bug in math.h missing some declarations. + +2018-07-31 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h (unfield): Add a call to force_string() on + new value. See test/assignnumfield.awk. Thanks to + Ralph Corderoy <ralph@inputplus.co.uk> for the bug report. + +2018-07-31 Arnold D. Robbins <arnold@skeeve.com> + + Handle newlines in -v and fix \-<newline>. Thanks to + Samy Mahmoudi <samy.mahmoudi@gmail.com> for the report. + + * awk.h [ELIDE_BACK_NL]: New constant. + * awkgram.y (yylex): Disallow any physical newlines in a string + even if escaped, in POSIX mode. + * main.c (arg_assign): In POSIX mode disallow physical newline + in a -v value. Otherwise call make_str_node() with ELIDE_BACK_NL. + * node.c (make_str_node): Handle ELIDE_BACK_NL. + +2018-07-31 Arnold D. Robbins <arnold@skeeve.com> + + * array.c (cmp_strings): Preserve value of lmin so it can be passed + to memcmp() if IGNORECASE comparison failed. Thanks to + M. Rashid Zamani <rashid.z@gmail.com> for the report. + +2018-07-27 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (make_regexp): Add warnings for unknown escape sequences, + similar to what we already do for strings. + * awkgram.y: Add lint warning about concatenation as target + of `>' redirection. Always use Op_parens so that + print "foo" > ("foo" 1) does not warn. + +2018-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (_GNU_SOURCE): Don't define it here, it's already + done in config.h. + +2018-07-13 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (format_nan_inf): New function to generate +nan, -nan, + +inf, -inf, so that gawk output for NaN and INF always has a sign. + Handles regular and MPFR. + (out_of_range): New function to check if a value is out of range, + both regular and MPFR. + (format_tree): Use them in out of range calculation. Check for out + of range in floating point formats also. Allow new *undocumented* + 'P' flag to not do out of range formantting. Used mainly for + the test program. + * awk.h (out_of_range, format_nan_inf): Declare functions. + * mpfr.c (mpg_format_val): Check for out of range and format the + the result appropriately if so. + * node.c (r_format_val): Ditto. + +2018-06-27 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Updated from GNULIB. + +2018-06-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_force_number): If strtod returns ERANGE, accept the + value as being numeric instead of forcing it to zero. The impact + is that huge string values that overflow IEEE 754 limits will now + be converted to inf or -inf instead of 0. Thanks to Daniel + Pettet for reporting this issue. + +2018-06-17 Arnold D. Robbins <arnold@skeeve.com> + + Fix a corner case with EPIPE to stdout/stderr. + Thanks to Peng Yu for the report. + + * io.c (close_io): Add new parameter for indicating EPIPE happened, + update the code to set it if so. + * awk.h (close_io): Revise declaration. + * debug.c (close_all): Change call to close_io(). + * interpret.h (interpret): For Op_atexit, if got an EPIPE, call + die_via_sigpipe(). + +2018-05-24 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (add_lint): For no-effect case, also check for + Op_push_i. Makes statements consisting of a single constant + trigger the warning. + +2018-05-23 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Updated from GNULIB. + +2018-05-14 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Minor edits. + +2018-05-13 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Update from GNULIB. + +2018-05-03 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (pc/Makefile.tst): New target. + (dist-hook): Now depends upon pc/Makefile.tst. + +2018-04-30 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h [dl_load_func]: Minor improvement in version mismatch + message as suggested by Manuel Collado + <m-collado@users.sourceforge.net>. + +2018-04-18 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Updated from GNULIB. + +2018-04-14 Manuel Collado <m-collado@users.sourceforge.net> + + * field.c (reset_record): Disable fieldwidth from API + get_record() if $0 is explicitly assigned a new value. + +2018-04-02 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub, install-sh: Updated from GNULIB. + +2018-04-01 Arnold D. Robbins <arnold@skeeve.com> + + Fix a nasty MPFR bug in r_dupnode. If the value being copied + is MPFN / MPFR, copy those bits over too. Thanks to + Noah Dean <N.Dean@gaminglabs.com> for the report. + + * node.c (r_dupnode): Check for MPFN / MPFR and copy the bits + over as needed. + + Unrelated: + + * interpret.h (UNFIELD): Turn into an inline function and + let UNFIELD macro call it, allows stepping in with a debugger. + (unfield): Function holding former body of UNFIELD macro. + +2018-03-26 Arnold D. Robbins <arnold@skeeve.com> + + Remove the tail recursion optimization. It's fundamentally + broken, in the case where a local var becomes a parameter. + Thanks to Denis Shirokov <cosmogen@gmail.com> for the report. + See test/tailrecurse.awk. + + * awk.h [num_tail_calls, tail_call]: Remove definitions. + * awkgram.y (grammar, mk_function): Remove code related to + the tail recursion optimization. + * eval.c (dump_fcall_stack): Adjust dumping code since no longer + looping through tail call recursion. + (setup_frame): Remove code related to the tail recursion optimization. + (init_interpret): Ditto. + +2018-03-22 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Check for %a support in system printf. + * builtin.c (format_tree): Add support for %a and %A, including + a lint warning. + * NEWS: Add a note about %a support. + +2018-03-13 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c, nonposix.h: Update copyright year. + +2018-03-11 Arnold D. Robbins <arnold@skeeve.com> + + * compile, config.guess, config.sub, configure.ac, depcomp, + install-sh, mkinstalldirs: Updated. + +2018-03-05 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h [PUSH_BINDING, POP_BINDING]: Moved to ... + * debug.c: here. + * awkgram.y (yylex): Make do_etoa_init into a boolean. + * io.c (rs1scan): Make found into a boolean. + +2018-02-25 Arnold D. Robbins <arnold@skeeve.com> + + * 4.2.1: Release tar ball made. + +2018-02-25 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Updated. + +2018-02-23 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Restore checking for PPC Macintosh before + checking for MPFR. See README_d/README.macosx for info. + +2018-02-21 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Remove checking for PPC Macintosh before + checking for MPFR. Installing a newer compiler on that + system allows things to work. + +2018-02-19 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h, io.c, msg.c: Update copyright year. + +2018-02-10 Arnold D. Robbins <arnold@skeeve.com> + + * main.c, msg.c: Add a call to fflush(NULL) before each call + to abort(), since GLIBC 2.27 doesn't necessarily flush before + aborting. Thanks to Nelson H.F. Beebe for the report. + +2018-02-09 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (socketopen): Rearrange assigning the flags to use + AI_ADDRCONFIG only if family is AF_UNSPEC. Thanks to + Houder <houder@xs4all.nl> for the report and initial + code suggestion. + +2018-02-07 Andrew J. Schorr <aschorr@telemetry-investments.com> + + 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 <arnold@skeeve.com> + + * config.guess, config.sub: Updated. + +2018-01-25 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Add explanatory comment about O_APPEND stuff. + * NEWS: Updated. + +2018-01-22 Arnold D. Robbins <arnold@skeeve.com> + + Fix the inplace tests on *BSD systems. + + * main.c (main): Add O_APPEND flag to fileno(stderr). + +2018-01-17 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_isarray): Check that tmp is Node_var + before calling DEREF. Thanks to Denis Shirokov + <cosmogen@gmail.com> for the report. + +2018-01-15 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Small typo fix. + * config.sub: Updated. + * io.c (fork_and_open_slave_pty): Rationalize down to one + function with two bodies. + (set_slave_pty_attributes, push_pty_line_disciplines): Move + into #ifdef for TERMIOS_H. Helps out with VMS compiling. + +2018-01-12 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Remove extraneous '*' on parameters of + type awk_ext_id. Thanks to Andrew Schorr for the report. + +2018-01-11 Arnold D. Robbins <arnold@skeeve.com> + + * compile, config.guess, config.rpath, config.sub, + depcomp: Updated from GNULIB. + +2018-01-08 John E. Malmberg <wb8tyw@qsl.net> + + * io.c (set_slave_pty_attributes): Currently no termios on VMS. + (set_slave_pty_attributes): No fork on VMS. + +2018-01-04 Arnold D. Robbins <arnold@skeeve.com> + + Refactor handling of slave pty. On AIX and HP-UX open + slave in the child. Otherwise open slave in the parent + before forking (restoring code mostly from 4.1.3). Thanks + to Andrew Schorr for the bug report. + + * io.c (fork_and_open_slave_pty): New routine. Two versions. + (set_slave_pty_attributes): New routine. Common code used by + both versions of fork_and_open_slave_pty. + (push_pty_line_disciplines): New routine. Common code used by + both versions of fork_and_open_slave_pty. + (two_way_open): Call fork_and_open_slave_pty instead of + doing it inline. + +2018-01-03 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (UPDATE_YEAR): Move to 2018. Revise copyright year. + * NEWS: Bring up to date. + +2018-01-02 Arnold D. Robbins <arnold@skeeve.com> + + If ROUNDMODE changes, cause cached string conversions + to become invalid. Thanks to Nethox <nethox@gmail.com> + for the report. Day 1 bug from 4.1.0 release. + + In all the below files, bump copyright year, too. + + * array.c (value_info): Include strndmode in the output. + * awk.h (NODE): New member, strndmode. + (MPFR_round_mode): Add extern declaration. + (force_string_fmt): Check s->strnmode against MPFR_round_mode. + * awkgram.y (set_profile_text): Set n->strndmode to MPFR_round_mode. + * builtin.c (do_print): Remove tests and just call force_string_fmt. + * field.c (set_record): Set n->strndmode to MPFR_round_mode. + * gawkapi.c (api_sym_update_scalar): Set r->strndmode to + MPFR_round_mode. + * interpret.h (r_interpret): For Op_assign_concat, set t1->strndmode + to MPFR_round_mode. + * mpfr.c (MPFR_round_mode): Define and initialize. + (mpfr_format_val): Set s->strndmode to MPFR_round_mode. + (set_ROUNDMODE): Update MPFR_round_mode when ROUNDMODE changes + successfully. + * node.c (r_format_val): Set s->strndmode to MPFR_round_mode. + (make_str_node): Set r->strndmode to MPFR_round_mode. + * str_array.c (str_kilobytes): Update a comment. + * symbol.c (check_param_names): Set n.strndmode to MPFR_round_mode. + +2017-12-24 Arnold D. Robbins <arnold@skeeve.com> + + Avoid some compiler warnings. Thanks to Michal Jaegermann + <michal.jnn@gmail.com> for the report. + + * builtin.c (do_strftime): Initialize save. + (do_dcgetttext): Initialize save and save2. + (do_dcngettext): Ditto. + (do_bindtextdomain): Initialize save and save1. + + Unrelated: + + * main.c (optlist): Make 'L' option's argument optional, to + match --lint. Thanks to Manuel Collado <mcollado2011@gmail.com> + for the report. + +2017-12-22 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub, depcomp, install-sh: Updated + from GNULIB. + +2017-12-20 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add --enable-versioned-dir option for a + directory with API version in it to hold extensions. + +2017-12-19 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Remove x's from `test "x$something" = "xyes" + kinds of things. With correct quoting, the x isn't needed. + (DYNAMIC): Remove use of -Wl,-export-dynamic on Linux + and FreeBSD. It was needed for old-style extensions, which are + no longer supported. + +2017-12-10 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: For '!' optimization on a string constant, don't + apply the optimization if it's a translatable string. Thanks + to Jeremy Feusi <jeremy@feusi.co> for the report. + +2017-11-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * debug.c (do_set_var): As in interpret.h (Op_store_field), we should + call the assign function before unref to give it a chance to copy + any non-malloced $n string values before freeing $0. + +2017-11-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * mpfr.c (get_rnd_mode): Fix MPFR_RNDA comment. + +2017-11-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Fix corruption when $0 is reassigned while other NODEs have open + references to $n. Thanks to Eric Pruitt <eric.pruitt@gmail.com> for + the bug report. + + * field.c (purge_record): For each $n field variable, if valref > 1 + and it has not already been malloced, make a copy of the string, since + $0 is about to be reset. + * interpret.h (Op_store_field): We must call the assign function + before unref, since we must copy any non-malloced $n string values + before freeing $0. + +2017-11-09 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Add a note to not post bugs in comp.lang.awk. + So there. + +2017-11-08 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (AWK_NUMBER_TYPE): Move this enum out to the + top level so that it works correctly with C++. + +2017-10-24 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Updated with info about OS/2. + +2017-10-21 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: For string concatenation, don't fold constants + if one or the other is translatable. Thanks to Harald van Dijk + <harald@gigawatt.nl> for the report. + +2017-10-21 KO Myung-Hun <komh78@gmail.com> + + * nonposix.h [__KLIBC__]: Include dlfcn.h, declare os2_dlsym, and + redirect dlsym to os2_dlsym. Declare os2_fixdllname. Declare + os2_dlopen and redirect dlopen to os2_dlopen. + * io.h (find_source) [__EMX__]: Truncate extension file basename + to 8 characters. + +2017-10-19 Arnold D. Robbins <arnold@skeeve.com> + + * 4.2.0: Release tar ball made. + +2017-10-17 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * NEWS: Actually, isarray is not deprecated in this release. + * builtin.c (do_isarray): Remove lint warning deprecating isarray. + +2017-10-14 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (do_split): Simplify the lint warnings. + Based on suggested code by Eric Pruitt <eric.pruitt@gmail.com>. + + Unrelated: + + * awkgram.y (check_funcs): Remove the REALLYMEAN ifdef and + simplify the lint checking code for function defined but not + called or called but not defined. + +2017-10-13 Arnold D. Robbins <arnold@skeeve.com> + + Assume a more C99 environment: + + * awk.h: Assume we have limits.h, stdarg.h and stdbool.h. + * configure.ac: Remove checks for limits.h and stdarg.h. + +2017-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Remove --with-whiny-user-strftime option. + * NEWS: Updated. + * ChangeLog.0: Fix a typo. :-) + +2017-10-08 Arnold D. Robbins <arnold@skeeve.com> + + * command.y: Fix the FSF's address. + +2017-10-08 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Rationalized with respect to stuff on the API. + Also rationalized with respect to the pretty printer changes. + +2017-10-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * README: Fix grammar by removing a stray word. + +2017-10-04 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Add a note about OS/2 not working. + +2017-10-02 Arnold D. Robbins <arnold@skeeve.com> + + Undo change of 2014-09-07: + + * configure.ac: Remove the undocumented option to enable locale + letters in identifiers. + * awkgram.y (is_alpha): Remove related code. + +2017-10-02 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Updated. + +2017-09-28 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (devopen): Move declaration of `cp' to where it's first used. + +2017-09-18 Arnold D. Robbins <arnold@skeeve.com> + + * README: Update required version of texinfo.tex. + * compile, config.guess, config.sub, depcomp: Updated. + +2017-09-17 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Small changes to make it usable with C++. + +2017-09-13 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (command.c): Don't need the dependency on awkgram.c + anymore. + * bisonfix.awk: Removed. + * README: Revised to describe use of Bison exclusively. + +2017-09-13 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (awkgram.c): Use -o option to bison. Get rid of + messing with y.tab.h, that was obsolete. + (EXTRA_DIST): Don't need bisonfix.awk anymore. + +2017-09-12 Petr Ovtchenkov <ptr@void-ptr.info> + Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (command.c): Make dependant on awkgram.c so + that bison is run serially with make -j. Use -o option so + that we no longer need bisonfix.awk in this rule. + +2017-08-28 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h (r_interpret): Add some casts to avoid warning + messages in printf statements. + + Unrelated: + + * configure.ac: Add check for gai_strerror. + * io.c (socketopen): Use gai_strerror to add more information + if getaddrinfo fails. + +2017-08-25 Pat Rankin <r.pat.rankin@gmail.com> + + * builtin.c (TYPE_MINIMUM): Use type uintmax_t for the calculation, + deferring the cast to the target type until the final result. + +2017-08-27 Juan Manuel Guerrero <juan.guerrero@gmx.de> + + * mbsupport.h [__DJGPP_]: Provide multi-byte specific declarations + and definitions for DJGPP. + +2017-08-23 Arnold D. Robbins <arnold@skeeve.com> + + * README.git: Minor edits to make build steps clearer. + +2017-08-21 Daniel Richard G. <skunk@iSKUNK.ORG> + + * awk.h (c_func): Renamed to c_function to avoid conflict. + with z/OS headers. + * ext.c, interpret.h: Ditto. + * configure: Regenerated after update to m4/arch.m4. + +2017-08-18 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (do_set_var): Fix typos in error messages. + Thanks to Jean-Philippe Guerard + <jean-philippe.guerard@xn--tigreray-i1a.org> for the report. + +2017-08-17 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (rebuild_record): Set new fields valref to 1 if + original field's valref was > 1. Update the comment. Found + by running chem. + * mpfr.c (do_mpfr_compl): Fix typo in warning message. + Thanks to Jean-Philippe Guerard + <jean-philippe.guerard@xn--tigreray-i1a.org> for the report. + * NEWS: Mention the Italian translation of the manual. + +2017-08-16 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.c (assign_number): Clean up the code a bit. + (api_get_mpfr, api_get_mpz): Add return NULL in non-MPFR case + to avoid compiler warnings. + +2017-08-16 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess: Update from GNULIB. + * NEWS, README: Updated in preparation for release. + +2017-08-16 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (assign_number): Add 'ifdef HAVE_MPFR' tests to get this + to build in the absence of MPFR. + +2017-08-13 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (gawk_api_major_version): Reset to 2 after merging + in feature/api-mpfr branch. + * NEWS: `intdiv' is not built-in; remove the entry for up and update + numbering. Add note about API supporting GMP and MPFR values. + +2017-08-09 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (check_mpfr_versions): Define differently based on if + MPFR version macro is defined. Enhance body to use do/while(0). + (dl_load): Call check_mpfr_versions unconditionally. + +2017-08-09 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Add URL for Bug reporting info to the help message. + + Unrelated: + + * str_array.c (str_lookup): Make a copy of the string if it + came from Nnull_string or a null field. Thanks to + Daniel Pettet for the report. + +2017-08-04 Arnold D. Robbins <arnold@skeeve.com> + + * array.c, awk.h, awkgram.y, builtin.c, cint_array.c, + cmd.h, debug.c, eval.c, ext.c, field.c, gawkapi.c, gawkmisc.c, + gettext.h, int_array.c, main.c, mpfr.c, msg.c, node.c, profile.c, + re.c, str_array.c, symbol.c: Update copyright years. + +2017-08-04 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, mkinstalldirs: Updated from GNULIB. + +2017-08-01 Juan Manuel Guerrero <juan.guerrero@gmx.de> + + Bring DJGPP support up to speed. + + * awk.h: Add DJGPP in #if for include of nonposix.h + * nonposix.h (btowc, putwc): Add declarations for DJGPP. + +2017-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (validate_qualified_name): Return type back to bool. + * awkgram.y (validate_qualified_name): Return type back to bool. + (lookup_builtin): Make allowances for `awk::' prefix on name. + * interpret.h (r_interpret): For indirect call, always pass true + for do_qualify argument of lookup. + * main.c (main): Make note of errors in -v values, use this + to exit failure if any happen. Only change current_namespace + to 'awk::' if doing pretty printing. + (arg_assign): If validate_qualified name returns false, error out. + +2017-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (set_namespace): Change return type void, adjust + all return statements. + [@namespace]: Don't YYABORT on bad namespace so that we can check + the rest of the program. + (validate_qualified_name): Check traditional / posix first. Return + after printing an error message; we don't want to print multiple + messages for the same identifer. + * interpret.h (r_interpret): For indirect call, set do_qualify + parameter of lookup based on presence of a colon. + +2017-07-20 Arnold D. Robbins <arnold@skeeve.com> + + Make qualified names work with -v and command-line assignments. + + * awk.h (validate_qualified_name, check_qualified_name): Declare. + * awkgram.y (validate_qualified_name): No longer static. + (check_qualified_name): Ditto. + * main.c (arg_assign): Allow colons in identifiers. If not a + bad identifier, call validate_qualified_name and instead of + check_special use check_qualified_name. + +2017-07-17 Arnold D. Robbins <arnold@skeeve.com> + + Allow identifiers that are gawk extensions to be used as plain + identifiers outside the "awk" namespace. Make the real + builtins available via awk::builtin_name(). Standard awk reserved + words and builtin functions remain reserved. + + * awk.h (getfname): Add boolean parameter to prepend namespace + or not. + * awkgram.y (check_qualified_name): New function. Enforces that + standard awk reserved words and functions aren't allowed, and + allows awk::gawk_extension from non-"awk" namespace. + [direct_func_call]: Always convert name to fully qualified. + (getfname): Add boolean parameter to prepend namespace + or not. Adjust code. + (yylex): Separate out validation code from code building the + NAME token. Use check_qualified_name to decide if token is + special instead of check_special. + (validate_qualified_name): Just checks the form of the fully + qualified name. + * debug.c (print_instruction): Update call to getfname. + * profile.c (pprint): Update call to getfname. + +2017-07-17 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y [direct_func_call]: Save full variable name for + indirect calls too. + +2017-07-17 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y [non_post_simp_exp]: Merge LEX_BUILTIN and + LEX_LENGTH expansions. + (lookup_builtin): Move MPFR test to after test for sub builtin. + + * awkgram.y [non_post_simp_exp]: Unmerge LEX_BUILTIN and + LEX_LENGTH expansions. This introduced a reduce/reduce + conflict, and those are bad. I don't know why I didn't + notice this earlier. Sigh. + +2017-07-15 Arnold D. Robbins <arnold@skeeve.com> + + Revert change of 2016-07-24 that always runs the dfa + matcher. Based on a bug report from Alexandre Oliva + <lxoliva@fsfla.org>, DFA can cause gawk to hang, even + in the C locale. + + * re.c (research): Don't use dfa if need_start is true. + +2017-07-13 Arnold D. Robbins <arnold@skeeve.com> + + More rationalization of the namespace code. + + * awk.h (is_valid_identifier): Declare. + * awkgram.y (grammar: direct_func_call): Store the fully qualified + name in the op code. + (yylex): Disallow reserved words and functions as namespace name. + (check_params): Small code edit + (validate_qualified_name): Use is_lsetter. + (set_namespace): Check for NULL pointer first! Use is_valid_identifier + instead of inline code. Disallow using reserved words as namespace + names. + * ext.c (is_valid_identifier): No longer static. + (make_builtin): Check name and namespace against reserved words and + fatal error if found. + * gawkapi.c (ns_lookup): New function to look for variables + in namespaces. + (api_sym_lookup): Check namespace for validity and use ns_lookup. + (api_sym_update): Ditto. + * profile.c (pp_print): Correctly print full function name + in a function call. + +2017-07-11 Arnold D. Robbins <arnold@skeeve.com> + + Continue adding namespace support to the extension API. + + * awk.h (make_builtin): Add leading name_space parameter. + * ext.c (make_builtin): Add leading name_space parameter. + Do the appropriate checking and building of a name before + installing in the symbol table. + * gawkapi.c (add_ext_func): Use name_space, not namespace. + Check that the parameter isn't NULL. + (api_sym_lookup, api_sym_update): Use name_space, not namespace. + * gawkapi.h: Use name_space, not namespace, everywhere. + +2017-07-11 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (is_letter): Add declaration. + * ext.c (is_valid_identifier): New function. + (make_builtin): Use is_valid_identifier instead of inline code. + (is_letter): Moved from here ... + * awkgram.y (is_letter): ... to here. + (yylex): Use is_letter instead of a test. + * command.y (yylex): Ditto. + * main.c (arg_assign): Ditto. + +2017-07-07 Arnold D. Robbins <arnold@skeeve.com> + + Remove warnings from GCC 7.1 compilation. + + * awk.h (fatal_tag_valid): Change type to int. + * awkgram.y (yylex): Set did_newline to true instead of using ++. + * builtin.c (format_tree): Set lj to true instead of using ++. + * cmd.h (pager_quit_tag_valid): Change type to int. + * debug.c (pager_quit_tag_valid): Change type to int. + (do_clear): Make bp_found an int, change uses. + (do_run): Treat fatal_tag_valid as an int. + * msg.c (fatal_tag_valid): Change type to int. + +2017-07-07 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yyerror): Produce better diagnostics for source + files that are not whole syntactic units. + + * gawkapi.c (api_sym_lookup, api_sym_update): Add namespace parameter. + Currently unused. + * gawkapi.h (api_sym_lookup, api_sym_update): Add namespace parameter. + (api_sym_lookup_ns, api_sym_update_ns): New macros. + (api_sym_lookup, api_sym_update): Adjust macro bodies. + +2017-07-07 Arnold D. Robbins <arnold@skeeve.com> + + * gawapi.h: Bring descriptive comments up to date, minor edits. + * io.c: Add some initial comments to functions where they were missing. + +2017-07-03 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h, gawkapi.c: Typo fixes in comments. + +2017-07-01 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (install): Don't call fix_up_namespace if + installing parameters. + * profile.c (remove_namespace): Renamed to + (adjust_namespace): Make smarter and add boolean parameter for + if return was mallc'ed. Adjust calls. + +2017-06-30 Arnold D. Robbins <arnold@skeeve.com> + + Add namespace info into Op_Rule and Op_Func. + Fix memory management problem. + The changes temporarily break the test suite. + + * awk.h (MAX_INSTRUCTION_ALLOC): Increase to 4. + (Op_K_namespace): Remove, not needed. + * eval.c (optypetab): Remove Op_K_namespace. + * awkgram.y (make_pp_namespace): New function. + (yylex): For BEGIN etc, allocate 4 in the instruction. + (install_func): Save namespace name for Op_rule. + (append_rule): Save namespace name for Op_rule. + * debug.c (print_instruction): Print namespace for Op_rule, Op_func. + Remove Op_K_namespace. + * profile.c (pp_namespace, remove_namespace): New functions. + (pprint): Call `pp_namespace'. Use `remove_namespace' on variable + names. + (pp_func): Ditto on both. + * symbol.c (lookup): Initialize `malloced' to false. + (install): Ditto. + + Unbreak the test suite: + + * awk.h (namespace_changed): Declare new boolean variable. + * awkgram.y (namespace_changed): Define new boolean variable. + (set_namespace): Set it to true when the namespace is changed. + * main.c (main): Set current_namespace to "awk::" for the pretty + printer. + * profile.c (pp_namespace): If namespace_changed is false, return. + +2017-06-28 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h [ns_name]: Add macro in preparation for use. + * debug.c (print_instruction): Add case for Op_K_namespace. + Not really used yet. + * symbol.c (fix_up_namespace): Bug fix to always allocate + memory for a full name. Add boolean parameter to indicate + if memory was malloc'ed or not. + (lookup): Adjust call to fix_up_namespace and use make_str_node + if the string was malloced. + (install): Ditto. + +2017-06-26 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Turn a tab into a space in AC_DEFINE(SUPPLY_INTDIV). + +2017-06-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkmisc.c (xmalloc): Remove function now in support/xalloc.h. + +2017-06-22 Arnold D. Robbins <arnold@skeeve.com> + + Make pretty-printing include parentheses that were explicitly + in the source code. Thanks to Hermann Peifer for the bug report. + + * awk.h (OPCODE): Add Op_parens. + * awkgram.y [Grammar]: If pretty-printing, add Op_parens ot end of + list for parenthesized expression. + * eval.c (optypetab): Add Op_parens. + * interpret.h (r_interpret): Ditto. + * profile.c (pprint): Ditto. For ?:, don't parenthesize it. + (pp_parenthesize): If string starts with left paren, return early. + (parenthesize): Don't call div_on_left_mul_on_right. + (div_on_left_mul_on_right): Remove function. + (pp_concat): Don't add parentheses if expressions already have them. + * NEWS: Updated. + +2017-06-21 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Replace malloc/memset combinations with calloc by using the new ezalloc + macro. + * awkgram.y (yyerror, do_add_srcfile, funcuse): Replace emalloc+memset + with ezalloc. + * cint_array.c (cint_lookup, cint_copy, tree_lookup, tree_copy, + leaf_lookup, leaf_copy): Ditto. + * command.y (mk_cmdarg): Ditto. + * debug.c (add_item): Ditto. + * eval.c (setup_frame): Ditto. + * field.c (set_record): Ditto. + * gawkapi.c (api_flatten_array_typed): Ditto. + * int_array.c (int_copy, grow_int_table): Ditto. + * io.c (init_awkpath, iop_alloc): Ditto. + * node.c (str2wstr): Ditto. + * re.c (make_regexp): Ditto. + * str_array.c (str_copy, grow_table): Ditto. + * symbol.c (make_params, new_context): Ditto. + +2017-06-19 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (ezalloc): Add new macro to allocate memory initialized to zero. + (ezalloc_real): New inline function to call calloc. + * gawkapi.h (ezalloc): Add new API macro to allocate memory initialized + to zero. + +2017-06-18 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (mbc_char_count): Fix code to correctly traverse + the string. Thanks to Hermann Peifer for the bug report. + * config.guess, config.sub: Update to latest from GNULIB. + * gettext.h: Pull in a few nice changes from GNULIB version. + +2017-06-16 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (lookup): Add second parameter. + * array.c (assoc_list): Adjust call to lookup. + * awkgram.y (grammar, parms_shadow, install_function, variable): + Ditto. + * command.y [Grammar]: Ditto. + * debug.c (find_symbol): Ditto. + * ext.c (make_builtin): Ditto. + * gawkapi.c (api_sym_lookup, api_sym_update): Ditto. + * interpret.h (r_interpret): Ditto. + * main.c (arg_assign): Ditto. + (main): Reset current_namespace after parsing. + * symbol.c (lookup): New second parameter, do_qualify. Use it + to qualify names or not. + (install): Call fix_up_namespace. + (is_all_upper): New helper routine. + (fix_up_namespace): New function. + +2017-06-13 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (awk_namespace, current_namespace): Move to const char. + (SRCFILE): Add namespace element. + * awkgram.y (awk_namespace, current_namespace): Move to const char. + (set_namespace): New function. + [Grammer]: Call it. + (tokentab): Add "namespace" entry. + (include_source): Push the current namespace. + (next_sourcefile): Pop the current namespace. + (yylex): Add lint warning if a reserved word is used as a namespace + name. + (validate_qualified_name): Make it an error to use a reserved + word as the second part of a fully qualified name. + +2017-06-11 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (awk_namespace, current_namespace): Declare. + (opcodeval): Add Op_K_namespace. + * awkgram.y (awk_namespace, current_namespace): Define. + (LEX_NAMESPACE): Add lexing and parsing of `@namespace directive'. + (tokentab): Add "namespace" entry. + (yylex): Check if first part of qualified identifier is + a reserved word or function. + * eval.c (optypetab): Add Op_K_namespace. + +2017-06-06 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Allow :: in identifiers (the "NAME" token). + Use validate_qualified_name to check it. + (validate_qualified_name): New function. + +2017-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (nextc): Force -e chunks to be syntactic units. + Needed for namespaces to work correctly. + +2017-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Mention PROCINFO["argv"]. + +2017-05-24 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (set_FIELDWIDTHS): Add check to protect against blank + characters after a `:' skip separator. + Fix field number in error message, thanks to a bug report + from Michal Jaegermann. + +2017-05-23 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (set_FIELDWIDTHS): Simplify the logic and consistentify + use of UINT_MAX. Make sure that negative value after : is caught. + +2017-05-23 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (fw_parse_field): Stop upon hitting the end of the + record; this enables correct counting of the number of fields. + (set_FIELDWIDTHS): Add `*' at end as meaning ``all the rest + of the data on the line.'' Allow skip:* as well. + * NEWS: Update information about FIELDWIDTHS. + +2017-05-20 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (add_lint): Make ``no effect'' check smarter about + reporting line numbers. + +2017-05-01 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (nextc): Fix to change of 2017-04-24 such that + @include works in multibyte locales. Thanks to Hermann + Peifer for the bug report. + +2017-04-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (make_regnode): Fix bug -- we should not set valref to 1 + when creating a node of type Node_regex, since valref is appropriate + only for Node_val nodes. This fixes a bug introduced in commit + 687e6594. Also, add an assert to make it clear that this function + supports only Node_regex and Node_dynregex. + * awk.h (NODE): Restore sref to the `val' subportion, since it is not + really needed for Node_regex, now that the bug in make_regnode has + been fixed. + (valref): Restore macro definition. + +2017-04-24 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (NODE): Additional cleanups. Removed `aq' and `param_list' + elements from various unions and removed 'nextp' and + `a_opaque' defines. None of these were in use. + Rework the comment for valref, per suggestion from + Andrew Schorr. + +2017-04-23 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (nextc): Adjust so that 3.1.x behavior is restored + whereby --source arguments are concatenated. Thanks to + "Neil R. Ormos" <ormos-gnulists17@ormos.org> for the report. + +2017-04-21 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (NODE): Put the `val' subportion back the way it + was and move valref (formerly sref) out of the unions + entirely. This was the real problem. Rework the corresponding + commentary. + [valref]: Removed the macro definition. + +2017-04-20 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Make letter case usage in the various + AC_ARG_ENABLE messages consistent with the rest of configure + output. + (--disable-mpfr): Add this option to make it easier + to check compiles without MPFR. Motivated by: + * awk.h (NODE): Rearrange the layout of the 'val' subportion + of the union to fix alignment problems when compiling without + MPFR. The problem only happened on 64-bit compiles, not + 32-bit compiles. + +2017-04-16 Arnold D. Robbins <arnold@skeeve.com> + + Rename intdiv it intdiv0 and require enabling at configure time. + + * awkgram.y (tokentab): Bracket intdiv0 in #ifdef SUPPLY_INTDIV. + (snode): Similar. + * builtin.c (do_intdiv): Bracket in #ifdef SUPPLY_INTDIV. + * mpfr.c (do_mpfr_intdiv): Bracket in #ifdef SUPPLY_INTDIV. + * configure.ac: Add --enable-builtin-intdiv0 option. If enabled, + also revise doc/gawktexi.in. + +2017-04-16 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_intdiv): Use DEREF on the arguments. + Thanks to Andrew Schorr for finding the problem. + * mpfr.c (do_mpfr_intdiv): Return -1 if numerator or denominator + are not valid numbers. Unref various bits first. + +2017-04-13 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (make_number_node): Simplify. + * mpfr.c (mpg_node): Change parameter name to `flags'. + +2017-04-12 Arnold D. Robbins <arnold@skeeve.com> + + * mpfr.c (mpg_format_val): Set STRCUR flag when we're done. + Fixes a memory leak. Thanks to valgrind for the report. + + * builtin.c (do_dcgettext): Move declaration of reslen to + outside the ifdefs. Thanks to Hermann Peifer for the report. + + * gawkapi.c (awk_value_to_node): Initialize ext_ret_val to NULL + to avoid compiler warnings. + +2017-04-12 Manuel Collado <m-collado@users.sourceforge.net> + + Fix the FPAT bug reported by Ed Morton in the gawk-bug mailing list. + + * awk.h (Regexp): Remove the non_empty flag. + * field.c (fpat_parse_field): Restructure the code to reduce complexity + and document the new structure. + + * field.c (fpat_parse_field): Further restructuring to avoid + invalid reads as reported by valgrind. + +2017-04-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (enum opcodeval): For the avoidance of doubt, specify that + Op_illegal must equal zero. + * symbol.c (bcfree): Improve clarity by setting opcode to Op_illegal + instead of 0. + (free_bc_mempool): Improve clarity by comparing opcode to Op_illegal + instead of to 0. + + * field.c (set_FIELDWIDTHS): Set use_chars to awk_true, since its + type is awk_bool_t. + +2017-04-10 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (free_bc_mempool): Change `first' from int to bool. + +2017-04-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (fw_parse_field): Edit comment about resetting shift state. + * gawkapi.h (awk_fieldwidth_info_t): Make white space more uniform. + +2017-04-08 Eli Zaretskii <eliz@gnu.org> + + * main.c (usage, copyleft) [__MINGW32__]: + * io.c (non_fatal_flush_std_file, close_io) [__MINGW32__]: Call + w32_maybe_set_errno to correctly set errno to EPIPE when appropriate. + + * awk.h (die_via_sigpipe) [__MINGW32__]: MinGW-specific definition. + +2017-04-07 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (INSTRUCTION_POOL): Redefine as an array of structures so we + can track allocated blocks. + * symbol.c (pools): Make it a pointer to avoid copying. + (struct instruction_block): Define structure to hold a block of + allocated instructions. + (bcfree): Update to use new INSTRUCTION_POOL definition. + (bcalloc): Allocate an instruction by searching first on the free + list, second for free space in the current block, or third by + allocating a new block. + (set_context): Update to reflect that pools is now a pointer. + (free_bc_mempool): New helper function to free a pool of a certain size. + (fre_bcpool): Call free_bc_mempool for each pool. + +2017-04-04 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (INSTRUCTION): Add pool_size member. + [MAX_INSTRUCTION_ALLOC]: New macro. + (INSTRUCTION_POOL): New type. + (struct context): Use INSTRUCTION_POOL. + * array.c (assoc_list): Reorg the code a bit to make sure + to always free the INSTRUCTIONs allocated for calling a + user-supplied sorting function. Based on code by + Andrew Schorr. + * symbol.c (free_bcpool): Rework to use an INSTRUCTION_POOL. + (bcfree, bcalloc): Rework to use separate chains in + the instruction pool. + (set_context): Update appropriately. + +2017-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (parse_field_func_t): New typedef. Used as needed. + (fw_parse_field): Edit comment about resetting shift state. + (set_parser): Fix leading comment's style and type of argument. + (set_FIELDWIDTHS): Improve the fatal error message. + * gawkapi.h: Minor edits in some comments. + +2017-03-27 Arnold D. Robbins <arnold@skeeve.com> + + Cause EPIPE errors to stdout to generate a real SIGPIPE. + + * awk.h (die_via_sigpipe): New macro. + * builtin.c (efwrite): Use it. + * io.c (non_fatal_flush_std_file): Ditto. + * main.c (usage): Ditto. + +2017-03-25 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (flush_io): Use r_fatal and r_warning for messagefunc + in the loop. + +2017-03-24 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (efwrite): Exit successfully upon EPIPE, as SIGPIPE + done. Improve error messages upon failure to write. + (do_fflush): Update ERRNO for non-fatal flush failures. + * io.c (non_fatal_flush_std_file): Update ERRNO when flush is + non-fatal. + (flush_io): If a redirect is marked non-fatal, only warning, + not fatal message. + +2017-03-23 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Updated again. + +2017-03-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * NEWS: Document new PROCINFO["FS"] value of "API". + +2017-03-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * NEWS: Document new FIELDWIDTHS skip capability and API input parser + field parsing enhancement. + +2017-03-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_input_buf_t): Update get_record comment regarding the + new field_width argument. + +2017-03-21 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_fieldwidth_info_t): Define new structure to contain + API field parsing info, replacing the previous awk_input_field_info_t + array. + (awk_fieldwidth_info_size): Define macro to calculate size of the + variable-length awk_fieldwidth_info_t structure. + (awk_input_buf_t): Update get_record prototype to update the type + of the final field_width argument from 'const awk_input_field_info_t **' + to 'const awk_fieldwidth_info_t **'. + * awk.h (set_record): Change 3rd argument from + 'const awk_input_field_info_t *' to 'const awk_fieldwidth_info_t *'. + * io.c (inrec, do_getline_redir, do_getline): Change field_width type + from 'const awk_input_field_info_t *' to + 'const awk_fieldwidth_info_t *'. + (get_a_record): Change field_width argument type from + 'const awk_input_field_info_t **' to 'const awk_fieldwidth_info_t **'. + * field.c (api_parser_override): Define new boolean to track whether + API parsing is currently overriding default parsing behavior. + (api_fw): Change type from 'const awk_input_field_info_t *' + to 'const awk_fieldwidth_info_t *'. + (FIELDWIDTHS): Change type from 'int *' to 'awk_fieldwidth_info_t *'. + (set_record): Use new boolean api_parser_override to track whether + API parsing override is in effect, since we can no longer discern + this from the value of parse_field -- FIELDWIDTHS parsing uses the + same function. + (calc_mbslen): New function to calculate the length of a multi-byte + string. + (fw_parse_field): Enhance to support the awk_fieldwidth_info_t + structure instead of simply using an array of integer field widths. + (api_parse_field): Remove function no longer needed since fw_parse_field + now supports both FIELDWIDTHS and API parsing. + (set_parser): Use api_parser_override instead of comparing parse_field + to api_parse_field. + (set_FIELDWIDTHS): Enhance to use new awk_fieldwidth_info_t structure + and parse new skip prefix for each field. + (current_field_sep): Use api_parser_override flag instead of comparing + to api_parse_field. + (current_field_sep_str): Ditto. + +2017-03-20 Arnold D. Robbins <arnold@skeeve.com> + + Improve handling of EPIPE. Problems reported by + Alexandre Ferrieux <alexandre.ferrieux@orange.com> + and David Kerns <david.t.kerns@gmail.com>. + + * awk.h (ignore_sigpipe, set_sigpipe_to_default, + non_fatal_flush_std): Declare new functions. + (ignore_sigpipe, set_sigpipe_to_default, + non_fatal_flush_std): New macros. + * builtin.c (do_fflush): When nonfatal not in force, flush + of stdout/stderr and EPIPE exits, simulating SIGPIPE, as + in nawk/mawk. Flush of other redirections with EPIPE now + also fatals. + (do_system): Use ignore_sipipe and set_sigpipe_to_default + instead of uglier inline ifdefed code. + * main.c (main): Ditto. + * io.c (redirect_string, two_way_open, gawk_popen): Ditto. + (flush_io): Use non_fatal_flush_std for stdout and stderr. + + Unrelated: + + * config.guess, config.rpath, config.sub, install-sh: + Sync with GNULIB. + +2017-03-16 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Some cleanups. + +2017-03-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_input_field_info_t): Define new structure to contain + API field parsing info. + (awk_input_buf_t): Update get_record prototype to use an array of + awk_input_field_info_t instead of integers. + * awk.h (set_record): Change 3rd argument from 'const int *' to + 'const awk_input_field_info_t *'. + * field.c (api_fw): Now points to an array of awk_input_field_info_t + instead of integers. + (set_record): Change 3rd argument to point to an array of + awk_input_field_info_t. + (api_parse_field): Update parsing logic to use awk_input_field_info_t + structures instead of an array of integers. + * io.c (inrec, do_getline_redir, do_getline): Change field_width type + from 'const int *' to 'const awk_input_field_info_t *'. + (get_a_record): Change field_width argument type from 'const int **' + to 'const awk_input_field_info_t **'. + +2017-03-09 Arnold D. Robbins <arnold@skeeve.com> + + * field.c: Minor style edits. + +2017-03-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (normal_parse_field): Renamed from save_parse_field to reflect + better its purpose. Added a comment to explain more clearly what's + going on. + (set_record, set_parser): Rename save_parse_field to normal_parse_field. + +2017-03-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_input_buf_t): Remove field_width array and instead + add it as a 6th argument to the get_record function. This should + not break existing code, since it's fine to ignore the additional + argument. Document the behavior of the field_width argument. + * io.c (inrec): Pass pointer to field_width array to get_a_record, + and then hand it off to set_record. + (do_getline_redir): If not reading into a variable, pass pointer to + field_width array to get_a_record and then hand it off to set_record. + (do_getline): Ditto. + (get_a_record): Add a 4th field_width argument to pass through to + the API get_record method. + +2017-03-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (set_record): Add a new argument containing a field-width + array returned by an API parser. + (field_sep_type): Add new enum value Using_API. + (current_field_sep_str): Declare new function. + * field.c (save_parse_field): New static variable to save the + parse_field value in cases where it's overridden by API parsing. + (api_fw): New static variable to hold pointer to API parser fieldwidth + array. + (set_record): Add new field-width array argument. If present, API + parsing will override the default parsing mechanism. + (api_parse_field): New field parser using field widths supplied by the + API. This is very similar to the existing fw_parse_field function. + (get_field): Fix typo in comment. + (set_parser): New function to set default parser and check whether + there's an API parser override in effect. Update PROCINFO["FS"] if + something has changed. + (set_FIELDWIDTHS): Use set_parser and stop updating PROCINFO["FS"]. + (set_FS): Ditto. + (set_FPAT): Ditto. + (current_field_sep): Return Using_API when using the API field parsing + widths. + (current_field_sep_str): New function to return the proper string + value for PROCINFO["FS"]. + * gawkapi.h (awk_input_buf_t): Add field_width array to enable the + parser get_record function to supply field widths to override the + default gawk field parsing mechanism. + * io.c (inrec): Pass iop->public.field_width to set_record as the + 3rd argument to enable API field parsing overrides. + (do_getline_redir, do_getline): Ditto. + * main.c (load_procinfo): Use new current_field_sep_str function + instead of switching on the return value from current_field_sep. + +2017-02-23 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (boolval): Return bool instead of int. + * eval.c (eval_condition): Same. + * io.c (pty_vs_pipe): Same + Thanks to Andrew Schorr for pointing these out. + +2017-02-21 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * NEWS: Document that mktime now takes an optional utc-flag argument. + * awkgram.y (tokentab): Modify mktime entry to indicate that it may + accept two arguments. + * builtin.c (mktime_tz): New function to run mktime in an arbitrary + time zone. Code was copied from the Linux timegm man page. + (do_mktime): Add support for new optional 2nd argument utc-flag by + using the new mktime_tz function. + (do_strftime): Change do_gmt type from int to bool. + +2017-02-17 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_typeof): Handle arguments that have + the NULL_FIELD flag set. + +2017-02-03 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (set_profile_text): Improve code clarity by using emalloc + to allocate the string instead of abusing estrdup. + +2017-02-02 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (set_profile_next): Allocate an extra byte at the + end for the NUL in case we add a sign. Thanks to Andrew Schorr + for making me look at this code. + + And later in the same day: + + * awkgram.y (set_profile_next): Undo previous change, since estrdup + handles it, but updated the comments. + +2017-02-01 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (mbc_char_count): Remove spurious multiplies by + gawk_mb_cur_max. Thanks to Andrew Schorr for making me look + at this code. + + Unrelated: + + * awkgram.y (make_profile_number): Renamed to ... + (set_profile_next): New function. All calls adjusted. Also improved + use at MPFR number case. + +2017-01-28 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (inetfile): Replace strncmp with memcmp in a few places, now + that we are checking string length beforehand. + +2017-01-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (redirect_string): Check explen positive before accessing *str. + In lintwarn message, use explen string length. Pass length to inetfile. + (devopen): Pass name length to inetfile. + Stop assuming that remoteport is NUL-terminated. + (two_way_open): Pass name length to inetfile. + (inetfile): Stop assuming NUL string termination; add checks to avoid + string overrun. + +2017-01-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (str_terminate_f): New helper function for terminating a string + NODE. + (str_terminate): Macro wrapper to call str_terminate_f. + (str_restore): New macro to restore the string. + * builtin.c (do_strftime): Use str_terminate and str_restore. + (do_dcgettext): Ditto, and remove saved_end flag since equivalent + to testing (t2 != NULL). Fix overrun bug in calculating result + length when !ENABLE_NLS. + (do_dcngettext, do_bindtextdomain): Use str_terminate and str_restore. + * interpret.h (Op_arrayfor_init, Op_indirect_func_call): Ditto. + * str_array.c (env_remove): Ditto. + +2017-01-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h [UNFIELD]: Fix condition for assignment from + value with valref == 1. Fixes problems introduced at gawk 4.1.2. + +2017-01-27 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h: Update copyright year. + * debug.c (do_run): Rework error message to ease translation. + Thanks to Rafael Fontenelle <rafaelff@gnome.org> and to + Eli Zaretskii <eliz@gnu.org>. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_dcgettext): First argument also needs protection + from string overrun. + (do_dcngettext): Need to terminate string1 and string2 also, + and replace strlen(the_result), which could overrun. + (do_bindtextdomain): Terminate both string args, and eliminate + saved_end boolean which is redundant with (t2 != NULL). + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (Op_arrayfor_init): Protect against string overrun + on sorting method. + (Op_indirect_func_call): Terminate function name. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * str_array.c (env_remove): Terminate string before calling unsetenv. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (is_hex): Add a new argument pointing to the end of the string + so we can check for string overrun. + (r_force_number): Pass string end to is_hex. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (get_numbase): Add string length argument so we can operate + on unterminated strings. + * awkgram.y: Call get_numbase with string length, and fix off-by-one + error in length passed to nondec2awknum: should be strlen(tokstart)-1 + based on surrounding code. + * builtin.c (do_strtonum): Pass string length to get_numbase. + (nondec2awknum): Check string length before accessing characters. + * mpfr.c (force_mpnum): Pass string length to get_numbase. + * node.c (r_force_number): Pass string length to get_numbase. + (get_numbase): Add string length argument and honor it. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_strftime): If format argument is passed, we need + to terminate it in case it's a field variable. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_format_val): Before we free s->stptr, make sure that it + was malloced. + (wstr2str): Add comment explaining why it's safe to free n->stptr + without doing any checks. + * mpfr.c (mpg_format_val): Ditto. And no need to reset the STRCUR flag + that we just checked. + +2017-01-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (enum block_id): Remove BLOCK_INVALID, since it serves no + useful purpose and seems to slow things down a bit. + * node.c (nextfree): Remove first invalid entry. + +2017-01-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (BLOCK): Remove typedef. BLOCK was used for 2 different + purposes: to contain a block allocation list header, and to hold + each individual allocated item. This was confusing, because the "size" + field was set only in the header, but not in each element. + (struct block_header): The block header contains a pointer to the first + element and the element size. + (struct block_item): Represent a single allocated item. This contains + only a pointer to the next element. This reduces the minimum allocated + item size from 2 pointers to 1 (16 bytes to 8 bytes on x86_64). + (nextfree): Change array item type from BLOCK to struct block_header. + (getblock, freeblock): Change cast from 'BLOCK' to 'struct block_item'. + * node.c (nextfree): Now an array of 'struct block_header' instead of + BLOCK. Switch the ordering to put the next pointer before the size. + (more_blocks): Replace 'BLOCK' with 'struct block_item', and add + an assert to ensure that the allocation size is at least as large + as 'struct block_item', i.e. 1 pointer. + +2017-01-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (numtype_choose): New backend macro used to implement + various macros whose calculations depend on how a number is + actually represented. This improves readability and should give + a small performance improvement when not using extended precision. + (get_number_ui, get_number_si, get_number_d, get_number_uj, iszero): + Rewrite using new numtype_choose macro. + +2017-01-04 Arnold Robbins <arnold@skeeve.com> + + Trade space for time for programs that toggle IGNORECASE a lot. + Brings 25% to 39% speedup. NODE does not actually grow in size. + + * awk.h (NODE::preg): Now an array of size two. + [CASE]: Flag no longer needed, so removed. + (IGNORECASE): Change type from int to bool. + * awkgram.y (make_regnode): Build two copies of the compiled regexp, + one without ignorecase, and one with. + * io.c (RS_re): Array replacing RS_re_yes_case and RS_re_no_case. + (set_RS): Use RS_re[IGNORECASE] as appropriate. Free and recompute + as needed. + * main.c (IGNORECASE): Change type from int to bool. + * re.c (re_update): Simplify the code. No need to check CASE flag + any longer. Recompute only if text of regexp changed. + * symbol.c (free_bc_internal): Adjust to free both elements of + m_re_reg. + +2017-01-18 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (r_interpret): Increase robustness of the optimization + logic in Op_assign_concat -- check that the node has MALLOC set, + and make sure to wipe all flags other than MALLOC, STRING, STRCUR, + and possibly WSTRCUR. Use STFMT_UNUSED define. + +2017-01-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (r_interpret): Fix bug in Op_assign_concat reported + on Cygwin mailing list. The string concatenation optimization was + not updating the node correctly by setting STRING and STRCUR flags + and setting stfmt. + +2017-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Enhance API to support extended-precision arithmetic. + * awk.h (enum block_id): Add new values BLOCK_MPFR and BLOCK_MPZ. + (make_number_node): New inline function to reduce code duplication + for creating numeric nodes. + * gawkapi.h (gawk_api_major_version): Bump to 3. + (awk_number_t): New typedef to represent numbers with varying internal + representations. + (awk_value_t): For numbers, replace double with awk_number_t. + (num_value): Redefine. + (num_type, num_ptr): New defines for awk_number_t union members. + (gawk_api_t): Add constants for version checking: gmp_major_version, + gmp_minor_version, mpfr_major_version, and mpfr_minor_version. + Add functions api_get_mpfr and api_get_mpz to allocate memory for + extended-precision numbers to hand to gawk. + (get_mpfr_ptr, get_mpz_ptr): Helper macros to wrap api_get_mpfr and + api_get_mpz. + (make_number): Modify to populate awk_number_t correctly. + (make_number_mpz, make_number_mpfr): New helper functions to create + extended-precision numeric nodes. + (check_mpfr_version): New macro to check GMP/MPFR version compatibility + in extensions that want to support extended-precision math. + * gawkapi.c (getmpfr, freempfr, getmpz, freempz): New macros to + allocate and free memory blocks for extended-precision math. + (awk_value_to_node): For AWK_NUMBER values, support three different + kinds of internal numbers: double, mpz_t, and mpfr_t. + (assign_number): New helper function to convert a numeric node to + an awk_value_t. + (node_to_awk_value): Use assign_number to pass numbers properly. + (api_get_mpfr): Implement new api_get_mpfr hook. + (api_get_mpfz): Implement new api_get_mpz hook. + (api_impl): Add GMP & MPFR versions, api_get_mpfr, and api_get_mpz. + * node.c (r_make_number): Use new make_number_node inline function + to reduce code duplication. + (nextfree): Add block allocators for mpfr_t and mpz_t. + (more_blocks): Add an assert to protect against cases where the block + size is too small to hold our structure. + * mpfr.c (mpg_node): Use new make_number_node inline function + to reduce code duplication. + +2017-01-04 Arnold Robbins <arnold@skeeve.com> + + * config.guess, config.sub, compile, depcomp: Sync from latest + in GNULIB. + +2016-12-27 Juergen Kahrs <Juergen.Kahrs@googlemail.com> + + * CMakeLists.txt: Updated after adding support library. + +2016-12-23 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (GNUPG_CHECK_MPFR): Don't call on PowerPC + Macintosh. C99 and the last version of MPFR that works on + that platform don't get along. Sigh. + +2016-12-22 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNULIB. + * intprops.h: New file. + * Makefile.am (base_sources): Add intprops.h. + + Unrelated. Import GNULIB fix for regex: fix integer-overflow + bug in never-used code. + Problem reported by Clément Pit–Claudel in: + http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg00654.html + Fix by Paul Eggert <eggert@cs.ucla.edu>: + + * regex_internal.h: Include intprops.h. + * regexec.c (re_search_2_stub): Use it to avoid undefined + behavior on integer overflow. + + Unrelated. Set up a support directory for externally obtained + support files. + + * Makefile.am (base_sources, EXTRA_DIST): Edit lists. + (SUBDIRS): Get ordering right. + (LDADD): Add support/libsupport.a. + (DEFS): Add -I for support directory. + * dfa.c, dfa.h, getopt.c, getopt.h, getopt1.c, getopt_int.h, + intprops.h, localeinfo.c, localeinfo.h, random.c, random.h, + regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h, + regexec.c, verify.h, xalloc.h: Moved to support. + + Unrelated: Totally break binary compatibility in the API + after merging in API min/max changes and REGEX and STRNUM + support in the API: + + * gawkapi.c (valtype2str): New function. + (node_to_awk_value): Minor simplification in a switch. + (api_flatten_array): Removed. + (api_flatten_array_typed): Use valtype2str in error message. + (api_impl): Reorder functions to group related ones together again. + * gawkapi.h (awk_valtype_t): Reorder enum values. + (struct gawk_api): Remove api_flatten_array field. Reorder + functions to group related ones together again. + +2016-12-17 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (api_add_ext_func): Add comment about point to + awk_ext_func_t not being const but gawk doesn't use it. + * * interpret.h (Op_ext_builtin): Simplify code, check only + if do_lint and ! f->suppress_lint and num_args > max_expected. + +2016-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (awk_ext_func_t): Put max back before min. Restores + source compatibility, although there will be compile warnings + because of the 3rd argument for the C function being missing. + * interpret.h (Op_ext_builtin): Used size_t instead of int for + the various variables. Add a check that max expected > 0. + +2016-12-14 Arnold D. Robbins <arnold@skeeve.com> + + MAJOR BREAKING API CHANGE. + + * awk.h (INSTRUCTION): Update extension function pointer to + take 3rd argument of pointer to struct awk_ext_func. + * gawkapi.c (api_add_ext_func): Update third arg to not be const. + * gawkapi.h (awk_ext_func_t): Put min before max. Add suppress_lint + and data pointer. + [gawk_api_major_version]: Update to 2. + [gawk_api_minor_version]: Reset to 0. + (api_add_ext_func): Update third arg to not be const. + * interpret.h (Op_ext_symbol): Revise lint check. + +2016-12-12 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (INSTRUCTION): Replace min_required and max_expected + with a pointer to the extension functions awk_ext_func_t struct. + * ext.c (make_builtin): Store a pointer to the extension function + struct into the INSTRUCTION instead of the min and max. + * gawkapi.h (awk_ext_func): Use size_t instead of unsigned short. + Put min second, which preserves source code compatibility. + * interpret.h (Op_ext_builtin): Use the pointer for the info + directly. If lint and max_expected > 0 and args > max_expected + print a message and set max_expected to zero so we only print once + per function. Remove special case of both min and max being zero. + (Op_ext_func): Adjust creation of the data structures. + +2016-12-11 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNULIB. + +2016-12-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Add API support for strnum values. + * gawkapi.c (awk_value_to_node): Add AWK_STRNUM. + (assign_string): Add a type argument so we can use this for AWK_STRING + or AWK_STRNUM. + (node_to_awk_value): When AWK_NUMBER is requested, a regex value + should return false, as per the header file documentation. + Add support for AWK_STRNUM requests. When AWK_REGEX is requested, + implement the cases properly instead of always returning true. + Fix AWK_SCALAR logic. For AWK_UNDEFINED, rewrite using a switch + and support AWK_STRNUM. + (api_sym_update): Add AWK_STRNUM. + (api_sym_update_scalar): Add optimized support for updating AWK_STRNUM. + (valid_subscript_type): Add AWK_STRNUM. + (api_create_value): Add AWK_STRNUM. + * gawkapi.h (awk_valtype_t): Add AWK_STRNUM. + (strnum_value): New macro. + (Value fetching table): Updated. + +2016-12-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (assign_regex): Do not call assign_string, since we + know that a REGEX value is not an unterminated field string. + * gawkapi.h (make_regex): Delete macro. + (make_const_regex, make_malloced_regex): Add new macros to replace + make_regex with necessary memory management support. + +2016-12-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (fixtype): Remove conditional checking if the node type + is Node_val. This is already covered by the assert, and if it's not + true, we have serious bugs. + * builtin.c (do_typeof): Do not treat Node_var the same way as + Node_val, since they are different beasts. In reality, the argument + to this function will never have type Node_var. + +2016-12-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_element_t): Remove obsolete comment claiming that + the index will always be a string. + (gawk_api_t): Add new api_flatten_array_typed function and indicate + that api_flatten_array has been superseded. + (flatten_array_typed): New macro to call api_flatten_array_typed. + (flatten_array): Redefine using the new flatten_array_typed macro. + * gawkapi.c (api_flatten_array_typed): New function renamed from + api_flatten_array to flatten an array with the types requested by the + caller. Also update the comments and error messages. + (api_flatten_array): Now a wrapper around api_flatten_array_typed. + (api_impl): Add new api_flatten_array_typed hook. + +2016-12-06 Arnold D. Robbins <arnold@skeeve.com> + + Add minimum required and maximum expected number of arguments + to the API. + + * awk.h (INSTRUCTION): Add new members min_required and max_expected. + * ext.c (make_builtin): Store values from extension function struct + into the INSTRUCTION. + * gawkapi.h (awk_ext_func): Add min_required args. Make both it and + max_expected_args into unsigned short to match type in INSTRUCTION. + * interpret.h (Op_ext_builtin): Store min_required and max_expected + in instructions. Add checking code and lint checks. + (Op_ext_func): Copy min_required and max_expected from function info. + + +2016-12-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (r_make_string_type): New inline function to create strings + of any type, currently AWK_STRING or AWK_REGEX. + (r_make_string): Now a wrapper around r_make_string_type. + (make_regex): Convert from an inline function to a macro that + calls r_make_string_type. + +2016-11-30 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with fixes in GNULIB. + + Unrelated: + + * gawkapi.h (make_regex): New function. + +2016-11-29 Arnold D. Robbins <arnold@skeeve.com> + + Add support for typed regex variables to the API. + + * awk.h (make_typed_regex): Declare function. + * awkgram.y (typed_regexp): Call make_typed_regex instead of + using inline code. + * gawkapi.h (AWK_REGEX): New value type. + (regex_value): New macro. + (Value fetching table): Updated. + * gawkapi.c (awk_value_to_node, node_to_awk_value, api_sym_update, + api_sym_update_scalar, valid_subscript_type, api_create_value): + Add support for AWK_REGEX. + (assign_regex): New function. + (api_flatten_array): Adjust comment. + * node.c (make_typed_regex): New function; moved code from grammar. + +2016-11-29 Arnold D. Robbins <arnold@skeeve.com> + + Remove redundant flag from dfa: + + * dfa.c (dfasyntax): Use RE_ICASE instead of DFA_CASE_FOLD. + * dfa.h (DFA_CASE_FOLD): Removed. + * re.c (make_regexp): Use RE_ICASE for regex and dfa. Yay! + + Unrelated: Don't have to recompute syntax stuff every time + we compile a regexp. + + * dfa.c (dfacopysyntax): New function. + (dfaalloc): Zero out the newly allocated memory. + * dfa.h (dfacopysyntax): Declare it. + * re.c (make_regexp): Declare two static dfaregs, one for + with and without ignorecase. Compute the syntax once for each, + then use dfacopysyntax to copy the settings when compiling + a regexp. + +2016-11-28 Arnold D. Robbins <arnold@skeeve.com> + + Make gawk compile on HP-UX 11.33. + + * debug.c (serialize_list): Renamed from `serialize'. + (unserialize_list): Renamed from `unserialize', for consistency. + + Unrelated: + + * dfa.c: Sync with GNULIB. Twice in one day. + + Unrelated: Start improving profiling comments for switch/case. + + * awkgram.y (switch_head): New production. + +2016-11-21 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNULIB. + +2016-11-17 Arnold D. Robbins <arnold@skeeve.com> + + General cleanup for zero termination of strings. + + * array.c (do_delete): Use %.*s. + (value_info): Get length and use %.*s. + (asort_actual): Save and restore character after end. + * awkgram.y (split_comment): Use make_string, not make_str_node. + * builtin.c (do_fflush): Use %.*s. + (locale_category_from_argument, do_dcgettext, do_dcngettext, + do_bindtextdomain): Save and restore character after end. + * debug.c (do_info, print_array, print_subscript, do_print_var, + do_set_var, display, do_watch, print_watch_item, serialize_subscript, + do_print_f): Use %.*s. + * eval.c (cmp_nodes, fmt_index): Save and restore character after end. + * interpret.h (r_interpret): Fix computation for concatenation of + wide strings. + * io.c (is_non_fatal_redirect): Add length parameter; save and + restore character after last. Adjust all other declarations and calls. + (do_close): Save and restore character after end. + * mpfr.c (ieee_fmts): Adjust table indentation. + (do_mpfr_strtonum): Clear wide string members of the union. + * msg.c (err): Use %.*s. + +2016-11-07 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h [USER_INPUT]: Renamed from MAYBE_NUM. + * builtin.c, eval.c, field.c, int_array.c, io.c, main.c, + mpfr.c, node.c: Change all uses. + +2016-11-15 Arnold D. Robbins <arnold@skeeve.com> + + Finish reworking typed regexes. + + * awk.h (typed_re): Replaces tre_reg. + * awkgram.y (typed_regexp production): Node_val points to a regular + Node_regex and also has string value and length. + (make_regnode): Simplified back to its original form. + * builtin.c (call_sub, call_match, call_split_func): For REGEX, + get n->typed_re. + * field.c (do_split, do_patsplit): Ditto, for separator regexp. + * profile.c (pprint): Op_match_rec, handle REGEX correctly. + * re.c (re_update): If REGEX, get t->typed_re->re_reg. + +2016-11-15 Arnold D. Robbins <arnold@skeeve.com> + + Start reworking typed regexes. + + * awk.h (Node_typedregex): Nuked. + [REGEX]: New flag. + (tre_reg): New member in val part of NODE union. + (force_string, force_number, fixtype): Remove use of Node_typedregex. + * awkgram.y (grammar): Use REGEX flag instead of node type. + (valinfo); Ditto. + (make_regnode): Adjust creation based on node type. + * builtin.c (do_length, do_print, call_sub, call_match, + call_split_func, do_typeof): Adjust code. + * debug.c (watchpoint_triggered, initialize_watch_item, + print_memory): Adjust code. + * eval.c (nodetypes): Remove Node_typedregex. + (flags2str): Add REGEX. + (setup_frame): Adjust code after removal of Node_typedregex. + * interpret.h (r_interpret): Adjust code after removal + of Node_typedregex. + * profile.c (pp_typed_regex): Renamed from pp_strong_regex. + (pp_string_or_strong_regex): Renamed from pp_string_or_strong_regex. + (pprint): Adjust code after removal of Node_typedregex. + * re.c (re_update): Adjust code after removal of Node_typedregex. + +2016-11-04 Eli Zaretskii <eliz@gnu.org> + + * builtin.c (efwrite) [__MINGW32__]: Call w32_maybe_set_errno if + errno is not set or set to EINVAL. + + * nonposix.h (w32_maybe_set_errno) [__MINGW32__]: Add prototype. + +2016-11-01 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (flags2str): Add NO_EXT_SET and NUMCONSTSTR. + +2016-10-31 Arnold D. Robbins <arnold@skeeve.com> + + Fix valgrind issues. + + * io.c (init_awkpath): Need to allocate max_path+3 pointers. + * awkgram.y (make_profile_number): Need to add STRCUR flag and + set n->stfmt to STFMT_UNUSED. See the comment in the code. + +2016-10-26 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (init_awkpath): Set max path len for leading separator. + +2016-10-25 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (init_awkpath): Restore documented behavior whereby + null elements represent the current directory. Sheesh. + Bug reported by "Jun T." <takimoto-j@kba.biglobe.ne.jp>. + + Disallow negative arguments to the bitwise functions. + + * NEWS: Document this. + * builtin.c (do_lshift, do_rshift, do_and, do_or, do_xor, do_compl): + Make negative arguments a fatal error. + * mpfr.c (do_mpfr_compl, get_intval): Ditto. + +2016-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * General: Remove trailing whitespace from all relevant files. + * mpfr.c: Replace Unicode sequences with ASCII. + * cint_array.c: Ditto. + +2016-10-16 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Typo fix in call to add_sign_to_num. + +2016-10-16 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (enum opcodeval): Add Op_unary_plus. + * awkgram.y (add_sign_to_num): New routine to put in a sign on + profiling constants. Call it as necessary. + In unary plus production, use new opcode, or set up a + constant as for unary minus. + (negate_num): Call add_sign_to_num instead of doing it directly. + * eval.c (optypetab): Add entry for Op_unary_plus. + * interpret.h (r_interpret): Add case for Op_unary_plus. + * profile.c (pprint, prec_level, is_scalar): Ditto. + +2016-10-13 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNULIB. + +2016-10-12 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (make_profile_number): Allocate an extra byte for the + string, so there's room for a minus if necessary. Store '\0' + in the right place. + (negate_num): Use memmove to shift the string up and then + insert a minus, instead of doing a fresh alloc + copy + free. + +2016-10-11 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (NUMCONSTSTR): New flag value. + * awkgram.y (make_profile_number): New function. Use it + wherever we make a number. This calls make_number and then, if + pretty printing, save the original string value and sets NUMCONSTSTR. + (negate_num): If NUNCONSTSTR set, update the saved string value. + * profile.c (pp_number): Assert NUMCONSSTR set, use that value. + Remove previous code. + +2016-09-24 Eli Zaretskii <eliz@gnu.org> + + * debug.c (restart) [__MINGW32__]: Cast 2nd argument of execvp to + avoid compiler warnings about prototype mismatch. Reported by + Marc de Bourget <marcdebourget@gmail.com>. + +2016-09-09 Norihiro Tanaka <noritnk@kcn.ne.jp> + + * awk.h (struct Regexp): Remove member has_anchor. All uses removed. + * re.c (make_regexp, research): Use dfa matcher for regex with anchor. + +2016-09-09 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. + +2016-09-08 Paul Eggert <eggert@cs.ucla.edu> + + * dfa.c, dfa.h: Sync with grep. + * re.c (make_regexp): Adjust to DFA API changes. + +2016-09-08 Arnold D. Robbins <arnold@skeeve.com> + + * command.y: Update license text to version 3. Oops. + +2016-09-07 Arnold D. Robbins <arnold@skeeve.com> + + * cmd.h, debug.c: Update license text to version citing + GPLv3+ and with correct FSF address. Thanks to + David Kaspar <dkaspar@redhat.com> for pointing out the need. + +2016-09-02 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. + +2016-09-01 Arnold D. Robbins <arnold@skeeve.com> + + Merge grep's now thread-safe dfa. Wheee. + + * dfa.h, dfa.c: Sync with grep. + * localeinfo.h, localeinfo.c, verify.h: New files. + * Makefile.am (base_sources): Adjust. + * awk.h (using_utf8): Declare new function. + * node.c (str2wstr): Use using_utf8 instead of now-gone dfa function. + * re.c: Include "localeinfo.h". + (localeinfo): New static variable. + (make_regexp): Adjust call to dfa_syntax. + (resetup): Call init_localeinfo on localeinfo. Remove call to + now-gone function dfa_init. + (using_utf8): New function. + +2016-08-29 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (fwrite_unlocked): Check for it. + * awk.h (fwrite): Define to fwrite_unlocked if we have it. + * NEWS: Make note of speed improvement. + +2016-08-25 Arnold D. Robbins <arnold@skeeve.com> + + POSIX now says use strcmp for == and !=. Thanks to Chet Ramey + for pointing me at the change. Make it so: + + * awk.h (cmp_nodes): New 3rd param indicating strcmp, not strcoll. + * debug.c (cmp_val): Update call to cmp_nodes. + * eval.c (cmp_nodes): New 3rd param indicating strcmp, not strcoll. + Adjust code and all callers. + (scalar_cmp_t): New enum type. Used in ... + (cmp_scalars): ... in order to call cmp_nodes correctly. + * interpret.h: Use the enum type in calls to cmp_scalars. + * re.c (re_update): Adjust call to cmp_nodes. + +2016-08-25 Norihiro Tanaka <noritnk@kcn.ne.jp> + + * awk.h (struct Regexp): Remove dfa. Now dfareg instead of it. All + referers changed. + * re.c (research): Arrange caller of dfaexec and research. + * (avoid_dfa): Removed. All callers changed. + * awk.h (avoid_dfa): Removed. + + Other changes by Arnold Robbins: + + * awk.h (struct Regexp): Change various boolean members to bool. + (RE_NO_FLAGS): New #define. + * interpret.h: Use RE_NO_FLAGS instead of zero. + * re.c (research): Prettify the logic a little bit. + +2016-08-25 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. + +2016-08-25 Arnold D. Robbins <arnold@skeeve.com> + + * 4.1.4: Release tar ball made. + +2016-08-23 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h: Sync with grep. API changes. + * dfa.c: Sync with grep. + * re.c (make_regexp): Adjust for API changes, move call to dfasyntax + into stanza that compiles the regex. + (resetup): Call dfa_init. + * node.c (str2wstr): using_utf8 is now called dfa_using_utf8. + + Unrelated: + + * Makefile.am: Quote all uses of $(srcdir) and $(distdir). + (spell): New target. + +2016-08-18 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. + +2016-08-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * int_array.c (is_integer): Fix merge of stable changes to remove + obsolete string formatting check that has been superseded by + the new standard_integer_string check. + +2016-08-14 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (make_regexp): Only call dfasyntax if actually using + dfa. Gives a 14% speedup on this test: https://raw.githubusercontent.com/chadbrewbaker/awka/master/benchmark/regexp.awk. + From blathering in comp.lang.awk. + +2016-08-12 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + + Unrelated: + + * int_array.c: Minor text and formatting edits. + +2016-08-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Add a comment explaining the NUMINT flag in more detail. + * int_array.c (standard_integer_string): New function to test whether + a string matches what would be produced by sprintf("%ld", <value>). + (is_integer): Fix bug -- if NUMBER was set, then the function was + accepting strnum values with nonstandard string representations. We + now call standard_integer_string to check that the string looks OK. + Also added ifdef'ed code to simplify the function by relying upon + force_number to parse the string, but this is disabled due to possible + negative performance impact. + +2016-08-03 Arnold D. Robbins <arnold@skeeve.com> + + Remove typed regexes until they can be done properly. + + * NEWS: Updated. + * awk.h (enum nodevals): Remove Node_typedregex. + (force_string, force_number): Remove check for Node_typedregex. + * awkgram.y (TYPED_REGEXP): Remove token. + (grammar): Remove productions related to typed regexps. + (yylex): Don't find a typed regex or return it. + (valinfo): Remove code for Node_typedregex. + * builtin.c (do_length, do_print, call_sub, call_match, + call_split_func, do_typeof): Remove code for Node_typedregex. + * debug.c (watchpoint_triggered, print_memory): Remove code + for Node_typedregex. + * eval.c (nodetypes, setup_frame): Remove code for Node_typedregex. + * interpret.h (r_interpret): Remove code for Node_typedregex. + * profile.c (pprint): Remove code for Node_typedregex. + (pp_strong_regex): Removed. + (pp_string_or_strong_regex): Remove code for Node_typedregex. + * re.c (re_update): Remove code for Node_typedregex. + +2016-08-01 Arnold D. Robbins <arnold@skeeve.com> + + * README, NEWS: Mark DJGPP port as unsupported. + +2016-08-01 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * mpfr.c (mpg_tofloat): Always set precision to avoid hysteresis effects + from previous calculations using the same temporary mpfr variables. + +2016-08-01 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * mpfr.c (default_prec): Add new static variable to show current PREC + setting in effect. + (init_mpfr, set_PREC): Save mpfr_set_default_prec argument in + default_prec. + (do_mpfr_func): If the argument's precision exceeds the default + precision, boost the result's precision to match it. This fixes a + bug where we used to copy the argument's precision, regardless of + whether it was higher or lower than the PREC setting. + +2016-07-24 Norihiro Tanaka <noritnk@kcn.ne.jp> + + * re.c (research): Now that the dfa matcher correctly runs even + in multibyte locales, try it if even if need_start is true. + However, if start > 0, avoid dfa matcher, since it can't handle + the case where the search starts in the middle of a string. + + Unrelated: + + * eval.c (load_casetable): Reset casetable[i] to `i' if i + should not be mapped to upper case. Fixes inconsistencies between + dfa and regex in some single bytes locales; notably el_GR.iso88597. + +2016-07-23 Arnold D. Robbins <arnold@skeeve.com> + + Make result of close on a pipe match result of system. + Thanks to Mike Brennan for the encouragement. + + * awk.h (sanitize_exit_status): Declare routine. + * builtin.c (sanitize_exit_status): New routine. + (do_system): Use it. + * io.c (close_rp): Use it on pclose result. + (gawk_pclose): Use it. + +2016-07-23 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_print): Improve logic for formatting + numeric values. + +2016-07-19 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * eval.c (set_LINT): Simplify the code considerably. + +2016-07-19 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (shadow_funcs): Change test at end to be + `lintfunc == r_fatal' instead of `lintfunc != warning'. + Thank to Andrew Schorr for the suggestion. + +2016-07-18 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (locale_dir): New variable, init to LOCALEDIR (set by + configure). + (set_locale_stuff): Move calls to bindtextdomain and + textdomain to here; they must be done after calling setlocale. + Use locale_dir instead of LOCALEDIR. + (main): Move call to set_locale_stuff() to before parsing arguments. + Check for GAWK_LOCALE_DIR env var and use it if there. If doing + locale debugging, call set_locale_stuff again if arg parsing changed + the locale. + + Unrelated: + + * dfa.c: Sync with GNU grep. + + Unrelated: + + * config.sub: Updated from GNULIB. + +2016-07-17 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (set_LINT): Reset lintfunc to `warning' for LINT="invalid". + Thanks to Andy Schorr for the report. + +2016-07-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Restore previous comment about unterminated strings, since + I am removing the string termination patches from field.c + (free_api_string_copies): Declare new gawkapi function. + * builtin.c (do_mktime, do_system): Restore temporary string + termination to protect against unterminated field values. + (nondec2awknum): Remove comment about unnecessary termination. + * eval.c (posix_compare): Restore temporary string termination. + * field.c (databuf): Remove struct, no longer needed. + (set_field): Remove memcpy for string termination, since we will support + unterminated field string values. + (rebuild_record): Ditto. Also no need to allocate space for terminated + string copies. + (allocate_databuf): Remove function, since memory management can again + be done inside set_record. + (set_record): Restore inline buffer management logic. + (reset_record): Remove calls to allocate_databuf, since we no longer + need space for making terminated copies of field strings. + * gawkapi.c (free_api_string_copies): New function to free strings + that we made to provide terminated copies to API functions. + (assign_string): New function to convert a string to an awk_value, + making sure to copy it if we need to terminate it. + (node_to_awk_value): Use assign_string to return string values with + NUL termination protection. + * int_array.c (is_integer): Restore temporary string termination. + * interpret.h (Op_push_i): Ditto. + (Op_ext_builtin): After external function returns, call + free_api_string_copies to free temporary string copies. + * mpfr.c (force_mpnum): Restore temporary string termination. + * node.c (r_force_number, get_ieee_magic_val): Ditto. + +2016-07-08 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + + Unrelated: + + * builtin.c (do_print): Coding style change. (This change obsoleted + by earlier changes in the fixtype branch.) + +2016-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Modify comments to indicate that MAYBE_NUM will now be + left enabled to indicate strnum values by the NUMBER|MAYBE_NUM + combination, whereas STRING|MAYBE_NUM indicates a potential strnum. + (fixtype): Modify MAYBE_NUM test to avoid calling force_number if + NUMCUR is already set. + * builtin.c (do_typeof): Call fixtype to resolve argument type. + This forces parsing of numeric strings, so there's a performance + penalty, but we must do this to give a correct result. The meaning + of "strnum" changes from "potential strnum" to "actual strnum". + * eval.c (set_TEXTDOMAIN): Remove some dead code left over from last + patch. + * int_array.c (is_integer): When a MAYBE_NUM is converted successfully + to a NUMBER, leave the MAYBE_NUM flag enabled. + * mpfr.c (mpg_force_number): Ditto. + * node.c (r_force_number): Ditto. + +2016-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Modify stptr comment to indicate that all strings are now + NUL-terminated. + * builtin.c (do_mktime): Remove unnecessary logic to terminate + the string with '\0' temporarily. + (do_system) Ditto. + (nondec2awknum): Add a comment about termination. + * eval.c (posix_compare): Remove logic to terminate strings temporarily. + (set_ORS): No need to terminate ORS, since the string node is already + terminated. What gave us the right to modify that node anyway? + (fmt_index): Remove code to terminate string. This seems to have been + invalid anyway, since we don't own that memory. + (set_TEXTDOMAIN): Do not terminate TEXTDOMAIN string, since the node + is already terminated. We didn't have the right to modify that node + anyway. + * gawkapi.c (node_to_awk_value): Add assert checks to confirm that the + string is NUL-terminated. + * gawkapi.h: Modify awk_string comment to indicate that strings are + always terminated with '\0'. + * int_array.c (isinteger): Remove unnecessary logic to terminate string + with '\0' temporarily. + * interpret.h (Op_push_i): Ditto. + * io.c (nextfile): Remove string termination. We didn't own that memory + anyway. + * mpfr.c (force_mpnum): Remove unnecessary logic to terminate the + string with '\0' temporarily. + * node.c (r_force_number): Remove NUL termination around strtod call, + since we already know that there is either a white space or '\0' + character there. Either one will stop strtod. + (get_ieee_magic_val): Ditto. + * profile.c (pp_number): No need to terminate string returned by + r_format_val. + +2016-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (Op_field_spec): Now that all $n field values are + NUL-terminated, there is no reason to call dupnode for $n where n > 0. + This saves malloc and copying overhead, thereby more than offsetting the + performance hit of the additional copying and NUL-termination in the + last patch to field.c. It also eliminates repeated parsing in cases + where $n, for n > 1, was accessed more than once in a numeric context, + so the new approach should be a performance win. + +2016-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Make sure that all field values, and therefore all strings inside gawk, + are terminated with a '\0' character! + + * field.c (databuf): New static struct to hold info about our buffer to + contain the field string values. + (allocate_databuf): New function to make sure the databuf is large + enough to hold $0 and copies of $1 through $NF. + (set_field): Copy $n into free space previously allocated in databuf + and add a '\0' at the end. + (rebuild_record): Call allocate_databuf to ensure sufficient space + for copying non-malloced field values. When copying field values, + use databuf to create a NUL-terminated copy. + (purge_record): New function extracted from reset_record to initialize + $1 through $NF to null values. + (set_record): Buffer management moved to new allocate_databuf function. + Call purge_record instead of reset_record, since reset_record contains + some extra logic not needed in this case. + (reset_record): Call purge_record to do most of the work, and call + allocate_databuf to make sure we have a big enough buffer to contain + copies of the $1 through $NF. + +2016-07-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Renumber flags to remove gap created when FIELD was removed. + +2016-07-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (rebuild_record): Need to set MALLOC flag if we allocate + memory for a residual field node with valref > 1. + +2016-07-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (rebuild_record): Do not bother to create new field nodes + to replace malloc'ed nodes when rebuilding $0. + +2016-07-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (FIELD): Remove unnecessary flag. + (MALLOC): Move definition to join the others, and improve the comment. + * array.c (value_info): Replace FIELD test with MALLOC test. + * eval.c (flags2str): Remove FIELD flag. + * field.c (init_fields): Remove FIELD bit from Null_field->flags. + (set_field): Remove FIELD bit from flags. + (rebuild_record): Test against MALLOC instead of FIELD. If a field + node has valref > 1, we should make a copy, although I don't think + it is valid for this to happen. + (set_record): Remove FIELD bit from flags. + * interpret.h (UNFIELD): Add comment, and test MALLOC flag instead of + FIELD. Remove probably buggy code to disable the FIELD flag when + valref is 1; that would have created a node where neither the FIELD + nor MALLOC flag was set, which seems invalid. + * node.c (r_dupnode): Remove code disabling FIELD flag. + +2016-07-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (force_string_fmt): New inline function to get the string + representation in a requested format. + (force_string): Reimplement as a macro using force_string_fmt function. + (force_string_ofmt): New macro to get a value's OFMT representation. + * builtin.c (do_print): Use new force_string_ofmt macro instead of + duplicating the logic inline. + +2016-07-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * str_array.c (str_lookup): There is no need to worry about the + MAYBE_NUM flag, since the code has been patched to make sure to + preserve the string value of strnum values, and the integer array + code should no longer mistakenly claim a strnum integer with a + nonstandard string representation. + +2016-07-03 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (rebuild_record): Revert warning message regarding flags, + since I'm not yet totally confident that it is invalid to have FIELD + and MALLOC set at the same time. + +2016-07-03 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * field.c (rebuild_record): Do not turn off the STRING flag when + copying a FIELD node, and issue a warning if MALLOC is enabled. + +2016-07-01 Arnold D. Robbins <arnold@skeeve.com> + + * array.c (value_info): Print something reasonable when stfmt + is -1. + * mpfr.c (mpg_format_val): Don't cast index to char. + * node.c (r_format_val): Ditto. + Thanks to Andrew Schorr for pointing these out. + + Unrelated: + + * gawkapi.c (api_warning): Fix the comment header. + (api_lintwarn): Factor out the call to va_end to after the if. + + Unrelated: + + * symbol.c (get_symbols): Add FUNCTAB and SYMTAB to the list + for the -d option. + * awkgram.y (dump_vars): Allow "-" to mean print to stdout. + Thanks to Hermann Peifer for the reports. + +2016-06-30 Arnold D. Robbins <arnold@skeeve.com> + + * node.c (r_force_number): Coding style change. + +2016-06-30 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (STFMT_UNUSED): New define indicating that the string + representation does not depend on CONVFMT or OFMT. + (force_string): Use STFMT_UNUSED to improve code clarity. + * array.c (value_info): Fix stfmt logic. + * builtin.c (do_print): Use STFMT_UNUSED to improve code clarity. + * field.c (set_record): Ditto. + * gawkapi.c (api_sym_update_scalar): Ditto. + * int_array.c (is_integer): Check stfmt equals STFMT_UNUSED before + bothering to inspect the string. + * mpfr.c (mpg_format_val): Use STFMT_UNUSED to improve code clarity. + Remove buggy cast to char in stfmt assignment. + * node.c (r_format_val): Ditto. + * str_array.c (str_lookup): Use STFMT_UNUSED to improve code clarity. + * symbol.c (check_param_names): Ditto. + +2016-06-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_force_number): Optimize by trimming leading and trailing + white space before we inspect the string contents. + (get_ieee_magic_val): Must terminate the string with '\0' before + calling strtod. + +2016-06-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_string): Add comment about the potential lack of + NUL-termination. + +2016-06-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Add a comment regarding the potential lack of NUL-termination + for Node_val strings. + +2016-06-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_format_val): Do not free stptr unless STRCUR is set. + This is safer than testing for non-NULL stptr, since, for example, + pp_number copies a node and calls r_format_val, but does not bother + to set stptr to NULL beforehand. + +2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_force_number): When checking for trailing spaces, protect + against running off the end of the string. + * mpfr.c (force_mpnum): Ditto. + +2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_print): There's actually no reason to test whether a + value is a number, since the STRCUR flag and stfmt value contain all + the necessary info, as in awk.h:force_string. + +2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_print): Do not use OFMT to print strnum values. We + accomplish this by calling format_val for a NUMBER only + if there is no string currently available, or if stfmt equals + neither -1 nor OFMTidx. + +2016-06-26 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Edit some comments. Add others. Minor coding style changes. + * builtin.c (format_tree): Restore a comment. + (do_mktime): Restore saving/restoring of byte after format string. + (do_sub): Coding style. Use %.*s in warning message. + (nondec2awknum): Restore saving/restoring of byte after string value + being converted. + * eval.c: Minor coding style edits. + * int_array.c (is_integer): Fix order of checks for not + updating string value: check length == 0 before testing values. + Coding style edits. + * mpfr.c (do_mpfr_strtonum): Coding style edits. + * node.c (r_force_number): Restore saving/restoring of byte after + string value being converted. Edit comments some. + +2016-06-26 Arnold D. Robbins <arnold@skeeve.com> + + Repair change of 2015-08-25 to handling of MAYBE_NUM. + * mpfr.c (mpg_force_number): Just clear MAYBE_NUM. + * node.c (r_force_number): Clear STRING separately after + setting NUMBER. + + Thanks to Andrew Schorr for reporting the problem. + A test case will eventually be merged into master. + + Only in stable and master. + +2016-06-20 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_strftime): Call fixtype before checking flags for + STRING type. + (do_print): Call fixtype before checking whether argument is a NUMBER. + * eval.c (set_BINMODE): Call fixtype before checking value type. + No need to call force_number if the flags say it's a number. + (r_get_field): Fix lint check for non-numeric argument. + * io.c (redirect): Call fixtype before checking whether it's a string. + +2016-06-18 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_force_number): Fix typo in comment. + +2016-06-16 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Add comment headers for several functions. + * builtin.c (nondec2awknum): Actually set a '\0' before + calling to strtod() so that the save and restore do something. + +2016-06-15 Arnold D. Robbins <arnold@skeeve.com> + + * config.sub: Update from GNULIB. + +2016-06-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (boolval): New inline function to standardize testing whether + a node's value is true. + * builtin.c (do_strftime): Use boolval to handle 3rd argument. + * eval.c (set_IGNORECASE, eval_condition): Use new boolval function. + * io.c (pty_vs_pipe): Use new boolval function. + +2016-06-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_strftime): Fix handling of 3rd argument to work + as a standard boolean: non-null or non-zero. + +2016-06-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (node_to_awk_value): When caller requests AWK_SCALAR + or AWK_UNDEFINED, we need to call fixtype before we check the type. + +2016-06-13 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y: Eliminate STRCUR tests. Must use STRING to test whether + a scalar is a string. + +2016-06-12 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h: Improve comment about STRING and NUMBER type assignment. + (nondec2awknum): Add endptr argument. + (fixtype): New inline function to clarify a scalar's type. + * array.c (sort_up_value_type): Call fixtype before checking the value + types. + * awkgram.y (yylex): Pass NULL endptr argument to nondec2awknum. + (valinfo): Remove dead tests: either STRING or NUMBER or both + must be set, so there's no reason to continue with checks for NUMCUR or + STRCUR. + * builtin.c (do_exp, do_int, do_log, do_sqrt, do_sin, do_cos, do_srand): + Fix lint check for non-numeric argument. + (do_string): Fix lint check for 1st and 2nd args being strings. + (do_length): Fix assert to allow for Node_typedregex. + Fix lint check for non-string argument. + (format_tree): Fix type detection for '%c' arguments. + (do_strftime): Fix lint check for non-numeric 2nd argument and + lint check for non-string 1st argument. + (do_mktime): Fix lint check for non-string argument. Eliminate useless + logic to save and restore terminating NUL. + (do_system, do_tolower, do_toupper): Fix lint check for non-string + argument. + (do_atan2, do_lshift, do_rshift, do_and, do_or, do_xor, do_compl, + do_intdiv): Fix lint checks for non-numeric args. + (do_sub): Attempt to clean up treatment of 3rd argument to gensub + despite vague documentation of expected behavior. + (do_strnum): Fix bug in number detection logic, and pass new endptr + arg to nondec2awknum. + (nondec2awknum): Add endptr argument so caller can detect how much + of the string was consumed. Eliminate unnecessary logic to save + and restore terminating NUL char. + (do_typeof): Use a switch to specify which cases are supported, and + issue a warning message when a corrupt type is detected. + * debug.c (print_memory): At least one of NUMBER and STRING should + be set, so no need to check for NUMCUR or STRCUR in addition. + * eval.c (cmp_nodes): Use fixtype function to fix arg types. + (set_IGNORECASE): Fix logic for acting on value type. Note that + setting IGNORECASE to a string value of "0" with NUMCUR set now enables + ignorecase, so that's a subtle change in behavior that seems to match + the docs. + (set_LINT): Try to clean up configuration logic based on type. + * ext.c (get_argument): Remove unused variable pcount. + * gawkapi.c (node_to_awk_value): Remove pointless test for NUMCUR + after calling force_number. Similarly, no need to test for STRCUR + after calling force_string. + * int_array.c (is_integer): Reject cases where a string value is + present that will not be correctly regenerated from the integer; + in particular, this could happen where blank space padding is present, + leading zeroes are present, or for hex or octal values. + Also fix some bugs where a strnum was converted to a NUMBER without + turning off the STRING bit. + * io.c (redirect_string): Make lint warning message more accurate. + (redirect): Change not_string test to use STRING bit, not STRCUR. + (pty_vs_pipe): Use fixtype to correct logic for detecting whether a + value is anumber. + * mpfr.c (mpg_force_number): If NUMCUR is set, there's no need to + test is_mpg_number. If it's not, the NODE is corrupt and we've got + bigger problems. Fix flag manipulation logic. Always set NUMCUR and + clear MAYBE_NUM, + (set_PREC): Fix logic using fixtype function. + (do_mpfr_atan2, do_mpfr_intdiv): Fix lint check for non-numeric + arguments. + (do_mpfr_func, do_mpfr_int, do_mpfr_compl, get_intval, do_mpfr_srand): + Fix lint check for non-numeric argument. + (do_mpfr_strtonum): Use fixtype and stop testing for NUMCUR bit. + * node.c (r_force_number): Eliminate pointless save and restore of + terminating NUL char. Always set NUMCUR and clear MAYBE_NUM, and + convert STRING to NUMBER if appropriate, fixing bugs in flag + manipulations. For non-decimal data, need to consider whether there + is trailing non-numeric data in deciding whether a MAYBE_NUM should + be converted to a NUMBER, so take advantage of new endptr arg + to nondec2awknum. + +2016-06-14 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Fix sub for long runs of backslashes. + Thanks to Mike Brennan for the report. + + Unrelated: + * ext.c (get_argument): Remove unused variable pcount. + +2016-06-10 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Get latest from Gnulib master. + * main.c (UPDATE_YEAR): Bump to 2016. + +2016-06-09 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + + Unrelated: + + * configure.ac: Move AM_CONDITIONAL[ENABLE_EXTENSIONS] outside + the enclosing if. Thanks to Assaf Gordon <assafgordon@gmail.com> + for the report. + +2016-06-08 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (lookup): If got Node_val, it's a non-variable + in SYMTAB, return NULL. Can affect watchpoints in the debugger, + maybe other places. Thanks to Hermann Peifer for the + test case and report. + +2016-06-05 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2016-06-01 Arnold D. Robbins <arnold@skeeve.com> + + * nonposix.h (getpgrp): Wrap declaration in ifdef so it doesn't + mess things up on POSIX systems (like Solaris). Thanks to + Nelson Beebe for the report. + * node.c (is_hex): New function to check for 0x preceded by + optional sign. + (r_force_number): Use it. Thanks to Mike Brennan for the report. + +2016-05-30 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_ext_func_t): Rename num_expected_args to + max_expected_args, and explain in the comment that it doesn't really + matter. + * ext.c (make_builtin): Replace num_expected_args with + max_expected_args. + (get_argument): Do not check whether the argument number exceeds + the maximum expected by the function. + +2016-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (arg_assign): Fully bracket ifdefs around call + to force_number. Thanks to Andrew Schorr for pointing out + that force_number was called only if LC_NUMERIC was defined. + + Lots of files: Update copyright date. + + * field.c (set_FS): Handle FS = "\0" if RS = "". Thanks to + Janis Papanagnou for the report. + + * getopt.c, getopt.h, getopt1.c, getopt_int.h: Sync with GLIBC. + +2016-05-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (get_actual_argument): Remove unused "optional" argument. + (get_scalar_argument, get_array_argument): Change macro definition to + remove 3rd "optional" argument. + * ext.c (get_actual_argument): Remove unused "optional" argument. + * gawkapi.c (api_get_argument, api_set_argument): Remove unused final + argument to get_array_argument and get_scalar_argument. + +2016-05-26 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h [fatal]: Make parentheses and use of indirection + consistent with warning and lintwarn. Thanks to Andrew Schorr + for pointing this out. + * str_array.c (str_lookup): Move test for MAYBE_NUM to where + we duplicate the subscript. Removing it across the board is + wrong if there are multiple references to the value. Thanks + to Andrew Schorr for discussion and test case. + +2016-05-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (get_actual_argument): Add an initial argument containing + the (NODE *) previously returned by get_argument. This allows us to + eliminate a call to get_argument from inside get_actual_argument. + (get_scalar_argument, get_array_argument): Change macro definition to + add an initial node argument to pass through to get_actual_argument. + * ext.c (get_actual_argument): Add initial (NODE *) argument to contain + the value previously returned by get_argument. This allows us to + avoid repeating the call to get_argument. We can also eliminate the + check for a NULL value, since the caller did that already. + * gawkapi.c (api_get_argument): Pass (NODE *) returned by get_argument + to get_array_argument and get_scalar_argument. + (api_set_argument): Pass (NODE *) returned by get_argument to + get_array_argument. + +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. + Bug reported by Andres Legarra <Andres.Legarra@toulouse.inra.fr>. + + Unrelated: Fix issues with SIGPIPE. Reported by + Ian Jackson <ijackson@chiark.greenend.org.uk>. + + * builtin.c (do_system): Reset/restore SIGPIPE to/from default around + call to system. + * io.c (redirect, gawk_popen [PIPES_SIMULATED]): Same. + +2016-05-12 Eli Zaretskii <eliz@gnu.org> + + * nonposix.h: Add prototypes for POSIX functions emulated in pc/* + files. + +2016-05-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (r_interpret): Op_ext_builtin. No need to test whether + op == Op_ext_builtin, since we wouldn't be here otherwise. + +2016-05-03 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (format_tree): Do not waste a byte at the end of a string. + +2016-05-03 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (format_tree): After the string has been rendered, use + realloc to shrink the buffer to the needed size. Otherwise, the minimum + buffer size of 512 bytes can result in lots of wasted memory if many + sprintf results are stored in an array. + +2016-05-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (gawk_api_major_version, gawk_api_minor_version): Add + CPP #define values to support conditional compilation. + +2016-05-02 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c: Sync with grep. + * re.c (research): Adjust type of try_backref. + +2016-05-02 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (success_node): Declare. + * array.c (success_node): Define. + * cint_array.c, int_array.c, str_array.c: Use `& success_node' + instead of `(NODE **) ! NULL' to indicate success throughout. + Thanks to Pat Rankin for the cleanup suggestion. + +2016-04-27 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (set_RS): Use rs1scan if do_traditional, even if length + of RS is > 1. Bug reported by Glauco Ciullini + <glauco.ciullini6245@gmail.com>. + +2016-04-24 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2016-04-11 Arnold D. Robbins <arnold@skeeve.com> + + * regex_internal.c: Replace _GL_ATTRIBUTE_PURE with + __attribute__. + +2016-04-11 Arnold D. Robbins <arnold@skeeve.com> + + * regexec.c: Stamp out last remaining use of __attribute. + * regcomp.c: Undo change of 2016-01-24 when parsing single-byte + ranges. Go back to treating them as bytes and not as characters. + The change broke things on Windows in non-UTF-8 character sets. + * mbsupport.h (mbstate_t): Define to int. + Update copyright. + +2016-04-10 John E. Malmberg <wb8tyw@qsl.net> + + * regex_internal.c: Use _GL_ATTRIBUTE_PURE macro + +2016-04-07 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (two_way_close_type): Move here from io.c. + (close_rp): Add declaration. + * builtin.c (do_printf): Call close_rp before fatal message when + attempting to write the closed write end of a two way pipe. + (do_print): Ditto. + (do_print_rec): Ditto. + * io.c (do_getline_redir): Same, for reading closed read end. + (close_rp): Make not static. + +2016-04-07 Eli Zaretskii <eliz@gnu.org> + + * nonposix.h (WEXITSTATUS, WIFEXITED, WIFSIGNALED, WTERMSIG) + (WIFSTOPPED, WSTOPSIG) [__MINGW32__]: New macros to replace the + missing header sys/wait.h. + (w32_status_to_termsig): Add prototype. + + * builtin.c (do_system) [__MINGW32__]: Compute the exit status of + 'system' differently under --traditional, as the low 8 bits are + the most interesting. + +2016-04-06 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_printf): Allow a write to the closed write-end of + a two-way pipe to be nonfatal if NONFATAL is set for it. + (do_print): Ditto. + (do_print_rec): Ditto. + * io.c (do_getline_redir): Same thing for reading from a closed + read end of a two-way pipe. Fatal error. + +2016-04-04 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_fflush): Add warning for flush to two-way + pipe where write end was closed. + * io.c (flush_io): Add some braces for the for loop. + +2016-04-02 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_printf): If the redirection is two way but the + fp is NULL, it means we're writing to the closed write-end of + a two-way pipe. Issue a fatal error message. + (do_print): Ditto. + (do_print_rec): Ditto. + * io.c (do_getline_redir): Same thing for reading from a closed + read end of a two-way pipe. Fatal error. + * NEWS: Updated. + +2016-03-27 Stephen Davies <sdavies@sdc.com.au> + + * awkgram.y (get_comment): Strip CRs from comment. Strip + off trailing newlines. + +2016-03-21 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pprint): Improve handling of comment after + and if statement without an else. + +2016-03-19 Arnold D. Robbins <arnold@skeeve.com> + + Considerable improvements to handling of comments when pretty + printing, particularly for end-of-line comments. + + * awkgram.y (prior_comment, comment_to_save): New variables. + (add_pending_comment): New function. + (grammar): Jump through lots more hoops to capture comments. + Due to shift-reduce parsing, there can be up to two comments + captured and waiting to be saved; be sure to get them both and + at the right times. This is difficult since comments have no + real syntactic existence. Call add_pending_comment on most of + the simple statements. + (get_comment): Save a pre-existing comment in prior_comment. + (split_comment): Use comment_to_save instead of `comment'. + * profile.c (end_line): Change to return the instruction after + the comment that gets printed; adjust return type. + (pprint): Add skip_comment static variable. Adjust logic for + skipping an end-of-line comment; only do it if skip_comment is + true. This is set to true in places where we can't use the + return value from end_line(). Call end_line() in many more places. + (pp_func): Handle end-of-line comments after a function header. + +2016-03-17 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_instruction): For Op_comment, improve notation as + to whether it's a full comment or an end of line comment. + +2016-03-14 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (socketopen): For SOCK_DGRAM, set read_len to sizeof + remote_addr. Makes UDP more or less work again. + Thanks to Juergen Kahrs for the fix. + +2016-03-11 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_instruction): Normalize printing of comment dump. + +2016-03-10 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_system): Further improvements. Catch core dump + flag. + +2016-03-11 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_system): Improve return values of system(). + +2016-03-08 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (print_instruction): Fix duplicate case not caught + by TinyCC. Grrr. + +2016-03-07 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (print_instruction): Further improvements in + instruction dump, especially for when pretty-printing. + * builtin.c (do_system): Augment the logic for the return + value so that death-by-signal info is available too. + +2016-03-03 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_list): Unconditionally compute delimlen. Avoids + compiler warning. + +2016-03-02 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_instruction): Improvements in instruction dump + for if and else. + +2016-03-01 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_instruction): For Op_comment, add notation as + to whether it's a full comment or an end of line comment. + +2016-02-29 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_list): Handle the case of nargs equal to zero. + Thanks to Hermann Peifer for the report. + +2016-02-28 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pprint): Fix copy-paste error in else handling. + Thanks to Michal Jaegermann for the report. + +2016-02-23 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.rpath, config.sub: Update to latest + from GNULIB. + +2016-02-23 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Update full list of infrastructure tools. + +2016-02-22 gettextize <bug-gnu-gettext@gnu.org> + + * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.7. + +2016-02-21 Nelson H.F. Beebe <beebe@math.utah.edu> + + * random.c [SHUFFLE_BITS, SHUFFLE_MAX, SHUFFLE_MASK]: New macros. + (shuffle_init, shuffle_buffer): New static variables. + (random_old): Renamed from random. + (random): New function wrapping random_old and providing a + shuffle buffer to increase the period. See the literature citations + and other notes in the code. + +2016-02-21 Arnold D. Robbins <arnold@skeeve.com> + + * regexec.c (prune_impossible_nodes): Remove attribute that + keeps it from compiling with 32 bit GCC. Who the heck knows + why or how. Sigh. Double sigh. + +2016-02-20 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h, + regexec.c: Sync with GLIBC, mostly prototype changes. + +2016-02-18 Arnold D. Robbins <arnold@skeeve.com> + + Fix profile / pretty-printing to chain else-ifs. + + * profile.c (pprint): Change third argument into a set of flags + for in the for header or in an else if. Adjust case Op_K_else to + make the right checks and format the code properly. In Op_K_if + clear the flag so that any following else gets indented properly. + Adjust all calls. + +2016-02-14 Arnold D. Robbins <arnold@skeeve.com> + + * README, NEWS: Updated to reflect use of Texinfo 6.1. + + Unrelated: + + * configure.ac: Switch to AC_PROG_CC_C99 to enable C99 + compilation and features. + * dfa.c: Sync with GNU grep, go back to C99 style declarations + at point of use. + +2016-02-05 Arnold D. Robbins <arnold@skeeve.com> + + Make optimization (constant folding and tail call recursion) + be on by default. + + * awkgram.y (common_exp): Only do concatenation of two strings(!) + * main.c (do_optimize): Init to true. + (optab): Add new -s/--no-optimize option. + (usage): Update message to include it. + (parse_args): Parse it. Set do_optimize to false if pretty + printing or profiling. + * NEWS: Updated. + +2016-01-28 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (SUBDIRS): Include extras. Otherwise dist does + doesn't work. + +2016-01-27 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (GAWK_AC_AIX_TWEAK): Remove call. + * configure: Regenerated. + * io.c (GAWK_AIX): Check _AIX instead. + * custom.h (_AIX): Add define of _XOPEN_SOURCE_EXTENDED. + + Unrelated: + + * configure.ac: Remove old stuff for ISC Unix, no longer needed. + * configure: Regenerated. + +2016-01-25 John E. Malmberg <wb8tyw@qsl.net> + + * io.c (redirect): Need to call close_one more than once after + running out of file handles. + +2016-01-25 Arnold D. Robbins <arnold@skeeve.com> + + * NEWS: Document VMS support updated. + +2016-01-24 Arnold D. Robbins <arnold@skeeve.com> + + Regex: treat [x] as x if x is a unibyte encoding error. + This change removes an ifdef GAWK. + + * regcomp.c (parse_byte) [ !_LIBC && RE_ENABLE_I18N]: New function. + (build_range_exp) [ !_LIBC && RE_ENABLE_I18N]: Use it. + From Paul Eggert <eggert@cs.ucla.edu>. + +2016-01-22 Arnold D. Robbins <arnold@skeeve.com> + + * regexec.c (prune_impossible_nodes): Remove all attributes, on + both declaration and definition. Fixes a Linux Mint 17 compilation + braino reported by Antonio Colombo. + * regex_internal.h (test_malloc): Add cast to silence a warning + on the same system. + (test_realloc): Ditto. + +2016-01-20 Arnold D. Robbins <arnold@skeeve.com> + + * regex_internal.h [attribute_hidden]: Remove definition. + * regcomp.c [attribute_hidden]: Remove uses. Not needed since + the variables are static. Thanks to Paul Eggert for pointing + this out. + +2016-01-18 Paul Eggert <eggert@cs.ucla.edu> + + Diagnose ERE '()|\1' + Problem reported by Hanno Boeck in: http://bugs.gnu.org/21513 + + * lib/regcomp.c (parse_reg_exp): While parsing alternatives, keep + track of the set of previously-completed subexpressions available + before the first alternative, and restore this set just before + parsing each subsequent alternative. This lets us diagnose the + invalid back-reference in the ERE '()|\1'. + + Unrelated: General minor cleanups (spelling, code) from Gnulib: + + * regex.h, regex_internal.c, regex_internal.h, regexec.c: Minor + cleanups. + +2016-01-14 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (r_get_lhs): If original array was Node_var_new, + assign value that is dupnode of Nnull_string and not + Nnull_string directly. Fixes core dump reported by + ruyk <Lonely.ruyk@mail.ru>. + + Unrelated: + + * ChangeLog: Cleanup spurious extra whitespace. + +2016-01-03 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (GAWK_AC_LINUX_ALPHA): Remove call. + * configure: Regenerated. + * NEWS: Document removal of support for GNU/Linux on Alpha. + +2016-01-02 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (add_utf8_anychar): Minor change in declaration of + utf8_classes to keep Tiny CC happy. Also syncs with grep. + * dfa.h: Sync with grep (update copyright year). + +2015-12-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (mk_condition): Revise to correctly handle + empty else part for pretty printing. Bug report by + ziyunfei <446240525@qq.com>. + +2015-12-20 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (nonfatal): New static constant string. + * is_non_fatal, is_non_fatal_redirect: Use it. + +2015-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (two_way_open): Remove unneeded close of slave in the + parent. + +2015-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_number): Move count into ifdef for MPFR. Avoids + an unused variable warning if not compiling for MPFR. + + Unrelated: + + * io.c (two_way_open): If using a pty instead of pipes, open the + slave in the child. Fixes AIX and doesn't seem to break GNU/Linux. + +2015-11-26 Arnold D. Robbins <arnold@skeeve.com> + + * command.y (cmdtab): Add "exit" as synonym for "quit". + Suggested by Joep van Delft <joepvandelft@xs4all.nl>. + * NEWS: Document this. + +2015-11-24 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (debug_pre_execute): Fix to check watchpoints before + checking breakpoints. Gives more natural behavior for the user. + * NEWS: Document this. + Issue reported by Joep van Delft <joepvandelft@xs4all.nl>. + +2015-10-28 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (nextc): Don't allow '\0' even if check_for_bad + is false. Fixes a problem reported by Hanno Boeck <hanno@hboeck.de>. + + Unrelated: + + * dfa.c: Sync with GNU grep. + +2015-10-25 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Fix invalid write problems. + Reported by Hanno Boeck <hanno@hboeck.de>. + Only appeared in master. Harumph. + +2015-10-16 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (SUBDIRS): Fix ordering so that + make check directly after configure works properly. + Thanks to Michal Jaegermann <michal.jnn@gmail.com> + for the report. + + Unrelated: + + * dfa.c: Sync with GNU grep. + +2015-10-11 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Fix invalid read problems. + Reported by Hanno Boeck <hanno@hboeck.de>. + +2015-10-04 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Bump version to 4.1.3a. + +2015-09-26 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Diagnose multidimensional arrays for + traditional/posix (fatal) or lint. Thanks to Ed Morton + for the bug report. + +2015-09-25 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub, config.rpath: Updated. + +2015-09-18 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (fpat_parse_field): Always use rp->non_empty instead + of only if in_middle. The latter can be true even if we've + already parsed part of the record. Thanks to Ed Morton + for the bug report. + +2015-09-11 Daniel Richard G. <skunk@iSKUNK.ORG> + + * regcomp.c: Include strings.h, wrapped in ifdef. Revise + defines for BTOWC. + * regex_internal.h: Remove ZOS_USS bracketing ifdefs. + +2015-09-04 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_num): Use format_val to print integral values + as integers. Thanks to Hermann Peifer for the report. + +2015-08-28 Daniel Richard G. <skunk@iSKUNK.ORG> + + * Makefile.am, configure.ac: Use an Automake conditional to + enable/disable the "extensions" subdirectory instead of + producing a stub Makefile therein from the configure script. + * awk.h, custom.h, regex_internal.h: Removed z/OS-specific code + that is no longer needed due to improvements in Gawk's general + Autotools support. + * awk.h: Allow <strings.h> to be #included together with + <string.h> as this is required on some systems (z/OS). + * io.c, configure.ac: <sys/select.h> is needed for select() + and related bits on z/OS. + * awk.h: Handle the redefinition of EXIT_FAILURE on z/OS in a + more elegant/general way. + * awkgram.y, command.y, configure.ac, eval.c, + helpers/testdfa.c: Define and use the USE_EBCDIC cpp symbol + instead of checking the value of 'a' whenever we want to know + if we're on an EBCDIC system. Also, don't assume that z/OS + necessarily means EBCDIC, as the compiler does have an ASCII + mode (-qascii). + * awkgram.y, command.y, configure.ac: On EBCDIC systems, + convert singleton EBCDIC characters in the input stream to + ASCII on the fly so that the generated awkgram.c/command.c in + the distributed sources can be used, i.e. we don't have to + require the user to build Bison and re-generate those files + themselves. This implementation uses a z/OS-specific function + (__etoa_l()) to do the conversion, but support for other + systems can be added in the future as necessary. + * io.c: No need to protect this block of "#if + defined(HAVE_TERMIOS_H)" code from z/OS; it works just fine + there. + * configure.ac: Check for the "struct passwd.pw_passwd" and + "struct group.gr_passwd" fields and conditionalize their use, + as they don't exist on z/OS. Needed for doc/gawktexi.in. + +2015-08-25 Arnold D. Robbins <arnold@skeeve.com> + + * node.c (str2wstr): Upon finding an invalid character, if + using UTF-8, use the replacement character instead of skipping + it. Helps match() and other functions work better in the face + of unexpected data. Make the lint warning an unconditional + warning. + + Unrelated: + + * awk.h: Add explanatory comment on the flags related to + types and values. + * mpfr.c (mpg_force_number): If setting NUMBER, clear STRING also + when clearing MAYBE_NUM. + (set_PREC): Check STRCUR instead of STRING. + * node.c (r_force_number): If setting NUMBER, clear STRING also + when clearing MAYBE_NUM. + +2015-08-15 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (dfamust): Restore c90 compat by moving some + variable declarations to the top of the routine. + +2015-08-12 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. Yet again, again. + +2015-08-02 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. Yet again. + +2015-07-21 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2015-07-18 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2015-07-08 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c: Sync with GNU grep. + +2015-06-29 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): If gawk extension function is found as + a function in a user-defined function body, treat it normally. + Makes eval "print and(a, 1)" work in the debugger again. + Thanks, yet again, to Hermann Peifer. + * interpret.h (r_interpret): Op_subscript. UPREF if the + element value is a typed regexp. Thanks to Hermann Peifer. + +2015-06-28 Arnold D. Robbins <arnold@skeeve.com> + + Improve memory tracking of typed regexps. + + * awkgram.y (make_regnode): Set valref to 1. + * interpret.h (r_interpret): Have Op_push_re upref typed regexp. + * builtin.c (do_typeof): OK to deref typed regex. + * awk.h (force_string): Do dupnode on the regexp text. + +2015-06-26 Arnold D. Robbins <arnold@skeeve.com> + + Remove support for old-style extensions. + + * awk.h (Node_old_ext_func, Op_old_ext_func): Removed. + Remove all uses throughout the code. + (load_old_ext, make_old_builtin): Remove declarations. + * ext.c (load_old_ext, make_old_builtin): Removed. + * awkgram.y (tokentab): Remove "extension" entry. + * eval.c (Node_old_ext_funci, Op_old_ext_func): Remove from tables. + * interpret.h (interpret): Remove stuff for old extensions. + + Unrelated: + + * builtin.c (do_typeof): Add support for strnum, distinguish + untyped from unassigned, use "string" and "number". Thanks to + Hermann Peifer for suggesting inclusion of strnum. + +2015-06-25 Arnold D. Robbins <arnold@skeeve.com> + + Further work straightening out memory management for typeof. + + * awk.h (DEREF): Add an assert. + * builtin.c (do_typeof): Add comments, cases where not to deref. + * debug.c (print_instruction): Add Op_push_arg_untyped. + * interpret.h (r_interpret): Additional comments / tweaks for + Op_push_arg_untyped. + + Unrelated. Make `x = @/foo/ ; print x' print something. + + * builtin.c (do_print): Check for Node_typedregex and handle it. + Needed for adding test code. + + Unrelated. Typo fix. + + * debug.c (initialize_watch_item): Dupnode the right thing. + +2015-06-22 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (snode): Make isarray not scalarize untyped parameters + also. + * profile.c (pprint): Add Op_push_arg_untyped. + + Improve debugger support for typed regexps. + Thanks to Hermann Peifer for the bug report. + + * awkgram.y (valinfo): Add support for Node_typedregex. + * debug.c (watchpoint_triggered): Handle Node_typedregex. + (initialize_watch_item): Ditto. + (print_memory): Ditto. + + Fix typeof to work on subarrays. Thanks, yet again, to + Hermann Peifer for the bug report. + + * builtin.c (do_typeof): Don't deref Node_var_array. + +2015-06-21 Arnold D. Robbins <arnold@skeeve.com> + + Fixes for typeof - Don't let typeof change an untyped variable + into a scalar. + + * awk.h (opcodeval): Add Op_push_arg_untyped. + * awkgram.y (snode): Separate out case for do_typeof, use + Op_push_arg_untyped. + * builtin.c (do_typeof): Arg will be equal to Nnull_string + if it's untyped. + * eval.c (optypes): Add Op_push_arg_untyped. + * interpret.h (r_interpret): Add Op_push_arg_untyped handling. + +2015-06-19 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_isarray): Minor edit to lint warning. + * TODO: Updated. + +2015-06-14 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c, regex_internal.h, regexec.c: Sync with GLIBC. + + Unrelated: + + * regex_internal.c, regexec.c: __attribute --> __attribute__. + + Related: + + * regex_internal.h: Clean up defines for non-GCC for attribute; + essentially sync it with GLIBC. + +2015-06-12 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Finish converting "hard" regex to "typed" regex. + +2015-05-31 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (posix_def_parse_field): Removed. It's no longer + needed after updates to the POSIX standard. Thanks to + Michael Klement <michael.klement@usa.net> for pointing this out. + +2015-05-26 Paul Eggert <eggert@Penguin.CS.UCLA.EDU> + + * floatcomp.c (count_trailing_zeros): New function. + This compiles to a single TZCNT instruction on the x86-64. + (adjust_uint): Use it to keep more high-order bits when + some of the lowest-order bits are zero. This implements + the documented behavior: "If the result cannot be represented + exactly as a C 'double', leading nonzero bits are removed one by + one until it can be represented exactly." + +2015-05-26 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c: Fix offsets so error messages come out correct + once again. + +2015-05-19 Arnold D. Robbins <arnold@skeeve.com> + + * 4.1.3: Release tar ball made. + +2015-05-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * symbol.c (load_symbols): Plug minor memory leak by calling unref(tmp) + on "identifiers" string after assoc_lookup is done with it. + +2015-05-15 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * main.c (load_procinfo_argv): New function to save argv array values + in PROCINFO["argv"][0..argc-1]. + (load_procinfo): Call load_procinfo_argv. + +2015-05-11 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h, awkgram.y, builtin.c, eval.c profile.c, re.c: + Change Node_hardregex to Node_typedregex everywhere. + +2015-05-05 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Yet Another Fix for parsing bracket + expressions. Thanks yet again to Andrew Schorr. Maybe it's + even finally nailed down now. + + Unrelated: + + * config.guess, config.sub: Get latest versions. + + Make profiling for hard regexes work. + + * profile.c (pp_string_or_hard_regex): Renamed from pp_string. + Add bool param for hard regex and add @ if so. + (pp_string): New function, calls pp_string_or_hard_regex. + (pp_hard_regex): New function, calls pp_string_or_hard_regex. + (pprint): Adjust to print a hard regex correctly. + +2015-05-01 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Make sure values are not null in param list. + Avoids core dump for `function f(func, a) {}'. Thanks to + Tibor Palinkas <libmawk@igor2.repo.hu>. + +2015-04-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am: Take --program-prefix into account when + installing/uninstalling the symlinks, especially 'awk'. + Thanks to Steffen Nurpmeso <sdaoden@yandex.com> for + the report. + + Unrelated: + + * awkgram.y (yylex): Yet Another Fix for parsing bracket + expressions. Thanks again to Andrew Schorr. + +2015-04-29 Arnold D. Robbins <arnold@skeeve.com> + + * 4.1.2: Release tar ball made. + +2015-04-28 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (isarray): Add lint warning that isarray() + is deprecated. + +2015-04-28 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Rework the bracket handling from zero. + Thanks to Michal Jaegermann for yet another test case. + + Unrelated: + + * eval.c (setup_frame): Restore call-by-value for $0. This was + necessitated by the changes on 2014-11-11 for conserving + memory use. Thanks to Andrew Schorr for the report and isolating + the cause of the problem. + +2015-04-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Make change of Jan 7 for parsing regexps + work better. Thanks to Nelson Beebe. + +2015-04-26 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. + +2015-04-16 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_strftime): For bad time_t values, return "". + +2015-04-16 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * node.c (r_force_number): If strtod sets errno, then force the + numeric value in node->numbr to zero. For subnormal values, strtod + sets errno but does not return zero, and we don't want to retain + those subnormal values. + +2015-04-16 Arnold D. Robbins <arnold@skeeve.com> + + Let parameter names shadow the names of gawk additional built-ins. + Make it actually work. + + * awkgram.y (want_param_names): Now an enum, there are three states. + (grammar): Set states properly. + (yylex): Improve checking logic. + +2015-04-16 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Updated by autoupdate. + * configure, aclocal.m4: Regenerated. + * io.c, main.c, profile.c: Removed use of RETSIGTYPE. + +2015-04-16 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_strftime): Use a double for the timestamp and + check that the value is within range for a time_t. + + Unrelated: + + * regex_internal.h (test_malloc, test_realloc): Use %lu in printf + format for error messages. Thanks to Michal Jaegermann for + pointing this out. + + Unrelated: + + * NEWS: Updated. + +2015-04-15 Arnold D. Robbins <arnold@skeeve.com> + + Let parameter names shadow the names of gawk additional built-ins. + + * awkgram.y (want_param_names): New variable. + (yylex): Check it before returning a built-in token. + (grammar): Set and clear it in the right places. + +2015-04-14 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_strftime): Restore checking for negative result and + add check that time_t is > 0 --- means we're assigning a negative value + to an unsigned time_t. Thanks again to Glaudiston Gomes da Silva + <glaudistong@gmail.com>. + + If localtime() or gmtime() return NULL, return a null string. + Thanks to Andrew Schorr. + + Unrelated: + * builtin.c (call_sub): Fix for indirect gensub, 3 args now works. + + Unrelated: + + * builtin.c (do_sub): Improve some variable names for readability + and add / expand some comments. + + Unrelated: + + * builtin.c (call_sub, call_match, call_split_func): Allow for + regex to be Node_hardregex. + +2015-04-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Make computations smarter; initial len + to malloc, test for final amount after all matches done and + need to copy in the final part of the original string. + +2015-04-13 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c (analyze): Prevent malloc(0). + * regex_internal.h (test_malloc, test_realloc): New functions + that check for zero count. + (re_malloc, re_realloc): Adjust to call the new functions for gawk. + * regexec.c (build_trtable, match_ctx_clean): Replace malloc/free + with re_malloc/re_free. + + Unrelated: + + * builtin.c (do_strftime): Disable checking timestamp value for less + than zero. Allows times before the epoch to work with strftime. + Thanks to Glaudiston Gomes da Silva <glaudistong@gmail.com> + for raising the issue. + +2015-04-12 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (efence): Make this link again. + Thanks to Michal Jaegermann for pointing out the problem. + +2015-04-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (yyerror): Rationalize buffer size computations. Remove + old valgrind workarounds. + * debug.c (gprintf): Rationalize buffer size computations. + (serialize_subscript): Ditto. + * io.c (iop_finish): Rationalize buffer size computations. + * profile.c (pp_string): Correct space allocation computation. + +2015-04-08 John E. Malmberg <wb8tyw@qsl.net> + + * custom.h: VMS shares some code paths with ZOS_USS in + building gawkfts extension. + +2015-04-08 Arnold D. Robbins <arnold@skeeve.com> + + Factor out opening of /dev/XXX files from /inet. + Enable interpretation of special filenames for profiling output. + + * awk.h (devopen_simple): Add declaration. + * io.c (devopen_simple): New routine. + (devopen): Call devopen_simple as appropriate. + * profile.c (set_prof_file): Call devopen_simple as appropriate, + some additional logic to handle fd to fp conversion. + + Unrelated: + + * main.c (usage): Add a comment for translators. + +2015-04-08 Eli Zaretskii <eliz@gnu.org> + + * profile.c (set_prof_file): Interpret a file name of "-" to mean + standard output. + +2015-04-06 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (force_number): Add `!= 0' check to bitwise operation. + * awkgram.y: Same, many places. + (check_special): Simplify code for checking extension flags. + +2015-04-05 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (install_builtins): If do_traditional is true, do not + install gawk extensions flagged with GAWKX. Similarly, if do_posix + is true, do not install functions flagged with NOT_POSIX. + This fixes a problem with spurious lint complaints about shadowing + a global variable that is not valid in traditional or posix mode. + Thanks to Andrew Schorr for finding the problem and supplying + initial code; I did it slightly differently. + +2015-04-03 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (force_string): If hard_regex, return string text of the regex. + (force_string, force_number): If hard_regex, return Nnull_string. + * awkgram.y: Fix ~ and !~ with @/.../. + * eval.c (setup_frame): Handle a hard regex. + * re.c (avoid_dfa): Ditto. + +2015-04-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * NEWS: Rename div to intdiv. + +2015-04-02 Arnold D. Robbins <arnold@skeeve.com> + + Rename div() to intdiv(). + + * builtin.c (do_intdiv): Renamed from do_div. + * mfpr.c (do_mpfr_intdiv): Renamed from do_mpfr_div. + * awk.h: Update declarations. + * awkgram.y (tokentab, snode): Revise accordingly. + +2015-03-31 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (call_sub): Renamed from call_sub_func. + (call_match, call_split_func): Declare. + * builtin.c (call_sub): Renamed from call_sub_func. + (call_match, call_split_func): New functions. + * interpret.h (r_interpret): Call new functions as appropriate. + * node.c (r_unref): Revert change to handle Node_regex, not needed. + +2015-03-31 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (r_get_field): Declare. + * builtin.c (call_sub_func): Rearrange the stack to be what + the buitin function expects. + * eval.c (r_get_field): Make extern. + +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. + * NEWS: Updated for retryable I/O and new API function. + +2015-03-24 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (make_regnode): Make extern. + * awk.h (make_regnode): Declare. + * builtin.c (call_sub_func): Start on reworking the stack to + be what do_sub() expects. Still needs work. + * interpret.h (r_interpret): Add a cast in comparison with do_sub(). + * node.c (r_unref): Handle Node_regex nodes. + +2015-03-24 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * interpret.h (r_interpret): When Op_K_exit has an argument of + Nnull_string, do not update exit_val, since no value was supplied. + +2015-03-24 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h, gawkapi.c, io.c: Minor code reformatting. + +2015-03-20 Arnold D. Robbins <arnold@skeeve.com> + + Start on fixing indirect calls of builtins. + + * awk.h (call_sub_func): Add declaration. + * awkgram.y (lookup_builtin): Handle length, sub functions. + (install_builtin): Handle length function. + * builtin.c (call_sub_func): New function. + * interpret.h (r_interpret): If calling do_sub, do it through + call_sub_func(). + +2015-03-19 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (re_update): Handle hard regex - for sub/gsub/gensub. + * awkgram.y (grammar): Add support for hard_regex with ~ and !~; + allowed only on the right hand side. + (mk_rexp): Handle a hard regex. + +2015-03-18 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_typeof): Be smarter about checking for uninitialized + values; can now detect and return "untyped" for such values. + * awkgram.y (yylex): Collect @/.../ entirely in the lexer and return + a new terminal (HARD_REGEX). + (regexp): Reverted to just a regular awk regexp constant. + (hard_regexp): New nonterminal, can be used only in direct + assignment and as an argument in function call. New set of nonterminals + for function call expression lists. More work still to do. + +2015-03-18 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.sub: Updated, from libtool 2.4.6. + +2015-03-17 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_number): Allocate enough room to print the number + in all cases. Was a problem mixing -M with profiling with a really + big number. Thanks to Hermann Peifer for the bug report. + +2015-03-08 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (regexflags2str): Removed. It was redundant. + + * io.c (devopen): Change the logic such that if nonfatal is true + for the socket, don't do retries. Also clean up the formatting + some. At strictopen, check if errno is ENOENT and if so, propagate + the error from getaddrinfo() up to the caller. Add explanatory + comments. + +2015-02-28 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (pty_vs_pipe): Remove check for NULL PROCINFO_node, since + this is now checked inside in_PROCINFO. + +2015-02-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (socketopen): New parameter hard_error; set it if + getaddrinfo() fails. Change fatals to warnings. + (devopen): Pass in address of boolean hard_error variable + and stop trying to open the file if hard_error is true. + Save and restore errno around call to socketopen() and + use restored errno if open() fails at strictopen. + +2015-02-27 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (check_param_names): Fix argument order in memset() call. + * configure.ac: Use AC_SEARCH_LIBS instead of AC_CHECK_LIB. This fixes + a long-standing problem where `-lm' was used twice in the final + compilation line. + +2015-02-27 Arnold D. Robbins <arnold@skeeve.com> + + Start on making regexp a real type. + + * awk.h (Node_hardregex): New node type. + (do_typeof): Add declaration. + * awkgram.y: Make @/.../ a hard regex. + (tokentab): New entry for typeof() function. + (snode): Try to handle typeof(). + (make_regnode): Handle Node_hardregex. + * builtin.c (do_typeof): New function. + * eval.c (nodetypes): Add Node_hardregex. + * re.c (re_update): Check for hardregex too in assert. + +2015-02-24 Arnold D. Robbins <arnold@skeeve.com> + + * POSIX.STD: Update copyright year. + * awkgram.y (yylex): Allow \r after \\ line continuation everywhere. + Thanks to Scott Rush <scott.rush@honeywell.com> for the report. + +2015-02-13 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Be more careful about passing true to + nextc() when collecting a regexp. Some systems' iscntrl() + are not as forgiving as GLIBC's. E.g., Solaris. + Thanks to Dagobert Michelsen <dam@baltic-online.de> for + the bug report and access to systems to check the fix. + +2015-02-12 Arnold D. Robbins <arnold@skeeve.com> + + * POSIX.STD: Update with info about function parameters. + * configure.ac: Remove test for / use of dbug library. + +2015-02-11 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Fix spelling error in comment. + +2015-02-10 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pprint): Restore printing of count for rules. + Bug report by Hermann Peifer. + +2015-02-08 Arnold D. Robbins <arnold@skeeve.com> + + * io.c: Make it "NONFATAL" everywhere. + +2015-02-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (RED_NON_FATAL): Removed. + (redirect): Add new failure_fatal parameter. + (is_non_fatal_redirect): Add declaration. + * builtin.c (efwrite): Rework check for non-fatal. + (do_printf): Adjust calls to redirect. + (do_print_rec): Ditto. Move check for redirection error up. + * io.c (redflags2str): Remove RED_NON_FATAL. + (redirect): Add new failure_fatal parameter. Simplify the code. + (is_non_fatal_redirect): New function. + (do_getline_redir): Adjust calls to redirect. + +2014-12-27 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (is_non_fatal_std): Declare new function. + * io.c (is_non_fatal_std): New function. + * builtin.c (efwrite): Call it. + +2015-02-07 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h, + regexec.c: Sync with GLIBC. Mostly copyright date updates. + +2015-02-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * eval.c (set_IGNORECASE): If IGNORECASE has a numeric value, try + using that before treating it as a string. This fixes a problem + where setting -v IGNORECASE=0 on the command line was not working + properly. + +2015-02-01 Arnold D. Robbins <arnold@skeeve.com> + + Move POSIX requirement for disallowing parameter names with the + same name as a function into --posix. + + * NEWS: Document it. + * awkgram.y (parse_program): Check do_posix before calling + check_param_names(). + * symbol.c (check_param_names): Set up a fake node and call + in_array() for function parameter names instead of linear + searching the function list a second time. Thanks to Andrew + Schorr for the motivation. + +2015-01-30 Arnold D. Robbins <arnold@skeeve.com> + + Don't allow function parameter names to be the same as function + names - required by POSIX. Bug first reported in comp.lang.awk. + + In addition, don't allow use of a parameter as a function name + in a call (but it's ok in indirect calls). + + * NEWS: Updated. + * awk.h (check_param_names): Add declaration. + * awkgram.y (at_seen): New variable. Communicates between + yylex() and the parser. + (FUNC_CALL production): Check at_seen and check that the identifier + is a function name. + (parse_program): Call check_param_names() and set errcount. + (yylex): Set at_seen after seeing an at-sign. + * symbol.c (check_param_names): New function. + +2015-01-24 Arnold D. Robbins <arnold@skeeve.com> + + Infrastructure updates. + + Bison 3.0.4. Automake 1.15. Gettext 0.19.4. + +2015-01-20 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.c (api_set_array_element): Remove useless call to + make_aname. + * symbol.c (load_symbols): Ditto. + Thanks to Andrew Schorr for pointing out the problem. + +2015-01-19 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.c: Update to bison 3.0.3. + * command.c: Ditto. + * NEWS: Note same. + +2015-01-16 Stephen Davies <sdavies@sdc.com.au> + + * awkgram.y (rule): Set first_rule to false. Catches more cases + for gathering comments. Thanks to Hermann Peifer for the test case. + +2015-01-15 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c: Sync with grep. Mainly copyright updates. + * getopt.c, getopt.h, getopt1.c getopt_int.h: Sync with GLIBC. + Mainly copyright updates, one minor code fix. + +2015-01-14 Arnold D. Robbins <arnold@skeeve.com> + + Remove deferred variables. + + * awk.h (register_deferred_variable): Remove declaration. + * awkgram.y (is_deferred_variable, process_deferred, + symtab_used, extensions_used, deferred_variables, + process_deferred): Remove declarations, bodies, and uses. + * builtin.c (do_length): Update comment. + * main.c (init_vars): Just call load_procinfo() and `load_environ()'. + +2015-01-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Revert changes to API deferred variable creation -- these variables + should be created when lookup is called, not when update is called. + * awk.h (variable_create): Remove function declaration. + * awkgram.y (variable_create): Remove function. + (variable): Restore variable_create functionality inline. + * gawkapi.c (api_sym_update): Revert to using install_symbol, since the + deferred variable check should be done when lookup is called, not here. + +2015-01-07 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (api_set_array_element): Remove stray call to + make_aname. I cannot see what purpose this served. Maybe I am + missing something. + +2015-01-07 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Update debug flags if developing. + * awkgram.y (yylex): Regex parsing bug fix for bracket expressions. + Thanks to Mike Brennan for the report. + * builtin.c (format_tree): Catch non-use of count$ for dynamic + field width or precision. + + Unrelated: + + Load deferred variables if extensions are used; they might + want to access PROCINFO and/or ENVIRON. Thanks to Andrew Schorr + for pointing out the issue. + + * awkgram.y (extensions_used): New variable. Set it on @load. + (do_add_scrfile): Set it on -l. + (process_deferred): Check it also. + +2015-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (api_sym_update): If copying a subarray, must update + the parent_array pointer. Also, call the astore hook if non-NULL. + (api_set_array_element): Call the astore hook if non-NULL. + +2015-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (variable_create): Now takes a 3rd argument to tell caller + whether this is a deferred variable. + * awkgram.y (variable_create): Return indicator of whether this is + a deferred variable in a newly added 3rd arg. + (variable): Pass 3rd arg to variable_create. + * gawkapi.c (api_sym_update): If we triggered the creation of a deferred + variable, we must merge the extension's array elements into the deferred + array, not the other way around. The ENVIRON array has special funcs + to call setenv and unsetenv. + +2015-01-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (variable_create): Declare new function. + * awkgram.y (variable_create): New function to create a variable + taking the deferred variable list into consideration. + (variable): Call new function variable_create if the variable is + not found. + * gawkapi.c (api_sym_update): If an array is being created, then + call new function variable_create instead of install_symbol. If this + is the first reference to a deferred variable, than the new array + may contain elements that must be merged into the array provided by + the extension. + +2015-01-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (wait_any): If the `interesting' argument is non-zero, then we + must not return until that child process has exited, since the caller + gawk_pclose depends on our returning its exit status. So in that case, + do not pass WNOHANG to waitpid. + +2015-01-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h: Fix another comment typo. + +2015-01-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h: Fix typo in comment. + +2015-01-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (gawk_api): Modify api_get_file to remove the typelen + argument. + (get_file): Remove typelen argument from the macro. + * gawkapi.c (api_get_file): Remove typelen argument. + +2014-12-24 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pprint): Be sure to set ip2 in all paths + through the code. Thanks to GCC 4.9 for the warning. + +2014-12-18 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Do not waste a byte at the end of a string. + +2014-12-14 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yyerror): Do not waste a byte at the end of a string. + * builtin.c (do_match): Ditto. + * command.y (append_statement): Ditto. + * debug.c (gprintf, serialize): Ditto. + * field.c (set_FIELDWIDTHS): Ditto. + * io.c.c (grow_iop_buffer): Ditto. + * profile.c (pp_string, pp_group3): Ditto. + +2014-12-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * array.c (concat_exp): Do not waste a byte at the end of a string. + * awkgram.y (common_exp): Ditto. + * builtin.c (do_substr): Ditto. + * eval.c (set_OFS): Ditto. + * field.c (rebuild_record): Ditto. + * gawkapi.h (r_make_string): Ditto. + * interpret.h (r_interpret): Ditto for Op_assign_concat. + * node.c (r_format_val, r_dupnode, make_str_node, str2wstr, wstr2str): + Ditto. + * re.c (make_regexp): Ditto. + +2014-12-20 Arnold D. Robbins <arnold@skeeve.com> + + Enable non-fatal output on per-file or global basis, + via PROCINFO. + + * awk.h (RED_NON_FATAL): New redirection flag. + * builtin.c (efwrite): If RED_NON_FATAL set, just set ERRNO and return. + (do_printf): Check errflg and if set, set ERRNO and return. + (do_print): Ditto. + (do_print_rec): Ditto. + * io.c (redflags2str): Update table. + (redirect): Check for global PROCINFO["nonfatal"] or for + PROCINFO[file, "nonfatal"] and don't fail on open if set. + Add RED_NON_FATAL to flags. + (in_PROCINFO): Make smarter and more general. + +2014-12-12 Stephen Davies <sdavies@sdc.com.au> + + Improve comment handling in pretty printing. + + * awk.h (comment_type): New field in the node. + (EOL_COMMENT, FULL_COMMENT): New defines. + * awkgram.y (block_comment): New variable. + (check_comment): New function. + (grammar): Add code to handle comments as needed. + (get_comment): Now takes a flag indicating kind of comment. + (yylex): Collect comments appropriately. + (append_rule): Ditto. + * profile.c (pprint): Smarten up comment handling. + Have printing \n take comments into account. + (end_line): New function. + (pp_func): Better handling of function comments. + +2014-12-10 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2014-11-26 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Improve wording of gensub warnings. + +2014-11-25 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): For gensub, add more warnings for invalid + third argument. + +2014-11-23 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Move all inline functions to the bottom of the file. + Keeps modern GCC happier. + +2014-11-22 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (emalloc, realloc): Redefine in terms of ... + (emalloc_real, erealloc_real): New static inline functions. + (fatal): Move definition up. + * gawkmisc.c (xmalloc): If count is zero, make it one for older + mallocs that require size > 0 (such as z/OS). + +2014-11-21 Arnold D. Robbins <arnold@skeeve.com> + + * main.c: Remove a debugging // comment. + * NOTES: Removed. + + Unrelated: + + Revert changes of 2014-11-20 from Paul Eggert. Causes failures + on z/OS. + + Unrelated: Avoid unnecessary copying of $0. + + * interpret.h (UNFIELD): New macro. + (r_interpret): Use it where *lhs is assigned to. + +2014-11-20 Paul Eggert <eggert@cs.ucla.edu> + + Port to systems where malloc (0) and/or realloc(P, 0) returns NULL. + * gawkmisc.c (xmalloc): + * xalloc.h (realloc): + Do not fail if malloc(0) or realloc(P, 0) returns NULL. + Fail only when the allocator returns null when attempting to + allocate a nonzero number of bytes. + +2014-11-19 Arnold D. Robbins <arnold@skeeve.com> + + Infrastructure upgrades: + + * Automake 1.14.1, Gettext 0.19.3, Libtool 2.4.3. + * compile, extension/build-aux/compile: New files. + +2014-11-19 gettextize <bug-gnu-gettext@gnu.org> + + * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.3. + +2014-11-16 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h: Revert change of 2014-11-11 since it breaks + certain uses. + + Unrelated: + + * dfa.c: Sync with GNU grep. + +2014-11-15 Arnold D. Robbins <arnold@skeeve.com> + + * array.c, awk.h, awkgram.y, builtin.c, dfa.c, eval.c, field.c, + interpret.h, io.c, main.c, mpfr.c, node.c, re.c, regex_internal.h, + replace.c: Remove all uses of MBS_SUPPORT. + * regex_internal.h: Disable wide characters on DJGPP. + * mbsupport.h: Rework to be needed only for DJGPP. + +2014-11-11 Arnold D. Robbins <arnold@skeeve.com> + + Don't let memory used increase linearly in the size of + the input. Problem reported by dragan legic + <dragan.legic@yandex.ru>. + + * field.c (set_record): NUL-terminate the buffer. + * interpret.h (r_interpret): Op_field_spec: if it's $0, increment + the valref. Op_store_var: if we got $0, handle it appropriately. + +2014-11-10 Arnold D. Robbins <arnold@skeeve.com> + + Reorder main.c activities so that we can set a locale on the + command line with the new, for now undocumented, -Z option. + + * main.c (parse_args, set_locale_stuff): New functions. + (stopped_early): Made file level static. + (optlist, optab): Add new argument. + (main): Adjust ordering and move inline code into new functions. + +2014-11-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (node_to_awk_value): When the type wanted is AWK_UNDEFINED + and a it's a Node_val set to Nnull_string, return AWK_UNDEFINED instead + of AWK_NUMBER 0. + +2014-11-06 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (redirect_string): First argument should be const. Add a new + extfd argument to enable extensions to create files with pre-opened + file descriptors. + (after_beginfile): Declare function used in both eval.c and gawkapi.c. + * eval.c (after_beginfile): Remove extern declaration now in awk.h. + * gawkapi.c (api_get_file): Implement API changes to return + awk_input_buf_t and/or awk_output_buf_t info, as well as accept an + fd for inserting an opened file into the table. + * gawkapi.h (gawk_api): Modify the api_get_file declaration to + return awk_bool_t and add 3 new arguments -- a file descriptor + for inserting an already opened file, and awk_input_buf_t and + awk_output_buf_t to return info about both input and output. + (get_file): Add new arguments to the macro. + * io.c (redirect_string): First arg should be const, and add a new + extfd arg so extensions can pass in a file that has already been + opened by the extension. Use the passed-in fd when appropriate, + and pass it into two_way_open. + (redirect): Pass new fd -1 arg to redirect_string. + (two_way_open): Accept new extension fd parameter and open it + as a socket. + +2014-11-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (retryable): New function to indicate whether I/O can be + retried for this file instead of throwing a hard error. + (get_a_record) Check whether this file is configured for retryable + I/O before returning nonstandard -2. + +2014-11-03 Norihiro Tanaka <noritnk@kcn.ne.jp> + + * re.c (research): Use dfa superset to improve matching speed. + +2014-11-02 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (div_on_left_mul_on_right): New function. + (parenthesize): Call it. + +2014-10-30 Arnold D. Robbins <arnold@skeeve.com> + + * configure: Regenerated after fix to m4/readline.m4. + + Unrelated; fixes to profiling. Thanks to Hermann Peifer and + Manuel Collado for pointing out problems: + + * profile.c (pprint): For Op_unary_minus, parenthesize -(-x) + correctly. + (prec_level): Get the levels right (checked the grammar). + (is_unary_minus): New function. + (pp_concat): Add checks for unary minus; needs to be parenthesized. + +2014-10-30 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * NEWS: Mention installation of /etc/profile.d/gawk.{csh,sh}. + +2014-10-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac (AC_CONFIG_FILES): Add extras/Makefile. + * Makefile.am (SUBDIRS): Add extras. + * extras: Add new subdirectory. + +2014-10-29 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. Again, again. + +2014-10-28 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. Again. + +2014-10-25 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2014-10-17 John E. Malmberg <wb8tyw@qsl.net> + + * ext.c (close_extensions): Test for null pointer since + since this can be called by signal handler before the + pointers are initialized. + +2014-10-15 Arnold D. Robbins <arnold@skeeve.com> + + Make sane the handling of AWKPATH and AWKLIBPATH: + + 1. Don't explicitly search "."; it must be in the path either + physically or as null element a la the shell's $PATH + 2. If environment's value was empty, use built-in default value. + 3. Set ENVIRON["AWK*PATH"] to the path used. + + * io.c (path_info): Remove try_cwd member. + (get_cwd): Removed, not needed anymore. + (do_find_source): Don't do explicit check in current directory. + It must come from the AWKPATH or AWKLIBPATH variable. + * main.c (path_environ): If value from environment was empty, + set it to the default. This is how gawk has behaved since 2.10. + +2014-10-13 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c (__re_error_msgid): Make error message for REG_EBRACK + more helpful - also used for unmatched [:, [., [=. + Thanks to Davide Brini for raising the issue. + +2014-10-12 KO Myung-Hun <komh78@gmail.com> + + Fixes for OS/2: + + * Makefile.am (install-exec-hook, uninstall-links): Use $(EXEEXT). + * getopt.h: Redefinitions if using KLIBC. + * io.c (_S_IFDIR, _S_IRWXU): Define if the more standard versions + are available. + +2014-10-12 Arnold D. Robbins <arnold@skeeve.com> + + * README: Remove Pat Rankin from VMS duties, per his request. + +2014-10-08 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2014-10-05 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pprint): Fix typo in header. Sheesh. + + Unrelated: + + * awkgram.y (mk_program): Add a comment that we don't need to + clear the comment* variables. + +2014-10-04 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_string_fp): Fix breaklines case to actually + output the current letter. This broke at gawk 4.0.0. Sigh. + Thanks to Bert Bos (bert@w3.org) for the report. + +2014-10-03 Stephen Davies <sdavies@sdc.com.au> + + * awkgram.y (program_comment): Renamed from comment0. + (function_comment): Renamed from commentf. + +2014-10-02 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y, profile.c: Minor white space cleanups. + +2014-10-01 Arnold D. Robbins <arnold@skeeve.com> + + Fix a few compile warnings: + + * awkgram.y (split_comment): Make static. + General: Remove some unused variables, clean up some whitepace nits. + + * profile.c (indent): Add some braces to turn off compiler warnings. + +2014-09-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * main.c (main): In optlist, it should say "h", not "h:", since there + is no argument for the help option. Thanks to Joep van Delft for + the bug report. + +2014-09-29 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Minor edits to sync with documentation. Does not + influence the behavior of the API. + +2014-09-28 Arnold D. Robbins <arnold@skeeve.com> + + * command.y (cmdtab): Add "where" as an alias for "backtrace". + Finally! + + Unrelated: + + * dfa.c: Sync with GNU grep. + +2014-09-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (check_for_bad): Bitwise-and the bad character with 0xFF + to avoid sign extension into a large integer. + + Unrelated: + + * configure.ac: Add an option to enable locale letters in identifiers. + Undocumented and subject to being rescinded at any time in the future. + * awkgram.y (is_alpha): Actual code is here. + * NEWS: Mention to look at configure --help. + + Unrelated: + + * profile.c (pprint): Use "rule(s)" instead of "block(s)" in the + header. + +2014-09-23 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (yylex): Don't check for junk characters inside + quoted strings. Caused issues on DJGPP and Solaris. + + Unrelated: + + * io.c (devopen): Straighten things out with respect to + compatibility with BWK awk. + +2014-09-19 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Further commentary as to the treacherousness + of isalnum and isalpha. + +2014-09-15 Arnold D. Robbins <arnold@skeeve.com> + + Finish removing use of isalpha and isalnum. + + * awk.h (is_alpha, is_alnum, is_identchar): Add declarations. + * awkgram.y (yylex): Use is_alpha. + (is_alpha, is_alnum): New functions. + (is_identchar): Use is_alnum. + * builtin.c (r_format_tree): Use is_alpha, is_alnum. + * command.y (yylex): Use is_alpha, is_identchar. + * ext.c (is_letter): Use is_alpha. + (is_identifier_char): Removed; replaced uses with is_identchar. + * main.c (arg_assign): Use is_alpha, is_alnum. + * node.c (r_force_number): Use is_alpha. + +2014-09-14 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (is_identchar): Change from simple macro to function + since use of isalnum() let non-ASCII letters slip through into + identifiers. + +2014-09-13 Stephen Davies <sdavies@sdc.com.au> + + When doing pretty-printing (but not profiling), include the original + comments in the output. + + General rules: + + Pretty printing: + - Do NOT indent by a tab + - Do NOT print the header comments ("# BEGIN rules", etc.) + - DO print the comments that are in the program + + Profiling: + - DO indent by a tab + - DO print the header comments + - Do NOT print the program's original comments + + * awkgram.y (comment0, commentf): New variables that are pointers to + program and function comments. + (get_comment): New function that retrieves consecutive comment lines + and empty lines as a unit). + (split_comment): New function: iff first block in the program is a + function and it is preceded by comments, take the last non-blank + line as function comment and any preceding lines as program comment.) + + Following token rules were changed to handle comments: + + * awkgram.y (pattern, LEX_BEGIN, LEX_END, LEX_BEGINFILE, LEX_ENDFILE, + action, function_prologue, statements): Update to handle comments. + + Following functions were changed to handle comments: + + * awkgram.y (mk_program, mk_function, allow_newline and yylex): Update + to handle comments. (Also fixed typo in case '\\'.) + + * profile.c (print_comment): New function to format comment printing. + (indent, pprint, dump_prog, pp_func): Changed to handle comments and + the revised indentation rules. + +2014-09-07 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Move libsigsegv stuff to ... + * main.c: here. Thanks to Yehezkel Bernat for motivating + the cleanup. + * symbol.c (make_symbol, install, install_symbol): Add const to + first parameter. Adjust decls and fix up uses. + +2014-09-05 Arnold D. Robbins <arnold@skeeve.com> + + Add builtin functions to FUNCTAB for consistency. + + * awk.h (Node_builtin_func): New node type. + (install_builtins): Declare new function. + * awkgram.y [DEBUG_USE]: New flag value for debug functions; they + don't go into FUNCTAB. + (install_builtins): New function. + * eval.c (nodetypes): Add Node_builtin_func. + * interpret.h (r_interpret): Rework indirect calls of built-ins + since they're now in the symbol table. + * main.c (main): Call `install_builtins'. + * symbol.c (install): Adjust for Node_builtin_func. + (load_symbols): Ditto. + +2014-09-04 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pprint): Case Op_K_for: Improve printing of + empty for loop header. + + Unrelated: Make indirect function calls work for built-in and + extension functions. + + * awkgram.y (lookup_builtin): New function. + * awk.h (builtin_func_t): New typedef. + (lookup_builtin): Declare it. + * interpret.h (r_interpret): For indirect calls, add code to + find and call builtin functions, and call extension functions. + +2014-09-01 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_substr): Return "" instead of null string in case + result is passed to length() with --lint. Based on discussions in + comp.lang.awk. + + Unrelated: + + * interpret.h (r_interpret): For indirect function call, separate + error message if lookup returned NULL. Otherwise got a core dump. + Thanks to "Kenny McKormack" for the report in comp.lang.awk. + +2014-08-27 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add test for strcasecmp. + * regcomp.c: Remove special case code around use of strcasecmp(). + * replace.c: Include missing/strncasecmp.c if either strcasecmp() + or strncasecmp() aren't available. + +2014-08-26 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c, regex_internal.c: Sync with GBLIC. Why not. + + Unrelated: + + Remove support for MirBSD. It uglified the code too much + for no discernible gain. + + * configure.ac: Remove check for MirBSD and define of + LIBC_IS_BORKED. + * dfa.c: Remove code depending on LIBC_IS_BORKED. + * main.c: Ditto. + * regcomp.c: Ditto. + * NEWS: Updated. + +2014-08-24 Arnold D. Robbins <arnold@skeeve.com> + + * regex.h: Remove underscores in names of parameters in function + declarations. Tweak names as needed. + +2014-08-20 Arnold D. Robbins <arnold@skeeve.com> + + * node.c (parse_escape): Max of 2 digits after \x. + +2014-08-18 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c: General formatting cleanup. + +2014-08-15 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Adjust whitespace for -L and add "invalid" + as a possible value for it. Report from Robert P. J. Day + <rpjday@crashcourse.ca>. + +2014-08-14 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (SUBDIRS): Put awklib after doc so that examples + get extracted when the doc changes. + +2014-08-13 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Move initial allocation of the replacement + string down towards code to do the replacement, with a (we hope) + better guesstimate of how much to initially allocate. The idea + is to avoid unnecessary realloc() calls by making a better guess + at how much to allocate. This came up in an email discussion + with Tom Dickey about mawk's gsub(). + +2014-08-12 Juergen Kahrs <jkahrs@users.sourceforge.net> + + * cmake/configure.cmake: + * cmake/package.cmake: Copyright update. + * README.cmake: + * README_d/README.cmake: Moved file. + +2014-08-12 Arnold D. Robbins <arnold@skeeve.com> + + OFS being set should rebuild $0 using previous OFS if $0 + needs to be rebuilt. Thanks to Mike Brennan for pointing this out. + + * awk.h (rebuild_record): Declare. + * eval.c (set_OFS): If not being called from var_init(), check + if $0 needs rebuilding. If so, parse the record fully and rebuild it. + Make OFS point to a separate copy of the new OFS for next time, since + OFS_node->var_value->stptr was already updated at this point. + * field.c (rebuild_record): Is now extern instead of static. + Use OFS and OFSlen instead of the value of OFS_node. + + Unrelated: + + * Makefile.am (RM): Define for makes that don't have it, + such as on OpenBSD. Thanks to Jeremie Courreges-Anglas + <jca@wxcvbn.org> for the report. + +2014-08-05 Arnold D. Robbins <arnold@skeeve.com> + + Bug fix: For MPFR sqrt(), need to set precision of result to be + the same as that of the argument. Doesn't hurt other functions. + See test/mpfrsqrt.awk. Thank to Katie Wasserman <katie@wass.net> + for the bug report. + + * mpfr.c (do_mpfr_func): New function. Runs code for MPFR functions + while still enabling debugging. Add call here to mpfr_set_prec(). + Original code from SPEC_MATH macro. + (SPEC_MATH): Change macro to call do_mpfr_func(). + + Next MPFR bug fix: The % operator gave strange results for negative + numerator. Thanks again to Katie Wasserman for the bug report. + + * mpfr.c (mpg_mod): Use mpz_tdiv_qr() instead of mpz_mod(). From + the GMP doc, mpz_mod() should have worked; it's not clear why + it doesn't. + +2014-08-03 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (format_tree): Don't need to check return value of + wctombr for -2. Thanks to Eli Zaretskii for pointing this out. + + Unrelated: + + * gawkapi.h: Fix doc for API get_record - errcode needs to + be greater than zero. + * interpret.h (r_interpret): Move setting of ERRNO to here, from ... + * io.c (inrec): ... here. Makes the code cleaner. + +2014-08-03 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (getfname): Match on either ptr or ptr2 so --profile + will work in -M (MPFR bignum) mode. + +2014-07-31 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (format_tree): Make %c handling more sane on Windows. + Rework the lint messages. + + Unrelated: + + * dfa.c: Sync with GNU grep. Mainly white space differences. + + Unrelated: + + * mpfr.c (cleanup_mpfr): New function to deallocate _mpf_t1 + and _mpf_t2; removes some valgrind warnings. + * awk.h (cleanup_mpfr): Add declaration. + * main.c (main): Add call to `cleanup_mpfr'. + + Fix memory leak: + + * mpfr.c (do_mpfr_div): Add unref to denominator and numerator + to not leak memory. Thanks to Katie Wasserman <katie@wass.net> + for isolating the problem to that routine. + +2014-07-25 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Add a warning message if -M is used and gawk was + compiled without MPFR/GMP. + +2014-07-24 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (usage): Put text for `-n' *after* text for `-m'. + Report from Robert P. J. Day <rpjday@crashcourse.ca>. + + Fix problems with I/O errors reported by Assaf Gordon + <assafgordon@gmail.com>: + + * io.c (inrec): Change type to bool to make calling easier. Add + check in non-EOF case for error, and if so, return false. + Update ERRNO in case there is an ENDFILE block. + * awk.h (inrec): Change type in declaration. + * interpret.h (r_interpret): Change call of inrec() to boolean + notation. + +2014-07-10 Arnold D. Robbins <arnold@skeeve.com> + + New `div()' function to do integer division and remainder; + mainly useful for use with GMP integers. Thanks to + Katie Wasserman <katie@wass.net> for the suggestion. + + * awk.h (do_div, do_mpfr_div): Declare new functions. + * builtin.c (do_div): New function. + * mpfr.c (do_mpfr_div): New function. + * awkgram.y (tokentab): New entry. + (snode): Add check for do_div/do_mpfr_div to make 3rd arg + be an array. + * NEWS: Updated. + * TODO: Updated. + +2014-07-10 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (check_for_bad): New routine to do the fatal message, + with smarter checking. + (nextc): Call it as appropriate. + + * builtin.c (format_tree): Add check for bad returns from mbrlen + to avoid trying to malloc (size_t) -1 bytes. Thanks to + mail.green.fox@gmail.com for the bug report. + +2014-07-03 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (nextc): Add bool check_for_bad parameter to check + for bad characters in the source program. + (yylex): Adjust calls. + +2014-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): The --pretty-print option no longer runs the + program. This removes the need for the GAWK_NO_PP_RUN environment var. + * NEWS: Updated. + * TODO: Updated. + +2014-06-22 Paul Eggert <eggert@penguin.cs.ucla.edu> + + Bring in from GNULIB: + + regex: fix memory leak in compiler + Fix by Andreas Schwab in: + https://sourceware.org/ml/libc-alpha/2014-06/msg00462.html + * lib/regcomp.c (parse_expression): Deallocate partially + constructed tree before returning error. + +2014-06-19 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Add more info to leading comment. + Add some whitespace in the code. + +2014-06-08 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2014-06-03 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (mbs_to_wchar): Define a macro if not MBS. + +2014-05-29 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2014-05-26 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (inetfile): Change return type to bool. Wrap code + with ifdef HAVE_SOCKETS so that it'll compile on DJGPP. + +2014-05-22 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Allow any redirected getline inside BEGINFILE/ENDFILE. + + * awkgram.y (LEX_GETLINE): Only require a redirection and not also + a variable if getline is in a BEGINFILE or ENDFILE rule. + * interpret.h (Op_K_getline_redir): Remove check and fatal error. + +2014-05-20 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (dfaexec): Minor sync with GNU grep. + +2014-05-14 Arnold D. Robbins <arnold@skeeve.com> + + * custom.h (_GL_PURE): Move definition to here. Sigh. + * dfa.h, dfa.c: Sync with GNU grep. Sigh. + + Unrelated: + + * custom.h: Remove stuff for Ultrix 4.3. No one has such + systems anymore; this just got missed earlier. + +2014-05-11 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (do_eval): Repair fix of 2014-05-09 and use + assoc_remove to take @eval out of the function table. + * symbol.c: Fix a comment. This file needs some work. + +2014-05-10 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (get_a_record): Finish TERMNEAREND handling in case + we don't have a regular file but aren't going to get more data. + Added some additional comments. + +2014-05-09 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (do_eval): Don't free `f' which points into the context + that was previously freed. Bug reported by Jan Chaloupka + <jchaloup@redhat.com>. Apparently introduced with move to + SYMTAB and FUNCTAB, but only showed up on Fedora 20 and Ubuntu 14.04, + which have a newer glibc. + (do_eval): Fix a memory leak seen by valgrind on Fedora 20 and + Ubuntu 14.04: the new SRCFILE that is added wasn't released. + + Unrelated: + + * io.c (get_a_record): Handle return of TERMNEAREND when the + entire file has been read into the buffer and we're using a + regex for RS. Bug report by Grail Dane <grail69@hotmail.com>. + +2014-05-04 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (debug_prog): Change check for GAWK_RESTART so that it + actually works. Bug fix: run command in debugger would start + over again but not actually start running the program. + +2014-04-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (two_way_open): In forked child, reset SIGPIPE to SIG_DFL. + Fixes problems with "broken pipe" errors from child processes, + restoring 4.1.0 and earlier behavior. Thanks to Daryl F + <wyatt@prairieturtle.ca> for the report. + (gawk_popen): Ditto. + +2014-04-25 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c: Merge with GNU grep; lots of forward motion. + +2014-04-24 Arnold D. Robbins <arnold@skeeve.com> + + Update xalloc.h for pending merge with dfa. + + * xalloc.h (xstrdup): Implement this. + (x2nrealloc): Incorporate changed logic from GNULIB. + +2014-04-20 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (struct inet_socket_info): Define new structure + for use in parsing special socket filenames. + (inetfile): Parse all components of the special socket filename + into the struct inet_socket_info. Returns true only if it is a + valid socket fliename, unlike the previous version which checked + for the '/inet[46]?/' prefix only. + (redirect): Patch to use updated inetfile() function. + (devopen): Remove logic to parse socket filenames, since this has + been moved into the inetfile() function. + (two_way_open): Update args to inetfile(). + +2014-04-20 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_rand): Make calls to random() in predictable + order to avoid order of evaluation differences amongst compilers. + Thanks to Anders Magnusson <ragge@ludd.ltu.se> (of the PCC team) + for the suggestion. + +2014-04-18 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Change adding of -export-dynamic for GCC to be + -Wl,-export-dynamic, which then works for PCC also. + +2014-04-11 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (closemaybesocket): Define if not defined, e.g. building + without socket code. Thanks to dave.gma@googlemail.com (Dave Sines) + for the report. + +2014-04-08 Arnold D. Robbins <arnold@skeeve.com> + + * 4.1.1: Release tar ball made. + +2014-04-08 Arnold D. Robbins <arnold@skeeve.com> + + * README: Update. + * configure.ac: Bump version. + +2014-04-03 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c (parse_bracket_exp): Move a call to `re_free' inside + an ifdef. Makes the code marginally cleaner. + +2014-03-30 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2014-03-28 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Remove duplicate AC_HEADER_TIME and rearrange + order of macros some. May help on older systems. + +2014-03-23 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Move include of dfa.h around for correct building + on Irix. Thanks to Nelson H.F. Beebe for the report. + + Unrelated: + + * .gitignore: Simplify .dSYM pattern for Mac OS X. + +2014-03-21 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (using_simple_locale): Add ifdefs in case there is no + locale support at all. Thanks to Scott Deifik for the report. + + Unrelated: + + * main.c (UPDATE_YEAR): Set to 2014. + +2014-03-17 Arnold D. Robbins <arnold@skeeve.com> + + * .gitignore: Add .dSYM directories for Mac OS X. + Thanks to Hermann Peifer for the suggestion. + +2014-03-10 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c: Sync with grep. Yet again. + * regex_internal.c (built_wcs_upper_buffer, build_upper_buffer): + Fixes from GNULIB for mixed case matching on Mac OS X. + + Unrelated: + + * builtin.c (format_tree): Smarten handling of %' flag. Always + pass it in for floating point formats. Then only add the + thousands_sep if there is one. Also, allow for thousands_sep + to be a string, not just one character. Thanks to Michal Jaegermann + for the report. + +2014-03-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (api_impl): Add memory allocation function pointers. + * gawkapi.h (GAWK_API_MINOR_VERSION): Bump. + (gawk_api_t): Add memory allocation function pointers api_malloc, + api_calloc, api_realloc, and api_free. + (gawk_malloc, gawk_calloc, gawk_realloc, gawk_free): New macros. + (emalloc): Replace malloc with gawk_malloc. + (erealloc): Replace erealloc with gawk_erealloc. + +2014-03-05 Arnold D. Robbins <arnold@skeeve.com> + + Straighten out enumerated types some more. + + * awk.h (add_srcfile): Fix type of first parameter. + * awkgram.y (add_srcfile, do_add_srcfile): Ditto. + * cmd.h (A_NONE): New enum nametypeval. + * command.y (argtab): Use it in final value. + * ext.c (make_builtin): Use awk_false, awk_true. + * io.c (init_output_wrapper): Use awk_false. + + Unrelated: + + * debug.c (do_commands): Initialize num to silence warnings. + Thanks to Michal Jaegermann. + + Unrelated: + + * builtin.c (do_mktime): Change lint warning for minutes to + check against 59, not 60. Thanks to Hermann Peifer for the report. + +2014-03-03 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. Yet again. + +2014-02-28 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with grep. Looks like good improvement with + respect to bracket expressions. + +2014-02-27 Arnold D. Robbins <arnold@skeeve.com> + + Fixes for enum/int mismatches as warned by some compilers. + + * awk.h (ANONE): New enum for array sorting. + * array.c (assoc_list): Use it. + * builtin.c (format_tree): New MP_NONE value. + * gawkapi.c: Use awk_false and awk_true everywhere instead of + false and true. + +2014-02-26 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Set up do-nothing extension/Makefile on + MirBSD also. + +2014-02-21 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c (parse_bracket_exp): Sync with grep. + +2014-02-20 Arnold D. Robbins <arnold@skeeve.com> + + * regex.h, regex.c, regex_internal.c, regex_internal.h: Sync + with GLIBC. Mainly copyright updates. + * getopt.c, getopt.h, getopt1.c, getopt_int.h: Ditto. + * dfa.c (parse_bracket_exp): Sync with grep, where they restored + the buggy code. Sigh. + + Unrelated: + + * NEWS: Typo fix. + * interpret.h (r_interpret): Init a variable for BEGINFILE to avoid + compiler warnings. Thanks to Michal Jaegermann. + +2014-02-15 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.c, command.c: Regenerated - Bison 3.0.2. + +2014-02-04 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (to_uchar): Make use of this. Syncs with GNU grep. + +2014-02-03 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (negate_num): Bracket `tval' in #ifdef MPFR since it's + only used in that code. + +2014-01-31 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (dist-hook): Improve creation of pc/config.h. We + have to jump through a lot of hoops for 'make distcheck' to + actually work. + +2014-01-30 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (dist-hook): Improve creation of pc/config.h to copy + the new file into the distribution directory being created. + Also, put the temporary files into /tmp. + +2014-01-28 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (negate_num): If just a double, return. Fixes a bug + that showed up on 32-bit systems with MPFR. Thanks to Eli Zaretskii + and Corinna Vinschen for the report. Also, free the MPZ integer. + Thanks to valgrind for the report. + + Unrelated: + + * dfa.c: Sync with GNU grep - removed some special cased code + for grep. + +2014-01-24 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac, field.c: Update copyright year. + +2014-01-19 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (negate_num): Handle the case of -0 for MPFR; the sign + was getting lost. Thanks to Hermann Peifer for the report. + +2014-01-18 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (parse_bracket_exp): Sync with GNU grep, which now uses + gawk's code for RRI in single-byte locales! Hurray. + +2014-01-16 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: For z/OS, restore creation of do-nothing + Makefile in extension directory. + +2014-01-14 Arnold D. Robbins <arnold@skeeve.com> + + * field.c (do_split): Make sure split() gets FS value if no + third arg even after FPAT was set. Thanks to Janis Papanagnou + for the report. + +2014-01-13 Arnold D. Robbins <arnold@skeeve.com> + + * README: Fix John Malmberg's email address. + +2014-01-12 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Update copyright year. + (func_use): Simplify code. + * command.y: Update copyright year. + * ext.c: Update copyright year. + (make_builtin): Small simplification. + (make_old_builtin): Make code consistent with make_builtin(), add + call to track_ext_func(). + * bootstrap.sh: Update copyright year. Remove touch of version.c + since that file is no longer autogenerated. + +2014-01-07 Arnold D. Robbins <arnold@skeeve.com> + + * command.y (next_word): Move into ifdef for HAVE_LIBREADLINE, + since it's only used by that code. + * ext.c (load_old_ext): Minor improvements. + +2014-01-03 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess, config.rpath, config.sub, depcomp, + install-sh: Updated. + * dfa.h, dfa.c: Sync with GNU grep; comment fix and copyright year. + * NEWS: Updated some, including copyright year. + +2013-12-26 Arnold D. Robbins <arnold@skeeve.com> + + * README: Add John Malmberg for VMS. + +2013-12-24 Arnold D. Robbins <arnold@skeeve.com> + + * getopt.h: Add `defined(__sun)' to list of system that do get to + include stdlib.h. Needed for Illumos. Thanks to + Richard Palo <richard.palo@free.fr> for the report. + +2013-12-21 Mike Frysinger <vapier@gentoo.org> + + * configure.ac: Add --disable-extensions flag to control + compiling extensions. Better for cross-compiling. + (AC_CANONICAL_HOST): Added. Changed case statements appropriately. + * Makefile.am (check-for-shared-lib-support): Removed. + (check-recursive, all-recursive): Removed. + +2013-12-21 Arnold D. Robbins <arnold@skeeve.com> + + * config.guess: Updated. + * configure, aclocal.m4: Updated based on automake 1.13.4. + +2013-12-19 Arnold D. Robbins <arnold@skeeve.com> + + * regexec.c (re_search_internal): Make sure `dfa' pointer is + not NULL before trying to dereference it. + +2013-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (AC_FUNC_VPRINTF): Remove. Not needed on current + systems. + * awk.h (HAVE_VPRINTF): Remove check. + +2013-12-12 John E. Malmberg <wb8tyw@qsl.net> + + * io.c (redirect): Add additional VMS error codes. + (nextfile): Retry open after closing some files. + +2013-12-10 Scott Deifik <scottd.mail@sbcglobal.net> + + * io.c (closemaybesocket): Add definition for DJGPP. + +2013-12-10 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (Floor, Ceil): Remove declarations and VMS redefinitions. + * floatcomp.c (Floor, Ceil): Removed, not needed. Move bracketing + ifdef to the top of the file. + * builtin.c (double_to_int): Use floor() and ceil(). + +2013-12-07 Arnold D. Robbins <arnold@skeeve.com> + + * regex_internal.h (__attribute__): Define to empty if not GCC. + * custom.h (__attribute__): Remove the definition from here; the + right place was regex_internal.h. + +2013-12-06 Arnold D. Robbins <arnold@skeeve.com> + + No need to generate version.c from version.in. + Thanks to John E. Malmberg <wb8tyw@qsl.net> for the suggestion. + + * version.in: Removed. + * version.c: Use PACKAGE_STRING directly. + * Makefile.am (EXTRA_DIST): Remove version.in. + (distcleancheck_listfiles): Remove this rule. + (MAINTAINERCLEANFILES): Remove this definition. + (version.c): Remove the rule to create it. + +2013-12-05 Arnold D. Robbins <arnold@skeeve.com> + + Fixes for Z/OS. + + * custom.h (__attribute__): Define to empty. + * dfa.c (parse_bracket_exp): Add a cast to quiet a warning. + * regex.c: Correctly bracket include of <sys/param.h>. + + Unrelated: + + * debug.c (find_rule): Add a FIXME comment. + +2013-12-03 John E. Malmberg <wb8tyw@qsl.net> + + * io.c (redirect): Add additional VMS error code to check. + (do_find_source): Append "/" if not a VMS filename. + +2013-12-01 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * main.c (optab): Sort by long option name. + +2013-11-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * main.c (optab): Add entry for --include. + +2013-11-23 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Merge from grep; minor fixes in how bit twiddling + is done. + +2013-11-01 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (lex): Reset laststart so that stuff like \s* works. + Fix from grep. + +2013-10-31 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (efwrite): If write error to stdout is EPIPE, + die silently. Thanks to Hermann Peifer for helping find this. + +2013-10-22 Arnold D. Robbins <arnold@skeeve.com> + + Revise error messages when writing to standard output or standard + error to ignore EPIPE. Add the ability based on an environment + variable to get the source file and line number. + + * awk.h (r_warning): Renamed from warning. + (warning): New macro to set location and call warning. + * io.c (flush_io): Print errors only if not EPIPE. + (close_io): Ditto. + * main.c (lintfunc): Init to r_warning. + (main): Enhance explanatory comment. + (usage): Print errors only if not EPIPE. + (copyleft): Ditto. + * msg.c (err): Make printing srcfile and srcline depend upon + GAWK_MSG_SRC environment variable. + (r_warning): Renamed from warning. + +2013-10-17 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Ignore SIGPIPE. See the comment in the code. + Thanks to Alan Broder for reporting the issue. + + Unrelated: + + * rand.c (do_rand): Fix computation and loop checking against + 1.0 to use do..while. + +2013-10-16 Arnold D. Robbins <arnold@skeeve.com> + + Make -O work again. Turns out that C99 bool variables + are clamped to zero or one. + + * main.c (do_optimize): Init to false. + (main): Set do_optimize to true on -O. + * eval.c (setup_frame): Change all uses of do_optimize to be + a boolean check instead of a test > 1. + * awkgram.y: Ditto. + (optimize_assignment): Remove check against do_optimize since + it was inited to true anyway. + + Unrelated: + + * re.c (resetup): Add a comment about the joy of syntax bits. + + Unrelated: + + * builtin.c (do_rand): If result is exactly 1.0, keep trying. + Thanks to Nelson Beebe. + +2013-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (lex): Sync with GNU grep. Handle multibyte \s and \S. + + Unrelated: + + * awk.h [ARRAY_MAXED]: Fix value of this and subsequent flags + after addition of NULL_FIELD. + * eval.c (flags2str): Add NULL_FIELD. Duh. + +2013-10-09 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (mk_assignment): Rework switch to handle Op_assign, + and to provide a better error message upon unknown opcode. + +2013-09-28 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2013-09-25 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_rand): Make the result more random by calling + random() twice. See the comment in the code. Thanks to + Bob Jewett <jewett@bill.scs.agilent.com> for the report and + the fix. + +2013-09-24 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (find_rule): Handle case where lineno is zero. Can happen + if break is given without a line number on a current line. Thanks + to Ray Song <i@maskray.me> for the report. + +2013-09-19 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (parse_bracket_exp): Use code from grep to keep things within + range (updates change of 2013-09-08). Fix whitespace in one of the + gawk-only additions. + +2013-09-13 Arnold D. Robbins <arnold@skeeve.com> + + Fix use of NF after it's extended, e.g. see test/nfloop.awk. + + * awk.h (NULL_FIELD): New flag + * builtin.c (do_print_rec): Check f0->flags instead of if + equal to Nnull_string. + * eval.c (r_get_field): Check (*lhs)->flags instead of if + equal to Nnull_string or Null_field. + * field.c (init_fields): Init field zero and Null_field with + NULL_FIELD flag. + (set_NF): Set parse_high_water = NF in case NF extended past the + end. This is the actual bug fix. + +2013-09-08 Arnold D. Robbins <arnold@skeeve.com> + + Fixes based on reports from a static code checker. Thanks to + Anders Wallin for sending in the list. + + * array.c (asort_actual): Free list if it's not NULL. + * builtin.c (do_sub): Set buf to NULL and assert on it before using + it. + * cint_array.c (cint_array_init): Clamp any value of NHAT from the + environment such that it won't overflow power_two_table when used as + an index. + * dfa.c (parse_bracket_exp): Check that len is in range before using it + to index buf. + * getopt.c (_getopt_internal_r): Change call to alloca to use malloc. + * io.c (socket_open): Init read_len to zero. + (two_way_open): Upon failure to fork, close the slave fd also. + * re.c (research): Init try_backref to false. + * regcomp.c (build_range_exp): Free any items that were allocated in + the case where not all items were. + (build_charclass_op): Same. Init br_token to zero with memset. + (create_tree): Init token t to zero with memset. + * regex_internal.c (re_dfa_add_node): Free any items that were + allocated in the case where not all items were. + * symbol.c (destroy_symbol): On default, break, to fall into releasing + of resources. + +2013-08-29 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (HAVE_HISTORY_LIST): Move checks and defines to the top. + (do_save, serialize): Adjust #if checks to depend on having both + readline and the history functions. Needed for Mac OS X whose + native readline is a very old version. Sigh. + * configh.in, configure: Regenerated due to change in m4/readline.m4. + Issue reported by Hermann Peifer and Larry Baker. + + Unrelated: + + * getopt.c: Sync with GLIBC, changes are minor. + + Unrelated: + + * dfa.c: Sync with version in grep. Primarily whitespace / comment + wording changes. + +2013-08-26 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c (parse_dup_op): Remove RE_TOKEN_INIT_BUG code (change of + Feb 19 2005) since it's no longer needed. + + * regcomp.c (re_fastmap_iter): Undo addition of volatile from + Jan 18 2007; no longer needed and is one less change to have to + maintain against the upstream. + + * regcomp.c, regex.h, regex_internal.h: Sync with GLIBC. + +2013-08-22 Arnold D. Robbins <arnold@skeeve.com> + + * str_array.c (env_store): If the new value being stored is NULL, + pass in "" instead. Avoids core dump on Mac OS X. + Thanks to Hermann Peifer for the bug report. + +2013-08-20 Arnold D. Robbins <arnold@skeeve.com> + + * nonposix.h: New file. Contains FAKE_FD_VALUE. + * awk.h: Include it if MinGW or EMX. + * Makefile.am (base_sources): Add nonposix.h. + +2013-08-18 Arnold D. Robbins <arnold@skeeve.com> + + Reflect updates to ENVIRON into the real environment. + + * awk.h (init_env_array): Add declaration. + * main.c (load_environ): Call init_env_array. + * str_array.c (env_remove, env_store, env_clear, init_env_array): + New functions. + (env_array_func): New array vtable. + +2013-08-18 Arnold D. Robbins <arnold@skeeve.com> + + * array.c (force_array): Set symbol->xarray to NULL before + initing the array if it was Node_var_new. + (null_array): Restore assert, undoing change of 2013-05-27. + +2013-08-15 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_memory): Fix whitespace / indentation. + +2013-08-02 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (append_rule): Add attempt to insert any comment + before a rule. Commented out at the moment. + +2013-07-30 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (enum opcodeval): Add Op_comment. + * awkgram.y (comment): New variable to hold comment text. + (statement): Add saved comments to lists being built. + (allow_newline): Save comment text if necessary. Append if have + existing text. + (yylex): Ditto. + * debug.c (print_instruction): Handle Op_comment. + * eval.c (optypes): Add entry for Op_comment. + * interpret.h (r_interpret): Ditto. + * profile.c (pprint): For Op_comment, print the comment text. + +2013-07-24 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (FAKE_FD_VALUE): Move definition from here ... + * awk.h (FAKE_FD_VALUE): ... to here. Fixes compilation on MinGW. + +2013-07-08 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (get_a_record): Change `min' to `MIN' for consistency with + other files and general practice. + +2013-07-07 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac (AC_CHECK_FUNCS): Check for sigprocmask. + * io.c (wait_any): If sigprocmask is available, block signals instead + of ignoring them temporarily. + +2013-07-05 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (gawk_api): Document that the api_get_file function will not + access the file type and length arguments if the file name is empty. + +2013-07-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac (AC_CHECK_FUNCS): Add a check for waitpid. + * io.c (wait_any): Enhance comment to explain why we loop reaping all + exited children when the argument is zero. When available, use waitpid + with WNOHANG to avoid blocking. Remove my previous incorrect patch to + exit after reaping the first child. The function is intended to + wait for all children, since we are not careful about reaping children + as soon as they die. + +2013-07-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (gawk_api): Remove unused api_lookup_file hook. + (lookup_file): Remove associated macro. + * gawkapi.c (api_lookup_file): Remove unused function. + (api_impl): Remove unused api_lookup_file hook. + +2013-07-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (main_beginfile): Declare new global INSTRUCTION *. + (parse_program): Set main_beginfile to point to the BEGINFILE + instruction block. + * gawkapi.c (api_get_file): After nextfile starts a new file, + we need to run the BEGINFILE actions. We retrieve the + instruction pointer from main_beginfile and execute it until + we reach the Op_after_beginfile opcode. We then run after_beginfile + manually and restore the value of currule and source. + +2013-07-04 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_element_t): Add comment indicating that the array + element index will always be a string! + * gawkapi.c (api_flatten_array): When converting the index to an awk + value, request a string conversion, since we want the indices to + appear as strings to the extensions. This makes the call to + force_string redundant, since node_to_awk_value does that internally + when we request a string. + +2013-07-02 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * eval.c (update_ERRNO_string): Set PROCINFO["errno"] to 0. + * io.c (inrec): Since get_a_record may now return -2, be sure + to throw an error in that case as well. + (wait_any): Fix what appears to be a bug. The old logic repeatedly + called wait until it failed. When a process has multiple children, + this causes it to stall until all of them have exited. Instead, + we now exit the function after the first successful wait call. + (do_getline_redir, do_getline): Handle case where get_a_record + returns -2. + (errno_io_retry): New function to decide whether an I/O operation should + be retried. + (get_a_record): When read returns an error, call errno_io_retry to + decide whether the operation should be retried. If so, return -2 + instead of setting the IOP_AT_EOF flag. + +2013-07-01 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * eval.c (update_ERRNO_int, unset_ERRNO): Update PROCINFO["errno"]. + +2013-06-30 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (redirect_string): Declare new function that provides API access + to the redirection mechanism. + * gawkapi.h (GAWK_API_MINOR_VERSION): Bump from 0 to 1 since 2 new + hooks were added to the api. + (gawk_api_t): Add 2 new functions api_lookup_file and api_get_file. + (lookup_file, get_file): New macros to wrap the new API functions. + * gawkapi.c (curfile): Declare this extern, since it is needed + by lookup_file and get_flie. + (api_lookup_file): Find an open file using curfile or getredirect(). + (api_get_file): Find or open a file using curfile or redirect_string(). + (api_impl): Add api_lookup_file and api_get_file. + * io.c (redirect_string): Renamed from redirect and changed arguments + to take a string instead of a 'NODE *'. This allows it to be called + through the API's new get_file hook. + (redirect): Now implemented by calling redirect_string backend function. + +2013-07-04 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (format_tree): Fixes for %c with multibyte characters + and field width > 1. Bugs reported by Nethox <nethox@gmail.com>. + +2013-07-02 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_string): Add a call to chksize and fix another. + Avoids valgrind errors on profile5 test. Thanks to Andrew + Schorr for the report. + +2013-06-27 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y: Minor whitespace cleanup, remove redundant ifdef. + +2013-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (copytoks): Rewrite to call addtok_mb() directly. Avoids + problems with multibyte characters inside character sets. + Thanks to Steven Daniels <stevendaniels88@gmail.com> for reporting + the problem. Much thanks to Mike Haertel <mike@ducky.net> for the + analysis and fix. + +2013-06-24 Eli Zaretskii <eliz@gnu.org> + + * io.c: Move #include "popen.h" out of the HAVE_SOCKETS condition, + as this is needed for non-sockets builds as well. See + http://lists.gnu.org/archive/html/bug-gawk/2013-06/msg00014.html + for the details of the problem this caused. + +2013-06-15 Arnold D. Robbins <arnold@skeeve.com> + + * io.c: Add ifdefs for VMS so that it will compile again. + Thanks to Anders Wallin. + +2013-06-11 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_lines): Move setting of binary mode to after all + the messing with the fd. Simplifies code some. + * io.c (srcopen): Rearrange so that can add call to setbinmode + here too. This fixes the debugger and makes reading source + files a little faster. Thanks again to Corinna Vinschen. + +2013-06-10 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (print_lines): Set binary mode so that calculation of the + byte offsets will be right. Thanks to Corinna Vinschen for the + direction. + +2013-06-10 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (check_bracket_exp): Remove warning about ranges being + locale dependent, since they aren't anymore. + +2013-06-09 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (iop_finish): Change fstat call to fcntl/F_GETFL per + Eli Z., for Windows. + +2013-06-03 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c (unwind_stack): If exiting, don't worry about strange stuff + on the stack. + + Unrelated: + + * awk.h (init_sockets): Declare. + * io.c (init_io): Remove ifdef around call. + +2013-06-01 Eli Zaretskii <eliz@gnu.org> + + * io.c (SHUT_RD) [SD_RECEIVE]: Define to SD_RECEIVE. + (SHUT_WR) [SD_SEND]: Define to SD_SEND. + (SHUT_RDWR) [SD_BOTH]: Define to SD_BOTH. + (FD_TO_SOCKET, closemaybesocket) [!FD_TO_SOCKET]: New macros. + (SOCKET_TO_FD, SOCKET) [!SOCKET_TO_FD]: New macros. + (PIPES_SIMULATED): Define only for DJGPP. + (pipe) [__MINGW32__]: Define to call _pipe, unless PIPES_SIMULATED + is defined. + (init_io) [HAVE_SOCKETS]: Call init_sockets. + (iop_close, socketopen): Call closemaybesocket instead of close. + (redirect) [__MINGW32__]: Call wait_any with a non-zero argument. + (devopen) [__EMX__ || __MINGW32__]: Don't call stat on network + pseudo-filenames. + (two_way_open) [HAVE_SOCKETS]: Switch input and output to binary + mode if appropriate. + (two_way_open) [!PIPES_SIMULATED]: Use the __EMX__ code for MinGW + as well. + [__MINGW32__] Call spawnl to invoke $ComSpec and pass it a + suitably quoted command line. + (two_way_open) [__MINGW32__]: Wait only for a specified process + ID. If successful, update the exit status of the exited process. + Don't use signals that are undefined on MinGW. + (two_way_open) [!PIPES_SIMULATED]: Use the __EMX__ code for MinGW + as well. + (min): Define only if not already defined. + (read_with_timeout) [__MINGW32__]: Allow reading from sockets with + timeout. + (gawk_fclose) [__MINGW32__]: Close the underlying socket as well. + + * getopt.c: Include stdlib.h for MinGW as well. + +2013-05-30 Arnold D. Robbins <arnold@skeeve.com> + + More profiling fixes: + + * profile.c (pprint): For Op_in_array, parenthesize subscript if + the precedence is lower. E.g.: (c = tolower(foo)) in ARRAY. + (prec_level): Merge cases for precedence of 5. + (parenthesize): Simplify, as in 3.1.8. Avoids stuff like + `(x == 1 && (z ==2 && (q == 4 && w == 7)))'. + + Unrelated: + + * io.c (iop_finish): fstat the fd before closing it to avoid + errors on some operating systems. Thanks to Eli Zaretskii + for the report. + +2013-05-29 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (pp_group3): Renamed from pp_concat. Change all calls. + (is_binary): Change return type to bool. + (is_scalar): New function. + (pp_concat): New function to handle concatenation operator better. + (pprint): Call it at case Op_concat. Fix Op_K_delete if multiple + indexes to separate with "][". + General: Add leading comments as needed. + +2013-05-28 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Add minor hack to not run code if pretty printing + and undocumented env var GAWK_NO_PP_RUN exists. + * profile.c (pp_string): Explicitly print NUL chars as \000. + +2013-05-27 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (AM_INIT_AUTOMAKE): Add dist-lzip to quiet + outside maintainer warnings. + + Unrelated: + + * configure.ac (AC_STRUCT_ST_BLKSIZE): Replaced with call to + AC_CHECK_MEMBERS. + + Unrelated: + + * array.c (null_array): Remove the assert and just clear + symbol->xarray. + +2013-05-26 Arnold D. Robbins <arnold@skeeve.com> + + * getopt.c: For Mac OS X, also include <stdlib.h> to avoid + some compiler warnings. + +2013-05-20 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h [FAKE_FD_VALUE]: Moved from here to ... + * io.c [FAKE_FD_VALUE]: here. + +2013-05-14 Eli Zaretskii <eliz@gnu.org> + + * io.c (devopen) [__EMX__ || __MINGW32__]: Produce EISDIR on MinGW + when an attempt to open() a directory fails. + (two_way_open) [__EMX__ || __MINGW32__]: When trying to open() a + directory fails with EISDIR, assign FAKE_FD_VALUE to the file + descriptor and attributes of a directory to its mode bits. This + is needed to support the readdir extension. + + * gawkapi.h (FAKE_FD_VALUE): New macro, used in io.h and in + extension/gawkdirfd.h. + +2013-05-09 Arnold D. Robbins <arnold@skeeve.com> + + * 4.1.0: Release tar ball made. + +2013-05-09 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (snode): Make it a fatal error to use a regexp constant + as the second argument of index(). Thanks to Christopher Durant + <christopher.durant@marquesa.net> and Brian Kernighan for the report + and the advice. + +2013-04-28 Eli Zaretskii <eliz@gnu.org> + + * io.c (redirect): Remove the HACK that called close_one when + errno was zero in the MinGW build. This prevents failure in + several tests in the test suite, e.g., closebad. + +2013-04-28 Arnold D. Robbins <arnold@skeeve.com> + + * bootstrap.sh: Fix a comment. + +2013-04-24 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (do_getline_redir): Fix the leading comment. + +2013-04-23 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (load_procinfo): Add PROCINFO entries for API major + and minor versions. + +2013-04-21 Arnold D. Robbins <arnold@skeeve.com> + + * missing: Update from Automake 1.13.1. + +2013-04-18 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Fix a typo. + +2013-04-17 Corinna Vinschen <vinschen@redhat.com> + + * configure.ac: Remove special casing for cygwin for libiconv + and libintl. + +2013-04-16 Arnold D. Robbins <arnold@skeeve.com> + + * bootstrap.sh: Touch gawk.texi too. Update copyright. + +2013-04-16 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.c: Regenerated from bison 2.7.1. + * command.c: Ditto. + * dfa.h, dfa.c: Minor edits to sync with GNU grep. + * gettext.h: Sync with gettext 0.18.2.1. + * random.h: Remove obsolete __P macro and use. Update copyright year. + * Makefile.am, array.c, builtin.c, cint_array.c, cmd.h, debug.c, + eval.c, ext.c, field.c, gawkapi.c, gawkapi.h, gettext.h, int_array.c, + interpret.h, msg.c, node.c, profile.c, re.c, replace.c, str_array.c, + symbol.c: Update copyright year. + + Update to automake 1.13.1: + + * configure.ac (AM_INIT_AUTOMAKE): Update version. + * configure, Makefile.in, aclocal.m4, awklib/Makefile.in, + doc/Makefile.in, test/Makefile.in: Regenerated. + + * getopt.c, getopt.h, getopt1.c, getopt_int.h: Sync with GLIBC. + +2013-04-14 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (check_funcs): Fix logic of test for called but + not defined warning. Thanks to Scott Deifik for the bug report. + +2013-04-02 Arnold D. Robbins <arnold@skeeve.com> + + * profile.c (print_lib_list): Send final newline to prof_fp + instead of stdout. Thanks to Hermann Peifer for the bug report. + +2013-03-27 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (SUBDIRS): Move extension back into the middle of + the list so that `make check' without a prior `make' works. + + Unrelated: + + * main.c (main): Move env_lc into ifdef for LIBC_IS_BORKED. + +2013-03-20 Arnold D. Robbins <arnold@skeeve.com> + + For systems where libc is borked (MirBSD, maybe others). + + * dfa.c: Force use of gawk_mb_cur_max instead of MB_CUR_MAX and make + mbrtowc a macro that always fails. + (using_utf8): Force utf8 to be 0 if libc borked and gawk_mb_cur_max + is one. + * main.c (main): If libc is borked and LC_ALL or LANG exist in the + environment and are set to "C" or "c", force gawk_mb_cur_max to one. + +2013-03-11 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (check_bracket_exp): Make handling of embedded ] in + regexp smarter. Thanks to Ed Morton <mortoneccc@comcast.net> + for reporting the bug. + +2013-03-01 Arnold D. Robbins <arnold@skeeve.com> + + Don't build extensions if API isn't supported: + + * Makefile.am (SUBDIRS): Move extension directory to last in case + building the extensions is not supported. + * configure.ac: Add check for MirBSD and don't even try to run the + checks for DYNAMIC if so. + + Check for systems (MirBSD) where libc doesn't understand not + to use UTF-8 for LC_ALL=C. + + * configure.ac (LIBC_IS_BORKED): AC_DEFINE if needed. + * regcomp.c (init_dfa): Change logic as needed if LIBC_IS_BORKED. + +2013-02-28 Arnold D. Robbins <arnold@skeeve.com> + + Cause profiling / pretty printing to include a list of + loaded extensions. Thanks to Hermann Peifer for the bug report. + + * awk.h (srcfiles): Add declaration. + * profile.c (print_lib_list): New function. + (dump_prog): Call it. + +2013-02-26 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (expression_list): In case of error return the list + instead of NULL so that snode gets something it can count. + +2013-02-12 Arnold D. Robbins <arnold@skeeve.com> + + * bisonfix.awk: Comment out code for fixing continued #if + statements. It is likely not needed anymore. Leave it there in + case I'm wrong. + +2013-02-06 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (printf_common): Move nargs > 0 check into assert. + (do_sprintf): Add nargs check and fatal message to here. + +2013-02-04 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Remove undocumented -m option which was for + compatibility with BWK awk. His awk dropped it back in 2007. + +2013-02-03 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add Automake test for cross compiling. + +2013-01-31 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c, regex.c, regex_internal.c, regexec.c: Update + copyright years to sync with GLIBC. + + From: http://www.sourceware.org/ml/libc-alpha/2013-01/msg00967.html, + by Andreas Schwab <schwab@suse.de>: + + * regexec.c (extend_buffers): Add parameter min_len. + (check_matching): Pass minimum needed length. + (clean_state_log_if_needed): Likewise. + (get_subexp): Likewise.` + +2013-01-31 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Include "dfa.h" which includes regex.h after limits.h + so that RE_DUP_MAX gets the correct value. Especially needed on + OpenVMS. Thanks to Anders Wallin. + + * main.c (version): Print out API version numbers if DYNAMIC. + Helpful also for knowing if to run the shlib tests. + + * configure: Regenerated after change in m4/readline.m4. + +2013-01-31 Arnold D. Robbins <arnold@skeeve.com> + + * PROBLEMS: Removed. It is no longer needed. + * Makefile.am (EXTRA_DIST): Remove PROBLEMS from list. + +2013-01-31 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac: Remove TEST_MPFR conditional added in last patch. + We will instead test for MPFR capability by looking at the output + from gawk --version. + +2013-01-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac: Add MPFR test for use in test/Makefile.am. + +2013-01-25 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (parms_shadow): Change int param to bool. + * cmd.h (output_is_tty): Sync type with rest of code (is bool). + * dfa.c (MALLOC): Undef first, for Irix. + * Makefile.am (LDADD): Use LIBREADLINE and LIBMPFR instead of + automake substitutions. + * configure.ac (AC_INIT): Version bump. + (GAWK_CHECK_READLINE): Renamed from GNUPG_CHECK_READLINE. + +2013-01-23 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (list_functions): Change parameter to bool. + * symbol.c (list_functions): Ditto. + (get_symbols): Change sort parameter to bool. Additional + code cleanup. + +2013-01-22 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (get_symbols): Reset count after each loop to only + sort the actual items retrieved. Thanks to Hermann Peifer (by + way of Andrew Schorr) for reporting the bug. Also add some + commentary and fix function name in emalloc calls. + +2013-01-20 Arnold D. Robbins <arnold@skeeve.com> + + * re.c (regexflags2str): New routine. + (resetup): If do_intervals, also turn on RE_NO_BK_BRACES. + Thanks to Yan Lei <yanl.fnst@cn.fujitsu.com> for the + bug report. + +2013-01-18 Arnold D. Robbins <arnold@skeeve.com> + + Fix a problem with include ordering to get ptrdiff_t definition, + showed up on Debian Lenny. Reported by Manuel Collado. + Fix brought over from grep. + + * dfa.h: Include regex.h and stddef.h directly. + * dfa.c: Adjust includes. + +2013-01-11 John Haque <j.eh@mchsi.com> + + * awk.h (do_mpfr_rshift): Renamed from do_mpfr_rhift. + * awkgram.y (do_mpfr_rshift): Renamed from do_mpfr_rhift. + * mpfr.c (_tz1, _tz2, _mpz1, _mpz2, mpz1, mpz2, get_bit_ops, + free_bit_ops): Removed. + (init_mpfr): Remove calls to mpz_init. + (get_intval, free_intval): New functions. + (do_mpfr_rshift, do_mpfr_lshift): Rework code. + (do_mpfr_and, do_mpfr_or, do_mpfr_xor): Accept two or more arguments + to match regular functions. + +2013-01-11 Arnold D. Robbins <arnold@skeeve.com> + + * bisonfix.awk: Adjust ARGV / ARGC to force reading of standard + input; apparently needed for Mac OS X. Thanks to Akim Demaille + for the report. + +2013-01-06 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (redirect, two_way_open): Set the name field in the + awk_input_buf_t and awk_output_buf_t structures, as needed. + Thanks to Manuel Collado for the report. + +2013-01-05 Arnold D. Robbins <arnold@skeeve.com> + + * regex_internal.h (struct re_dfa_t): Restore ifdefs around + __libc_lock_define, they really were needed. Bleah. + +2013-01-01 Arnold D. Robbins <arnold@skeeve.com> + + Sync with GLIBC regex files. + + * regex_internal.h (struct re_dfa_t): Remove ifdefs around + __libc_lock_define since it's already defined to empty in non-LIBC + case. + * regexec.c (check_node_accept_bytes): Restore decl with use from + GLIBC code since this is LIBC case. + +2012-12-27 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_print, do_printf): Use output_fp as default + output for print/printf only if running under the debugger. + Otherwise use stdout as Brian, Peter, and Al intended. + +2012-12-25 Arnold D. Robbins <arnold@skeeve.com> + + Remove sym-constant from API after discussions with John + Haque and Andrew Schorr. + + * gawkapi.h (api_sym_constant): Removed field in API struct. + (sym_constant): Remove macro. + * gawkapi.c (set_constant, api_sym_update, api_sym_constant): Removed. + (sym_update_real): Renamed to api_sym_update(). is_const parameter + removed and code adjusted. + +2012-12-24 Arnold D. Robbins <arnold@skeeve.com> + + * 4.0.2: Release tar ball made. + +2012-12-23 John Haque <j.eh@mchsi.com> + + * eval.c (r_get_lhs): Node_array_ref. If original is Node_var, + don't assign null-string as value. + * ext.c (get_argument): Node_array_ref. Check if already a scalar. + +2011-12-23 John Haque <j.eh@mchsi.com> + + * awkgram.y (is_deferred_variable): New function. + (func_install): Call it. + * eval.c (r_interpret): Op_push_arg. Check for uninitialized scalar. + +2012-12-23 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (tokentab): Whitespace fix for "include". + * builtin.c (printf_common): Do a fatal error if no args to printf() + or sprintf(). + +2012-12-19 Arnold D. Robbins <arnold@skeeve.com> + + * bootstrap.sh: Touch extension/aclocal.m4 also. + + Unrelated: Extend input parser API: + + * awk.h (IOBUF): Remove read_func pointer. + * gawkapi.h (awk_input_buf_t): Move it to here. + * io.c (iop_alloc, get_a_record, get_read_timeout): Adjust code. + + Unrelated: Make sure that variables like NF, NR, FNR are + accessable correctly both through SYMTAB and through API. + + * gawkapi.c (api_sym_lookup): Call update_global_values(). + (api_sym_lookup_scalar): Ditto. + * interpret.h (Op_subscript, Op_subscript_lhs): Ditto. + * main.c (update_global_values): Adjust comment. + + Unrelated: Fix --disable-lint so that everything compiles. + + * main.c (main): Move case label inside ifdef. + * awkgram.y (isnoeffect): Add ifdefs around declaration, use, + and function body. + + Unrelated: Restore building with tcc. + + * awk.h (AFUNC): Move to array.c which is the only place its used. + (ainit_ind, atypeof_ind, etc.): New macros for use in array.c + * array.c (AFUNC): Change to use F##_ind. Works with tcc and other + compilers. + * configure.ac: Only add -export-dynamic flag if compiling with gcc. + +2012-12-18 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (sym_update_real): If setting a scalar variable that exists + already in an undefined state with type set to Node_var_new, we must + update the type to Node_var if the new value is not undefined. + +2012-12-18 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (tokentab): "extension" needs to be inside ifdef DYNAMIC. + Thanks to Anders Wallin for finding this. + +2012-12-16 Arnold D. Robbins <arnold@skeeve.com> + + * debug.c (do_set_var): Fix last remaining `*assoc_lookup() = x'. + +2012-12-15 Arnold D. Robbins <arnold@skeeve.com> + + Infrastructure Updates: + + * awkgram.c, command.c: Regenerated with bison 2.7. + * config.guess, config.sub, depcomp: Updated from automake 1.12.6. + +2012-12-09 Arnold D. Robbins <arnold@skeeve.com> + + Clean up BINMODE to use symbolic values. + + * awk.h (enum binmode_values): New enum. + * eval.c (set_BINMODE): Use them. + * io.c (binmode, close_rp, gawk_popen): Ditto. + * main.c (main): Ditto. + * builtin.c (do_system): Ditto. + + Unrelated: + + * configure.ac: Look for posix_openpt + * io.c (two_way_open): Use posix_openpt if it's available. + Thanks to Christian Weisgerber <naddy@mips.inka.de> for + the changes. + + Also unrelated: + + * regex.c: Don't include <sys/param.h> on VMS. Thanks to + Anders Wallin. + + Also unrelated: + + * ext.c (is_letter, is_identifier_char): New functions. Don't use + <ctype.h> functions since those could rely on the locale. + (make_builtin): Adjust test for valid name to call the new + functions and return false instead of throwing a fatal error. + (make_old_builtin): Adjust test for valid name to call the new + function. + * awk.h (is_identchar): Move from here, ... + * awkgram.y (is_identchar): ... to here. This is safe, since + the locale is C during parsing the program. + + Also unrelated: Make all checks for bitflags being set consistent + in case we should wish to switch them to macro calls: + + * awkgram.y, builtin.c, cint_array.c, debug.c, eval.c, gawkapi.c, + int_array.c, io.c, mpfr.c, node.c, profile.c, str_array.c: Fix + as needed. + +2012-12-07 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (tokentab): `fflush()' is now in POSIX, remove the + RESX flag. This was the last use, so delete the flag. + (yylex): Don't check RESX. + + Thanks to Nathan Weeks <weeks@iastate.edu> for helping make this + happen. + +2012-12-01 Arnold D. Robbins <arnold@skeeve.com> + + * interpret.h: For op_assign_concat, if both strings + have WSTRCUR, then do the realloc() and append for the + wide string too. Thanks to Janis Papanagnou + <janis_papanagnou@hotmail.com> for the discussion in + comp.lang.awk. + +2012-11-30 Arnold D. Robbins <arnold@skeeve.com> + + * regcomp.c, regex.c, regex_internal.h, regexec.c: Sync + with GLIBC. Why not. + + * gawkapi.c (awk_bool_t): Change into an enum with awk_false and + awk_true values. + +2012-01-30 Andrew J. Schorr <aschorr@telemetry-investments.com> + + Further cleanups of macros in awk.h + + * awk.h (_r, _t): Remove declarations. + (unref, m_force_string): Remove macros. + (r_unref): Move declaration. + (r_force_string): Remove declaration. + (DEREF, force_string, force_number, unref): Now inline functions. + (POP_STRING, TOP_STRING): Back to macros. + * eval.c (_t): Remove definition. + * main.c (_r): Remove definition. + * node.c (r_force_string): Remove. + +2012-11-27 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_fflush): Make fflush() and fflush("") both + flush everything. See the comment in the code. + +2012-11-26 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (Node_old_ext_func, Op_old_ext_func): New enum values. + * configure.ac: Use -export-dynamic if supported for old extension + mechanism. + * eval.c (nodeytpes): Add Node_old_ext_func. + (optypetab): Add Op_old_ext_func. + * ext.c (make_old_ext_builtin): "New" function. + * interpret.h: Special case Op_old_ext_builtin. Add checks for + Node_old_ext_func. + * msg.c: Adjust placement of a comment. + +2012-05-02 John Haque <j.eh@mchsi.com> + + * str_array.c (str_copy): Initialize next pointer in the linked list + to avoid memory corruption. + * int_array.c (int_copy): Ditto. + +2012-04-21 John Haque <j.eh@mchsi.com> + + Shutdown routine for a dynamic extension. + + * awk.h (SRCFILE): New field fini_func. + * ext.c (load_ext): Takes an additional argument to look up and + save the clean up routine in SRCFILE struct. + (INIT_FUNC, FINI_FUNC): Defines for default init and fini routine + names. + (do_ext): Use default for the name of the init or fini routine if + one is not supplied. Adjust call to load_ext(). + (close_extensions): Execute fini routines. + * interpret.h (Op_at_exit): Call close_extensions(). + * msg.c (gawk_exit): Ditto. + * debug.c (close_all): Ditto. + * main.c (main): Adjust call to load_ext(). + * awkgram.y (tokentab): Specify 2nd and 3rd optional arguments + for the extension() built-in. + + Unrelated: + + * interpret.h (Op_arrayfor_init): Use assoc_length for array size. + +2012-04-19 John Haque <j.eh@mchsi.com> + + Enhanced array interface to support transparent implementation + using external storage and ... + + * awk.h (astore): Optional post-assignment store routine for + array subscripts. + (Op_subscript_assign): New opcode to support the store routine. + (alength): New array interface routine for array length. + (assoc_length): New macro. + (assoc_empty): Renamed from array_empty. + * awkgram.y (snode): Append Op_subscript_assign opcode if + (g)sub variable is an array element. + (mk_getline): Same for getline variable. + (mk_assignment): Same if assigning to an array element. + * field.c (set_element): Call store routine if needed. + * builtin.c (do_match): Ditto. + (do_length): Use length routine for array size. + * symbol.c (print_vars): Ditto. + * array.c (null_length): Default function for array length interface. + (asort_actual): Call store routine if defined. + (asort_actual, assoc_list): Use length routine for array size. + (null_array_func): Add length and store routine entries. + * str_array.c (str_array_func): Same. + * cint_array.c (cint_array_func): Same. + * int_array.c (int_array_func): Same. + * eval.c (optypetab): Add Op_subscript_assign. + * profile.c (pprint): Add case Op_subscript_assign. + * interpret.h (set_array, set_idx): New variables to keep track + of an array element with store routine. + (Op_sub_array, Op_subscript_lhs, Op_store_sub, Op_subscript_assign): + Add code to handle array store routine. + * debug.c (print_symbol, print_array, cmp_val, watchpoint_triggered, + initialize_watch_item): Use length routine for array size. + + * awk.h (assoc_kind_t): New typedef for enum assoc_list_flags. + (sort_context_t): Renamed from SORT_CONTEXT. + * array.c (asort_actual, assoc_sort): Adjust. + * cint_array.c (cint_list, tree_list, leaf_list): Adjust. + * int_array.c (int_list): Adjust. + * str_array.c (str_list): Adjust. + +2012-04-18 John Haque <j.eh@mchsi.com> + + * awk.h (atypeof, AFUNC): New macros. + (afunc_t): Renamed typedef from array_ptr. + * array.c (register_array_func, null_lookup): Use AFUNC macro + instead of hard-coded index for array functions. + (asort_actual): Unref null array elements before overwriting. + (force_array): Renamed from get_array. + (null_array): Renamed from init_array. Also initialize flags to 0. + (array_types): Renamed from atypes. + (num_array_types): Renamed from num_atypes. + * interpret.h (r_interpret): In case Op_sub_array, unref null array element. + * str_array.c (str_array_init): Reworked for (re)initialization of array. + * int_array.c (int_array_init): Ditto. + * cint_array.c (cint_array_init): Ditto. + +2012-11-24 Arnold D. Robbins <arnold@skeeve.com> + + Directory cleanup. + + * TODO.xgawk, FUTURES: Merged into TODO. + * TODO: More stuff added. + * Makefile.am (EXTRA_DIST): Updated. + +2012-11-22 Arnold D. Robbins <arnold@skeeve.com> + + Cleanup of awk.h. + + * array.c (r_in_array): Removed. + * awk.h (MALLOC_ARG_T): Replaced with size_t everywhere. + (S_ISREG, setsid): Moved to io.c. + (__extension__): Removed. + (INT32_BIT): Moved to cint_array.c. + (_t): Always declare. + (DO_LINT_INVALID, et al): Moved into an enum. + (POP_ARRAY, POP_PARAM, POP_SCALAR, TOP_SCALAR, dupnode, in_array): + Moved into inline functions. + (force_number, force_string): Simplified. + (ZOS_USS): Remove undef of DYNAMIC, it's handled in configure.ac. + * io.c (S_ISREG, setsid): Moved to here. + * cint_array.c (INT32_BIT): Moved to here. + * eval.c (_t): Always define. + * protos.h: Use size_t directly instead of MALLOC_ARG_T. + + Unrelated: + + * gawkapi.h: Add `awk_' prefix to structure tags where they + were missing. Document the full list of include files needed. + +2012-11-14 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (do_find_source): On VMS, don't add the `/' separator. + Thanks to Anders Wallin. + + MPFR minor cleanup: + + * awk.h (mpfr_unset): Declare new function. + * mpfr.c (mpfr_unset): New function. + * node.c (r_unref): Call it instead of inline code. + * gawk_api.c (api_sym_update_scalar): Call it instead of inline code. + +2012-11-13 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (get_symbols): Check type, not vname. Keeps + valgrind happy. Thanks to Andrew Schorr for noticing the problem. + +2012-11-10 Arnold D. Robbins <arnold@skeeve.com> + + * Update to bison 2.6.5. Various files regenerated. + * io.c (find_source): Add a default value for SHLIBEXT. + (read_with_timeout): For VMS also, just use read(). + +2012-11-10 John Haque <j.eh@mchsi.com> + + * int_array.c (int_copy): Initialize next pointer of newchain to null. + * eval.c (eval_condition): Force string context for an integer used + as array index. + +2012-11-10 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.c (api_add_ext_func, api_awk_atexit, api_clear_array, + api_create_array, api_create_value, api_register_ext_version, + api_release_value, api_update_ERRNO_string, node_to_awk_value, + remove_element, run_ext_exit_handlers): Add null pointer checks. + Everywhere: Add / fixup leading comments. + + * interpret.h (Op_store_sub): If assigning to an uninitialized variable + through SYMTAB, change it to Node_var. Add explanatory comments. + * symbol.c (get_symbol): Rationalized. Skip non-variables in SYMTAB. + +2012-11-04 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Minor documentation edit. + +2012-10-31 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (want_regexp): Use as a bool, not as an int. + * field.c: Fix a comment. + * gawkapi.h: Add comment to include <errno.h>. + * symbol.c (load_symbols): ``No automatic aggregate initialization.'' + Here too. Sigh again. + + * gawkapi.h: Minor documentation edits. + +2012-11-27 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_fflush): Make fflush() and fflush("") both + flush everything. See the comment in the code. + +2012-10-28 Arnold D. Robbins <arnold@skeeve.com> + + * Update to bison 2.6.4. Various files regenerated. + +2012-10-27 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Continuing the minor formatting / doc cleanups. + +2012-10-26 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Continuing the minor formatting / doc cleanups. + +2012-10-24 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Still more minor formatting / doc cleanups. + +2012-10-23 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: More minor formatting / doc cleanups. + +2012-10-21 Arnold D. Robbins <arnold@skeeve.com> + + Fixes for z/OS from Dave Pitts. + + * awk.h (assoc_list_flags): No trailing comma on last enum value. + * gawkapi.h (awk_valtype_t): Ditto. + * symbol.c (lookup): ``No automatic aggregate initialization.'' Sigh. + + Unrelated: + + * gawkapi.h: Minor formatting / doc cleanups. + +2012-10-19 Arnold D. Robbins <arnold@skeeve.com> + + If SYMTAB is used, make sure ENVIRON and PROCINFO get loaded too. + + * awkgram.y (process_deferred): New function. Call it when program + is completely parsed. + (symtab_used): New variable. + (variable): Set it to true if SYMTAB is looked up. + * main.c (load_environ, load_procinfo): Make sure the routines are + only called once. + + Unrelated fixes: + + * awkgram.y (yylex): Check continue_allowed and break_allowed as + soon as they are seen in the scanner; the rules that check them + can not be reduced until after a token that allows them is seen, + leading to errors at execution time. + * interpret.h (Op_K_break, Op_K_continue, Op_jmp): Add assertion + that pc->target_jmp is not NULL. + + * symbol.c (lookup): Correct a comment. + +2012-10-14 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (IOBUF_PUBLIC): Renamed awk_input_buf_t. + (struct iobuf_public): Renamed struct awk_input. + * awk.h: Adjust. + +2012-10-13 Arnold D. Robbins <arnold@skeeve.com> + + * Update to Automake 1.12.4. Various files regenerated. + +2012-10-11 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (dup_ent): New member for Node_param_list. + * symbol.c (install): For parameters, if this is a duplicate, chain + it off the original using the dup_ent pointer. + (remove_params): If there's a duplicate, remove it from the list. + + * awk.h: Fix flags to have unique numeric values. Oops. + +2012-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Add considerably more documentation. Rearrange order + of functions in the struct to make more sense, grouping related + functions together in a more logical order. + * gawkapi.c: Adjust as needed. + * ext.c (make_builtin): Adjust for name change in struct member. + +2012-10-05 Arnold D. Robbins <arnold@skeeve.com> + + * mbsupport.h: Add a bunch of undefs for z/OS. + +2012-10-04 Arnold D. Robbins <arnold@skeeve.com> + + * TODO.xgawk: Update. + * awk.h (make_str_node): Removed macro. + (make_string): Modified to call make_str_node. + (r_make_str_node): Renamed to make_str_node. + * gawkapi.c: Changed r_make_str_node to make_str_node everywhere. + * node.c (make_str_node): Renamed from make_str_node. + + Update to automake 1.12.4. + + * Makefile.in, aclocal.m4, awklib/Makefile.in, doc/Makefile.in, + extension/Makefile.in, extension/aclocal.m4, test/Makefile.in: + Regenerated. + + * interpret.h (Op_Subscript): Added lint warnings for FUNCTAB + and SYMTAB. + +2012-10-02 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (func_table): Declare. + * awkgram.y: If do_posix or do_traditional, then check for + delete on SYMTAB. Add check for delete on FUNCTAB, also. + * interpret.h (Op_Subscript): For FUNCTAB, return the element name + as its value too. Avoids lots of weirdness and allows indirect calls + after assignment from FUNCTAB["foo"] to work. + (Op_store_sub): Disallow assignment to elements of FUNCTAB. + (Op_indirect_func_all): Turn assert into check and fatal error. + * symbol.c (func_table): No longer static. + (lookup): If do_posix or do_traditional, skip the global table. + (release_all_vars): Clear func_table too. + +2012-09-25 Arnold D. Robbins <arnold@skeeve.com> + + First cut at SYMTAB and FUNCTAB. This does the following: + - Change symbol table handling to use gawk arrays. + - Store symbols in SYMTAB array and allow indirect access + through SYMTAB to variables, both getting and setting. + - List function names in FUNCTAB indexes; Values cannot be + used at the moment. + - No documentation yet. + + * awk.h (Node_hashnode, hnext, hname, hlength, hcode, hvalue): + Removed, not needed any more. + (init_symbol_table, symbol_table): Add declarations. + * awkgram.y: Disallow delete on SYMTAB, fix warning for tawk + extension if traditional. + * eval.c (nodetypes): Remove Node_hashnode element. + * interpret.h (Op_subscript, Op_store_sub): Handle SYMTAB and go + through to the actual value. + * main.c (main): Init Nnull_string earlier. Add call to + init_symbol_table(). + * profile.c (pp_str, pp_len): Change definitions. + (pp_next): New macro. + (pp_push, pp_pop): Adjust uses. + * symbol.c (variables): Removed. + (global_table, param_table, func_table, symbol_table, + installing_specials): New variables. + (lookup, make_params, install_params, remove_params, remove_symbol, + make_symbol, install, get_symbols, release_all_vars, append_symbol, + release_symbols, load_symbols): Rework logic considerably. + (init_symbol_table): New function. + +2012-09-23 Arnold D. Robbins <arnold@skeeve.com> + + `delete array' and `nextfile' are now in POSIX. + Thanks to Nathan Weeks <weeks@iastate.edu> for the + initiative and letting us know about it. + + * awkgram.y: Make the right code changes for `delete array' + and `nextfile'. + (tokentab): Set flags to zero for nextfile. + +2012-09-19 Arnold D. Robbins <arnold@skeeve.com> + + * symbol.c (load_symbols): Zero out the new node. Prevents assertion + failure on PPC Mac OS X. + +2012-09-14 Arnold D. Robbins <arnold@skeeve.com> + + Allow read-only access to built-in variables from extensions. + + * awk.h (NO_EXT_SET): New flag. + * gawkapi.c (api_sym_lookup, api_sym_update_real): Set flag if off + limits variable instead of failing. Adjust logic. + (api_sym_update_scalar, api_set_array_element, api_del_array_element, + api_release_flattened_array): Adjust logic. + * gawkapi.h: Adjust documentation. + + Provide PROCINFO["identifiers"]. Undocumented for now. + + * awk.h (load_symbols): Add declaration. + * awkgram.y (variable): Adjust comment formatting. + * main.c (main): Call load_symbols(). + * symbol.c (load_symbols): New function. + +2012-09-13 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Determination of DYNAMIC adjusted. Hopefully is + smarter for z/OS. + +2012-09-13 Dave Pitts <dpitts@cozx.com> + + * awk.h: Add defines for z/OS for newer types. + +2012-08-31 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.c: Wrap various bits in #ifdef DYNAMIC so that + gawk will compile on systems without dynamic loading. + +2012-08-24 Arnold D. Robbins <arnold@skeeve.com> + + Add version facility to API. Thanks to Manuel Collado + for the idea. + + * awk.h (print_ext_versions): Declare. + Rearrange includes and decls to make more sense. + * gawkapi.h (register_ext_version): New API. + (dl_load_func): Add code for ext_version. + * gawkapi.c (api_register_ext_version, print_ext_versions): + New functions. + * main.c (do_version): New variable. + (optab): Set it for -v / --version. + (main): Set it in arg parsing switch. Call version() after the + extensions have been loaded. + +2012-08-22 Arnold D. Robbins <arnold@skeeve.com> + + Add output wrapper and two-way processor to extension API. + + * awk.h (struct redirect): Replace output FILE * with awk_output_buf_t. + (register_output_wrapper, register_two_way_processor): Declare. + * builtin.c (efwrite): Adjust logic to use rp->output data and + functions if rp is not NULL. Remove redundant declaration of function. + (do_fflush, do_printf, do_print, do_print_rec): Same adjustment. + * ext.c (make_builtin): Adjust error messages. + * gawkapi.c (api_register_output_wrapper, + api_register_two_way_processor): New functions. + (sym_update_real): Adjust code formatting. + * gawkapi.h (awk_input_parser_t): Make next pointer awk_const. + (awk_output_buf_t, awk_two_way_processor_t): New structs. + (api_register_output_wrapper, api_register_two_way_processor): New APIs. + (dl_load_func): Allow for empty function table (NULL elements). + * io.c (find_output_wrapper, init_output_wrapper, find_two_processor, + gawk_fwrite, gawk_ferror, gawk_fflush, gawk_fclose): New functions. + (redirect): Call init_output_wrapper, find_output_wrapper as needed. + Adjust use of rp->fp to rp->output.fp and also function calls. + (close_rp, close_redir, flush_io): Same adjustment. + (two_way_open): Same adjustment. Call find_two_way_processor, and + find_output_wrapper, as needed. + +2012-08-17 Arnold D. Robbins <arnold@skeeve.com> + + * Update infrastructure: Automake 1.12.3 and bison 2.6.2. + +2012-08-15 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync w/GNU grep. + +2012-08-12 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Make the versions enum constants instead of defines. + +2012-08-11 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (add_srcfile): It is now a fatal error to load the + same file with -f and -i (or @include). + * TODO.xgawk: Update to reflect this change. + +2012-08-10 Arnold D. Robbins <arnold@skeeve.com> + + * FUTURES, TODO.xgawk: Updates. + +2012-08-08 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add -DNDEBUG to remove asserts if not developing. + + * gawkapi.h: Document how to build up arrays. + * gawkapi.c (api_sym_update): For an array, pass the new cookie + back out to the extension. + + * awk.h (IOBUF): Move struct stat into IOBUF_PUBLIC. + (os_isreadable): Change to take an IOBUF_PUBLIC. + * gawkapi.h (IOBUF_PUBLIC): Received struct stat. + (INVALID_HANDLE): Moves to here. + * io.c (iop_alloc): Stat the fd and fill in stat buf. + (iop_finish): Use passed in stat info. + +2012-08-05 Arnold D. Robbins <arnold@skeeve.com> + + * README.git: More stuff added. + +2012-08-01 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (iop_finish): New function. + (iop_alloc): Add errno_val parameter. Move code into iop_finish. + Add large explanatory leading comment. + (after_beginfile): Rework logic. Check for input parser first, then + check for invalid iop. + (nextfile): Organize code better. Call iop_alloc then iop_finish. + (redirect): Call iop_alloc, find_input_parser, iop_finish. + (two_way_open): Call iop_alloc, find_input_parser, iop_finish. + (gawk_popen): Call iop_alloc, find_input_parser, iop_finish. + (find_input_parser): Set iop->valid if input parser takes control. + (get_a_record): Rework setting RT to use macros. + +2012-07-29 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awk.h (set_RT_to_null, set_RT): Removed. + * gawkapi.h (api_set_RT): Removed. + (get_record): Signature changed in input parser struct. + * gawkapi.c (api_set_RT): Removed. + * io.c (set_RT_to_null, set_RT): Removed. + (get_a_record): Adjustments for new API for input parser. + +2012-07-29 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (os_isreadable): Adjust declaration. + (struct iobuf): Add new member `valid'. + * io.c (iop_alloc): Remove do_input_parsers parameter, it's + always true. Adjust logic to set things to invalid if could not + find an input parser. + (after_beginfile): Use valid member to check if iobuf is valid. + Don't clear iop->errcode. + (nextfile): Adjust logic to clear errcode if valid is true and + also to update ERRNO. + (redirect): Check iop->valid and cleanup as necessary, including + setting ERRNO. + (two_way_open): Ditto. + (gawk_popen): Ditto. + (devopen): Remove check for directory. + +2012-07-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (find_input_parser): Issue a warning if take_control_of fails. + +2012-07-27 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (set_RT): Change to take a NODE * parameter. + * io.c (set_RT): Change to take a NODE * parameter. + * gawkapi.h: Change open hook to input parser in comment. + * gawkapi.c (api_set_RT): Adjust call to set_RT. + +2012-07-26 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h (set_RT_to_null, set_RT): Declare functions. + (os_isreadable): Declare function. + * io.c (set_RT_to_null, set_RT): New functions. + (iop_close): Init ret to zero. + * gawkapi.c (api_register_input_parser): Check for null pointer. + (api_set_RT): New function. + * gawkapi.h (api_set_RT): New function. + +2012-07-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (IOBUF_PUBLIC): Document the get_record and close_func + API. + (awk_input_parser_t) Change can_take_file argument to const, and + document the API. + * io.c (get_a_record): Document that the caller initializes *errcode + to 0, and remote the test for non-NULL errcode. + +2012-07-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (api_sym_update_scalar): Fix some minor bugs. Was + not updating AWK_NUMBER when valref != 1. And strings were not + freeing MPFR values. + +2012-07-25 Arnold D. Robbins <arnold@skeeve.com> + + Start refactoring of IOBUF handling and turn "open hooks" + into "input parsers". + + * awk.h (IOP_NOFREE_OBJ): Flag removed. + (register_input_parser): Renamed from register_open_hook. + * ext.c (load_ext): Make sure lib_name is not NULL. + * gawk_api.c (api_register_input_parser): Renamed from + api_register_open_hook. + * gawk_api.h (api_register_input_parser): Renamed from + api_register_open_hook. Rework structure to have "do you want it" + and "take control of it" functions. + * io.c (iop_alloc): Remove third argument which is IOBUF pointer. + Always malloc it. Remove use of IOP_NOFREE_OBJ everywhere. + (find_input_parser): Renamed from find_open_hook. + (nextfile): Don't use static IOBUF. + (iop_close): Call close_func first. Then close fd or remap it + if it's still not INVALID_HANDLE. + (register_input_parser): Renamed from register_open_hook. + Use a FIFO list and check if more than one parser will accept the + file. If so, fatal error. + +2012-07-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac: Instead of using acl_shlibext for the shared library + extension, define our own variable GAWKLIBEXT with a hack to work + correctly on Mac OS X. + * Makefile.am (SHLIBEXT): Use the value of GAWKLIBEXT instead of + acl_shlibext. + +2012-07-24 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Add crude but small hack to make plug-ins work + on Mac OS X. + +2012-07-20 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Rework table to not take up so much space. + * gawkapi.c (api_sym_update_scalar): Rework optimization code + to clean up the function. + +2012-07-17 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h: Add comments explaining new api_create_value and + api_release_value functions. + * gawkapi.c (sym_update_real): Allow updates with AWK_SCALAR and + AWK_VALUE_COOKIE types. After creating a regular variable, + remove the call to unref(node->var_value), since this is not + done elsewhere in the code (see, for example, main.c:init_vars). + If the update is for an existing variable, allow any val_type + except AWK_ARRAY (was previously disallowing AWK_SCALAR and + AWK_VALUE_COOKIE for no apparent reason). + (api_sym_update_scalar): The switch should return false for an + invalid val_type value, so change the AWK_ARRAY case to default. + (valid_subscript_type): Any scalar value is good, so accept any valid + type except AWK_ARRAY. + (api_create_value): Accept only AWK_NUMBER and AWK_STRING values. + Anything else should fail. + +2012-07-17 Arnold D. Robbins <arnold@skeeve.com> + + Speedup: + + * awk.h (r_free_wstr): Renamed from free_wstr. + (free_wstr): Macro to test the WSTRCUR flag first. + * node.c (r_free_wstr): Renamed from free_wstr. + + Support value cookies: + + * gawkapi.h (awk_val_type_t): Add AWK_VALUE_COOKIE. + (awk_value_cookie_t): New type. + (awk_value_t): Support AWK_VALUE_COOKIE. + (api_create_value, api_release_value): New function pointers. + * gawkapi.c (awk_value_to_node, api_sym_update_scalar, + valid_subscript_type): Handle AWK_VALUE_COOKIE. + (api_create_value, api_release_value): New functions. + +2012-07-16 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.c (awk_value_to_node): Support AWK_SCALAR. + (api_sym_update_scalar): Performance improvements. + +2012-07-12 Arnold D. Robbins <arnold@skeeve.com> + + Allow creation of constants. Thanks to John Haque for the + implementation concept. + + * gawk_api.h (api_sym_constant): Create a constant. + * gawk_api.h (api_sym_update_real): Renamed from api_sym_update. + Add is_const parameter and do the right thing if true. + (api_sym_update, api_sym_constant): Call api_sym_update_real + in the correct way. + (set_constant): New function. + +2012-07-11 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h: Fix typo in comment. + (awk_value_t): Type for scalar_cookie should be awk_scalar_t, + not awk_array_t. + (gawk_api): Add new api_sym_lookup_scalar function. + (sym_lookup_scalar): New wrapper macro for api_sym_lookup_scalar hook. + * gawkapi.c (api_sym_lookup_scalar): New function for faster scalar + lookup. + (api_impl): Add entry for api_sym_lookup_scalar. + +2012-07-11 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (awk_value_to_node): Change to a switch statement + so AWK_SCALAR or other invalid type is handled properly. + (valid_subscript_type): Test whether a value type is acceptable + for use as an array subscript (any scalar value will do). + (api_get_array_element, api_set_array_element, api_del_array_element): + Use new valid_subscript_type instead of restricting to string values. + +2012-07-11 Arnold D. Robbins <arnold@skeeve.com> + + Lots of API work. + + * gawkapi.h: Function pointer members renamed api_XXX and + macros adjusted. More documentation. + (awk_valtype_t): New AWK_SCALAR enum for scalar cookies. + (awk_scalar_t): New type. + (awk_value_t): New member scalar_cookie. + (api_sym_update_scalar): New API function. + (erealloc): New macro. + (make_const_string): New macro, renamed from dup_string. + (make_malloced_string): New macro, renamed from make_string. + (make_null_string): New inline function. + (dl_load_func): Add call to init routine through pointer if + not NULL. + + * gawkapi.c (awk_value_to_node): Assume that string values came + from malloc. + (node_to_awk_value): Handle AWK_SCALAR. + (api_sym_update): Ditto. + (api_sym_update_scalar): New routine. + (api_get_array_element): Return false if the element doesn't exist. + Always unref the subscript. + (remove_element): New helper routine. + (api_del_array_element): Use it. + (api_release_flattened_array): Ditto. + (api_impl): Add the new routine. + +2012-07-11 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (api_sym_update): Allow val_type to be AWK_UNDEFINED + for setting a variable to "", i.e. dupnode(Nnull_string). + +2012-07-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (add_srcfile): Lint warning message for a previously loaded + shared library should say "already loaded shared library" instead + of "already included source file". + +2012-07-08 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (set_array_element): Use index + value instead + of element structure. Matches get_array_element. + (set_array_element_by_elem): New macro to use an element. + * gawkapi.c (api_set_array_element): Make the necessary adjustments. + +2012-07-04 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (tokentab): Remove limit on number of arguments + for "and", "or", and "xor". + * builtin.c (do_and, do_or, do_xor): Modify code to perform the + respective operation on any number of arguments. There must be + at least two. + +2012-06-29 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h: Improve the documentation of the return values + per Andrew Schorr. + +2012-06-25 Arnold D. Robbins <arnold@skeeve.com> + + * TODO.xgawk: Updated. + * awk.h (track_ext_func): Declared. + * awkgram.y (enum defref): Add option for extension function. + (struct fdesc): Add member for extension function. + (func_use): Handle extension function, mark as extension and defined. + (track_ext_func): New function. + (check_funcs): Update logic for extension functions. + * ext.c (make_builtin): Call track_ext_func. + +2012-06-24 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Most of IOBUF has been hidden. + * gawkapi.h (IOBUF): Remove declaration (now back in awk.h). + (IOBUF_PUBLIC): Declare new structure defining subset of IOBUF fields + that should be exposed to extensions. + (gawk_api): Update register_open_hook argument from IOBUF to + IOBUF_PUBLIC. + * awk.h (IOBUF): Restore declaration with 5 fields moved to new + IOBUF_PUBLIC structure. + (register_open_hook): Update open_func argument from IOBUF to + IOBUF_PUBLIC. + * gawkapi.c (api_register_open_hook): Ditto. + * io.c (after_beginfile, nextfile, iop_close, gawk_pclose): Some fields + such as fd and name are now inside the IOBUF public structure. + (struct open_hook): Update open_func argument from IOBUF to + (register_open_hook): Ditto. + (find_open_hook): opaque now inside IOBUF_PUBLIC. + (iop_alloc): fd and name now in IOBUF_PUBLIC. + (get_a_record): If the get_record hook returns EOF, set the IOP_AT_EOF + flag. Access fd inside IOBUF_PUBLIC. + (get_read_timeout): File name now inside IOBUF_PUBLIC. + * interpret.h (r_interpret): File name now inside IOBUF_PUBLIC. + * ext.c (load_ext): No need to call return at the end of a void + function. + +2012-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * ext.c (load_ext): Don't return a value from a void function. + * gawkapi.c (api_set_array_element): Set up vname and parent_array. + +2012-06-21 Arnold D. Robbins <arnold@skeeve.com> + + More API and cleanup: + + * awk.h (stopme): Make signature match other built-ins. + * awkgram.y (stopme): Make signature match other built-ins. + (regexp): Minor edit. + * gawkapi.c (api_set_argument): Remove unused variable. + Set parent_array field of array value. + * TODO.xgawk: Update some. + + Remove extension() builtin. + + * awk.h (do_ext): Removed. + (load_ext): Signature changed. + * awkgram.y (tokentab): Remove do_ext. + Change calls to do_ext. + * ext.c (load_ext): Make init function a constant. + * main.c (main): Change calls to do_ext. + +2012-06-20 Arnold D. Robbins <arnold@skeeve.com> + + Restore lost debugging function: + + * awkgram.y (stopme): Restore long lost debugging function. + * awk.h (stopme): Add declaration. + + API work: + + * ext.c (get_argument): Make extern. + * awk.h (get_argument): Declare it. + * gawkapi.c (api_set_argument): Call it. Finish off the logic. + (api_get_argument): Refine logic to use get_argument. + * gawkapi.h (set_argument): New API. + +2012-06-19 Arnold D. Robbins <arnold@skeeve.com> + + Remove code duplication in gawkapi.c from msg.c: + + * awk.h (err): Add `isfatal' first parameter. + * awkgram.y (err): Adjust all calls. + * msg.c (err): Adjust all calls. Move fatal code to here ... + (r_fatal): From here. + * gawkapi.c: Remove code duplication and adjust calls to `err'. + + Handle deleting elements of flattened array: + + * awk.h (get_argument): Remove declaration. + * ext.c (get_argument): Make static. + * gawkapi.h (awk_flat_array_t): Make opaque fields const. Add + more descriptive comments. + * gawkapi.c (release_flattened_array): Delete elements flagged + for deletion. Free the flattened array also. + + Add additional debugging when developing: + + * configure.ac: Add additional debugging flags. + * configure: Regenerated. + +2012-06-18 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.h (get_array_element): Restore `wanted' parameter. + (awk_element_t): Use awk_value_t for index. Add awk_flat_array_t. + (flatten_array): Change signature to use awk_flat_array_t; + (release_flattened_array): Change signature to use awk_flat_array_t; + * gawkapi.c (api_sym_update): Handle case where variable exists already. + (api_get_array_element): Restore `wanted' parameter and pass it + on to node_to_awk_value. + (api_set_array_element): Revisse to match changed element type. + (api_flatten_array): Revise signature, implement. + (api_release_flattened_array): Revise signature, implement. + +2012-06-17 Arnold D. Robbins <arnold@skeeve.com> + + API Work: + + * gawkapi.h (get_array_element): Remove `wanted' parameter. + (r_make_string): Comment the need for `api' and `ext_id' parameters. + * gawkapi.c (api_sym_update): Move checks to front. + Initial code for handling arrays. Still needs work. + (api_get_array_element): Implemented. + (api_set_array_element): Additional checking code. + (api_del_array_element): Implemented. + (api_create_array): Implemented. + (init_ext_api): Force do_xxx values to be 1 or 0. + (update_ext_api): Ditto. + +2012-06-12 Arnold D. Robbins <arnold@skeeve.com> + + API Work: + + * gawkapi.h (awk_value_t): Restore union. + (get_curfunc_param): Renamed to get_argument. Return type changed + to awk_bool_t. Semantics better thought out and documented. + (awk_atexit, get_array_element): Return type now void. + (sym_lookup): Return type now void. Argument order rationalized. + * gawkapi.c (node_to_awk_value): Return type is now awk_bool_t. + Semantics now match table in gawkawpi.h. + (api_awk_atexit): Return type now void. + (api_sym_lookup): Return type is now awk_bool_t. Change parameter + order. + (api_get_array_element): Return type is now awk_bool_t. + + Further API implementations and fixes for extension/testext.c: + + * awk.h (final_exit): Add declaration. + * ext.c (load_ext): Change `func' to install_func. + * gawkapi.c: Add casts to void for id param in all functions. + (api_sym_update): Finish implementation. + (api_get_array_element): Start implementation. + (api_set_array_element): Add error checking. + (api_get_element_count): Add error checking, return the right value. + * main.c (main): Call final_exit instead of exit. + (arg_assign): Ditto. + * msg.c (final_exit): New routine to run the exit handlers and exit. + (gawk_exit): Call it. + * profile.c (dump_and_exit): Ditto. + +2012-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Addition of time extension moved to "done" section. + +2012-06-10 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.c (api_update_ERRNO_string): Treat boolean true as a request + for TRANSLATE, and false as DONT_TRANSLATE. + +2012-06-06 Arnold D. Robbins <arnold@skeeve.com> + + * cint_array.c (tree_print, leaf_print): Add additional casts + for printf warnings. + + * awk.h (update_ext_api): Add declaration. + * gawkapi.c (update_ext_api): New function. + * eval.c (set_LINT): Call update_ext_api() at the end. + * gawkapi.h: Document that do_XXX could change on the fly. + + * awk.h (run_ext_exit_handlers): Add declaration. + * msg.c (gawk_exit): Call it. + +2012-06-05 Arnold D. Robbins <arnold@skeeve.com> + + * ext.c (load_ext): Remove use of RTLD_GLOBAL. Not needed in new + scheme. Clean up error messages. + +2012-06-04 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Remove use of -export-dynamic for GCC. + * configure: Regenerated. + +2012-05-30 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (is_off_limits_var): Minor coding style edit. + * gawkapi.c (awk_value_to_node): More cleanup. + (node_to_awk_value): Use `wanted' for decision making. + (api_sym_update): Start implementation. Needs more work. + General: More cleanup, comments. + * gawkapi.h (api_sym_update): Add additional comments. + +2012-05-29 Arnold D. Robbins <arnold@skeeve.com> + + * gawkapi.c (node_to_awk_value): Add third parameter indicating type + of value desired. Based on that, do force_string or force_number + to get the "other" type. + (awk_value_to_node): Clean up the code a bit. + (get_curfunc_param): Move forcing of values into node_to_awk_value. + (api_sym_lookup): Add third parameter indicating type of value wanted. + (api_get_array_element): Ditto. + * gawk_api.h: Additional comments and clarifications. Revise APIs + to take third 'wanted' argument as above. + (awk_value_t): No longer a union so that both values may be accessed. + All macros: Parenthesized the bodies. + * bootstrap.sh: Rationalize a bit. + +2012-05-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (include_HEADERS): Add so gawkapi.h will be installed. + (base_sources): Add gawkapi.h so that it is in dist tarball. + * TODO.xgawk: Update. + * main.c (is_off_limits_var): Stop returning true for everything + except PROCINFO. + +2012-05-25 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (is_off_limits_var): New function to check if a variable + is one that an extension function may not change. + * awk.h (is_off_limits_var): Declare it. + * gawkapi.c (api_sym_lookup): Use it. + + * bootstrap.sh: Touch various files in the extension directory also. + +2012-05-24 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * gawkapi.h (awk_param_type_t): Remove (use awk_valtype_t instead). + (awk_ext_func_t): Pass a result argument, and return an awk_value_t *. + (gawk_api.get_curfunc_param): Add a result argument. + (gawk_api.set_return_value): Remove obsolete function. + (gawk_api.sym_lookup, gawk_api.get_array_element): Add a result + argument. + (gawk_api.api_make_string, gawk_api.api_make_number): Remove hooks, + since access to gawk internal state is not required to do this. + (set_return_value): Remove obsolete macro. + (get_curfunc_param, sym_lookup, get_array_element): Add result argument. + (r_make_string, make_number): New static inline functions. + (make_string, dup_string): Revise macro definitions. + (dl_load_func): Remove global_api_p and global_ext_id args, + and fix SEGV by setting api prior to checking its version members. + (GAWK): Expand ifdef to include more stuff. + * gawkapi.c (node_to_awk_value): Add result argument. + (api_get_curfunc_param): Add result argument, and use awk_valtype_t. + (api_set_return_value): Remove obsolete function. + (awk_value_to_node): New global function to convert back into internal + format. + (api_add_ext_func): Simply call make_builtin. + (node_to_awk_value): Add result argument, and handle Node_val case. + (api_sym_lookup, api_get_array_element): Add result argument. + (api_set_array_element): Implement. + (api_make_string, api_make_number): Remove functions that belong on + client side. + (api_impl): Remove 3 obsolete entries. + * TODO.xgawk: Update to reflect progress. + * Makefile.am (base_sources): Add gawkapi.c. + * awk.h: Include gawkapi.h earlier. + (api_impl, init_ext_api, awk_value_to_node): Add declarations + so we can hook in new API. + (INSTRUCTION): Add new union type efptr for external functions. + (extfunc): New define for d.efptr. + (load_ext): Remove 3rd obj argument that was never used for anything. + (make_builtin): Change signature for new API. + * awkgram.y (load_library): Change 2nd argument to load_ext + from dlload to dl_load, and remove pointless 3rd argument. + * main.c (main): Call init_ext_api() before loading shared libraries. + Change 2nd argument to load_ext from dlload to dl_load, and remove + pointless 3rd argument. + * ext.c (do_ext): Remove pointless 3rd argument to load_ext. + (load_ext): Remove 3rd argument. Port to new API (change initialization + function signature). If initialization function fails, issue a warning + and return -1, else return 0. + (make_builtin): Port to new API. + * interpret.h (r_interpret): For Op_ext_builtin, call external functions + with an awk_value_t result buffer, and convert the returned value + to a NODE *. For Node_ext_func, code now in extfunc instead of builtin. + +2012-05-21 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac: Remove libtool, and call configure in the + extension subdirectory. Change pkgextensiondir to remove the + version number, since the new API has builtin version checks. + * TODO.xgawk: Update. + * ltmain.sh: Removed, since libtool no longer used here. + +2012-05-19 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Update to reflect progress and new issues. + * main.c (main): Add -i (--include) option. + (usage): Ditto. + * awkgram.y (add_srcfile): Eliminate duplicates only for SRC_INC + and SRC_EXTLIB sources (i.e. -f duplicates should not be removed). + * io.c (find_source): Set DEFAULT_FILETYPE to ".awk" if not defined + elsewhere. + +2012-05-15 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Include "gawkapi.h" to get IOBUF. + * gawkapi.h: Considerable updates. + * gawkapi.c: New file. Start at implementing the APIs. + +2012-05-13 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Update to reflect recent discussions and deletion of + extension/xreadlink.[ch]. + +2012-05-11 Arnold D. Robbins <arnold@skeeve.com> + + Sweeping change: Use `bool', `true', and `false' everywhere. + +2012-04-09 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * eval.c (unset_ERRNO): Fix memory management bug -- need to use + dupnode with Nnull_string. + +2012-04-08 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (valgrind): Define VALGRIND instead of redefining AWK. + This allows test/Makefile.am to set up the command environment as + desired. + (valgrind-noleak): Ditto, plus set --leak-check=no instead of the + default summary setting. + +2012-04-07 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Update to reflect progress. + +2012-04-01 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Move valgrind-noleak item into "done" section. + * Makefile.am (valgrind-noleak): Add new valgrind rule that omits + the "--leak-check=full" option to help spot more serious problems. + +2012-04-01 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Move ERRNO item into "done" section. + * awk.h (update_ERRNO, update_ERRNO_saved): Remove declarations. + (update_ERRNO_int, enum errno_translate, update_ERRNO_string, + unset_ERRNO): Add new declarations. + * eval.c (update_ERRNO_saved): Renamed to update_ERRNO_int. + (update_ERRNO_string, unset_ERRNO): New functions. + * ext.c (do_ext): Use new update_ERRNO_string function. + * io.c (ERRNO_node): Remove redundant extern declaration (in awk.h). + (after_beginfile, nextfile): Replace update_ERRNO() with + update_ERRNO_int(errno). + (inrec): Replace update_ERRNO_saved with update_ERRNO_int. + (do_close): Use new function update_ERRNO_string. + (close_redir, do_getline_redir, do_getline): Replace update_ERRNO_saved + with update_ERRNO_int. + +2012-03-27 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: Update to reflect debate about how to support Cygwin + and other platforms that cannot link shared libraries with unresolved + references. + * awkgram.y (add_srcfile): Minor bug fix: reverse sense of test + added by Arnold in last patch. + * configure.ac: AC_DISABLE_STATIC must come before AC_PROG_LIBTOOL. + +2012-03-26 Arnold D. Robbins <arnold@skeeve.com> + + Some cleanups. + + * awkgram.y (add_srcfile): Use whole messages, better for + translations. + * io.c (init_awkpath): Small style tweak. + * main.c (path_environ): Straighten out initial comment, fix + compiler warning by making `val' const char *. + +2012-03-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * configure.ac (AC_DISABLE_STATIC): Add this to avoid building useless + static extension libraries. + +2012-03-25 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * TODO.xgawk: New file listing completed and pending xgawk enhancements. + +2012-03-24 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * io.c (path_info): Fix white space. + (pi_awkpath, pi_awklibpath): Avoid structure initializers. + (do_find_source): Eliminate pointless parentheses. + (find_source): Leave a space after "&". + * main.c (load_environ): Fix typo in comment. + +2012-03-21 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * awkgram.y (LEX_LOAD): New token to support @load. + (grammar): Add rules to support @load. + (tokentab): Add "load". + (add_srcfile): Improve error message to distinguish between source files + and shared libraries. + (load_library): New function to load libraries specified with @load. + (yylex): Add support for LEX_LOAD (treated the same way as LEX_INCLUDE). + +2012-03-20 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * Makefile.am (EXTRA_DIST): Remove extension. + (SUBDIRS): Add extension so libraries will be built. + (DEFS): Define DEFLIBPATH and SHLIBEXT so we can find shared libraries. + * awk.h (deflibpath): New extern declaration. + * configure.ac: Add support for building shared libraries by adding + AC_PROG_LIBTOOL and AC_SUBST for acl_shlibext and pkgextensiondir. + (AC_CONFIG_FILES): Add extension/Makefile. + * io.c (pi_awkpath, pi_awklibpath): New static structures to contain + path information. + (awkpath, max_pathlen): Remove static variables now inside pi_awkpath. + (init_awkpath): Operate on path_info structure to support both + AWKPATH and AWKLIBPATH. No need for max_path to be static, since + this should be called only once for each environment variable. + (do_find_source): Add a path_info arg to specify which path to search. + Check the try_cwd parameter to decide whether to search the current + directory (not desirable for AWKLIBPATH). + (find_source): Choose appropriate path_info structure based on value + of the is_extlib argument. Set EXTLIB_SUFFIX using SHLIBEXT define + instead of hardcoding ".so". + * main.c (path_environ): New function to add AWKPATH or AWKLIBPATH + to the ENVIRON array. + (load_environ): Call path_environ for AWKPATH and AWKLIBPATH. + +2012-06-19 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Do setlocale to "C" if --characters-as-bytes. + Thanks to "SP" for the bug report. + +2012-05-09 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Added AC_HEADER_STDBOOL + * awk.h, dfa.c, regex.c: Reworked to use results + of test and include missing_d/gawkbool.h. + +2012-05-07 Arnold D. Robbins <arnold@skeeve.com> + + * array.c (prnode): Add casts to void* for %p format. + * debug.c (print_instruction): Ditto. + * builtin.c: Fix %lf format to be %f everywhere. + + Unrelated: + + * replace.c: Don't include "config.h", awk.h gets it for us. + +2012-05-04 Arnold D. Robbins <arnold@skeeve.com> + + * getopt.c [DJGPP]: Change to __DJGPP__. + * mbsupport.h [DJGPP]: Change to __DJGPP__. + + Unrelated: + + * awk.h: Workarounds for _TANDEM_SOURCE. + +2012-05-01 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. RRI code now there, needed additional + change for gawk. + * configure.ac: Add check for stdbool.h. + * regex.c: Add check for if not have stdbool.h, then define the + bool stuff. + +2012-04-27 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + * xalloc.h (xmemdup): Added, from grep, for dfa.c. Sigh. + +2012-04-27 Arnold D. Robbins <arnold@skeeve.com> + + Update to autoconf 2.69, automake 1.12. + + * INSTALL, aclocal.m4, configh.in, depcomp, install-sh, missing, + mkinstalldirs, ylwrap: Updated. + * configure.ac (AC_TYPE_LONG_LONG_INT, AC_TYPE_UNSIGNED_LONG_LONG_INT, + AC_TYPE_INTMAX_T, AC_TYPE_UINTMAX_T): Renamed from gl_* versions. + * configure: Regenerated. + +2012-04-24 Arnold D. Robbins <arnold@skeeve.com> + + * cmd.h (dPrompt, commands_Prompt, eval_Prompt, dgawk_Prompt): Changed + to dbg_prompt, commands_prompt, eval_prompt, dgawk_prompt. + * debug.c: Ditto. + * command.y: Ditto. Some minor whitespace and comments cleanup. + +2012-04-24 Arnold D. Robbins <arnold@skeeve.com> + + io.c cleanup and some speedup for RS as regexp parsing. + + * awk.h (Regexp): New members has_meta and maybe_long. + (enum redirval): Add redirect_none as value 0. + (remaybelong): Remove function declaration. + * awkgram.y: Use redirect_none instead of 0 for no redirect cases. + * io.c (go_getline_redir): Second arg now of type enum redirval. + Changed intovar into into_variable. + (comments and whitespace): Lots of general cleanup. + (socket_open): readle changed to read_len. + (two_way_open): Add additional calls to os_close_on_exec. + (rsrescan): Simplify code a bit and use RS->maybe_long. + * re.c (make_regexp): Set up new members in Regexp struct. + (remaybelong): Remove function. + (reisstring): Simplified code. + +2012-04-16 Eli Zaretskii <eliz@gnu.org> + + * io.c (read_with_timeout) [__MINGW32__]: Just call the blocking + 'read', as 'select' is only available for sockets. + * mpfr.c (set_ROUNDMODE) [!HAVE_MPFR]: Renamed from set_RNDMODE. + * main.c (load_procinfo): Declare name[] also when HAVE_MPFR is + defined even though HAVE_GETGROUPS etc. are not. + +2012-04-12 John Haque <j.eh@mchsi.com> + + * array.c, awk.h, awkgram.y, builtin.c, command.y, debug.c, + field.c, mpfr.c, profile.c: Change RND_MODE to ROUND_MODE. + +2012-04-11 John Haque <j.eh@mchsi.com> + + * main.c (varinit): Change RNDMODE to ROUNDMODE. + +2012-04-11 Arnold D. Robbins <arnold@skeeve.com> + + * main.c: Change --arbitrary-precision to --bignum. + +2012-04-02 John Haque <j.eh@mchsi.com> + + Add support for arbitrary-precision arithmetic. + + * mpfr.c: New file. + * awk.h (struct exp_node): Add union to handle different number types. + (MPFN, MPZN): New flag values. + (DO_MPFR, do_mpfr): New defines. + (PREC_node, RNDMODE_node): Add declarations. + (PRECISION, RND_MODE, MNR, MFNR, mpzval, do_ieee_fmt): Add declarations. + (make_number, str2number, format_val, cmp_numbers): Ditto. + (force_number): Change definition. + (Func_pre_exec, Func_post_exec): New typedefs. + (POP_NUMBER, TOP_NUMBER): Change definitions. + (get_number_ui, get_number_si, get_number_d, get_number_uj, + iszero, IEEE_FMT, mpg_float, mpg_integer, mpg_float, + mpg_integer): New defines. + * awkgram.y (tokentab): Add alternate function entries for MPFR/GMP. + (snode): Choose the appropriate function. + (negate_num): New function to negate a number. + (grammar): Use it. + (yylex): Adjust number handling code. + * array.c (value_info, asort_actual, sort_user_func): Adjust for + MPFR/GMP numbers. + (do_adump, indent): Minor changes. + (sort_up_index_number, sort_up_value_number, sort_up_value_type): Use + cmp_numbers() for numeric comparisons. + * builtin.c (mpz2mpfr): New function. + (format_tree): Adjust to handle MPFR and GMP numbers. + * eval.c (register_exec_hook): New function to manage interpreter hooks. + (num_exec_hook, pre_execute, post_execute): New and adjusted definitions. + (h_interpret): Renamed from debug_interpret. + (init_interpret): Changed to use the new name. + (flags2str): New entries for MPFN and MPZN. + (cmp_nodes): Reworked to use separate routine for numeric comparisons. + (set_IGNORECASE, set_BINMODE, set_LINT, update_NR, update_FNR, + update_NF): Adjust code and some cleanup. + * field.c (rebuild_record): Field copying code reworked to handle + MPFR/GMP numbers. + (set_NF): Minor adjustment. + * io.c (INCREMENT_REC): New macro. + (inrec, do_getline): Use the new macro. + (nextfile, set_NR, set_FNR, get_read_timeout, pty_vs_pipe): Adjust code + to handle MPFR/GMP numbers. + * interpret.h (r_interpret): Adjust TOP_NUMBER/POP_NUMBER usage. + (EXEC_HOOK): New macro and definition. + (DEBUGGING): Removed. + * main.c (DEFAULT_PREC, DEFAULT_RNDMODE): New defines. + (opttab): New entry for option arbitrary-precision. + (main): Handle the new option. + (usage): Add to usage message. + (varinit): Add PREC and RNDMODE. + (load_procinfo): Install MPFR and GMP related items. + (version): Append MPFR and GMP versions to message. + * msg.c (err) : Adjust FNR handling with MPFR/GMP. + * node.c (r_format_val): Renamed from format_val. + (r_force_number): Return NODE * instead of AWKNUM. + (make_number, str2number, format_val, cmp_numpers: Defined and initialized. + (r_unref): Free MPFR/MPZ numbers. + (get_numbase): Renamed from isnondecimal and return the base. + (cmp_awknums): New function to compare two AWKNUMs. + * command.y (yylex): Adjust number handling code. + (grammar): Minor adjustments to handle negative numbers. + * debug.c (init_debug): New function. + (do_info, do_set_var, watchpoint_triggered, serialize, + initialize_watch_item, do_watch, print_watch_item): Minor adjustments. + (debug_pre_execute): Adjusted to handle MPFR and GMP numbers. + +2012-04-09 Arnold D. Robbins <arnold@skeeve.com> + + * INSTALL, config.guess, config.sub, depcomp, install-sh, + missing, mkinstalldirs, ylwrap: Update to latest from automake 1.11.4. + +2012-04-08 Arnold D. Robbins <arnold@skeeve.com> + + * Update various files to automake 1.11.4. + +2012-03-30 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac (GAWK_AC_NORETURN): Do as macro instead of inline. + +2012-03-29 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.h, dfa.c: Sync with grep. Major cleanups and some changes + there. + * re.c (research): Pass size_t* to dfaexec to match type change. + * configure.ac (AH_VERBATIM[_Noreturn]): Added from Paul Eggert to + ease compiling. + (AC_INIT): Bump version. + * configure, configh.in, version.c: Regenerated. + +2012-03-28 Arnold D. Robbins <arnold@skeeve.com> + + * 4.0.1: Release tar ball made. + +2012-03-28 Arnold D. Robbins <arnold@skeeve.com> + + * getopt.c: Add DJGPP to list of platforms where it's ok + to include <stdlib.h>. + * awkgram.y, builtin.c, ext.c, mbsupport.h, re.c: Update + copyright year. + +2012-03-21 Corinna Vinschen <vinschen@redhat.com> + + * getopt.c: Add Cygwin to list of platforms where it's ok + to include <stdlib.h>. + +2012-03-20 Arnold D. Robbins <arnold@skeeve.com> + + Get new getopt to work on Linux and C90 compilers: + + * getopt.c: Undef ELIDE_CODE for gawk. + (_getopt_internal_r): Init first.needs_free to 0. In test for -W + move executable code to after declarations for C90 compilers. + * getopt1.c: Undef ELIDE_CODE for gawk. + + Minor bug fix with printf, thanks to John Haque: + + * builtin.c (format_tree): Initialize base to zero at the top + of the while loop. + + Getting next tar ball ready: + + * configure.ac: Remove duplicate check for wcscoll. Thanks + to Stepan Kasal. + +2012-03-16 Arnold D. Robbins <arnold@skeeve.com> + + * getopt.c, getopt.h, getopt1.c, getopt_int.h, regcomp.c, + regex.c, regex.h, regex_internal.c, regex_internal.h, + regexec.c: Sync with GLIBC, what the heck. + +2012-03-14 Eli Zaretskii <eliz@gnu.org> + + * mbsupport.h (btowc): Change for non-DJGPP. + * re.c (dfaerror): Add call to exit for DJGPP. + +2012-03-14 Arnold D. Robbins <arnold@skeeve.com> + + * regex_internal.c (re_string_skip_chars): Fix calculation of + remain_len with m.b. chars. Thanks to Stanislav Brabec + <sbrabec@suse.cz>. + +2012-02-28 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (init_groupset): Make `getgroups' failing a non-fatal + error. After all, what's the big deal? Should help on Plan 9. + +2012-02-27 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (parse_bracket_exp): Revert changes 2012-02-15 to stay + in sync with grep. + * dfa.h (dfarerror): Add __attribute__ from grep. + +2012-02-15 Arnold D. Robbins <arnold@skeeve.com> + + Fix warnings from GCC 4.6.2 -Wall option. + + * awkgram.y (newline_eof): New function to replace body of + NEWLINE_EOF macro. + (yylex): Replace body of NEWLINE_EOF macro. + * dfa.c (parse_bracket_exp): Init variables to zero. + * ext.c (dummy, junk): Remove. + * regex_internal.c (re_string_reconstruct): Remove buf array. It was + set but not used. + +2012-02-10 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2012-02-07 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (main): Move init of `output_fp' to before parsing of + program so that error messages from msg.c don't dump core. + Thanks to Michael Haardt <michael@moria.de>. + +2012-01-13 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c [is_valid_unibtye_character]: Fix from GNU grep to + bug reported by me from Scott Deifik for DJGPP. + +2012-01-03 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2012-01-02 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (Read_can_timeout, Read_timeout, Read_default_timeout): + Renamed to use lower case. + Other minor stylistic edits. + +2012-01-01 John Haque <j.eh@mchsi.com> + + * awk.h (struct iobuf): New entry read_func. + * io.c (Read_can_timeout, Read_timeout, Read_default_timeout): + New variables. + (init_io): New routine to initialize the variables. + (in_PROCINFO): New "clever" routine to parse elements with indices + separated by a SUPSEP. + (get_read_timeout): New routine to read timeout value for an IOBUF. + (read_with_timeout): New routine to read from a fd with a timeout. + (pty_vs_pipe): Use in_PROCINFO(). + (get_a_record): Set the timeout value and the read routine as necessary. + * main.c (main): Call init_io(). + +2011-12-31 Arnold D. Robbins <arnold@skeeve.com> + + * profile_p.c: Remove the file. + * msg.c (err): Remove check for name being dgawk. + +2011-12-31 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h [STREQ, STREQN]: Remove macros. + * awkgram.y, builtin.c, command.y, debug.c, eval.c, + io.c, msg.c: Change all uses to call strcmp, strncmp. + +2011-12-28 Arnold D. Robbins <arnold@skeeve.com> + + * int_array.c, str_array.c: Fix some compiler warnings 32/64 + bit system differences. + +2011-12-26 John Haque <j.eh@mchsi.com> + + Merge gawk, pgawk and dgawk into a single executable gawk. + + * awk.h (DO_PRETTY_PRINT, DO_PROFILE, DO_DEBUG, + do_pretty_print, do_debug): New defines. + (interpret): New variable, a pointer to an interpreter routine. + (enum exe_mode): Nuked. + * main.c (opttab): New options --pretty-print and --debug; + Remove option --command. + (usage): Update usage messages. + * interpret.h: New file. + * eval.c (r_interpret): Move to the new file. + (debug_interpret): New interpreter routine when debugging. + (init_interpret): New routine to initialize interpreter related + variables. + * eval_d.c, eval_p.c: Delete files. + * debug.c (interpret): Renamed to debug_prog. + (DEFAULT_PROMPT, DEFAULT_HISTFILE, DEFAULT_OPTFILE): Remove prefix 'd'. + * profile.c (init_profiling): Nuked. + * Makefile.am: Adjusted. + + Add command line option --load for loading extensions. + + * awk.h (srctype): Add new source type SRC_EXTLIB. + * ext.c(load_ext): New routine to load extension. + (do_ext): Adjust to use load_ext(). + * main.c (opttab): Add new option --load. + (main): Call load_ext() to load extensions. + (usage): Add usage message for the new option. + * io.c (get_cwd): New routine. + (do_find_source): Use the new routine. + (find_source): Handle new type SRC_EXTLIB. + * awkgram.y (parse_program, next_sourcefile): Skip type SRC_EXTLIB. + (add_srcfile): Adjust call to find_source. + * debug.c (source_find): Same. + + Unrelated: + + * ext.c (get_argument): Fixed argument parsing. + * array.c (null_array_func): Reworked array routines for an empty array. + * str_array.c, int_array.c: Make GCC happy, use %u instead of %lu + printf formats. + * eval.c (node_Boolean): New array for TRUE and FALSE nodes. + (init_interpret): Create the new nodes. + (eval_condition): Add test for the new nodes. + (setup_frame): Disable tail-recursion optimization when profiling. + * interpret.h (r_interpret): Use the boolean nodes instead of making + new ones when needed. + +2011-12-26 Arnold D. Robbins <arnold@skeeve.com> + + Finish Rational Range Interpretation (!) + + * dfa.c (match_mb_charset): Compare wide characters directly + instead of using wcscoll(). + * regexec.c (check_node_accept_byte): Ditto. + + Thanks to Paolo Bonzini for pointing these out. + +2011-12-06 John Haque <j.eh@mchsi.com> + + * debug.c (source_find): Fix misplaced call to efree. + * profile.c (redir2str): Add a missing comma in the redirtab array. + * eval.c (r_interpret): Disallow call to exit if currule is undefined. + This avoids the possibility of running END blocks more than once when + used in a user-defined sorted-in comparison function. + * array.c (sort_user_func): Adjust appropriately. + +2011-12-06 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h, mbsupport.h: Changes for MBS support on DJGPP + and z/OS. + * io.c: Disable pty support on z/OS. + +2011-11-27 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + * dfa.h: Add _GL_ATTRIBUTE_PURE macro. Bleah. + +2011-11-14 John Haque <j.eh@mchsi.com> + + * debug.c (set_breakpoint_at): Fix problem with setting + breakpoints in a switch statement. Thanks to Giorgio Palandri + <giorgio.palandri@gmail.com> for the bug report. + +2011-11-14 Arnold D. Robbins <arnold@skeeve.com> + + * mbsupport.h: Add check for HAVE_BTOWC, per Pat Rankin. + +2011-11-12 Eli Zaretskii <eliz@gnu.org> + + * mbsupport.h: Additional glop for dfa.c in Windows environment. + +2011-11-01 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Move glop for ! MBS_SUPPORT to ... + * mbsupport.h: ... here. + * replace.c: Include missing_d/wcmisc.c if ! MBS_SUPPORT. + * regex_internal.h: Move include of mbsupport.h up and add + additional checks to avoid inclusion of wctype.h and wchar.h. + +2011-10-27 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_strftime): Per Pat Rankin, instead of casting + fclock, use a long variable and check for negative or overflow. + +2011-10-25 Arnold D. Robbins <arnold@skeeve.com> + + Merge with gawk_performance branch done. Additionally: + + * cint_array.c, int_array.c, str_array.c: Fix compiler complaints + about printf formats (signed / unsigned vs. %d / %u). + * eval.c (setup_frame): Add a missing return value. + +2011-10-25 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (dist-hook): Use `cd $(srcdir)/pc' so that + `make distcheck' works completely. + * builtin.c (do_strftime): Add cast to long int in check + for fclock < 0 for systems where time_t is unsigned (e.g., VMS). + +2011-10-25 Stefano Lattarini <stefano.lattarini@gmail.com> + + dist: generated file `version.c' is not removed by "make distclean" + + * Makefile.am (distcleancheck_listfiles): Define to ignore the + generated `version.c' file. + +2011-10-24 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c (wcscoll): Create for VMS. + * Makefile.am (dist-hook): Run sed scripts to make pc/config.h. + +2011-10-24 Eli Zaretskii <eliz@gnu.org> + + * builtin.c [HAVE_POPEN_H]: Include "popen.h". + * README.git: Update for pc/ systems. + +2011-10-21 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (distcleancheck_listfiles): Added, per advice from + Stefano Lattarini <stefano.lattarini@gmail.com>. + * dfa.c: Additional faking of mbsupport for systems without it; + mainly VMS. + +2011-10-21 Stefano Lattarini <stefano.lattarini@gmail.com> + + * configure.ac (AM_C_PROTOTYPES): Remove call to this macro. + The comments in configure.ac said that the call to AM_C_PROTOTYPES + was needed for dfa.h, synced from GNU grep; but this statement is + not true anymore in grep since commit v2.5.4-24-g9b5e7d4 "replace + AC_CHECK_* with gnulib modules", dating back to 2009-11-26. Also, + the support for automatic de-ANSI-fication has been deprecated in + automake 1.11.2, and will be removed altogether in automake 1.12. + * vms/vms-conf.h (PROTOTYPES, __PROTOTYPES): Remove these #define, + they are not used anymore. + * pc/config.h (PROTOTYPES): Likewise. + +2011-10-18 Dave Pitts <dpitts@cozx.com> + + * dfa.c: Move some decls to the top of their functions for + C90 compilers. + +2011-10-18 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_strftime): Add check for negative / overflowed + time_t value with fatal error. Thanks to Hermann Peifer + <peifer@gmx.eu> for the bug report. + * dfa.c (setbit_wc): Non-MBS version. Add a return false + since VMS compiler doesn't understand that abort doesn't return. + +2011-10-10 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Init textlen to zero to avoid "may be + used uninitialized" warning. Thanks to Corinna Vinschen for + pointing this out. + * eval.c (unwind_stack): Add parentheses around condition in while + to avoid overzealous warning from GCC. + +2011-09-30 Eli Zaretskii <eliz@gnu.org> + + * io.c (remap_std_file): Fix non-portable code that caused + redirected "print" to fail if a previous read from standard input + returned EOF. Reported by David Millis <tvtronix@yahoo.com>. + (remap_std_file): Per Eli's suggestion, removed the leading close + of oldfd and will let dup2 do the close for us. + +2011-10-11 John Haque <j.eh@mchsi.com> + + * symbol.c: Add licence notice. + * array.c (PREC_NUM, PREC_STR): Define as macros. + +2011-10-09 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2011-10-07 John Haque <j.eh@mchsi.com> + + Tail recursion optimization. + * awkgram.y (grammar, mk_function): Recognize tail-recursive + calls. + * awk.h (tail_call, num_tail_calls): New defines. + * eval.c (setup_frame): Reuse function call stack for + tail-recursive calls. + (dump_fcall_stack): Reworked. + +2011-10-04 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h, main.c (gawk_mb_cur_max): Make it a constant 1 when + MBS_SUPPORT isn't available to allow GCC dead code constant + expression computation and dead code elimination to help out. + +2011-10-02 Arnold D. Robbins <arnold@skeeve.com> + + * io.c (rsnullscan, get_a_record): Fix the cases where terminators + are incomplete when RS == "". Also fix the case where the new value + is shorter than the old one. Based on patch from Rogier + <rogier777@gmail.com> as submitted by Jeroen Schot + <schot@A-Eskwadraat.nl>. + +2011-09-24 Arnold D. Robbins <arnold@skeeve.com> + + * eval.c, io.c, re.c: Fix some spelling errors. Thanks to + Jeroen Schot <schot@A-Eskwadraat.nl>. + +2011-09-21 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c, mbsupport.h: Sync with GNU grep. Large amount of changes + that remove many ifdefs, moving many conditions for multibyte + support into regular C code and relying GCC's dead code optimization + to eliminate code that won't be needed. + * dfa.c: For gawk, add a number of additional defines so that things + will compile if MBS_SUPPORT is 0. + * array.c, awk.h, awkgram.y, builtin.c, eval.c, field.c, main.c, + node.c, re.c: Change `#ifdef MBS_SUPPORT' to `#if MBS_SUPPORT'. + * awk.h, regex_internal.h: Move NO_MBSUPPORT handling to ... + * mbsupport.h: ...here. + +2011-09-16 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2011-09-08 John Haque <j.eh@mchsi.com> + + Optimization for compound assignment, increment and + decrement operators; Avoid unref and make_number calls + when there is no extra references to the value NODE. + +2011-09-03 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNU grep. + +2011-08-31 John Haque <j.eh@mchsi.com> + + Grammar related changes: Simplify grammar for user-defined + functions and general cleanups. + + * symbol.c: New file. + * awkgram.y: Move symbol table related routines to the + new file. + (rule, func_name, function_prologue, param_list): Reworked. + (install_function, check_params): Do all error checks + for the function name and parameters before installing in + the symbol table. + (mk_function): Finalize function definition. + (func_install, append_param, dup_params): Nuked. + * symbol.c (make_params): allocate function parameter nodes + for the symbol table. Use the hash node as Node_param_list; + Saves a NODE for each parameter. + (install_params): Install function parameters into the symbol + table. + (remove_params): Remove parameters out of the symbol table. + * awk.h (parmlist, FUNC): Nuked. + (fparms): New define. + + Dynamically loaded function parameters are now handled like + those for a builtin. + + * awk.h (Node_ext_func, Op_ext_builtin): New types. + (Op_ext_func): Nuked. + * ext.c (make_builtin): Simplified. + (get_curfunc_arg_count): Nuked; Use the argument 'nargs' of + the extension function instead. + (get_argument, get_actual_argument): Adjust. + * eval.c (r_interpret): Update case Op_func_call for a dynamic + extension function. Handle the new opcode Op_ext_builtin. + * pprint (profile.c): Adjust. + + Use a single variable to process gawk options. + + * awk.h (do_flags): New variable. + (DO_LINT_INVALID, DO_LINT_ALL, DO_LINT_OLD, DO_TRADITIONAL, + DO_POSIX, DO_INTL, DO_NON_DEC_DATA, DO_INTERVALS, + DO_PROFILING, DO_DUMP_VARS, DO_TIDY_MEM, + DO_SANDBOX): New defines. + (do_traditional, do_posix, do_intervals, do_intl, + do_non_decimal_data, do_profiling, do_dump_vars, + do_tidy_mem, do_sandbox, do_lint, + do_lint_old): Defined as macros. + * main.c: Remove definitions of the do_XX variables. Add + do_flags definition. + * debug.c (execute_code, do_eval, parse_condition): Save + do_flags before executing/parsing and restore afterwards. + + Nuke PERM flag. Always increment/decrement the reference + count for a Node_val. Simplifies macros and avoids + occasional memory leaks, specially in the debugger. + + * awk.h (UPREF, DEREF, dupnode, unref): Simplified. + (mk_number): Nuked. + * (*.c): Increment the reference count of Nnull_string before + assigning as a value. + + Revamped array handling mechanism for more speed and + less memory consumption. + + * awk.h (union bucket_item, BUCKET): New definitions. Used as + bucket elements for the hash table implementations of arrays; + 40% space saving in 32 bit x86. + (buckets, nodes, array_funcs, array_base, array_capacity, + xarray, alookup, aexists, aclear, aremove, alist, + acopy, adump, NUM_AFUNCS): New defines. + (array_empty): New macro to test for an empty array. + (assoc_lookup, in_array): Defined as macros. + (enum assoc_list_flags): New declaration. + (Node_ahash, NUMIND): Nuked. + * eval.c (r_interpret): Adjust cases Op_subscript, + Op_subscript_lhs, Op_store_var and Op_arrayfor_incr. + * node.c (dupnode, unref): Removed code related to Node_ahash. + * str_array.c: New file to handle array with string indices. + * int_array.c: New file to handle array with integer indices. + * cint_array.c: New file. Special handling of arrays with + (mostly) consecutive integer indices. + + Memory pool management reworked to handle NODE and BUCKET. + + * awk.h (struct block_item, BLOCK, block_id): New definitions. + (getblock, freeblock): New macros. + (getbucket, freebucket): New macros to allocate and deallocate + a BUCKET. + (getnode, freenode): Adjusted. + * node.c (more_nodes): Nuked. + (more_blocks): New routine to allocate blocks of memory. + +2011-08-24 Arnold D. Robbins <arnold@skeeve.com> + + Fix pty co-process communication on Ubuntu GNU/Linux. + + * io.c: Add include of <sys/ioctl.h> to get definition of TIOCSCTTY. + (two_way_open): Move call for this ioctl to after setsid() call. + +2011-08-23 Arnold D. Robbins <arnold@skeeve.com> + + * regex_internal.c (re_string_fetch_byte_case): Remove + __attribute((pure)) since it causes failures with gcc -O2 + -fno-inline. Thanks to Neil Cahill <ncahill_alt@yahoo.com> + for reporting the bug. + +2011-08-10 John Haque <j.eh@mchsi.com> + + BEGINFILE/ENDFILE related code redone. + + * awk.h (prev_frame_size, has_endfile, target_get_record, + target_newfile): New defines. + * awkgram.y (mk_program): Initialize has_endfile appropriately for + Op_get_record. + (parse_program): Initialize new jump targets for + Op_get_record and Op_newfile. + * eval.c (unwind_stack): Change argument to number of + items to be left in the stack. Adjust code. + (pop_fcall, pop_stack): New defines. + (setup_frame): Initialize prev_frame_size. + (exec_state, EXEC_STATE): New structure and typedef. + (exec_state_stack): New variable. + (push_exec_state, pop_exec_state): New functions to save and + later retrieve an execution state. + (r_interpret): Use the new functions and the defines in + cases Op_K_getline, Op_after_beginfile, Op_after_endfile, + Op_newfile and Op_K_exit. + * io.c (after_beginfile): When skipping a file using nextfile, + return zero in case there was an error opening the file. + (has_endfile): Nuke global variable. + (inrec): Add a second argument to pass errno to the calling + routine. + * debug.c (print_instruction): Update cases. + +2011-08-10 Arnold D. Robbins <arnold@skeeve.com> + + Fix (apparently long-standing) problem with FIELDWIDTHS. + Thanks to Johannes Meixner <jsmeix@suse.de>. + + * field.c (set_FIELDWIDTHS): Adjust calculations. + + Fix problem with FPAT, reported by "T. X. G." <leopardie333@yahoo.com> + + * awk.h (Regexp): Add new member 'non_empty'. + * field.c (fpat_parse_field): Save/restore local variable non_empty + from member in Regexp struct. + +2011-08-09 Arnold D. Robbins <arnold@skeeve.com> + + Fix pty issue reported by "T. X. G." <leopardie333@yahoo.com> + + * configure.ac: Check for setsid. + * awk.h: If not HAVE_SETSID define it as an empty macro. + * io.c (two_way_open): Call setsid if using pty's. + +2011-07-29 Eli Zaretskii <eliz@gnu.org> + + * builtin.c (format_tree): Rename small -> small_flag, + big -> big_flag, bigbig -> bigbig_flag. Solves compilation errors + when building Gawk with libsigsegv on MS-Windows, see + https://lists.gnu.org/archive/html/bug-gawk/2011-07/msg00029.html. + +2011-07-28 Arnold D. Robbins <arnold@skeeve.com> + + * builtin.c (do_sub): Revert to gawk 3.1 behavior for backslash + handling. It was stupid to think I could break compatibility. + Thanks to John Ellson <ellson@research.att.com> for raising + the issue. + +2011-07-26 John Haque <j.eh@mchsi.com> + + * eval.c (r_interpret): In cases Op_var_assign and Op_field_assign, + include Op_K_getline_redir in the test for skipping the routine. + +2011-07-26 John Haque <j.eh@mchsi.com> + + Fix handling of assign routines for 'getline var'. + Rework the previous fix for (g)sub. + + * awk.h: New define assign_ctxt for use in Op_var_assign + and Op_field_assign opcodes. Remove define AFTER_ASSIGN. + * awkgram.y (snode, mk_getline): Initialize assign_ctxt. + * builtin.c (do_sub): Adjust to take only the first two + arguments. + * eval.c (r_interpret): In cases Op_var_assign and Op_field_assign, + skip the routine as appropriate. Adjust case Op_sub_builtin. + * main.c (get_spec_varname): New function. + * debug.c (print_instruction): Use the new function to get + special variable name. + +2011-07-17 Arnold D. Robbins <arnold@skeeve.com> + + * main.c (varinit): Mark FPAT as NON_STANDARD. Thanks to + Wolfgang Seeberg <wolfgang.seeberg@yahoo.com> for the report. + * Makefile.am (EXTRA_DIST): Add po/README, per advice from + Bruno Haible. + * dfa.c: Sync with GNU grep. + * xalloc.h (xzalloc): New function, from GNU grep, for dfa.c. + * README: Note that bug list is really a real mailing list. + +2011-07-16 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (AUTOMAKE_OPTIONS): Removed. + * configure.ac (AM_INIT_AUTOMAKE): Removed dist-bzip2 option, on + advice from Karl Berry. + +2011-07-15 John Haque <j.eh@mchsi.com> + + * awk.h (Op_sub_builtin): New opcode. + (GSUB, GENSUB, AFTER_ASSIGN, LITERAL): New flags for + Op_sub_builtin. + * awkgram.y (struct tokentab): Change opcode to Op_sub_builtin + for sub, gsub and gensub. + (snode): Update processing of sub, gsub and gensub. + * builtin.c (do_sub, do_gsub, do_gensub): Nuke. + (sub_common): Renamed to do_sub. Relocate gensub argument + handling code from do_gensub to here; Simplify the code a + little bit. + * eval.c (r_interpret): Handle Op_sub_builtin. Avoid field + re-splitting or $0 rebuilding if (g)sub target string is + a field and no substitutions were done. + * pprint (profile.c): Add case for the new opcode. + * print_instruction (debug.c): Ditto. + + Take out translation for errno strings; extensions will + need to use their own domain. + + * awk.h (enum errno_translate): Removed. + (update_ERRNO_string): Remove second translate parameter. + * eval.c (update_ERRNO_string): Remove second translate parameter + and code that used it. + * gawkapi.h (api_update_ERRNO_string): Remove third translate + parameter. + * gawkapi.c (api_update_ERRNO_string): Remove third translate + parameter and change call to update_ERRNO_string. + * io.c (do_close): Fix call to update_ERRNO_string. + +2011-07-15 Arnold D. Robbins <arnold@skeeve.com> + + * awk.h: Typo fix: "loner" --> longer. Thanks to Nelson Beebe. + * builtin.c (efwrite): Fix flushing test back to what it was + in 3.1.8. Thanks to Strefil <strefil@yandex.ru> for the problem + report. + * configure.ac: Bump version to 4.0.0a for stable branch. + +2011-06-24 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.am (EXTRA_DIST): Add ChangeLog.0. + * 4.0.0: Remake the tar ball. + +2011-06-23 Arnold D. Robbins <arnold@skeeve.com> + + * configure.ac: Update version to 4.0.0. + * configure: Regenerated. + * ChangeLog.0: Rotated ChangeLog into this file. + * ChangeLog: Created anew for gawk 4.0.0 and on. + * README: Bump version to 4.0.0. + * 4.0.0: Release tar ball made. |