2012-04-07 Andrew J. Schorr * TODO.xgawk: Update to reflect progress. 2012-04-01 Andrew J. Schorr * 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 * 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 * 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 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 * configure.ac (AC_DISABLE_STATIC): Add this to avoid building useless static extension libraries. 2012-03-25 Andrew J. Schorr * TODO.xgawk: New file listing completed and pending xgawk enhancements. 2012-03-24 Andrew J. Schorr * 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 * 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 * 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-01-02 Arnold D. Robbins * io.c (Read_can_timeout, Read_timeout, Read_default_timeout): Renamed to use lower case. Other minor stylistic edits. 2012-01-01 John Haque * 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 seperated 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 * profile_p.c: Remove the file. * msg.c (err): Remove check for name being dgawk. 2011-12-31 Arnold D. Robbins * 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 * int_array.c, str_array.c: Fix some compiler warnings 32/64 bit system differences. 2011-12-26 John Haque 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 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 * 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 possiblity of running END blocks more than once when used in a user-defined sorted-in comparision function. * array.c (sort_user_func): Adjust appropriately. 2011-12-06 Arnold D. Robbins * 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 * dfa.c: Sync with GNU grep. * dfa.h: Add _GL_ATTRIBUTE_PURE macro. Bleah. 2011-11-14 John Haque * debug.c (set_breakpoint_at): Fix problem with setting breakpoints in a switch statement. Thanks to Giorgio Palandri for the bug report. 2011-11-14 Arnold D. Robbins * mbsupport.h: Add check for HAVE_BTOWC, per Pat Rankin. 2011-11-12 Eli Zaretskii * mbsupport.h: Additional glop for dfa.c in Windows environment. 2011-11-01 Arnold D. Robbins * 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 * 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 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 * 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 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 * dfa.c (wcscoll): Create for VMS. * Makefile.am (dist-hook): Run sed scripts to make pc/config.h. 2011-10-24 Eli Zaretskii * builtin.c [HAVE_POPEN_H]: Include "popen.h". * README.git: Update for pc/ systems. 2011-10-21 Arnold D. Robbins * Makefile.am (distcleancheck_listfiles): Added, per advice from Stefano Lattarini . * dfa.c: Additional faking of mbsupport for systems without it; mainly VMS. 2011-10-21 Stefano Lattarini * 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 * dfa.c: Move some decls to the top of their functions for C90 compilers. 2011-10-18 Arnold D. Robbins * builtin.c (do_strftime): Add check for negative / overflowed time_t value with fatal error. Thanks to Hermann Peifer 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 * builtin.c (do_sub): Init textlen to zero to avoid "may be used unitialized" 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 * 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 . (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 * symbol.c: Add licence notice. * array.c (PREC_NUM, PREC_STR): Define as macros. 2011-10-09 Arnold D. Robbins * dfa.c: Sync with GNU grep. 2011-10-07 John Haque 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 * 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 * 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 as submitted by Jeroen Schot . 2011-09-24 Arnold D. Robbins * eval.c, io.c, re.c: Fix some spelling errors. Thanks to Jeroen Schot . 2011-09-21 Arnold D. Robbins * 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 elimnate 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 * dfa.c: Sync with GNU grep. 2011-09-08 John Haque 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 * dfa.c: Sync with GNU grep. 2011-08-31 John Haque 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 checkings 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 occassional 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 Fix pty co-process communication on Ubuntu GNU/Linux. * io.c: Add include of to get definition of TIOCSCTTY. (two_way_open): Move call for this ioctl to after setsid() call. 2011-08-23 Arnold D. Robbins * regex_internal.c (re_string_fetch_byte_case ): Remove __attribute((pure)) since it causes failures with gcc -O2 -fno-inline. Thanks to Neil Cahill for reporting the bug. 2011-08-10 John Haque 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 Fix (apparently long-standing) problem with FIELDWIDTHS. Thanks to Johannes Meixner . * field.c (set_FIELDWIDTHS): Adjust calculations. Fix problem with FPAT, reported by "T. X. G." * 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 Fix pty issue reported by "T. X. G." * 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 * 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 * 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 for raising the issue. 2011-07-26 John Haque * 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 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 * main.c (varinit): Mark FPAT as NON_STANDARD. Thanks to Wolfgang Seeberg 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 * Makefile.am (AUTOMAKE_OPTIONS): Removed. * configure.ac (AM_INIT_AUTOMAKE): Removed dist-bzip2 option, on advice from Karl Berry. 2011-07-15 John Haque * 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. 2011-07-15 Arnold D. Robbins * 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 for the problem report. * configure.ac: Bump version to 4.0.0a for stable branch. 2011-06-24 Arnold D. Robbins * Makefile.am (EXTRA_DIST): Add ChangeLog.0. * 4.0.0: Remake the tar ball. 2011-06-23 Arnold D. Robbins * 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.