aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt108
-rw-r--r--ChangeLog96
-rw-r--r--Makefile.in2
-rw-r--r--NEWS30
-rw-r--r--README_d/ChangeLog4
-rw-r--r--README_d/README.cmake95
-rw-r--r--TODO197
-rw-r--r--awk.h3
-rw-r--r--awkgram.c12
-rw-r--r--awkgram.y12
-rw-r--r--awklib/Makefile.am11
-rw-r--r--awklib/Makefile.in105
-rw-r--r--awklib/eg/lib/div.awk17
-rw-r--r--builtin.c129
-rw-r--r--cmake/Toolchain_clang.cmake19
-rw-r--r--cmake/Toolchain_generic.cmake21
-rw-r--r--cmake/Toolchain_mingw32.cmake23
-rw-r--r--cmake/Toolchain_s390.cmake20
-rw-r--r--cmake/auk.icobin0 -> 5190 bytes
-rwxr-xr-xcmake/basictest553
-rwxr-xr-xcmake/configure58
-rw-r--r--cmake/configure.cmake300
-rwxr-xr-xcmake/docmaker100
-rw-r--r--cmake/package.cmake54
-rw-r--r--configh.in3
-rwxr-xr-xconfigure28
-rw-r--r--configure.ac9
-rw-r--r--dfa.c12
-rw-r--r--doc/CMakeLists.txt95
-rw-r--r--doc/ChangeLog32
-rw-r--r--doc/Makefile.am14
-rw-r--r--doc/Makefile.in14
-rw-r--r--doc/awkcard.in3
-rw-r--r--doc/gawk.127
-rw-r--r--doc/gawk.info1343
-rw-r--r--doc/gawk.texi124
-rw-r--r--doc/gawktexi.in124
-rw-r--r--extension/CMakeLists.txt84
-rw-r--r--main.c20
-rw-r--r--mpfr.c89
-rw-r--r--node.c3
-rw-r--r--pc/config.h6
-rw-r--r--po/CMakeLists.txt133
-rw-r--r--po/it.po32
-rw-r--r--regcomp.c12
-rw-r--r--regex.h62
-rw-r--r--str_array.c79
-rw-r--r--test/CMakeLists.txt90
-rw-r--r--test/ChangeLog11
-rw-r--r--test/Makefile.am19
-rw-r--r--test/Makefile.in18
-rw-r--r--test/rand.ok2
-rw-r--r--test/randtest.ok0
-rwxr-xr-xtest/randtest.sh113
54 files changed, 3607 insertions, 963 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 00000000..154d2afb
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,108 @@
+#
+# CMakeLists.txt --- CMake input file for gawk
+#
+# Copyright (C) 2013
+# the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## process this file with CMake to produce Makefile
+
+cmake_minimum_required (VERSION 2.6)
+project (gawk C)
+
+include(cmake/configure.cmake)
+
+set (EXTRA_LIBS "")
+
+if (${HAVE_MPFR})
+ set (EXTRA_LIBS ${EXTRA_LIBS} mpfr gmp)
+endif ()
+if (${HAVE_LIBREADLINE})
+ set (EXTRA_LIBS ${EXTRA_LIBS} readline)
+endif ()
+if (${DYNAMIC})
+ set (EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_DL_LIBS} )
+endif ()
+
+include_directories(${CMAKE_SOURCE_DIR})
+
+if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
+ # This is enough to build with MinGW in a native Windows environment
+ # and also with a cross-compiler on OpenSuSE 12.2.
+ # On Ubuntu 12.04 patches to gawk's source code are needed:
+ # - insert #include <windows.h> at the top of awk.h
+ # - remove function execvp from pc/gawkmisc.pc
+ DefineConfigHValue(HAVE_SETENV 1)
+ DefineConfigHValue(HAVE_USLEEP 1)
+ DefineConfigHValue(STDC_HEADERS 1)
+ DefineConfigHValue(HAVE_STRINGIZE 1)
+ include_directories(${CMAKE_SOURCE_DIR}/missing_d)
+ DefineConfigHValue(HAVE_MKSTEMP 1)
+ set (EXTRA_LIBS ${EXTRA_LIBS} ws2_32)
+ # TODO: Eli Zaretskii remined me that the generated
+ # settings in config.h should be the same as those in
+ # pc/config.h. With these settings and DYNAMIC=1
+ # it looks like functions in dynamic libs (extensions) can
+ # be invoked on Windows.
+ DefineConfigHValue(HAVE_GETSYSTEMTIMEASFILETIME 1)
+ set (GAWK_SOURCES ${GAWK_SOURCES} regex.c pc/getid.c pc/gawkmisc.pc pc/popen.c)
+ include_directories(${CMAKE_SOURCE_DIR}/pc)
+endif()
+
+set (GAWK_SOURCES ${GAWK_SOURCES}
+ array.c
+ builtin.c
+ cint_array.c
+ command.c
+ debug.c
+ dfa.c
+ eval.c
+ ext.c
+ field.c
+ floatcomp.c
+ gawkapi.c
+ gawkmisc.c
+ int_array.c
+ io.c
+ main.c
+ mpfr.c
+ msg.c
+ node.c
+ profile.c
+ random.c
+ re.c
+ replace.c
+ str_array.c
+ symbol.c
+ version.c
+)
+
+add_executable (gawk ${GAWK_SOURCES} ${BISON_awkgram_OUTPUTS})
+target_link_libraries (gawk m ${EXTRA_LIBS})
+install(PROGRAMS ${CMAKE_BINARY_DIR}/gawk${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin)
+
+# Beware: before building the extension, -DGAWK gets undefined.
+add_subdirectory(extension)
+enable_testing()
+add_subdirectory(test)
+add_subdirectory(doc)
+include(InstallRequiredSystemLibraries)
+set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
+include(cmake/package.cmake)
diff --git a/ChangeLog b/ChangeLog
index 2759539b..3931f564 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,27 @@
* regcomp.c, regex_internal.c: Sync with GBLIC. Why not.
+ Unrelated:
+
+ Remove support for MirBSD. It uglified the code too much
+ for no discernable 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 neeeded.
+
+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.
@@ -33,6 +54,13 @@
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
@@ -104,6 +132,12 @@
* 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
@@ -126,6 +160,21 @@
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.
@@ -140,6 +189,13 @@
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:
@@ -260,6 +316,13 @@
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
@@ -626,6 +689,11 @@
* 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
@@ -643,6 +711,11 @@
* 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.
@@ -662,6 +735,13 @@
* 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
@@ -743,6 +823,12 @@
* 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.
@@ -751,6 +837,16 @@
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.
diff --git a/Makefile.in b/Makefile.in
index 4d50757d..5c2a7f11 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -107,7 +107,7 @@ DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/configh.in mkinstalldirs ABOUT-NLS awkgram.c \
- command.c depcomp ylwrap $(include_HEADERS) COPYING \
+ command.c depcomp ylwrap $(include_HEADERS) COPYING TODO \
config.guess config.rpath config.sub install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
diff --git a/NEWS b/NEWS
index 047c8e2a..e1064220 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,36 @@
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
+Changes from 4.1.x to 4.2.0
+---------------------------
+
+1. If not in POSIX mode, changes to ENVIRON are reflected into
+ gawk's environment, affecting any programs run by system()
+ or for piped redirections.
+
+2. The series of numbers returned by rand() should now be "more
+ random" than previously. Gawk's rand() remains repeatable; you will
+ get the same series of numbers each time you call rand() repeatedly,
+ but this will be a different series than previously.
+
+3. The --pretty-print option no longer runs the program too.
+
+4. The igawk script and igawk.1 man page are no longer installed by
+ `make install'. They have been obsolete since gawk 4.0.0.
+
+5. Gawk now has a `div()' function to perform integer division; this is
+ primarily useful for the -M option to avoid MPFR division when all
+ values involved are integers.
+
+6. Gawk can now be built with CMake. This is an alternative build
+ system for those who may want it; gawk is not going to switch off
+ use of the autotools anytime soon, if ever.
+
+7. Gawk now processes a maximum of two hexadecimal digits in \x
+ escape sequences inside strings.
+
+8. MirBSD is no longer supported.
+
Changes from 4.1.1 to 4.1.2
---------------------------
diff --git a/README_d/ChangeLog b/README_d/ChangeLog
index 6bc828d9..8c19cfdb 100644
--- a/README_d/ChangeLog
+++ b/README_d/ChangeLog
@@ -1,3 +1,7 @@
+2014-08-12 Juergen Kahrs <jkahrs@users.sourceforge.net>
+
+ * README.cmake: Moved file from top-level to here.
+
2014-04-08 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.1: Release tar ball made.
diff --git a/README_d/README.cmake b/README_d/README.cmake
new file mode 100644
index 00000000..b291d1be
--- /dev/null
+++ b/README_d/README.cmake
@@ -0,0 +1,95 @@
+CMake is a build automation system
+ http://en.wikipedia.org/wiki/Cmake
+
+We try to use it as a replacement for the established GNU build system.
+This attempt is currently only experimental. If you wonder why anyone
+should do this, read
+
+ Why the KDE project switched to CMake -- and how
+ http://lwn.net/Articles/188693/
+ Escape from GNU Autohell!
+ http://www.shlomifish.org/open-source/anti/autohell
+
+- How can I get GNU Awk compiled with CMake as fast as possible ?
+ git clone git://git.savannah.gnu.org/gawk.git
+ cd gawk
+ git checkout cmake
+ mkdir build
+ cd build
+ cmake ..
+ make
+ ./gawk --version
+ make test
+Notice that this git-checkout allows you to read the source code,
+track the cmake branch and get updates. You will not be able to
+commit anything.
+
+- How can I use git to contribute source code ?
+You need an account at Savannah. Read this to understand the first steps:
+ http://savannah.gnu.org/maintenance/UsingGit
+ README.git
+Use your account there to register your public ssh key at Savannah.
+Then you are ready to checkout. Remember that (when cloning) you are
+setting up your own local repository and make sure you configure it
+properly.
+ git clone ssh://my_account_name@git.sv.gnu.org/srv/git/gawk.git
+ git config --global user.name "first-name last-name"
+ git config --global user.email First.Last@email.com
+ git config --global color.ui auto
+
+- What is the current status of the cmake branch ?
+It has just begun, pre-alpha, unclear if it will ever be taken up
+by the maintainer. We want to study if using CMake with such a
+basic tool like gawk is feasible and if it easier to use than
+the GNU build system.
+
+- Where can I find a tutorial on CMake basics ?
+Use the "official tutorial":
+ http://www.cmake.org/cmake/help/cmake_tutorial.html
+
+- Where is the reference of all commands and variables ?
+Depending on the CMake version you use, select one of these:
+ http://www.cmake.org/cmake/help/v2.8.10/cmake.html
+
+- How can I cross-compile ?
+Proceed in the same way as explained above for native compilation,
+but use a different build directory. When using CMake, do this:
+ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain_mingw32.cmake ..
+Write a new Toolchain file for your cross-compiler and use it.
+
+- How can I build an installable file ?
+Use "make package". The exact kind of installable file depends on your
+operating system and defaults to TGZ.
+
+- Can I build an executable that runs on any Win32 platform ?
+Yes, there are two ways of doing this.
+In both cases you need a MinGW compiler and the NSIS package builder
+installed on the host that shall do the build.
+ http://sourceforge.net/projects/mingw
+ http://sourceforge.net/projects/nsis
+When installed properly, the NSIS tool can even build an installer file
+(a single .exe file that unpacks, registers and installs the gawk executable
+and several other files).
+1. way: native build on a Win32 platform
+ http://www.cmake.org/cmake/help/runningcmake.html
+ After clicking "Configure" select the MinGW option with the default native compiler
+ In the build directory, the command "mingw32-make" will build the gawk.exe
+ The command "mingw32-make package" will build installer file
+2. way: build with cross-compiler on a Linux platform like Ubuntu 12.04 LTS
+ Proceed as describe above for cross-compilers.
+ The command "make ; make package" will build gawk.exe and the installer file
+
+- How can I run test cases ?
+You can run all the test cases that are defined in test/Makefile.am.
+These test case scripts were not changed, but the way they are invoked has
+been adapted to CMake habits.
+See http://cmake.org/Wiki/CMake/Testing_With_CTest#Simple_Testing
+ cmake ..
+ make
+ make test # run all test cases
+ ctest -N # list all test cases but don't run them
+ ctest -R BASIC # run all test cases belonging to group BASIC
+ ctest -R MPFR # run all test cases belonging to group MPFR
+ ctest -E SHLIB.filefunc # run all tests, except the SHLIB.filefunc test case
+Remember that running test cases is possible only after a native build.
+
diff --git a/TODO b/TODO
new file mode 100644
index 00000000..66c8cc91
--- /dev/null
+++ b/TODO
@@ -0,0 +1,197 @@
+Sun Aug 24 20:00:53 IDT 2014
+============================
+
+There were too many files tracking different thoughts and ideas for
+things to do, or consider doing. This file merges them into one. As
+tasks are completed, they should be moved to the DONE section, below,
+or simply removed.
+
+Upon creation of a release (major or patch release), items from the
+previous release should be removed.
+
+This file should exist only in the master branch or branches based off
+of it for development, but not in the stable branch. This may require some
+careful work with Git.
+
+TODO
+====
+
+Minor Cleanups and Code Improvements
+------------------------------------
+
+ Review the bash source script for working with shared libraries in
+ order to nuke the use of libtool. [ Partially started in the
+ nolibtool branch. ]
+
+ Enhance profiling to save comments in a byte-code that does nothing
+ but that can be used when pretty printing the program.
+
+ API:
+ ??? #if !defined(GAWK) && !defined(GAWK_OMIT_CONVENIENCE_MACROS)
+
+ ?? Add debugger commands to reference card
+
+ Look at function order within files.
+
+ Consider removing use of and/or need for the protos.h file.
+
+ Recheck if gnulib regex can be dropped in
+
+ Fully synchronize whitespace tests (for \s, \S in Unicode
+ environment) with those of GNU grep.
+
+Minor New Features
+------------------
+
+ Enhance extension/fork.c waitpid to allow the caller to specify
+ the options. And add an optional array argument to wait and
+ waitpid in which to return exit status information.
+
+ Consider relaxing the strictness of --posix.
+
+ Make it possible to put print/printf + redirections into
+ an expression.
+
+ ? Add an optional base to strtonum, allowing 2-36.
+
+ ? Optional third argument for index indicating where to start the
+ search.
+
+Major New Features
+------------------
+
+ Think about how to generalize indirect access. Manuel Collado
+ suggests things like
+
+ foo = 5
+ @"foo" += 4
+
+ Also needed:
+
+ Indirect calls of built-ins
+ Indirect calls of extension functions
+ Indirect through array elements, not just scalar variables
+
+ Some way to make regexp constants first class citizens:
+ - Assign to variables
+ - Pass to functions
+ Tawk has this and it would also make indirect calling of builtins
+ work more reasonably. Probably would use a special syntax like
+ @/.../ for such objects.
+
+ Consider a typeof() function that returns a string (scalar, array,
+ regexp).
+
+ Add ability to do decimal arithmetic.
+
+ Rework management of array index storage. (Partially DONE.)
+
+ Consider using an atom table for all string array indices.
+
+ DBM storage of awk arrays. Try to allow multiple dbm packages.
+
+ ?? A RECLEN variable for fixed-length record input. PROCINFO["RS"]
+ would be "RS" or "RECLEN" depending upon what's in use.
+ *** Could this be done as an extension?
+
+ ?? Use a new or improved dfa and/or regex library.
+
+ Rewrite in C++.
+
+Things To Think About That May Never Happen
+-------------------------------------------
+
+ Consider making shadowed variables a warning and not
+ a fatal warning when --lint=fatal.
+
+ Similar for extra parameters in a function call.
+
+ Look at code coverage tools, like S2E: https://s2e.epfl.ch/
+
+ Try running with diehard. See http://www.diehard-software.org,
+ https://github.com/emeryberger/DieHard
+
+ Implement namespaces. Arnold suggested the following in an email:
+ - Extend the definition of an 'identifier' to include "." as a valid
+ character although an identifier can't start with it.
+ - Extension libraries install functions and global variables with names
+ that have a "." in them: XML.parse(), XML.name, whatever.
+ - Awk code can read/write such variables and call such functions,
+ but they cannot define such functions
+ function XML.foo() { .. } # error
+ or create a variable with such a name if it doesn't exist. This would
+ be a run-time error, not a parse-time error.
+ - This last rule may be too restrictive.
+ I don't want to get into fancy rules a la perl and file-scope visibility
+ etc, I'd like to keep things simple. But how we design this is going
+ to be very important.
+
+ Include a sample rpm spec file in a new packaging subdirectory.
+ (Really needed?)
+
+ Patch lexer for @include and @load to make quotes optional.
+ (Really needed?)
+
+ ? Have strftime() pay attention to the value of ENVIRON["TZ"]
+
+ Add a lint check if the return value of a function is used but
+ the function did not supply a value.
+
+ Consider making gawk output +nan for NaN values so that it
+ will accept its own output as input.
+ NOTE: Investigated this. GLIBC formats NaN as '-nan'
+ and -NaN as 'nan'. Dealing with this is not simple.
+
+ Enhance FIELDWIDTHS with some way to indicate "the rest of the record".
+ E.g., a length of 0 or -1 or something. Maybe "n"?
+
+
+DONE
+====
+
+Minor Cleanups and Code Improvements
+------------------------------------
+
+Minor New Features
+------------------
+
+Major New Features
+------------------
+
+Things That We Decided We Will Never Do
+=======================================
+
+ Consider moving var_value info into Node_var itself to reduce
+ memory usage. This would break all uses of get_lhs in the
+ code. It's too sweeping a change.
+
+ Add macros for working with flags instead of using & and |
+ directly.
+
+ FIX regular field splitting to use FPAT algorithm.
+ Note: Looked at this. Not sure it's with the trouble:
+ If it ain't broke...
+
+ Scope IDs for IPv6 addresses
+
+ Gnulib
+
+ Make FIELDWIDTHS be an array?
+
+ "Do an optimization pass over parse tree?"
+ This isn't relevant now that we are using a byte code engine.
+
+ "Consider integrating Fred Fish's DBUG library into gawk."
+ I did this once as an experiment. But I don't see a lot of value
+ to this at this stage of the development. Stepping through things
+ in a debugger is generally enough. Also, I would have to try to
+ track down the latest version of this.
+
+ "Make awk '/foo/' files... run at egrep speeds (how?)"
+ This has been on the list since the early days (gawk 1.x or early
+ 2.x). But I am not sure how to really do this, nor have I done
+ timings, nor does there seem to be any real demand for this.
+
+ Change from dlopen to using the libltdl library (i.e. lt_dlopen).
+ This may support more platforms. If we move off of libtool
+ then this is the wrong direction.
diff --git a/awk.h b/awk.h
index a232e7a0..527b4453 100644
--- a/awk.h
+++ b/awk.h
@@ -1361,6 +1361,7 @@ extern NODE *do_aoption(int nargs);
extern NODE *do_asort(int nargs);
extern NODE *do_asorti(int nargs);
extern unsigned long (*hash)(const char *s, size_t len, unsigned long hsize, size_t *code);
+extern void init_env_array(NODE *env_node);
/* awkgram.c */
extern NODE *variable(int location, char *name, NODETYPE type);
extern int parse_program(INSTRUCTION **pcode);
@@ -1418,6 +1419,7 @@ extern AWKNUM nondec2awknum(char *str, size_t len);
extern NODE *do_dcgettext(int nargs);
extern NODE *do_dcngettext(int nargs);
extern NODE *do_bindtextdomain(int nargs);
+extern NODE *do_div(int nargs);
#if MBS_SUPPORT
extern int strncasecmpmbs(const unsigned char *,
const unsigned char *, size_t);
@@ -1555,6 +1557,7 @@ extern NODE *do_mpfr_and(int);
extern NODE *do_mpfr_atan2(int);
extern NODE *do_mpfr_compl(int);
extern NODE *do_mpfr_cos(int);
+extern NODE *do_mpfr_div(int);
extern NODE *do_mpfr_exp(int);
extern NODE *do_mpfr_int(int);
extern NODE *do_mpfr_log(int);
diff --git a/awkgram.c b/awkgram.c
index be852dfa..1c5e952d 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4199,6 +4199,7 @@ static const struct token tokentab[] = {
{"dcngettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext, 0},
{"default", Op_K_default, LEX_DEFAULT, GAWKX, 0, 0},
{"delete", Op_K_delete, LEX_DELETE, NOT_OLD, 0, 0},
+{"div", Op_builtin, LEX_BUILTIN, GAWKX|A(3), do_div, MPF(div)},
{"do", Op_K_do, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0, 0},
{"else", Op_K_else, LEX_ELSE, 0, 0, 0},
{"eval", Op_symbol, LEX_EVAL, 0, 0, 0},
@@ -6244,7 +6245,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
}
#ifdef HAVE_MPFR
- /* N.B.: There isn't any special processing for an alternate function below */
+ /* N.B.: If necessary, add special processing for alternate builtin, below */
if (do_mpfr && tokentab[idx].ptr2)
r->builtin = tokentab[idx].ptr2;
else
@@ -6273,6 +6274,15 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
arg = subn->nexti;
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
+ } else if (r->builtin == do_div
+#ifdef HAVE_MPFR
+ || r->builtin == MPF(div)
+#endif
+ ) {
+ arg = subn->nexti->lasti->nexti->lasti->nexti; /* 3rd arg list */
+ ip = arg->lasti;
+ if (ip->opcode == Op_push)
+ ip->opcode = Op_push_array;
} else if (r->builtin == do_match) {
static bool warned = false;
diff --git a/awkgram.y b/awkgram.y
index 53a218a2..2ceb88e0 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1860,6 +1860,7 @@ static const struct token tokentab[] = {
{"dcngettext", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext, 0},
{"default", Op_K_default, LEX_DEFAULT, GAWKX, 0, 0},
{"delete", Op_K_delete, LEX_DELETE, NOT_OLD, 0, 0},
+{"div", Op_builtin, LEX_BUILTIN, GAWKX|A(3), do_div, MPF(div)},
{"do", Op_K_do, LEX_DO, NOT_OLD|BREAK|CONTINUE, 0, 0},
{"else", Op_K_else, LEX_ELSE, 0, 0, 0},
{"eval", Op_symbol, LEX_EVAL, 0, 0, 0},
@@ -3905,7 +3906,7 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
}
#ifdef HAVE_MPFR
- /* N.B.: There isn't any special processing for an alternate function below */
+ /* N.B.: If necessary, add special processing for alternate builtin, below */
if (do_mpfr && tokentab[idx].ptr2)
r->builtin = tokentab[idx].ptr2;
else
@@ -3934,6 +3935,15 @@ snode(INSTRUCTION *subn, INSTRUCTION *r)
arg = subn->nexti;
if (arg->nexti == arg->lasti && arg->nexti->opcode == Op_push)
arg->nexti->opcode = Op_push_arg; /* argument may be array */
+ } else if (r->builtin == do_div
+#ifdef HAVE_MPFR
+ || r->builtin == MPF(div)
+#endif
+ ) {
+ arg = subn->nexti->lasti->nexti->lasti->nexti; /* 3rd arg list */
+ ip = arg->lasti;
+ if (ip->opcode == Op_push)
+ ip->opcode = Op_push_array;
} else if (r->builtin == do_match) {
static bool warned = false;
diff --git a/awklib/Makefile.am b/awklib/Makefile.am
index 6ffbea81..87ee96b8 100644
--- a/awklib/Makefile.am
+++ b/awklib/Makefile.am
@@ -39,13 +39,12 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
pkgdatadir = $(datadir)/awk
pkglibexecdir = $(libexecdir)/awk
-bin_SCRIPTS = igawk
pkglibexec_PROGRAMS = pwcat grcat
AUXAWK = passwd.awk group.awk
nodist_grcat_SOURCES = grcat.c
nodist_pwcat_SOURCES = pwcat.c
-all: $(srcdir)/stamp-eg $(AUXPROGS) igawk $(AUXAWK)
+all: $(srcdir)/stamp-eg $(AUXPROGS) $(AUXAWK)
install-exec-hook: $(AUXAWK)
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
@@ -57,10 +56,9 @@ install-exec-hook: $(AUXAWK)
# pkglibexecdir and pkgdatadir are removed in the top level Makefile's uninstall
uninstall-local:
rm -fr $(DESTDIR)$(pkglibexecdir)/* $(DESTDIR)$(pkgdatadir)/*
- rm -f $(DESTDIR)$(bindir)/igawk
clean-local:
- rm -f $(AUXAWK) igawk *.exe
+ rm -f $(AUXAWK) *.exe
rm -fr eg.old
rm -fr grcat.dSYM pwcat.dSYM
@@ -72,7 +70,7 @@ $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
@echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg
@echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg
-$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \
+$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c \
$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @:
pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
@@ -81,9 +79,6 @@ pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c
$(COMPILE) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@
-igawk: $(srcdir)/eg/prog/igawk.sh
- cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@
-
passwd.awk: $(srcdir)/eg/lib/passwdawk.in
sed 's;/usr/local/libexec/awk;$(pkglibexecdir);' < $(srcdir)/eg/lib/passwdawk.in > passwd.awk
diff --git a/awklib/Makefile.in b/awklib/Makefile.in
index d32ae04a..38124fad 100644
--- a/awklib/Makefile.in
+++ b/awklib/Makefile.in
@@ -37,7 +37,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
-
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
@@ -122,7 +121,7 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(bindir)"
+am__installdirs = "$(DESTDIR)$(pkglibexecdir)"
PROGRAMS = $(pkglibexec_PROGRAMS)
nodist_grcat_OBJECTS = grcat.$(OBJEXT)
grcat_OBJECTS = $(nodist_grcat_OBJECTS)
@@ -130,34 +129,6 @@ grcat_LDADD = $(LDADD)
nodist_pwcat_OBJECTS = pwcat.$(OBJEXT)
pwcat_OBJECTS = $(nodist_pwcat_OBJECTS)
pwcat_LDADD = $(LDADD)
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-SCRIPTS = $(bin_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -349,7 +320,6 @@ EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg
# Get config.h from the build directory and custom.h from the source directory.
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
-bin_SCRIPTS = igawk
AUXAWK = passwd.awk group.awk
nodist_grcat_SOURCES = grcat.c
nodist_pwcat_SOURCES = pwcat.c
@@ -429,41 +399,6 @@ uninstall-pkglibexecPROGRAMS:
clean-pkglibexecPROGRAMS:
-test -z "$(pkglibexec_PROGRAMS)" || rm -f $(pkglibexec_PROGRAMS)
-install-binSCRIPTS: $(bin_SCRIPTS)
- @$(NORMAL_INSTALL)
- @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n' \
- -e 'h;s|.*|.|' \
- -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) { files[d] = files[d] " " $$1; \
- if (++n[d] == $(am__install_max)) { \
- print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
- else { print "f", d "/" $$4, $$1 } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
- $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-binSCRIPTS:
- @$(NORMAL_UNINSTALL)
- @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 's,.*/,,;$(transform)'`; \
- dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -572,9 +507,9 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
-all-am: Makefile $(PROGRAMS) $(SCRIPTS)
+all-am: Makefile $(PROGRAMS)
installdirs:
- for dir in "$(DESTDIR)$(pkglibexecdir)" "$(DESTDIR)$(bindir)"; do \
+ for dir in "$(DESTDIR)$(pkglibexecdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -636,7 +571,7 @@ install-dvi: install-dvi-am
install-dvi-am:
-install-exec-am: install-binSCRIPTS install-pkglibexecPROGRAMS
+install-exec-am: install-pkglibexecPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
@@ -676,8 +611,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-binSCRIPTS uninstall-local \
- uninstall-pkglibexecPROGRAMS
+uninstall-am: uninstall-local uninstall-pkglibexecPROGRAMS
.MAKE: install-am install-exec-am install-strip
@@ -685,20 +619,19 @@ uninstall-am: uninstall-binSCRIPTS uninstall-local \
clean-local clean-pkglibexecPROGRAMS cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-binSCRIPTS install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-exec-hook install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-pkglibexecPROGRAMS install-ps \
- install-ps-am install-strip installcheck installcheck-am \
- installdirs maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
- ps ps-am tags tags-am uninstall uninstall-am \
- uninstall-binSCRIPTS uninstall-local \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-exec-hook \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am \
+ install-pkglibexecPROGRAMS install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-local \
uninstall-pkglibexecPROGRAMS
-all: $(srcdir)/stamp-eg $(AUXPROGS) igawk $(AUXAWK)
+all: $(srcdir)/stamp-eg $(AUXPROGS) $(AUXAWK)
install-exec-hook: $(AUXAWK)
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
@@ -710,10 +643,9 @@ install-exec-hook: $(AUXAWK)
# pkglibexecdir and pkgdatadir are removed in the top level Makefile's uninstall
uninstall-local:
rm -fr $(DESTDIR)$(pkglibexecdir)/* $(DESTDIR)$(pkgdatadir)/*
- rm -f $(DESTDIR)$(bindir)/igawk
clean-local:
- rm -f $(AUXAWK) igawk *.exe
+ rm -f $(AUXAWK) *.exe
rm -fr eg.old
rm -fr grcat.dSYM pwcat.dSYM
@@ -725,7 +657,7 @@ $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
@echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg
@echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg
-$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c $(srcdir)/eg/prog/igawk.sh \
+$(srcdir)/eg/lib/pwcat.c $(srcdir)/eg/lib/grcat.c \
$(srcdir)/eg/lib/passwdawk.in $(srcdir)/eg/lib/groupawk.in: stamp-eg; @:
pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
@@ -734,9 +666,6 @@ pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c
grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c
$(COMPILE) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@
-igawk: $(srcdir)/eg/prog/igawk.sh
- cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@
-
passwd.awk: $(srcdir)/eg/lib/passwdawk.in
sed 's;/usr/local/libexec/awk;$(pkglibexecdir);' < $(srcdir)/eg/lib/passwdawk.in > passwd.awk
diff --git a/awklib/eg/lib/div.awk b/awklib/eg/lib/div.awk
new file mode 100644
index 00000000..9d919288
--- /dev/null
+++ b/awklib/eg/lib/div.awk
@@ -0,0 +1,17 @@
+# div --- do integer division
+
+#
+# Arnold Robbins, arnold@skeeve.com, Public Domain
+# July, 2014
+
+function div(numerator, denominator, result, i)
+{
+ split("", result)
+
+ numerator = int(numerator)
+ denominator = int(denominator)
+ result["quotient"] = int(numerator / denominator)
+ result["remainder"] = int(numerator % denominator)
+
+ return 0.0
+}
diff --git a/builtin.c b/builtin.c
index 0995fdf7..934664b0 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2405,6 +2405,8 @@ static char *const state = (char *const) istate;
NODE *
do_rand(int nargs ATTRIBUTE_UNUSED)
{
+ double tmprand;
+#define RAND_DIVISOR ((double)GAWK_RANDOM_MAX+1.0)
if (firstrand) {
(void) initstate((unsigned) 1, state, SIZEOF_STATE);
/* don't need to srandom(1), initstate() does it for us. */
@@ -2416,7 +2418,66 @@ do_rand(int nargs ATTRIBUTE_UNUSED)
*
* 0 <= n < 1
*/
- return make_number((AWKNUM) (random() % GAWK_RANDOM_MAX) / GAWK_RANDOM_MAX);
+ /*
+ * Date: Wed, 28 Aug 2013 17:52:46 -0700
+ * From: Bob Jewett <jewett@bill.scs.agilent.com>
+ *
+ * Call random() twice to fill in more bits in the value
+ * of the double. Also, there is a bug in random() such
+ * that when the values of successive values are combined
+ * like (rand1*rand2)^2, (rand3*rand4)^2, ... the
+ * resulting time series is not white noise. The
+ * following also seems to fix that bug.
+ *
+ * The add/subtract 0.5 keeps small bits from filling
+ * below 2^-53 in the double, not that anyone should be
+ * looking down there.
+ *
+ * Date: Wed, 25 Sep 2013 10:45:38 -0600 (MDT)
+ * From: "Nelson H. F. Beebe" <beebe@math.utah.edu>
+ * (4) The code is typical of many published fragments for converting
+ * from integer to floating-point, and I discuss the serious pitfalls
+ * in my book, because it leads to platform-dependent behavior at the
+ * end points of the interval [0,1]
+ *
+ * (5) the documentation in the gawk info node says
+ *
+ * `rand()'
+ * Return a random number. The values of `rand()' are uniformly
+ * distributed between zero and one. The value could be zero but is
+ * never one.(1)
+ *
+ * The division by RAND_DIVISOR may not guarantee that 1.0 is never
+ * returned: the programmer forgot the platform-dependent issue of
+ * rounding.
+ *
+ * For points 4 and 5, the safe way is a loop:
+ *
+ * double
+ * rand(void) // return value in [0.0, 1.0)
+ * {
+ * value = internal_rand();
+ *
+ * while (value == 1.0)
+ * value = internal_rand();
+ *
+ * return (value);
+ * }
+ */
+
+ do {
+ long d1, d2;
+ /*
+ * Do the calls in predictable order to avoid
+ * compiler differences in order of evaluation.
+ */
+ d1 = random();
+ d2 = random();
+ tmprand = 0.5 + ( (d1/RAND_DIVISOR + d2) / RAND_DIVISOR );
+ tmprand -= 0.5;
+ } while (tmprand == 1.0);
+
+ return make_number((AWKNUM) tmprand);
}
/* do_srand --- seed the random number generator */
@@ -3565,6 +3626,72 @@ do_bindtextdomain(int nargs)
return make_string(the_result, strlen(the_result));
}
+/* do_div --- do integer division, return quotient and remainder in dest array */
+
+/*
+ * We define the semantics as:
+ * numerator = int(numerator)
+ * denominator = int(denonmator)
+ * quotient = int(numerator / denomator)
+ * remainder = int(numerator % denomator)
+ */
+
+NODE *
+do_div(int nargs)
+{
+ NODE *numerator, *denominator, *result;
+ double num, denom, quotient, remainder;
+ NODE *sub, **lhs;
+
+ result = POP_PARAM();
+ if (result->type != Node_var_array)
+ fatal(_("div: third argument is not an array"));
+ assoc_clear(result);
+
+ denominator = POP_SCALAR();
+ numerator = POP_SCALAR();
+
+ if (do_lint) {
+ if ((numerator->flags & (NUMCUR|NUMBER)) == 0)
+ lintwarn(_("div: received non-numeric first argument"));
+ if ((denominator->flags & (NUMCUR|NUMBER)) == 0)
+ lintwarn(_("div: received non-numeric second argument"));
+ }
+
+ (void) force_number(numerator);
+ (void) force_number(denominator);
+ num = double_to_int(get_number_d(numerator));
+ denom = double_to_int(get_number_d(denominator));
+
+ if (denom == 0.0)
+ fatal(_("div: division by zero attempted"));
+
+ quotient = double_to_int(num / denom);
+ /*
+ * FIXME: This code is duplicated, factor it out to a
+ * separate function.
+ */
+#ifdef HAVE_FMOD
+ remainder = fmod(num, denom);
+#else /* ! HAVE_FMOD */
+ (void) modf(num / denom, & remainder);
+ remainder = num - remainder * denom;
+#endif /* ! HAVE_FMOD */
+ remainder = double_to_int(remainder);
+
+ sub = make_string("quotient", 8);
+ lhs = assoc_lookup(result, sub);
+ unref(*lhs);
+ *lhs = make_number((AWKNUM) quotient);
+
+ sub = make_string("remainder", 9);
+ lhs = assoc_lookup(result, sub);
+ unref(*lhs);
+ *lhs = make_number((AWKNUM) remainder);
+
+ return make_number((AWKNUM) 0.0);
+}
+
/* mbc_byte_count --- return number of bytes for corresponding numchars multibyte characters */
diff --git a/cmake/Toolchain_clang.cmake b/cmake/Toolchain_clang.cmake
new file mode 100644
index 00000000..89353570
--- /dev/null
+++ b/cmake/Toolchain_clang.cmake
@@ -0,0 +1,19 @@
+# http://www.cmake.org/Wiki/CmakeMingw
+# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
+
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Generic)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER /usr/bin/clang)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /usr/lib64/clang/3.1)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
diff --git a/cmake/Toolchain_generic.cmake b/cmake/Toolchain_generic.cmake
new file mode 100644
index 00000000..91ddc6e7
--- /dev/null
+++ b/cmake/Toolchain_generic.cmake
@@ -0,0 +1,21 @@
+# http://www.cmake.org/Wiki/CmakeMingw
+# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
+
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Generic)
+
+# which compilers to use for C and C++
+# Settings for Ubuntu 12.04.1 LTS
+SET(CMAKE_C_COMPILER /usr/bin/gcc)
+
+# here is the target environment located
+# Settings for Ubuntu 12.04.1 LTS
+SET(CMAKE_FIND_ROOT_PATH /usr/)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
diff --git a/cmake/Toolchain_mingw32.cmake b/cmake/Toolchain_mingw32.cmake
new file mode 100644
index 00000000..bb885f2f
--- /dev/null
+++ b/cmake/Toolchain_mingw32.cmake
@@ -0,0 +1,23 @@
+# http://www.cmake.org/Wiki/CmakeMingw
+# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
+
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+# Settings for Ubuntu 12.04.1 LTS
+SET(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc)
+SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++)
+SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres)
+
+# here is the target environment located
+# Settings for Ubuntu 12.04.1 LTS
+SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
diff --git a/cmake/Toolchain_s390.cmake b/cmake/Toolchain_s390.cmake
new file mode 100644
index 00000000..e1cdcfff
--- /dev/null
+++ b/cmake/Toolchain_s390.cmake
@@ -0,0 +1,20 @@
+# http://www.cmake.org/Wiki/CmakeMingw
+# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
+# http://wiki.debian.org/EmdebianToolchain#Get_the_binaries
+
+# the name of the target operating system
+SET(CMAKE_SYSTEM_NAME Generic)
+
+# which compilers to use for C and C++
+SET(CMAKE_C_COMPILER /usr/bin/s390-linux-gnu-gcc-4.4)
+
+# here is the target environment located
+SET(CMAKE_FIND_ROOT_PATH /usr/s390-linux-gnu/)
+
+# adjust the default behaviour of the FIND_XXX() commands:
+# search headers and libraries in the target environment, search
+# programs in the host environment
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+
diff --git a/cmake/auk.ico b/cmake/auk.ico
new file mode 100644
index 00000000..795ef1d9
--- /dev/null
+++ b/cmake/auk.ico
Binary files differ
diff --git a/cmake/basictest b/cmake/basictest
new file mode 100755
index 00000000..210ed224
--- /dev/null
+++ b/cmake/basictest
@@ -0,0 +1,553 @@
+#!/bin/sh
+
+# Use this for debugging the test cases.
+# The resulting textual output will not destroy the test cases.
+set -x
+# After test case execution, the output can be found in
+# build/Testing/Temporary/LastTest.log
+
+export PATH=$PATH:/c/MinGW/msys/1.0/bin
+export GAWKEXE=$1
+export TESTCASE=$2
+TOPSRCDIR=$(dirname ${0})/..
+SRCDIR=${TOPSRCDIR}/test
+export AWKPATH=${SRCDIR}
+export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/
+export LANG=C
+# Is this shell running in a native MinGW shell (MSYS) ?
+if test -n "$COMSPEC"; then
+ # Ignore all differences in white space.
+ COMPARE="diff -w"
+ PATH_SEPARATOR="\\"
+else
+ # This is a shell running in Unix environment.
+ COMPARE="cmp"
+ PATH_SEPARATOR="/"
+fi
+
+# This is the central function for executing a standard test case.
+# Many of the more specialized test cases rely on this function.
+function simple_test_case() {
+ local options=$1 # options passed to the gawk executable
+ local parameters=$2 # parameters passed to the test case script
+ cd ${SRCDIR}
+ if test -r ${TESTCASE}.in
+ # Any existing .in file will be redirected to standard input.
+ # The output redirection must be bound to the test script, otherwise
+ # the "set -x" logging would mix with the test case output.
+ then
+ ${pregawk} $GAWKEXE ${options} -f ${TESTCASE}.awk ${parameters} < ${TESTCASE}.in ${postgawk} > _${TESTCASE} 2>&1
+ else
+ ${pregawk} $GAWKEXE ${options} -f ${TESTCASE}.awk ${parameters} ${postgawk} > _${TESTCASE} 2>&1
+ fi || echo EXIT CODE: $? >> _${TESTCASE}
+ # Compare the expected (correct) output with the actual output.
+ ${COMPARE} ${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ # If the comparison succeeds then remove the actual output.
+ # Else leave the actual output file untouched for later analysis.
+}
+
+# Each test case that cannot be handle in the "standard way" shall
+# be implemented as a function here.
+
+function lintold() { simple_test_case "--lint-old" "" ; }
+function defref() { simple_test_case "--lint" "" ; }
+function fmtspcl() { simple_test_case "--lint" "" ; }
+function lintwarn() { simple_test_case "--lint" "" ; }
+function noeffect() { simple_test_case "--lint" "" ; }
+function nofmtch() { simple_test_case "--lint" "" ; }
+function shadow() { simple_test_case "--lint" "" ; }
+function uninit2() { simple_test_case "--lint" "" ; }
+function uninit3() { simple_test_case "--lint" "" ; }
+function uninit4() { simple_test_case "--lint" "" ; }
+function uninit5() { simple_test_case "--lint" "" ; }
+function uninitialized() { simple_test_case "--lint" "" ; }
+
+function regtest() {
+ echo 'Some of the output from regtest is very system specific, do not'
+ echo 'be distressed if your output differs from that distributed.'
+ echo 'Manual inspection is called for.'
+ AWK=$GAWKEXE ${SRCDIR}/regtest.sh
+}
+
+function compare() { simple_test_case "" "0 1" ; }
+
+function inftest() {
+ echo This test is very machine specific...
+ $GAWKEXE -f ${SRCDIR}/inftest.awk | sed "s/inf/Inf/g" >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function getline2() { simple_test_case "" "getline2.awk getline2.awk" ; }
+
+function awkpath() {
+ AWKPATH="${SRCDIR}$(PATH_SEPARATOR)/lib" $GAWKEXE -f awkpath.awk >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function argtest() { simple_test_case "" "-x -y abc" ; }
+
+function badargs() {
+ $GAWKEXE -f 2>&1 | grep -v patchlevel >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function nonl() { simple_test_case "--lint" "/dev/null" ; }
+
+function poundbang() {
+# The original poundbang test case looks a bit non-deterministic.
+# This is a shortened version.
+ sed "s;/tmp/gawk;$GAWKEXE;" < ${SRCDIR}/poundbang.awk > ./_pbd.awk
+ chmod +x ./_pbd.awk
+ ./_pbd.awk ${SRCDIR}/poundbang.awk > _`basename ${TESTCASE}` ;
+ ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk
+}
+
+function messages() {
+ $GAWKEXE -f ${SRCDIR}/messages.awk >_out2 2>_out3
+ ${COMPARE} ${SRCDIR}/out1.ok _out1 && ${COMPARE} ${SRCDIR}/out2.ok _out2 && ${COMPARE} ${SRCDIR}/out3.ok _out3 && rm -f _out1 _out2 _out3
+}
+
+function argarray() {
+ case ${SRCDIR} in
+ .) : ;;
+ *) cp ${SRCDIR}/argarray.in . ;;
+ esac
+ TEST=test echo just a test | $GAWKEXE -f ${SRCDIR}/argarray.awk ./argarray.in - >_${TESTCASE}
+ case ${SRCDIR} in
+ .) : ;;
+ *) rm -f ./argarray.in ;;
+ esac
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+
+function localenl() {
+ ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} 2>/dev/null
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function mbprintf1() {
+ GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE
+ LANG=en_US.UTF-8
+ $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function mbfw1() {
+ GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE
+ LANG=en_US.UTF-8
+ $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function printfbad2() {
+ $GAWKEXE --lint -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in 2>&1 | sed "s;$SRCDIR/;;g" >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function beginfile1() {
+ AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function beginfile2() {
+ # This differs from the original, the pwd part is new.
+ # The re-direction is now bound to the .sh file.
+ # This way the output of "set -x" is not written to the script's output file.
+ ( cd ${SRCDIR} && LC_ALL=C AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh ${SRCDIR}/${TESTCASE}.in > `pwd`/_${TESTCASE} 2>&1 )
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
+}
+
+function dumpvars() {
+ AWKPATH=${SRCDIR} $GAWKEXE --dump-variables 1 < ${SRCDIR}/${TESTCASE}.in >/dev/null 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ mv awkvars.out _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function manyfiles() {
+ rm -rf junk
+ mkdir junk
+ $GAWKEXE 'BEGIN { for (i = 1; i <= 1030; i++) print i, i}' >_${TESTCASE}
+ $GAWKEXE -f ${SRCDIR}/manyfiles.awk _${TESTCASE} _${TESTCASE}
+ wc -l junk/* | $GAWKEXE '$1 != 2' | wc -l | sed "s/ *//g" > _${TESTCASE}
+ rm -rf junk
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function exitval1() {
+ $GAWKEXE -f ${SRCDIR}/exitval1.awk >_${TESTCASE} 2>&1; echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function fsspcoln() {
+ $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 'FS=[ :]+' ${SRCDIR}/${TESTCASE}.in >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rsstart2() {
+ $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/rsstart1.in >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rsstart3() {
+ head ${SRCDIR}/rsstart1.in | $GAWKEXE -f ${SRCDIR}/rsstart2.awk >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function strftime() {
+ echo This test could fail on slow machines or on a minute boundary,
+ echo so if it does, double check the actual results:
+ GAWKLOCALE=C; export GAWKLOCALE
+ TZ=GMT0; export TZ
+ (LC_ALL=C date) | $GAWKEXE -v OUTPUT=_${TESTCASE} -f ${SRCDIR}/strftime.awk
+ ${COMPARE} strftime.ok _${TESTCASE} && rm -f _${TESTCASE} strftime.ok || exit 0
+}
+
+function inplace1() {
+ cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
+ cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
+}
+
+function inplace2() {
+ cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
+ cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak
+}
+
+function inplace3() {
+ cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
+ cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >>_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak
+}
+
+function testext() {
+ $GAWKEXE ' /^(@load|BEGIN)/,/^}/' ${SRCDIR}/../extension/testext.c > testext.awk
+ $GAWKEXE -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE}
+ rm -f testext.awk
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
+}
+
+function readdir() {
+ if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { print $NF }'`" = nfs ]; then
+ echo This test may fail on GNU/Linux systems when run on an NFS filesystem.;
+ echo If it does, try rerunning on an ext'[234]' filesystem. ;
+ fi
+ $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/.. > ${SRCDIR}/_${TESTCASE} 2>&1
+ ls -afli ${TOPSRCDIR} | sed 1d | $GAWKEXE -f ${SRCDIR}/readdir0.awk -v extout=${SRCDIR}/_${TESTCASE} > ${SRCDIR}/${TESTCASE}.ok
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok
+}
+
+function ordchr2() {
+ $GAWKEXE -l ordchr 'BEGIN {print chr(ord("z"))}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function include2() {
+ AWKPATH=${SRCDIR} $GAWKEXE -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe2() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -f inclib -f inclib.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe3() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe4() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe5() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -i hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe6() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -i inchello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function incdupe7() {
+ AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i inchello >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+# TODO: The compare operation passes even when there are diffs.
+function readfile() {
+ $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok
+}
+
+function fts() {
+ if [ "`uname`" = IRIX ]; then \
+ echo This test may fail on IRIX systems when run on an NFS filesystem.; \
+ echo If it does, try rerunning on an xfs filesystem. ; \
+ fi
+ simple_test_case "" ""
+}
+
+function charasbytes() {
+ [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
+ AWKPATH=${SRCDIR} $GAWKEXE -b -v BINMODE=2 -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in | \
+ od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$//' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function symtab6() {
+ $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk
+ grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' > _${TESTCASE} ; rm __${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function symtab8() {
+ $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE}
+ grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' | grep -v '^FILENAME' >> _${TESTCASE} ; rm __${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function colonwarn() {
+ for i in 1 2 3 ; \
+ do $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk $i < ${SRCDIR}/${TESTCASE}.in ; \
+ done > _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function litoct() {
+ echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function devfd() {
+ $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4<${SRCDIR}/devfd.in4 5<${SRCDIR}/devfd.in5 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function fflush() {
+ ${SRCDIR}/fflush.sh >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function mmap8k() {
+ $GAWKEXE '{ print }' ${SRCDIR}/mmap8k.in >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/mmap8k.in _${TESTCASE} && rm -f _${TESTCASE} || cp ${SRCDIR}/${TESTCASE}.in ${TESTCASE}.ok
+}
+
+function pid() {
+ AWKPATH=${SRCDIR} AWK=$GAWKEXE ${SHELL} ${SRCDIR}/pid.sh $$ > _${TESTCASE} ; :
+ ${COMPARE} ${SRCDIR}/pid.ok _`basename ${TESTCASE}` && rm -f _${TESTCASE}
+}
+
+function strftlng() {
+ TZ=UTC; export TZ; $GAWKEXE -f ${SRCDIR}/strftlng.awk >_${TESTCASE}
+ if ${COMPARE} ${SRCDIR}/strftlng.ok _${TESTCASE} >/dev/null 2>&1 ; then : ; else \
+ TZ=UTC0; export TZ; $GAWKEXE -f ${SRCDIR}/strftlng.awk >_${TESTCASE} ; \
+ fi
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function nors() {
+ echo A B C D E | tr -d '\12\15' | $GAWKEXE '{ print $NF }' - ${SRCDIR}/nors.in > _${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function fmtspcl() {
+ $GAWKEXE -v "sd=${SRCDIR}" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < ${SRCDIR}/fmtspcl.tok > ${TESTCASE}.ok 2>/dev/null
+ $GAWKEXE $AWKFLAGS -f ${SRCDIR}/fmtspcl.awk --lint >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ if test -z "$AWKFLAGS" ; then
+ ${COMPARE} ${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+ else
+ ${COMPARE} ${SRCDIR}/${TESTCASE}-mpfr.ok _${TESTCASE} && rm -f _${TESTCASE}
+ fi
+}
+
+function pipeio2() { simple_test_case "-v SRCDIR=${SRCDIR}" "" ; }
+
+function arynocls() {
+ AWKPATH=${SRCDIR} $GAWKEXE -v INPUT=${SRCDIR}/arynocls.in -f arynocls.awk >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function inetechu() {
+ echo This test is for establishing UDP connections
+ $GAWKEXE 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}'
+}
+
+function inetecht() {
+ echo This test is for establishing TCP connections
+ $GAWKEXE 'BEGIN {print "" |& "/inet/tcp/0/127.0.0.1/9"}'
+}
+
+function inetdayu() {
+ echo This test is for bidirectional UDP transmission
+ $GAWKEXE 'BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13"; \
+ "/inet/udp/0/127.0.0.1/13" |& getline; print $0}'
+}
+
+function inetdayt() {
+ echo This test is for bidirectional TCP transmission
+ $GAWKEXE 'BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13"; \
+ "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}'
+}
+
+function redfilnm() { simple_test_case "" "srcdir=${SRCDIR}" ; }
+
+function leaddig() { simple_test_case "-v x=2E" "" ; }
+function longwrds() { simple_test_case "-vSORT=sort" "" ; }
+
+function gsubtst3() {
+ $GAWKEXE --re-interval -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function space() {
+ $GAWKEXE -f ' ' ${SRCDIR}/space.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rsnulbig() {
+ # Suppose that block size for pipe is at most 128kB:
+ $GAWKEXE 'BEGIN { for (i = 1; i <= 128*64+1; i++) print "abcdefgh123456\n" }' 2>&1 | \
+ $GAWKEXE 'BEGIN { RS = ""; ORS = "\n\n" }; { print }' 2>&1 | \
+ $GAWKEXE '/^[^a]/; END{ print NR }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rsnulbig2() {
+ $GAWKEXE 'BEGIN { ORS = ""; n = "\n"; for (i = 1; i <= 10; i++) n = (n n); \
+ for (i = 1; i <= 128; i++) print n; print "abc\n" }' 2>&1 | \
+ $GAWKEXE 'BEGIN { RS = ""; ORS = "\n\n" };{ print }' 2>&1 | \
+ $GAWKEXE '/^[^a]/; END { print NR }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function printf0() { simple_test_case "--posix" "" ; }
+
+function profile1() {
+ $GAWKEXE --pretty-print=ap-${TESTCASE}.out -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out1
+ $GAWKEXE -f ap-${TESTCASE}.out ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out2 ; rm ap-${TESTCASE}.out
+ ${COMPARE} _${TESTCASE}.out1 _${TESTCASE}.out2 && rm _${TESTCASE}.out[12] || { echo EXIT CODE: $$? >>_${TESTCASE} ; \
+ cp $(srcdir)/dtdgport.awk > ${TESTCASE}.ok ; }
+}
+
+function profile2() {
+ $GAWKEXE --profile=ap-${TESTCASE}.out -v sortcmd=sort -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > /dev/null
+ sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function profile3() {
+ $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null
+ sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function profile4() {
+ GAWK_NO_PP_RUN=1 $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null
+ sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function profile5() {
+ GAWK_NO_PP_RUN=1 $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null
+ sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function posix2008sub() {
+ $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function next() {
+ LC_ALL=${GAWKLOCALE:-C} LANG=${GAWKLOCALE:-C} AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1
+ LC_ALL=C ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function exit() {
+ AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function mpfrexprange() { simple_test_case "-M -vPREC=53 " "" ; }
+function mpfrrnd() { simple_test_case "-M -vPREC=53 " "" ; }
+function mpfrnr() { simple_test_case "-M -vPREC=113" "" ; }
+function mpfrbigint() { simple_test_case "-M " "" ; }
+
+function jarebug() {
+ ${SRCDIR}/${TESTCASE}.sh "$GAWKEXE" "${SRCDIR}/${TESTCASE}.awk" "${SRCDIR}/${TESTCASE}.in" "_${TESTCASE}"
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rtlen() {
+ ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rtlen01() {
+ ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function rtlenmb() {
+ GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE
+ ${SRCDIR}/rtlen.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function nondec2() { simple_test_case "--non-decimal-data -v a=0x1" "" ; }
+
+function nofile() {
+ $GAWKEXE '{}' no/such/file >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function binmode1() {
+ $GAWKEXE -v BINMODE=3 'BEGIN { print BINMODE }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function devfd1() {
+ $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+function devfd2() {
+ # The program text is the '1' which will print each record. How compact can you get?
+ $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
+ ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
+}
+
+# Is this test case implemented as a function ?
+if [ "$( type -t $TESTCASE )" = "function" ]
+then
+ $TESTCASE
+else
+ # If no function exists, then treat the test case in standard way.
+ simple_test_case "" ""
+fi
+
diff --git a/cmake/configure b/cmake/configure
new file mode 100755
index 00000000..d375a81c
--- /dev/null
+++ b/cmake/configure
@@ -0,0 +1,58 @@
+#!/bin/sh
+# On 2013-05-14 Arnold wrote in an e-mail:
+
+# <QUOTE)
+# I think that using CMake would be more palatable if there is also a simple
+# configure wrapper that can be used by people who build distributions. This would
+# mean things like
+#
+# configure CC=XXXX # XXXX in { gcc, clang, tcc } or native platform cc
+# configure --prefix=/path/to/install
+#
+# And the few other current configure options like --with-whiny-user-strftime,
+# --disable-nls, etc. I don't know if we need all the standard configure options,
+# but I do want the ones I've added in configure.ac.
+# </QUOTE)
+
+
+# Anyone using this script still needs an out-of-source build directory.
+if [ -f CMakeLists.txt ] ; then
+ echo "Your current working directory contains a file CMakeLists.txt, indicating"
+ echo "that this is a source directory. Create a new directory elsewhere, change into"
+ echo "this empty directory and try again."
+ echo " mkdir build"
+ echo " cd build"
+ echo " ../$0"
+ exit 1
+fi
+
+# TODO: Evaluate all the options and translate the options into CMake variables.
+CC=$( which cc )
+PREFIX=""
+SRCDIR=".."
+WHINY=""
+
+for p in $@
+do
+ if [ ${p:0:3} = "CC=" ]; then CC=${p:3}; fi
+ if [ ${p:0:9} = "--prefix=" ]; then PREFIX=-DCMAKE_INSTALL_PREFIX=${p:9}; fi
+ if [ ${p:0:9} = "--srcdir=" ]; then SRCDIR=${p:9}; fi
+ if [ ${p:0:26} = "--with-whiny-user-strftime" ]; then WHINY=-DUSE_INCLUDED_STRFTIME=1; fi
+done
+CC=$( which $CC )
+
+rm -f Toolchain.cmake
+(
+ echo "set(CMAKE_C_COMPILER $CC)"
+ echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)"
+ echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)"
+ echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)"
+) > Toolchain.cmake
+
+if ! [ -f ${SRCDIR}/CMakeLists.txt ] ; then
+ echo "The source directory (${SRCDIR}) does not contain a file CMakeLists.txt."
+ exit 1
+fi
+
+cmake ${PREFIX} ${WHINY} -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake ${SRCDIR}
+
diff --git a/cmake/configure.cmake b/cmake/configure.cmake
new file mode 100644
index 00000000..7dbe841c
--- /dev/null
+++ b/cmake/configure.cmake
@@ -0,0 +1,300 @@
+#
+# cmake/configure --- CMake input file for gawk
+#
+# Copyright (C) 2013-2014
+# the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## process this file with CMake to produce Makefile
+
+option (USE_CONFIG_H "Generate a file config.h for inclusion into C source code" ON)
+if (USE_CONFIG_H)
+ file( WRITE config.h "/* all settings defined by CMake. */\n\n" )
+ ADD_DEFINITIONS (-D HAVE_CONFIG_H)
+ # Configure a header file to pass some of the CMake settings
+ # to the source code
+ # http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:configure_file
+ # CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE )
+else()
+ file( WRITE config.h "/* empty file, all settings defined by CMake. */" )
+endif()
+
+include(CheckIncludeFiles)
+include(CheckIncludeFile)
+include(CheckSymbolExists)
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+include(CheckTypeSize)
+include(CheckStructHasMember)
+INCLUDE(CheckCSourceCompiles)
+include(CheckPrototypeDefinition)
+
+MACRO(DefineConfigH feature)
+# message(STATUS feature=${feature}=${${feature}})
+ if (${feature})
+ if (${USE_CONFIG_H} STREQUAL ON)
+ FILE( APPEND config.h "#define ${feature} ${${feature}}\n")
+ else()
+ #ADD_DEFINITIONS (-D ${feature})
+ ADD_DEFINITIONS (-D${feature}=${${feature}})
+ endif ()
+ endif ()
+ENDMACRO(DefineConfigH)
+
+MACRO(DefineConfigHValue feature value)
+ set(${feature} ${value})
+ DefineConfigH(${feature})
+ENDMACRO(DefineConfigHValue)
+
+MACRO(DefineFunctionIfAvailable func feature)
+ check_function_exists("${func}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineFunctionIfAvailable)
+
+MACRO(DefineHFileIfAvailable hfile feature)
+ check_include_file("${hfile}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineHFileIfAvailable)
+
+MACRO(DefineTypeIfAvailable type feature)
+ check_type_size("${type}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineTypeIfAvailable)
+
+MACRO(DefineSymbolIfAvailable symbol hfile feature)
+ check_symbol_exists("${symbol}" "${hfile}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineSymbolIfAvailable)
+
+MACRO(DefineStructHasMemberIfAvailable struct member hfile feature)
+ check_struct_has_member("${struct}" "${member}" "${hfile}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineStructHasMemberIfAvailable)
+
+MACRO(DefineLibraryIfAvailable lib func location feature)
+ check_library_exists("${lib}" "${func}" "${location}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineLibraryIfAvailable)
+
+MACRO(DefineIfSourceCompiles source feature)
+ check_c_source_compiles( "${source}" "${feature}")
+ DefineConfigH(${feature})
+ENDMACRO(DefineIfSourceCompiles)
+
+FILE( READ configure.ac CONFIG_AUTOMAKE )
+STRING( REGEX MATCH "AC_INIT\\(\\[GNU Awk\\], ([0-9]+\\.[0-9]+\\.[0-9]+)" GAWK_AUTOMAKE_LINE_VERSION "${CONFIG_AUTOMAKE}")
+STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}")
+STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" GAWK_MINOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}")
+STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GAWK_BUGFIX_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}")
+
+# The definition of the symbol GAWK cannot be passed in config.h
+# because the extensions will fail to build.
+add_definitions(-DGAWK)
+DefineConfigHValue(_GL_ATTRIBUTE_PURE "__attribute__ ((__pure__))")
+DefineConfigHValue(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}")
+DefineConfigHValue(VERSION \\"${GAWK_VERSION}\\")
+DefineConfigHValue(PACKAGE \\"gawk\\")
+DefineConfigHValue(PACKAGE_STRING \\"GNU Awk ${GAWK_VERSION}\\")
+DefineConfigHValue(PACKAGE_TARNAME \\"gawk\\")
+DefineConfigHValue(PACKAGE_URL \\"http://www.gnu.org/software/gawk/\\")
+DefineConfigHValue(PACKAGE_VERSION \\"${GAWK_VERSION}\\")
+DefineConfigHValue(DEFPATH \\"${CMAKE_BINARY_DIR}/awk\\")
+DefineConfigHValue(DEFLIBPATH \\"${CMAKE_BINARY_DIR}/lib\\")
+if (CMAKE_DL_LIBS)
+ message(STATUS "Found CMAKE_DL_LIBS:${CMAKE_DL_LIBS}")
+else()
+ message(STATUS "Found no CMAKE_DL_LIBS")
+endif()
+if (CMAKE_SHARED_LIBRARY_SUFFIX)
+ DefineConfigHValue(DYNAMIC 1)
+ STRING( REGEX REPLACE "^(\\.)([a-zA-Z0-9])" "\\2" SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}")
+ DefineConfigHValue(SHLIBEXT \\"${SHLIBEXT}\\")
+ message(STATUS "Found SHLIBEXT: ${SHLIBEXT}")
+else()
+ message(STATUS "Found no SHLIBEXT")
+endif()
+DefineTypeIfAvailable("unsigned int" SIZEOF_UNSIGNED_INT)
+DefineTypeIfAvailable("unsigned long" SIZEOF_UNSIGNED_LONG)
+#/* Define to 1 if *printf supports %F format */
+add_definitions(-D PRINTF_HAS_F_FORMAT)
+#/* Define as the return type of signal handlers (`int' or `void'). */
+add_definitions(-D RETSIGTYPE=void)
+#add_definitions(-D PIPES_SIMULATED)
+check_prototype_definition(getpgrp "pid_t getpgrp(void)" "NULL" "unistd.h" GETPGRP_VOID)
+DefineConfigH(GETPGRP_VOID)
+#add_definitions(-D YYPARSE_PARAM)
+
+DefineFunctionIfAvailable(snprintf HAVE_SNPRINTF)
+DefineFunctionIfAvailable(vprintf HAVE_VPRINTF)
+DefineHFileIfAvailable(sys/types.h HAVE_SYS_TYPES_H)
+DefineHFileIfAvailable(sys/stat.h HAVE_SYS_STAT_H)
+DefineHFileIfAvailable(string.h HAVE_STRING_H)
+DefineHFileIfAvailable(memory.h HAVE_MEMORY_H)
+DefineHFileIfAvailable(strings.h HAVE_STRINGS_H)
+DefineHFileIfAvailable(stdint.h HAVE_STDINT_H)
+DefineHFileIfAvailable(inttypes.h HAVE_INTTYPES_H)
+DefineHFileIfAvailable(stdlib.h HAVE_STDLIB_H)
+DefineHFileIfAvailable(unistd.h HAVE_UNISTD_H)
+FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include)
+FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib)
+DefineSymbolIfAvailable("CODESET" "langinfo.h" HAVE_LANGINFO_CODESET)
+DefineSymbolIfAvailable("LC_MESSAGES" "locale.h" HAVE_LC_MESSAGES)
+DefineTypeIfAvailable("_Bool" HAVE__BOOL)
+if (${HAVE_GETTEXT} AND ${HAVE_DCGETTEXT} AND ${HAVE_LANGINFO_CODESET} AND ${HAVE_LC_MESSAGES})
+ add_definitions(-D LOCALEDIR=\\"/usr/share/locale\\")
+ add_definitions(-D ENABLE_NLS)
+ ADD_SUBDIRECTORY( po )
+endif()
+DefineHFileIfAvailable(stdbool.h HAVE_STDBOOL_H)
+DefineHFileIfAvailable(sys/wait.h HAVE_SYS_WAIT_H)
+DefineHFileIfAvailable(arpa/inet.h HAVE_ARPA_INET_H)
+DefineHFileIfAvailable(fcntl.h HAVE_FCNTL_H)
+DefineHFileIfAvailable(limits.h HAVE_LIMITS_H)
+DefineHFileIfAvailable(locale.h HAVE_LOCALE_H)
+DefineHFileIfAvailable(libintl.h HAVE_LIBINTL_H)
+DefineHFileIfAvailable(mcheck.h HAVE_MCHECK_H)
+DefineHFileIfAvailable(netdb.h HAVE_NETDB_H)
+DefineHFileIfAvailable(netinet/in.h HAVE_NETINET_IN_H)
+DefineHFileIfAvailable(stdarg.h HAVE_STDARG_H)
+DefineHFileIfAvailable(stddef.h HAVE_STDDEF_H)
+DefineHFileIfAvailable(sys/ioctl.h HAVE_SYS_IOCTL_H)
+DefineHFileIfAvailable(sys/param.h HAVE_SYS_PARAM_H)
+DefineHFileIfAvailable(sys/socket.h HAVE_SYS_SOCKET_H)
+DefineHFileIfAvailable(sys/termios.h HAVE_TERMIOS_H)
+DefineHFileIfAvailable(stropts.h HAVE_STROPTS_H)
+DefineHFileIfAvailable(wchar.h HAVE_WCHAR_H)
+DefineHFileIfAvailable(wctype.h HAVE_WCTYPE_H)
+DefineTypeIfAvailable("long long int" HAVE_LONG_LONG_INT)
+DefineTypeIfAvailable("unsigned long long int" HAVE_UNSIGNED_LONG_LONG_INT)
+DefineTypeIfAvailable(intmax_t INTMAX_T)
+DefineTypeIfAvailable(uintmax_t UINTMAX_T)
+DefineTypeIfAvailable("time_t" TIME_T_IN_SYS_TYPES_H)
+SET(CMAKE_EXTRA_INCLUDE_FILES wctype.h)
+DefineTypeIfAvailable("wctype_t" HAVE_WCTYPE_T)
+DefineTypeIfAvailable("wint_t" HAVE_WINT_T)
+SET(CMAKE_EXTRA_INCLUDE_FILES)
+
+DefineStructHasMemberIfAvailable("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE)
+DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE)
+DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_ST_BLKSIZE)
+DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_TM_ZONE)
+DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE)
+
+DefineHFileIfAvailable(sys/time.h HAVE_SYS_TIME_H)
+DefineFunctionIfAvailable(alarm HAVE_ALARM)
+DefineFunctionIfAvailable(tzname HAVE_DECL_TZNAME)
+DefineFunctionIfAvailable(mktime HAVE_MKTIME)
+DefineFunctionIfAvailable(getaddrinfo HAVE_GETADDRINFO)
+DefineFunctionIfAvailable(atexit HAVE_ATEXIT)
+DefineFunctionIfAvailable(btowc HAVE_BTOWC)
+DefineFunctionIfAvailable(fmod HAVE_FMOD)
+DefineFunctionIfAvailable(isinf HAVE_ISINF)
+DefineFunctionIfAvailable(ismod HAVE_ISMOD)
+DefineFunctionIfAvailable(getgrent HAVE_GETGRENT)
+DefineSymbolIfAvailable("getgroups" "unistd.h" HAVE_GETGROUPS)
+if (${HAVE_GETGROUPS})
+ check_prototype_definition(getgroups "int getgroups(int size, gid_t list[])" "NULL" "unistd.h" GETGROUPS_T)
+ if (${GETGROUPS_T})
+ DefineConfigHValue(GETGROUPS_T gid_t)
+ else()
+ DefineConfigHValue(GETGROUPS_T int)
+ endif()
+endif()
+
+DefineTypeIfAvailable("pid_t" PID_T)
+DefineTypeIfAvailable("intmax_t" HAVE_INTMAX_T)
+DefineFunctionIfAvailable(grantpt HAVE_GRANTPT)
+DefineFunctionIfAvailable(isascii HAVE_ISASCII)
+DefineFunctionIfAvailable(iswctype HAVE_ISWCTYPE)
+DefineFunctionIfAvailable(iswlower HAVE_ISWLOWER)
+DefineFunctionIfAvailable(iswupper HAVE_ISWUPPER)
+DefineFunctionIfAvailable(mbrlen HAVE_MBRLEN)
+DefineFunctionIfAvailable(memcmp HAVE_MEMCMP)
+DefineFunctionIfAvailable(memcpy HAVE_MEMCPY)
+DefineFunctionIfAvailable(memmove HAVE_MEMMOVE)
+DefineFunctionIfAvailable(memset HAVE_MEMSET)
+DefineFunctionIfAvailable(mkstemp HAVE_MKSTEMP)
+DefineFunctionIfAvailable(posix_openpt HAVE_POSIX_OPENPT)
+DefineFunctionIfAvailable(setenv HAVE_SETENV)
+DefineFunctionIfAvailable(setlocale HAVE_SETLOCALE)
+DefineFunctionIfAvailable(setsid HAVE_SETSID)
+DefineFunctionIfAvailable(strchr HAVE_STRCHR)
+DefineFunctionIfAvailable(strerror HAVE_STRERROR)
+DefineFunctionIfAvailable(strftime HAVE_STRFTIME)
+DefineFunctionIfAvailable(strncasecmp HAVE_STRNCASECMP)
+DefineFunctionIfAvailable(strcoll HAVE_STRCOLL)
+DefineFunctionIfAvailable(strtod HAVE_STRTOD)
+DefineFunctionIfAvailable(strtoul HAVE_STRTOUL)
+DefineFunctionIfAvailable(system HAVE_SYSTEM)
+DefineFunctionIfAvailable(tmpfile HAVE_TMPFILE)
+DefineFunctionIfAvailable(towlower HAVE_TOWLOWER)
+DefineFunctionIfAvailable(towupper HAVE_TOWUPPER)
+DefineFunctionIfAvailable(tzset HAVE_TZSET)
+DefineFunctionIfAvailable(usleep HAVE_USLEEP)
+DefineFunctionIfAvailable(wcrtomb HAVE_WCRTOMB)
+DefineFunctionIfAvailable(wcscoll HAVE_WCSCOLL)
+DefineFunctionIfAvailable(wctype HAVE_WCTYPE)
+DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC)
+
+add_definitions(-D HAVE_STRINGIZE)
+add_definitions(-D _Noreturn=)
+
+find_package(BISON QUIET)
+# If there is a bison installed on this platform,
+if (${BISON_FOUND} STREQUAL "TRUE")
+ # then let bison generate awkgram.c.
+ BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c)
+else()
+ # otherwise use the existing awkgram.c.
+ set(BISON_awkgram_OUTPUTS ${CMAKE_SOURCE_DIR}/awkgram.c)
+endif()
+
+find_package(Gettext REQUIRED)
+if (GETTEXT_FOUND STREQUAL "TRUE")
+ include_directories(${GETTEXT_INCLUDE_DIR})
+ DefineFunctionIfAvailable(gettext HAVE_GETTEXT)
+ DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT)
+else ()
+ message( FATAL_ERROR "Gettext not found" )
+endif()
+
+find_package(LATEX)
+include(GNUInstallDirs)
+include(GetPrerequisites)
+
+# For some unknown reason the defines for the extensions
+# are written into config.h only if they are implemented
+# here and not in extension/CMakeLists.txt.
+DefineLibraryIfAvailable(m sin "" HAVE_LIBM)
+DefineLibraryIfAvailable(mpfr mpfr_add_si "" HAVE_MPFR)
+DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS)
+DefineLibraryIfAvailable(readline readline "" HAVE_LIBREADLINE)
+DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH)
+DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H)
+DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H)
+DefineFunctionIfAvailable(dirfd HAVE_DIRFD)
+DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE)
+DefineFunctionIfAvailable(select HAVE_SELECT)
+DefineFunctionIfAvailable(gettimeofday HAVE_GETTIMEOFDAY)
+DefineHFileIfAvailable(sys/select.h HAVE_SYS_SELECT_H)
+DefineFunctionIfAvailable(nanosleep HAVE_NANOSLEEP)
+DefineHFileIfAvailable(time.h HAVE_TIME_H)
+DefineFunctionIfAvailable(GetSystemTimeAsFileTime HAVE_GETSYSTEMTIMEASFILETIME)
+
diff --git a/cmake/docmaker b/cmake/docmaker
new file mode 100755
index 00000000..4af7cee1
--- /dev/null
+++ b/cmake/docmaker
@@ -0,0 +1,100 @@
+#!/bin/sh
+
+# The first parameter is the target, the file to be built.
+# All remaining parameters are dependencies (file names).
+if [ $# -lt 1 ] ; then
+ echo " $0: Incorrect number ($#) of parameters passed: $*"
+ exit 1
+fi
+OUTFILE=$1
+shift 1
+INFILES="$@"
+
+MAKEINFO="makeinfo --no-split --force"
+TROFF="groff -t -Tps -U"
+SEDME="sed -e \"s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/\" -e \"s/^\/level0 save def/\/level0 save def 30 -48 translate/\""
+SEDME2="sed '/%%Page: 10 10/,/0 Cg EP/d'"
+
+function BuildTarget()
+{
+ local OUTFILE=$1
+ local INFILE=""
+ local COMMAND=""
+
+ FILEBASE=${OUTFILE%.*}
+ case $OUTFILE in
+ *\.in | *\.1 | macros | cardfonts | colors | ad.block | setter.outline | \
+ gawkinet.texi | rflashlight.eps | api-figure1.fig | api-figure2.fig | api-figure3.fig | \
+ general-program.fig | process-flow.fig | statist.eps)
+ INFILE=$OUTFILE
+ ;;
+ *\.texi)
+ if [ $FILEBASE = gawk ] ; then
+ INFILE=gawktexi.in
+ else
+ INFILE=$OUTFILE.in
+ fi
+ COMMAND="awk -f sidebar.awk < $INFILE > $OUTFILE"
+ ;;
+ *\.dvi)
+ INFILE=$FILEBASE.texi
+ COMMAND="texi2dvi -q --clean $INFILE"
+ ;;
+ *\.info)
+ INFILE=$FILEBASE.texi
+ COMMAND="${MAKEINFO} $INFILE"
+ ;;
+ *\.ps)
+ if [ $FILEBASE = awkcard ] ; then
+ INFILE=awkcard.in
+ COMMAND="${TROFF} $* | ${SEDME} | cat setter.outline - | ${SEDME2} > awkcard.ps"
+ elif [ $FILEBASE = gawk.1 -o $FILEBASE = igawk.1 ] ; then
+ INFILE=$FILEBASE
+ COMMAND="groff -z -man $INFILE > $OUTFILE"
+ else
+ INFILE=$FILEBASE.dvi
+ COMMAND="dvips -q -o $OUTFILE $INFILE"
+ fi
+ ;;
+ *\.pdf)
+ INFILE=$FILEBASE.ps
+ COMMAND="ps2pdf -q $INFILE $OUTFILE"
+ ;;
+ *\.tr)
+ INFILE=$FILEBASE.in
+ COMMAND="sed 's:SRCDIR:.:' < $INFILE > $OUTFILE"
+ ;;
+ *\.nc)
+ INFILE=$FILEBASE.in
+ COMMAND="sed 's:SRCDIR:.:' < $INFILE > $OUTFILE"
+ COMMAND="${TROFF} $* | ${SEDME} | cat setter.outline - | ${SEDME2} > $FILEBASE.ps && touch $OUTFILE"
+ ;;
+ *)
+ echo " unknwon target $OUTFILE"
+ exit 1
+ esac
+
+ if [ ! -r "$INFILE" ] ; then
+ echo " $0: Cannot read input file $INFILE"
+ exit 1
+ fi
+
+ if [ -f "$OUTFILE" ] ; then
+ if [ "$INFILE" -ot "$OUTFILE" ] ; then
+ #printf " Target %15s is up-to-date\n" $OUTFILE
+ COMMAND=""
+ fi
+ fi
+ #echo " Generating $OUTFILE from $INFILE"
+ echo $COMMAND | sh -x
+ #echo "COMMAND=$COMMAND"
+}
+
+# Build all dependencies first, then build the target.
+for dep in $INFILES
+do
+ #echo $OUTFILE depends on $dep
+ BuildTarget $dep
+done
+BuildTarget $OUTFILE
+
diff --git a/cmake/package.cmake b/cmake/package.cmake
new file mode 100644
index 00000000..203a8c3b
--- /dev/null
+++ b/cmake/package.cmake
@@ -0,0 +1,54 @@
+#
+# cmake/package --- CMake input file for gawk
+#
+# Copyright (C) 2013-2014
+# the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## process this file with CMake to produce Makefile
+
+SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}")
+set(CPACK_PACKAGE_VENDOR "GNU Project - Free Software Foundation (FSF)")
+SET(CPACK_PACKAGE_NAME "gawk")
+SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}")
+SET(CPACK_PACKAGE_VERSION_MAJOR "${GAWK_MAJOR_VERSION}")
+SET(CPACK_PACKAGE_VERSION_MINOR "${GAWK_MINOR_VERSION}")
+SET(CPACK_PACKAGE_VERSION_PATCH "${GAWK_BUGFIX_VERSION}")
+SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
+SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
+set(CPACK_PACKAGE_CONTACT "bug-gawk@gnu.org")
+
+IF (WIN32)
+ SET(CPACK_GENERATOR "NSIS")
+ set(CPACK_NSIS_INSTALL_ROOT "C:")
+ set(CPACK_NSIS_MENU_LINKS "http://www.gnu.org/software/gawk" "GNU Awk")
+ set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico")
+ set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico")
+ set(CPACK_NSIS_CONTACT "bug-gawk@gnu.org")
+ set(CPACK_NSIS_DISPLAY_NAME "GNU Awk")
+ELSE()
+ SET(CPACK_PACKAGING_INSTALL_PREFIX /usr)
+ IF(NOT CPACK_GENERATOR)
+ SET(CPACK_GENERATOR "TGZ")
+ ENDIF()
+ message(STATUS "CPACK_GENERATOR set to ${CPACK_GENERATOR}")
+ENDIF()
+
+INCLUDE(CPack)
diff --git a/configh.in b/configh.in
index 90924526..1ca2946a 100644
--- a/configh.in
+++ b/configh.in
@@ -320,9 +320,6 @@
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
-/* libc is broken for regex handling */
-#undef LIBC_IS_BORKED
-
/* disable lint checks */
#undef NO_LINT
diff --git a/configure b/configure
index b59d9355..038e2081 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNU Awk 4.1.1a.
+# Generated by GNU Autoconf 2.69 for GNU Awk 4.1.60.
#
# Report bugs to <bug-gawk@gnu.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='GNU Awk'
PACKAGE_TARNAME='gawk'
-PACKAGE_VERSION='4.1.1a'
-PACKAGE_STRING='GNU Awk 4.1.1a'
+PACKAGE_VERSION='4.1.60'
+PACKAGE_STRING='GNU Awk 4.1.60'
PACKAGE_BUGREPORT='bug-gawk@gnu.org'
PACKAGE_URL='http://www.gnu.org/software/gawk/'
@@ -1324,7 +1324,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU Awk 4.1.1a to adapt to many kinds of systems.
+\`configure' configures GNU Awk 4.1.60 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1394,7 +1394,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU Awk 4.1.1a:";;
+ short | recursive ) echo "Configuration of GNU Awk 4.1.60:";;
esac
cat <<\_ACEOF
@@ -1512,7 +1512,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GNU Awk configure 4.1.1a
+GNU Awk configure 4.1.60
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2221,7 +2221,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU Awk $as_me 4.1.1a, which was
+It was created by GNU Awk $as_me 4.1.60, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3104,7 +3104,7 @@ fi
# Define the identity of the package.
PACKAGE='gawk'
- VERSION='4.1.1a'
+ VERSION='4.1.60'
cat >>confdefs.h <<_ACEOF
@@ -5999,14 +5999,6 @@ then
CFLAGS="$CFLAGS -D_SYSV3"
fi
-case $host_os in
-mirbsd*)
-
-$as_echo "#define LIBC_IS_BORKED 1" >>confdefs.h
-
- ;;
-esac
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -11506,7 +11498,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by GNU Awk $as_me 4.1.1a, which was
+This file was extended by GNU Awk $as_me 4.1.60, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -11574,7 +11566,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-GNU Awk config.status 4.1.1a
+GNU Awk config.status 4.1.60
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 5ad3b564..8b4f188e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([GNU Awk], 4.1.1a, bug-gawk@gnu.org, gawk)
+AC_INIT([GNU Awk], 4.1.60, bug-gawk@gnu.org, gawk)
# This is a hack. Different versions of install on different systems
# are just too different. Chuck it and use install-sh.
@@ -119,13 +119,6 @@ dnl need -D_SYSV3 for ISC
CFLAGS="$CFLAGS -D_SYSV3"
fi
-dnl check for systems where libc is borked for regex handling
-case $host_os in
-mirbsd*)
- AC_DEFINE([LIBC_IS_BORKED], 1, [libc is broken for regex handling])
- ;;
-esac
-
dnl Set the programming language for checks. Fortunately,
dnl this only needs to be set once, since everything is in C.
AC_LANG([C])
diff --git a/dfa.c b/dfa.c
index 1a153785..2d0e7f20 100644
--- a/dfa.c
+++ b/dfa.c
@@ -77,14 +77,6 @@ is_blank (int c)
}
#endif /* GAWK */
-#ifdef LIBC_IS_BORKED
-extern int gawk_mb_cur_max;
-#undef MB_CUR_MAX
-#define MB_CUR_MAX gawk_mb_cur_max
-#undef mbrtowc
-#define mbrtowc(a, b, c, d) (-1)
-#endif
-
/* HPUX defines these as macros in sys/param.h. */
#ifdef setbit
# undef setbit
@@ -828,10 +820,6 @@ using_utf8 (void)
wchar_t wc;
mbstate_t mbs = { 0 };
utf8 = mbrtowc (&wc, "\xc4\x80", 2, &mbs) == 2 && wc == 0x100;
-#ifdef LIBC_IS_BORKED
- if (gawk_mb_cur_max == 1)
- utf8 = 0;
-#endif
}
return utf8;
}
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 00000000..e12f5de0
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,95 @@
+#
+# doc/CMakeLists.txt --- CMake input file for gawk
+#
+# Copyright (C) 2013
+# the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## process this file with CMake to produce Makefile
+
+MACRO(DocDependency outfile)
+ add_dependencies(doc ${outfile})
+ add_custom_target(
+ ${outfile}
+ DEPENDS ${ARGN}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMAND ${CMAKE_SOURCE_DIR}/cmake/docmaker ${outfile} ${ARGN}
+ )
+ENDMACRO(DocDependency)
+
+find_program(TEXI2DVI_CONVERTER texi2dvi)
+if (TEXI2DVI_CONVERTER)
+ add_custom_target(doc)
+ DocDependency(gawk.texi gawktexi.in rflashlight.eps api-figure1.fig api-figure2.fig api-figure3.fig general-program.fig process-flow.fig)
+ DocDependency(rflashlight.eps)
+ DocDependency(api-figure1.fig)
+ DocDependency(api-figure2.fig)
+ DocDependency(api-figure3.fig)
+ DocDependency(general-program.fig)
+ DocDependency(process-flow.fig)
+ DocDependency(gawk.dvi gawk.texi)
+ DocDependency(gawk.info gawk.texi)
+ DocDependency(gawkinet.dvi gawkinet.texi)
+ DocDependency(gawkinet.info gawkinet.texi)
+ DocDependency(gawkinet.texi statist.eps)
+ DocDependency(gawk.1.ps gawk.1)
+ DocDependency(igawk.1.ps igawk.1)
+ find_program(DVIPS_CONVERTER dvips)
+ if (DVIPS_CONVERTER)
+ DocDependency(gawk.ps gawk.dvi)
+ DocDependency(gawkinet.ps gawkinet.dvi)
+ find_program(PS2PDF_CONVERTER ps2pdf)
+ if (PS2PDF_CONVERTER)
+ DocDependency(gawk.1.pdf gawk.1.ps)
+ DocDependency(igawk.1.pdf igawk.1.ps)
+ DocDependency(gawk.pdf gawk.ps)
+ DocDependency(gawkinet.pdf gawkinet.ps)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.1.pdf DESTINATION doc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/igawk.1.pdf DESTINATION doc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.info DESTINATION doc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.pdf DESTINATION doc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawkinet.info DESTINATION doc)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawkinet.pdf DESTINATION doc)
+
+ set(CARDSRC macros cardfonts colors awkcard.tr)
+ set(CARDSRC_N macros cardfonts no.colors awkcard.tr)
+ set(CARDFILES ${CARDSRC} ad.block awkcard.in setter.outline)
+ DocDependency(awkcard.tr awkcard.in)
+ DocDependency(awkcard.nc ${CARDFILES})
+ DocDependency(awkcard.ps ${CARDFILES})
+ DocDependency(awkcard.pdf awkcard.ps)
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/awkcard.pdf DESTINATION doc)
+
+ else()
+ message(WARNING "Found no ps2pdf tool; no doc will be generated")
+ install(CODE "MESSAGE(\"doc generated only in .ps files\")")
+ endif()
+ else()
+ message(WARNING "Found no dvips tool; no doc will be generated")
+ install(CODE "MESSAGE(\"doc generated only in .dvi files and man pages in .ps files\")")
+ endif()
+else()
+ message(WARNING "Found no texi2dvi tool; no doc will be generated")
+ add_custom_command(
+ TARGET doc
+ COMMAND echo no doc generated because of missing texi2dvi
+ )
+endif()
+
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 79c69a30..4eaa8138 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -9,6 +9,10 @@
exercises. Remove use of LC_ALL in an example; doesn't seem
to be needed anymore.
+ Unrelated:
+
+ * gawktexi.in: Document that MirBSD is no longer supported.
+
2014-08-25 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Exercises are excluded from print edition.
@@ -42,6 +46,10 @@
* gawktexi.in: Starting on reviewer comments.
Update acknowledgements.
+2014-08-12 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Cause div.awk to get into the example files.
+
2014-08-06 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Misc minor additions.
@@ -56,6 +64,18 @@
* gawktexi.in: Fix doc for API get_record - errcode needs to
be greater than zero.
+2014-07-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Numeric Functions): For `div()', clarify
+ truncation is towards zero. Thanks to Michal Jaegermann
+ for pointing out the need to clarify this.
+
+2014-07-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Numeric Functions): Document new `div()' function.
+ (Arbitrary Precision Integers): Document raison d'etre for div().
+ * gawk.1, awkcard.in: Document `div()'.
+
2014-07-04 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Bracket Expressions): Add a note about how to
@@ -66,6 +86,11 @@
* gawktexi.in: Update permissions on copyright page per
latest maintain.texi. Add GPL to print version of book.
+2014-06-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Document that --pretty-print no longer runs the
+ program. Remove mention of GAWK_NO_PP_RUN env var.
+
2014-06-22 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Typo fixes and minor corrections.
@@ -362,7 +387,7 @@
2013-12-26 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: More minor additions / fixes.
- (Bugs): Add John Malmberg for VMS.
+ (Bugs): Add John Malmberg for VMS. Other minor edits.
2013-12-25 Arnold D. Robbins <arnold@skeeve.com>
@@ -436,6 +461,11 @@
* gawktexi.in (FN, FFN, DF,DDF, PVERSION, CTL): Remove macros.
They have no alternate versions and are just in the way.
+2013-08-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.1: Document that ENVIRON updates affect the environment.
+ * gawktexi.in: Ditto.
+
2013-06-27 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Update from Karl, fixes a formating problem.
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 86321bbc..8a0442a7 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -26,7 +26,7 @@
info_TEXINFOS = gawk.texi gawkinet.texi
-man_MANS = gawk.1 igawk.1
+man_MANS = gawk.1
EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \
awkcard.in awkforai.txt texinfo.tex cardfonts \
@@ -50,7 +50,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \
bc_notes
# Get rid of generated files when cleaning
-CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf
+CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf
MAKEINFO = @MAKEINFO@ --no-split --force
@@ -75,9 +75,9 @@ AWKCARD = awkcard.ps
gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk
awk -f $(srcdir)/sidebar.awk < $(srcdir)/gawktexi.in > gawk.texi
-postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD)
+postscript: gawk.ps gawkinet.ps gawk.1.ps $(AWKCARD)
-pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf
+pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf
gawk.ps: gawk.dvi
TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi
@@ -91,12 +91,6 @@ gawk.1.ps: gawk.1
gawk.1.pdf: gawk.1.ps
ps2pdf gawk.1.ps gawk.1.pdf
-igawk.1.ps: igawk.1
- -groff -man $(srcdir)/igawk.1 > igawk.1.ps
-
-igawk.1.pdf: igawk.1.ps
- ps2pdf igawk.1.ps igawk.1.pdf
-
awkcard.tr: awkcard.in
sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr
diff --git a/doc/Makefile.in b/doc/Makefile.in
index abaf5601..d89beffd 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -341,7 +341,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
info_TEXINFOS = gawk.texi gawkinet.texi
-man_MANS = gawk.1 igawk.1
+man_MANS = gawk.1
EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \
awkcard.in awkforai.txt texinfo.tex cardfonts \
api-figure1.eps api-figure1.fig api-figure1.pdf \
@@ -365,7 +365,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 README.card ad.block setter.outline \
# Get rid of generated files when cleaning
-CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf
+CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf
TROFF = groff -t -Tps -U
SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \
-e "s/^\/level0 save def/\/level0 save def 30 -48 translate/"
@@ -869,9 +869,9 @@ uninstall-man: uninstall-man1
gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk
awk -f $(srcdir)/sidebar.awk < $(srcdir)/gawktexi.in > gawk.texi
-postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD)
+postscript: gawk.ps gawkinet.ps gawk.1.ps $(AWKCARD)
-pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf igawk.1.pdf
+pdf: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf
gawk.ps: gawk.dvi
TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi
@@ -885,12 +885,6 @@ gawk.1.ps: gawk.1
gawk.1.pdf: gawk.1.ps
ps2pdf gawk.1.ps gawk.1.pdf
-igawk.1.ps: igawk.1
- -groff -man $(srcdir)/igawk.1 > igawk.1.ps
-
-igawk.1.pdf: igawk.1.ps
- ps2pdf igawk.1.ps igawk.1.pdf
-
awkcard.tr: awkcard.in
sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr
diff --git a/doc/awkcard.in b/doc/awkcard.in
index ca28f0a7..556bdc1e 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -1609,6 +1609,9 @@ expand;
l lw(2i).
\*(CD\*(FCatan2(\*(FIy\*(FC, \*(FIx\*(FC)\*(FR The arctangent of \*(FIy/x\fP in radians.
\*(FCcos(\*(FIexpr\*(FC)\*(FR The cosine of \*(FIexpr\fP, which is in radians.
+\*(CB\*(FCdiv(\*(FIn\*(FR\*(FC,\*(FI d\*(FR\*(FC,\*(FI res\*(FR\*(FC)\*(FR T{
+Return the result of integer division in \*(FIres\*(FR.\*(CD
+T}
\*(FCexp(\*(FIexpr\*(FC)\*(FR The exponential function (\*(FIe \*(FC^ \*(FIx\*(FR).
\*(FCint(\*(FIexpr\*(FC)\*(FR Truncate to integer.
\*(FClog(\*(FIexpr\*(FC)\*(FR The natural logarithm function (base \*(FIe\^\*(FR).
diff --git a/doc/gawk.1 b/doc/gawk.1
index c7646557..d5756f08 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -13,7 +13,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Apr 17 2014" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Jul 10 2014" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -917,11 +917,17 @@ An array containing the values of the current environment.
The array is indexed by the environment variables, each element being
the value of that variable (e.g., \fBENVIRON["HOME"]\fP might be
\fB"/home/arnold"\fR).
-Changing this array does not affect the environment seen by programs which
+.sp
+In POSIX mode,
+changing this array does not affect the environment seen by programs which
.I gawk
spawns via redirection or the
.B system()
function.
+Otherwise,
+.I gawk
+updates its real environment so that programs it spawns see
+the changes.
.TP
.B ERRNO
If a system error occurs either doing a redirection for
@@ -2623,6 +2629,23 @@ Return the cosine of
.IR expr ,
which is in radians.
.TP
+.BI div( num ", " denom ", " result )
+Truncate
+.I num
+and
+.I denom
+to integers. Return the quotient of
+.I num
+divided by
+.I denom
+in \fIresult\fB["quotient"]\fR
+and the remainder in
+in \fIresult\fB["remainder"]\fR.
+This is a
+.I gawk
+extension, primarily of value when working with
+arbitrarily large integers.
+.TP
.BI exp( expr )
The exponential function.
.TP
diff --git a/doc/gawk.info b/doc/gawk.info
index 2841d21e..afa825cc 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -2575,10 +2575,8 @@ The following list describes options mandated by the POSIX standard:
different file name for the output. No space is allowed between
the `-o' and FILE, if FILE is supplied.
- NOTE: Due to the way `gawk' has evolved, with this option
- your program is still executed. This will change in the next
- major release such that `gawk' will only pretty-print the
- program and not run it.
+ NOTE: In the past, this option would also execute your
+ program. This is no longer the case.
`-O'
`--optimize'
@@ -2964,11 +2962,6 @@ change. The variables are:
supposed to be differences, but occasionally theory and practice
don't coordinate with each other.)
-`GAWK_NO_PP_RUN'
- If this variable exists, then when invoked with the
- `--pretty-print' option, `gawk' skips running the program. This
- variable will not survive into the next major release.
-
`GAWK_STACKSIZE'
This specifies the amount by which `gawk' should grow its internal
evaluation stack, when needed.
@@ -3358,15 +3351,17 @@ apply to both string constants and regexp constants:
`\xHH...'
The hexadecimal value HH, where HH stands for a sequence of
- hexadecimal digits (`0'-`9', and either `A'-`F' or `a'-`f'). Like
- the same construct in ISO C, the escape sequence continues until
- the first nonhexadecimal digit is seen. (c.e.) However, using
- more than two hexadecimal digits produces undefined results. (The
- `\x' escape sequence is not allowed in POSIX `awk'.)
+ hexadecimal digits (`0'-`9', and either `A'-`F' or `a'-`f'). A
+ maximum of two digts are allowed after the `\x'. Any further
+ hexadecimal digits are treated as simple letters or numbers.
+ (c.e.)
- CAUTION: The next major relase of `gawk' will change, such
- that a maximum of two hexadecimal digits following the `\x'
- will be used.
+ CAUTION: In ISO C, the escape sequence continues until the
+ first nonhexadecimal digit is seen. For many years, `gawk'
+ would continue incorporating hexadecimal digits into the
+ value until a non-hexadecimal digit or the end of the string
+ was encountered. However, using more than two hexadecimal
+ digits produces
`\/'
A literal slash (necessary for regexp constants only). This
@@ -10216,10 +10211,18 @@ Options::), they are not special.
An associative array containing the values of the environment.
The array indices are the environment variable names; the elements
are the values of the particular environment variables. For
- example, `ENVIRON["HOME"]' might be `"/home/arnold"'. Changing
- this array does not affect the environment passed on to any
- programs that `awk' may spawn via redirection or the `system()'
- function. (In a future version of `gawk', it may do so.)
+ example, `ENVIRON["HOME"]' might be `/home/arnold'.
+
+ For POSIX `awk', changing this array does not affect the
+ environment passed on to any programs that `awk' may spawn via
+ redirection or the `system()' function.
+
+ However, beginning with version 4.2, if not in POSIX compatibility
+ mode, `gawk' does update its own environment when `ENVIRON' is
+ changed, thus changing the environment seen by programs that it
+ creates. You should therefore be especially careful if you modify
+ `ENVIRON["PATH"]"', which is the search path for finding
+ executable programs.
Some operating systems may not have environment variables. On
such systems, the `ENVIRON' array is empty (except for
@@ -11745,6 +11748,21 @@ brackets ([ ]):
`cos(X)'
Return the cosine of X, with X in radians.
+`div(NUMERATOR, DENOMINATOR, RESULT)'
+ Perform integer division, similar to the standard C function of the
+ same name. First, truncate `numerator' and `denominator' towards
+ zero, creating integer values. Clear the `result' array, and then
+ set `result["quotient"]' to the result of `numerator /
+ denominator', truncated towards zero to an integer, and set
+ `result["remainder"]' to the result of `numerator % denominator',
+ truncated towards zero to an integer. This function is primarily
+ intended for use with arbitrary length integers; it avoids
+ creating MPFR arbitrary precision floating-point values (*note
+ Arbitrary Precision Integers::).
+
+ This function is a `gawk' extension. It is not available in
+ compatibility mode (*note Options::).
+
`exp(X)'
Return the exponential of X (`e ^ X') or report an error if X is
out of range. The range of values X can have depends on your
@@ -19666,8 +19684,8 @@ by the `Ctrl-<\>' key.
called this way, `gawk' "pretty prints" the program into `awkprof.out',
without any execution counts.
- NOTE: The `--pretty-print' option still runs your program. This
- will change in the next major release.
+ NOTE: Once upon a time, the `--pretty-print' option would also run
+ your program. This is is no longer the case.

File: gawk.info, Node: Advanced Features Summary, Prev: Profiling, Up: Advanced Features
@@ -22142,6 +22160,29 @@ just use the following:
gawk -M 'BEGIN { n = 13; print n % 2 }'
+ When dividing two arbitrary precision integers with either `/' or
+`%', the result is typically an arbitrary precision floating point
+value (unless the denominator evenly divides into the numerator). In
+order to do integer division or remainder with arbitrary precision
+integers, use the built-in `div()' function (*note Numeric Functions::).
+
+ You can simulate the `div()' function in standard `awk' using this
+user-defined function:
+
+ # div --- do integer division
+
+ function div(numerator, denominator, result, i)
+ {
+ split("", result)
+
+ numerator = int(numerator)
+ denominator = int(denominator)
+ result["quotient"] = int(numerator / denominator)
+ result["remainder"] = int(numerator % denominator)
+
+ return 0.0
+ }
+
---------- Footnotes ----------
(1) Weisstein, Eric W. `Sylvester's Sequence'. From MathWorld--A
@@ -26168,6 +26209,8 @@ the current version of `gawk'.
- Ultrix
+ * Support for MirBSD was removed at `gawk' version 4.2.
+

File: gawk.info, Node: Feature History, Next: Common Extensions, Prev: POSIX/GNU, Up: Language History
@@ -27071,7 +27114,9 @@ Various `.c', `.y', and `.h' files
`doc/igawk.1'
The `troff' source for a manual page describing the `igawk'
- program presented in *note Igawk Program::.
+ program presented in *note Igawk Program::. (Since `gawk' can do
+ its own `@include' processing, neither `igawk' nor `igawk.1' are
+ installed.)
`doc/Makefile.in'
The input file used during the configuration process to generate
@@ -27113,11 +27158,10 @@ Various `.c', `.y', and `.h' files
contains a `Makefile.in' file, which `configure' uses to generate
a `Makefile'. `Makefile.am' is used by GNU Automake to create
`Makefile.in'. The library functions from *note Library
- Functions::, and the `igawk' program from *note Igawk Program::,
- are included as ready-to-use files in the `gawk' distribution.
- They are installed as part of the installation process. The rest
- of the programs in this Info file are available in appropriate
- subdirectories of `awklib/eg'.
+ Functions::, are included as ready-to-use files in the `gawk'
+ distribution. They are installed as part of the installation
+ process. The rest of the programs in this Info file are available
+ in appropriate subdirectories of `awklib/eg'.
`extension/*'
The source code, manual pages, and infrastructure files for the
@@ -31049,20 +31093,20 @@ Index
* --include option: Options. (line 159)
* --lint option <1>: Options. (line 185)
* --lint option: Command Line. (line 20)
-* --lint-old option: Options. (line 295)
+* --lint-old option: Options. (line 293)
* --load option: Options. (line 173)
* --non-decimal-data option <1>: Nondecimal Data. (line 6)
* --non-decimal-data option: Options. (line 211)
* --non-decimal-data option, strtonum() function and: Nondecimal Data.
(line 36)
-* --optimize option: Options. (line 237)
-* --posix option: Options. (line 254)
-* --posix option, --traditional option and: Options. (line 273)
+* --optimize option: Options. (line 235)
+* --posix option: Options. (line 252)
+* --posix option, --traditional option and: Options. (line 271)
* --pretty-print option: Options. (line 224)
* --profile option <1>: Profiling. (line 12)
-* --profile option: Options. (line 242)
-* --re-interval option: Options. (line 279)
-* --sandbox option: Options. (line 286)
+* --profile option: Options. (line 240)
+* --re-interval option: Options. (line 277)
+* --sandbox option: Options. (line 284)
* --sandbox option, disabling system() function: I/O Functions.
(line 97)
* --sandbox option, input redirection with getline: Getline. (line 19)
@@ -31070,9 +31114,9 @@ Index
(line 6)
* --source option: Options. (line 117)
* --traditional option: Options. (line 81)
-* --traditional option, --posix option and: Options. (line 273)
+* --traditional option, --posix option and: Options. (line 271)
* --use-lc-numeric option: Options. (line 219)
-* --version option: Options. (line 300)
+* --version option: Options. (line 298)
* --with-whiny-user-strftime configuration option: Additional Configuration Options.
(line 35)
* -b option: Options. (line 68)
@@ -31080,32 +31124,32 @@ Index
* -c option: Options. (line 81)
* -D option: Options. (line 108)
* -d option: Options. (line 93)
-* -e option: Options. (line 335)
+* -e option: Options. (line 333)
* -E option: Options. (line 125)
* -e option: Options. (line 117)
* -f option: Options. (line 25)
* -F option: Options. (line 21)
* -f option: Long. (line 12)
-* -F option, -Ft sets FS to TAB: Options. (line 308)
+* -F option, -Ft sets FS to TAB: Options. (line 306)
* -F option, command-line: Command Line Field Separator.
(line 6)
-* -f option, multiple uses: Options. (line 313)
+* -f option, multiple uses: Options. (line 311)
* -g option: Options. (line 147)
* -h option: Options. (line 154)
* -i option: Options. (line 159)
-* -L option: Options. (line 295)
+* -L option: Options. (line 293)
* -l option: Options. (line 173)
* -M option: Options. (line 205)
* -N option: Options. (line 219)
* -n option: Options. (line 211)
-* -O option: Options. (line 237)
+* -O option: Options. (line 235)
* -o option: Options. (line 224)
-* -P option: Options. (line 254)
-* -p option: Options. (line 242)
-* -r option: Options. (line 279)
-* -S option: Options. (line 286)
+* -P option: Options. (line 252)
+* -p option: Options. (line 240)
+* -r option: Options. (line 277)
+* -S option: Options. (line 284)
* -v option: Assignment Options. (line 12)
-* -V option: Options. (line 300)
+* -V option: Options. (line 298)
* -v option: Options. (line 32)
* -W option: Options. (line 46)
* . (period), regexp operator: Regexp Operators. (line 44)
@@ -31163,10 +31207,10 @@ Index
* ? (question mark), regexp operator: Regexp Operators. (line 111)
* [] (square brackets), regexp operator: Regexp Operators. (line 56)
* \ (backslash): Comments. (line 50)
-* \ (backslash), \" escape sequence: Escape Sequences. (line 82)
+* \ (backslash), \" escape sequence: Escape Sequences. (line 84)
* \ (backslash), \' operator (gawk): GNU Regexp Operators.
(line 56)
-* \ (backslash), \/ escape sequence: Escape Sequences. (line 73)
+* \ (backslash), \/ escape sequence: Escape Sequences. (line 75)
* \ (backslash), \< operator (gawk): GNU Regexp Operators.
(line 30)
* \ (backslash), \> operator (gawk): GNU Regexp Operators.
@@ -31206,7 +31250,7 @@ Index
* \ (backslash), in bracket expressions: Bracket Expressions. (line 17)
* \ (backslash), in escape sequences: Escape Sequences. (line 6)
* \ (backslash), in escape sequences, POSIX and: Escape Sequences.
- (line 118)
+ (line 120)
* \ (backslash), in regexp constants: Computed Regexps. (line 29)
* \ (backslash), in shell commands: Quoting. (line 48)
* \ (backslash), regexp operator: Regexp Operators. (line 18)
@@ -31375,7 +31419,7 @@ Index
* awf (amazingly workable formatter) program: Glossary. (line 24)
* awk debugging, enabling: Options. (line 108)
* awk language, POSIX version: Assignment Ops. (line 137)
-* awk profiling, enabling: Options. (line 242)
+* awk profiling, enabling: Options. (line 240)
* awk programs <1>: Two Rules. (line 6)
* awk programs <2>: Executable Scripts. (line 6)
* awk programs: Getting Started. (line 12)
@@ -31433,10 +31477,10 @@ Index
* awkvars.out file: Options. (line 93)
* b debugger command (alias for break): Breakpoint Control. (line 11)
* backslash (\): Comments. (line 50)
-* backslash (\), \" escape sequence: Escape Sequences. (line 82)
+* backslash (\), \" escape sequence: Escape Sequences. (line 84)
* backslash (\), \' operator (gawk): GNU Regexp Operators.
(line 56)
-* backslash (\), \/ escape sequence: Escape Sequences. (line 73)
+* backslash (\), \/ escape sequence: Escape Sequences. (line 75)
* backslash (\), \< operator (gawk): GNU Regexp Operators.
(line 30)
* backslash (\), \> operator (gawk): GNU Regexp Operators.
@@ -31476,7 +31520,7 @@ Index
* backslash (\), in bracket expressions: Bracket Expressions. (line 17)
* backslash (\), in escape sequences: Escape Sequences. (line 6)
* backslash (\), in escape sequences, POSIX and: Escape Sequences.
- (line 118)
+ (line 120)
* backslash (\), in regexp constants: Computed Regexps. (line 29)
* backslash (\), in shell commands: Quoting. (line 48)
* backslash (\), regexp operator: Regexp Operators. (line 18)
@@ -31581,7 +31625,7 @@ Index
(line 67)
* Brian Kernighan's awk <12>: GNU Regexp Operators.
(line 83)
-* Brian Kernighan's awk <13>: Escape Sequences. (line 122)
+* Brian Kernighan's awk <13>: Escape Sequences. (line 124)
* Brian Kernighan's awk: When. (line 21)
* Brian Kernighan's awk, extensions: BTL. (line 6)
* Brian Kernighan's awk, source code: Other Versions. (line 13)
@@ -31779,7 +31823,7 @@ Index
* cosine: Numeric Functions. (line 15)
* counting: Wc Program. (line 6)
* csh utility: Statements/Lines. (line 44)
-* csh utility, POSIXLY_CORRECT environment variable: Options. (line 353)
+* csh utility, POSIXLY_CORRECT environment variable: Options. (line 351)
* csh utility, |& operator, comparison with: Two-way I/O. (line 25)
* ctime() user-defined function: Function Example. (line 74)
* currency symbols, localization: Explaining gettext. (line 104)
@@ -31810,13 +31854,13 @@ Index
* dark corner, CONVFMT variable: Strings And Numbers. (line 40)
* dark corner, escape sequences: Other Arguments. (line 35)
* dark corner, escape sequences, for metacharacters: Escape Sequences.
- (line 140)
+ (line 142)
* dark corner, exit statement: Exit Statement. (line 30)
* dark corner, field separators: Field Splitting Summary.
(line 46)
-* dark corner, FILENAME variable <1>: Auto-set. (line 90)
+* dark corner, FILENAME variable <1>: Auto-set. (line 98)
* dark corner, FILENAME variable: Getline Notes. (line 19)
-* dark corner, FNR/NR variables: Auto-set. (line 301)
+* dark corner, FNR/NR variables: Auto-set. (line 309)
* dark corner, format-control characters: Control Letters. (line 18)
* dark corner, FS as null string: Single Character Fields.
(line 20)
@@ -31963,7 +32007,7 @@ Index
* debugger, read commands from a file: Debugger Info. (line 96)
* debugging awk programs: Debugger. (line 6)
* debugging gawk, bug reports: Bugs. (line 9)
-* decimal point character, locale specific: Options. (line 270)
+* decimal point character, locale specific: Options. (line 268)
* decrement operators: Increment Ops. (line 35)
* default keyword: Switch Statement. (line 6)
* Deifik, Scott <1>: Bugs. (line 71)
@@ -32002,12 +32046,12 @@ Index
(line 81)
* differences in awk and gawk, command-line directories: Command-line directories.
(line 6)
-* differences in awk and gawk, ERRNO variable: Auto-set. (line 74)
+* differences in awk and gawk, ERRNO variable: Auto-set. (line 82)
* differences in awk and gawk, error messages: Special FD. (line 16)
* differences in awk and gawk, FIELDWIDTHS variable: User-modified.
(line 37)
* differences in awk and gawk, FPAT variable: User-modified. (line 43)
-* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 115)
+* differences in awk and gawk, FUNCTAB variable: Auto-set. (line 123)
* differences in awk and gawk, function arguments (gawk): Calling Built-in.
(line 16)
* differences in awk and gawk, getline command: Getline. (line 19)
@@ -32030,7 +32074,7 @@ Index
(line 260)
* differences in awk and gawk, print/printf statements: Format Modifiers.
(line 13)
-* differences in awk and gawk, PROCINFO array: Auto-set. (line 128)
+* differences in awk and gawk, PROCINFO array: Auto-set. (line 136)
* differences in awk and gawk, read timeouts: Read Timeout. (line 6)
* differences in awk and gawk, record separators: awk split records.
(line 124)
@@ -32040,7 +32084,7 @@ Index
(line 26)
* differences in awk and gawk, RS/RT variables: gawk split records.
(line 58)
-* differences in awk and gawk, RT variable: Auto-set. (line 257)
+* differences in awk and gawk, RT variable: Auto-set. (line 265)
* differences in awk and gawk, single-character fields: Single Character Fields.
(line 6)
* differences in awk and gawk, split() function: String Functions.
@@ -32048,7 +32092,7 @@ Index
* differences in awk and gawk, strings: Scalar Constants. (line 20)
* differences in awk and gawk, strings, storing: gawk split records.
(line 77)
-* differences in awk and gawk, SYMTAB variable: Auto-set. (line 261)
+* differences in awk and gawk, SYMTAB variable: Auto-set. (line 269)
* differences in awk and gawk, TEXTDOMAIN variable: User-modified.
(line 152)
* differences in awk and gawk, trunc-mod operation: Arithmetic Ops.
@@ -32064,6 +32108,7 @@ Index
* display debugger command: Viewing And Changing Data.
(line 8)
* display debugger options: Debugger Info. (line 57)
+* div: Numeric Functions. (line 18)
* division: Arithmetic Ops. (line 44)
* do-while statement: Do Statement. (line 6)
* do-while statement, use of regexps in: Regexp Usage. (line 19)
@@ -32087,8 +32132,8 @@ Index
* dynamically loaded extensions: Dynamic Extensions. (line 6)
* e debugger command (alias for enable): Breakpoint Control. (line 73)
* EBCDIC: Ordinal Functions. (line 45)
-* effective group ID of gawk user: Auto-set. (line 133)
-* effective user ID of gawk user: Auto-set. (line 137)
+* effective group ID of gawk user: Auto-set. (line 141)
+* effective user ID of gawk user: Auto-set. (line 145)
* egrep utility <1>: Egrep Program. (line 6)
* egrep utility: Bracket Expressions. (line 26)
* egrep.awk program: Egrep Program. (line 54)
@@ -32143,13 +32188,13 @@ Index
(line 11)
* EREs (Extended Regular Expressions): Bracket Expressions. (line 26)
* ERRNO variable <1>: TCP/IP Networking. (line 54)
-* ERRNO variable: Auto-set. (line 74)
+* ERRNO variable: Auto-set. (line 82)
* ERRNO variable, with BEGINFILE pattern: BEGINFILE/ENDFILE. (line 26)
* ERRNO variable, with close() function: Close Files And Pipes.
(line 139)
* ERRNO variable, with getline command: Getline. (line 19)
* error handling: Special FD. (line 16)
-* error handling, ERRNO variable and: Auto-set. (line 74)
+* error handling, ERRNO variable and: Auto-set. (line 82)
* error output: Special FD. (line 6)
* escape processing, gsub()/gensub()/sub() functions: Gory Details.
(line 6)
@@ -32182,10 +32227,10 @@ Index
* exit status, of VMS: VMS Running. (line 29)
* exit the debugger: Miscellaneous Debugger Commands.
(line 99)
-* exp: Numeric Functions. (line 18)
+* exp: Numeric Functions. (line 33)
* expand utility: Very Simple. (line 72)
* Expat XML parser library: gawkextlib. (line 35)
-* exponent: Numeric Functions. (line 18)
+* exponent: Numeric Functions. (line 33)
* expressions: Expressions. (line 6)
* expressions, as patterns: Expression Patterns. (line 6)
* expressions, assignment: Assignment Ops. (line 6)
@@ -32203,7 +32248,7 @@ Index
(line 6)
* extension API version: Extension Versioning.
(line 6)
-* extension API, version number: Auto-set. (line 224)
+* extension API, version number: Auto-set. (line 232)
* extension example: Extension Example. (line 6)
* extension registration: Registration Functions.
(line 6)
@@ -32282,7 +32327,7 @@ Index
* file names, distinguishing: Auto-set. (line 56)
* file names, in compatibility mode: Special Caveats. (line 9)
* file names, standard streams in gawk: Special FD. (line 46)
-* FILENAME variable <1>: Auto-set. (line 90)
+* FILENAME variable <1>: Auto-set. (line 98)
* FILENAME variable: Reading Files. (line 6)
* FILENAME variable, getline, setting with: Getline Notes. (line 19)
* filenames, assignments as: Ignoring Assigns. (line 6)
@@ -32350,9 +32395,9 @@ Index
* flush buffered output: I/O Functions. (line 28)
* fnmatch() extension function: Extension Sample Fnmatch.
(line 12)
-* FNR variable <1>: Auto-set. (line 99)
+* FNR variable <1>: Auto-set. (line 107)
* FNR variable: Records. (line 6)
-* FNR variable, changing: Auto-set. (line 301)
+* FNR variable, changing: Auto-set. (line 309)
* for statement: For Statement. (line 6)
* for statement, looping over arrays: Scanning an Array. (line 20)
* fork() extension function: Extension Sample Fork.
@@ -32389,7 +32434,7 @@ Index
* FS variable, --field-separator option and: Options. (line 21)
* FS variable, as null string: Single Character Fields.
(line 20)
-* FS variable, as TAB character: Options. (line 266)
+* FS variable, as TAB character: Options. (line 264)
* FS variable, changing value of: Field Separators. (line 35)
* FS variable, running awk programs and: Cut Program. (line 68)
* FS variable, setting from command line: Command Line Field Separator.
@@ -32402,7 +32447,7 @@ Index
* FSF (Free Software Foundation): Manual History. (line 6)
* fts() extension function: Extension Sample File Functions.
(line 61)
-* FUNCTAB array: Auto-set. (line 115)
+* FUNCTAB array: Auto-set. (line 123)
* function calls: Function Calls. (line 6)
* function calls, indirect: Indirect Calls. (line 6)
* function definition example: Function Example. (line 6)
@@ -32452,7 +32497,7 @@ Index
* G-d: Acknowledgments. (line 92)
* Garfinkle, Scott: Contributors. (line 34)
* gawk program, dynamic profiling: Profiling. (line 179)
-* gawk version: Auto-set. (line 199)
+* gawk version: Auto-set. (line 207)
* gawk, ARGIND variable in: Other Arguments. (line 12)
* gawk, awk and <1>: This Manual. (line 14)
* gawk, awk and: Preface. (line 21)
@@ -32473,13 +32518,13 @@ Index
* gawk, distribution: Distribution contents.
(line 6)
* gawk, ERRNO variable in <1>: TCP/IP Networking. (line 54)
-* gawk, ERRNO variable in <2>: Auto-set. (line 74)
+* gawk, ERRNO variable in <2>: Auto-set. (line 82)
* gawk, ERRNO variable in <3>: BEGINFILE/ENDFILE. (line 26)
* gawk, ERRNO variable in <4>: Close Files And Pipes.
(line 139)
* gawk, ERRNO variable in: Getline. (line 19)
-* gawk, escape sequences: Escape Sequences. (line 130)
-* gawk, extensions, disabling: Options. (line 254)
+* gawk, escape sequences: Escape Sequences. (line 132)
+* gawk, extensions, disabling: Options. (line 252)
* gawk, features, adding: Adding Code. (line 6)
* gawk, features, advanced: Advanced Features. (line 6)
* gawk, field separators and: User-modified. (line 71)
@@ -32490,7 +32535,7 @@ Index
* gawk, FPAT variable in <1>: User-modified. (line 43)
* gawk, FPAT variable in: Splitting By Content.
(line 27)
-* gawk, FUNCTAB array in: Auto-set. (line 115)
+* gawk, FUNCTAB array in: Auto-set. (line 123)
* gawk, function arguments and: Calling Built-in. (line 16)
* gawk, hexadecimal numbers and: Nondecimal-numbers. (line 42)
* gawk, IGNORECASE variable in <1>: Array Sorting Functions.
@@ -32521,7 +32566,7 @@ Index
* gawk, OS/2 version of: PC Using. (line 16)
* gawk, PROCINFO array in <1>: Two-way I/O. (line 99)
* gawk, PROCINFO array in <2>: Time Functions. (line 47)
-* gawk, PROCINFO array in: Auto-set. (line 128)
+* gawk, PROCINFO array in: Auto-set. (line 136)
* gawk, regexp constants and: Using Constant Regexps.
(line 28)
* gawk, regular expressions, case sensitivity: Case-sensitivity.
@@ -32529,18 +32574,18 @@ Index
* gawk, regular expressions, operators: GNU Regexp Operators.
(line 6)
* gawk, regular expressions, precedence: Regexp Operators. (line 161)
-* gawk, RT variable in <1>: Auto-set. (line 257)
+* gawk, RT variable in <1>: Auto-set. (line 265)
* gawk, RT variable in <2>: Multiple Line. (line 129)
* gawk, RT variable in: awk split records. (line 124)
* gawk, See Also awk: Preface. (line 34)
* gawk, source code, obtaining: Getting. (line 6)
* gawk, splitting fields and: Constant Size. (line 88)
* gawk, string-translation functions: I18N Functions. (line 6)
-* gawk, SYMTAB array in: Auto-set. (line 261)
+* gawk, SYMTAB array in: Auto-set. (line 269)
* gawk, TEXTDOMAIN variable in: User-modified. (line 152)
* gawk, timestamps: Time Functions. (line 6)
* gawk, uses for: Preface. (line 34)
-* gawk, versions of, information about, printing: Options. (line 300)
+* gawk, versions of, information about, printing: Options. (line 298)
* gawk, VMS version of: VMS Installation. (line 6)
* gawk, word-boundary operator: GNU Regexp Operators.
(line 63)
@@ -32622,7 +32667,7 @@ Index
* Grigera, Juan: Contributors. (line 57)
* group database, reading: Group Functions. (line 6)
* group file: Group Functions. (line 6)
-* group ID of gawk user: Auto-set. (line 172)
+* group ID of gawk user: Auto-set. (line 180)
* groups, information about: Group Functions. (line 6)
* gsub <1>: String Functions. (line 139)
* gsub: Using Constant Regexps.
@@ -32721,7 +32766,7 @@ Index
* installation, VMS: VMS Installation. (line 6)
* installing gawk: Installation. (line 6)
* instruction tracing, in debugger: Debugger Info. (line 89)
-* int: Numeric Functions. (line 23)
+* int: Numeric Functions. (line 38)
* INT signal (MS-Windows): Profiling. (line 214)
* integer array indices: Numeric Array Subscripts.
(line 31)
@@ -32850,7 +32895,7 @@ Index
* lint checking, empty programs: Command Line. (line 16)
* lint checking, issuing warnings: Options. (line 185)
* lint checking, POSIXLY_CORRECT environment variable: Options.
- (line 338)
+ (line 336)
* lint checking, undefined functions: Pass By Value/Reference.
(line 88)
* LINT variable: User-modified. (line 88)
@@ -32864,14 +32909,14 @@ Index
* loading, extensions: Options. (line 173)
* local variables, in a function: Variable Scope. (line 6)
* locale categories: Explaining gettext. (line 81)
-* locale decimal point character: Options. (line 270)
+* locale decimal point character: Options. (line 268)
* locale, definition of: Locales. (line 6)
* localization: I18N and L10N. (line 6)
* localization, See internationalization, localization: I18N and L10N.
(line 6)
-* log: Numeric Functions. (line 30)
+* log: Numeric Functions. (line 45)
* log files, timestamps in: Time Functions. (line 6)
-* logarithm: Numeric Functions. (line 30)
+* logarithm: Numeric Functions. (line 45)
* logical false/true: Truth Values. (line 6)
* logical operators, See Boolean expressions: Boolean Ops. (line 6)
* login information: Passwd Functions. (line 16)
@@ -32911,8 +32956,8 @@ Index
* mawk utility <2>: Nextfile Statement. (line 47)
* mawk utility <3>: Concatenation. (line 36)
* mawk utility <4>: Getline/Pipe. (line 62)
-* mawk utility: Escape Sequences. (line 130)
-* maximum precision supported by MPFR library: Auto-set. (line 213)
+* mawk utility: Escape Sequences. (line 132)
+* maximum precision supported by MPFR library: Auto-set. (line 221)
* McIlroy, Doug: Glossary. (line 149)
* McPhee, Patrick: Contributors. (line 100)
* message object files: Explaining gettext. (line 42)
@@ -32924,8 +32969,8 @@ Index
(line 54)
* messages from extensions: Printing Messages. (line 6)
* metacharacters in regular expressions: Regexp Operators. (line 6)
-* metacharacters, escape sequences for: Escape Sequences. (line 136)
-* minimum precision supported by MPFR library: Auto-set. (line 216)
+* metacharacters, escape sequences for: Escape Sequences. (line 138)
+* minimum precision supported by MPFR library: Auto-set. (line 224)
* mktime: Time Functions. (line 25)
* modifiers, in format specifiers: Format Modifiers. (line 6)
* monetary information, localization: Explaining gettext. (line 104)
@@ -32947,7 +32992,7 @@ Index
* networks, programming: TCP/IP Networking. (line 6)
* networks, support for: Special Network. (line 6)
* newlines <1>: Boolean Ops. (line 67)
-* newlines <2>: Options. (line 260)
+* newlines <2>: Options. (line 258)
* newlines: Statements/Lines. (line 6)
* newlines, as field separators: Default Field Splitting.
(line 6)
@@ -32976,7 +33021,7 @@ Index
(line 47)
* nexti debugger command: Debugger Execution Control.
(line 49)
-* NF variable <1>: Auto-set. (line 104)
+* NF variable <1>: Auto-set. (line 112)
* NF variable: Fields. (line 33)
* NF variable, decrementing: Changing Fields. (line 107)
* ni debugger command (alias for nexti): Debugger Execution Control.
@@ -32985,9 +33030,9 @@ Index
* non-existent array elements: Reference to Elements.
(line 23)
* not Boolean-logic operator: Boolean Ops. (line 6)
-* NR variable <1>: Auto-set. (line 123)
+* NR variable <1>: Auto-set. (line 131)
* NR variable: Records. (line 6)
-* NR variable, changing: Auto-set. (line 301)
+* NR variable, changing: Auto-set. (line 309)
* null strings <1>: Basic Data Typing. (line 26)
* null strings <2>: Truth Values. (line 6)
* null strings <3>: Regexp Field Splitting.
@@ -33101,7 +33146,7 @@ Index
* p debugger command (alias for print): Viewing And Changing Data.
(line 36)
* Papadopoulos, Panos: Contributors. (line 128)
-* parent process ID of gawk process: Auto-set. (line 181)
+* parent process ID of gawk process: Auto-set. (line 189)
* parentheses (), in a profile: Profiling. (line 146)
* parentheses (), regexp operator: Regexp Operators. (line 81)
* password file: Passwd Functions. (line 16)
@@ -33143,14 +33188,14 @@ Index
* plus sign (+), += operator: Assignment Ops. (line 82)
* plus sign (+), regexp operator: Regexp Operators. (line 105)
* pointers to functions: Indirect Calls. (line 6)
-* portability: Escape Sequences. (line 100)
+* portability: Escape Sequences. (line 102)
* portability, #! (executable scripts): Executable Scripts. (line 33)
* portability, ** operator and: Arithmetic Ops. (line 81)
* portability, **= operator and: Assignment Ops. (line 143)
* portability, ARGV variable: Executable Scripts. (line 59)
* portability, backslash continuation and: Statements/Lines. (line 30)
* portability, backslash in escape sequences: Escape Sequences.
- (line 118)
+ (line 120)
* portability, close() function and: Close Files And Pipes.
(line 81)
* portability, data files as single record: gawk split records.
@@ -33168,7 +33213,7 @@ Index
* portability, NF variable, decrementing: Changing Fields. (line 115)
* portability, operators: Increment Ops. (line 60)
* portability, operators, not in POSIX awk: Precedence. (line 98)
-* portability, POSIXLY_CORRECT environment variable: Options. (line 358)
+* portability, POSIXLY_CORRECT environment variable: Options. (line 356)
* portability, substr() function: String Functions. (line 510)
* portable object files <1>: Translator i18n. (line 6)
* portable object files: Explaining gettext. (line 37)
@@ -33189,7 +33234,7 @@ Index
* POSIX awk, < operator and: Getline/File. (line 26)
* POSIX awk, arithmetic operators and: Arithmetic Ops. (line 30)
* POSIX awk, backslashes in string constants: Escape Sequences.
- (line 118)
+ (line 120)
* POSIX awk, BEGIN/END patterns: I/O And BEGIN/END. (line 16)
* POSIX awk, bracket expressions and: Bracket Expressions. (line 26)
* POSIX awk, bracket expressions and, character classes: Bracket Expressions.
@@ -33217,11 +33262,11 @@ Index
* POSIX awk, regular expressions and: Regexp Operators. (line 161)
* POSIX awk, timestamps and: Time Functions. (line 6)
* POSIX awk, | I/O operator and: Getline/Pipe. (line 55)
-* POSIX mode: Options. (line 254)
+* POSIX mode: Options. (line 252)
* POSIX, awk and: Preface. (line 21)
* POSIX, gawk extensions not included in: POSIX/GNU. (line 6)
* POSIX, programs, implementing in awk: Clones. (line 6)
-* POSIXLY_CORRECT environment variable: Options. (line 338)
+* POSIXLY_CORRECT environment variable: Options. (line 336)
* PREC variable: User-modified. (line 124)
* precedence <1>: Precedence. (line 6)
* precedence: Increment Ops. (line 60)
@@ -33264,24 +33309,24 @@ Index
* printing, unduplicated lines of text: Uniq Program. (line 6)
* printing, user information: Id Program. (line 6)
* private variables: Library Names. (line 11)
-* process group idIDof gawk process: Auto-set. (line 175)
-* process ID of gawk process: Auto-set. (line 178)
+* process group idIDof gawk process: Auto-set. (line 183)
+* process ID of gawk process: Auto-set. (line 186)
* processes, two-way communications with: Two-way I/O. (line 6)
* processing data: Basic High Level. (line 6)
* PROCINFO array <1>: Passwd Functions. (line 6)
* PROCINFO array <2>: Time Functions. (line 47)
-* PROCINFO array: Auto-set. (line 128)
+* PROCINFO array: Auto-set. (line 136)
* PROCINFO array, and communications via ptys: Two-way I/O. (line 99)
* PROCINFO array, and group membership: Group Functions. (line 6)
* PROCINFO array, and user and group ID numbers: Id Program. (line 15)
* PROCINFO array, testing the field splitting: Passwd Functions.
(line 161)
-* PROCINFO array, uses: Auto-set. (line 234)
+* PROCINFO array, uses: Auto-set. (line 242)
* PROCINFO, values of sorted_in: Controlling Scanning.
(line 26)
* profiling awk programs: Profiling. (line 6)
* profiling awk programs, dynamically: Profiling. (line 179)
-* program identifiers: Auto-set. (line 146)
+* program identifiers: Auto-set. (line 154)
* program, definition of: Getting Started. (line 21)
* programming conventions, --non-decimal-data option: Nondecimal Data.
(line 36)
@@ -33325,12 +33370,12 @@ Index
* Rakitzis, Byron: History Sorting. (line 25)
* Ramey, Chet <1>: General Data Types. (line 6)
* Ramey, Chet: Acknowledgments. (line 60)
-* rand: Numeric Functions. (line 35)
+* rand: Numeric Functions. (line 50)
* random numbers, Cliff: Cliff Random Function.
(line 6)
* random numbers, rand()/srand() functions: Numeric Functions.
- (line 35)
-* random numbers, seed of: Numeric Functions. (line 65)
+ (line 50)
+* random numbers, seed of: Numeric Functions. (line 80)
* range expressions (regexps): Bracket Expressions. (line 6)
* range patterns: Ranges. (line 6)
* range patterns, line continuation and: Ranges. (line 65)
@@ -33400,7 +33445,7 @@ Index
(line 59)
* regular expressions, gawk, command-line options: GNU Regexp Operators.
(line 70)
-* regular expressions, interval expressions and: Options. (line 279)
+* regular expressions, interval expressions and: Options. (line 277)
* regular expressions, leftmost longest match: Leftmost Longest.
(line 6)
* regular expressions, operators <1>: Regexp Operators. (line 6)
@@ -33440,7 +33485,7 @@ Index
* right shift: Bitwise Functions. (line 52)
* right shift, bitwise: Bitwise Functions. (line 32)
* Ritchie, Dennis: Basic Data Typing. (line 54)
-* RLENGTH variable: Auto-set. (line 244)
+* RLENGTH variable: Auto-set. (line 252)
* RLENGTH variable, match() function and: String Functions. (line 224)
* Robbins, Arnold <1>: Future Extensions. (line 6)
* Robbins, Arnold <2>: Bugs. (line 32)
@@ -33458,7 +33503,7 @@ Index
* Robbins, Miriam <2>: Getline/Pipe. (line 39)
* Robbins, Miriam: Acknowledgments. (line 92)
* Rommel, Kai Uwe: Contributors. (line 42)
-* round to nearest integer: Numeric Functions. (line 23)
+* round to nearest integer: Numeric Functions. (line 38)
* round() user-defined function: Round Function. (line 16)
* rounding numbers: Round Function. (line 6)
* ROUNDMODE variable: User-modified. (line 128)
@@ -33466,9 +33511,9 @@ Index
* RS variable: awk split records. (line 12)
* RS variable, multiline records and: Multiple Line. (line 17)
* rshift: Bitwise Functions. (line 52)
-* RSTART variable: Auto-set. (line 250)
+* RSTART variable: Auto-set. (line 258)
* RSTART variable, match() function and: String Functions. (line 224)
-* RT variable <1>: Auto-set. (line 257)
+* RT variable <1>: Auto-set. (line 265)
* RT variable <2>: Multiple Line. (line 129)
* RT variable: awk split records. (line 124)
* Rubin, Paul <1>: Contributors. (line 15)
@@ -33481,14 +33526,14 @@ Index
(line 68)
* sample debugging session: Sample Debugging Session.
(line 6)
-* sandbox mode: Options. (line 286)
+* sandbox mode: Options. (line 284)
* save debugger options: Debugger Info. (line 84)
* scalar or array: Type Functions. (line 11)
* scalar values: Basic Data Typing. (line 13)
* scanning arrays: Scanning an Array. (line 6)
* scanning multidimensional arrays: Multiscanning. (line 11)
* Schorr, Andrew <1>: Contributors. (line 133)
-* Schorr, Andrew <2>: Auto-set. (line 284)
+* Schorr, Andrew <2>: Auto-set. (line 292)
* Schorr, Andrew: Acknowledgments. (line 60)
* Schreiber, Bert: Acknowledgments. (line 38)
* Schreiber, Rita: Acknowledgments. (line 38)
@@ -33508,7 +33553,7 @@ Index
* sed utility <2>: Simple Sed. (line 6)
* sed utility: Field Splitting Summary.
(line 46)
-* seeding random number generator: Numeric Functions. (line 65)
+* seeding random number generator: Numeric Functions. (line 80)
* semicolon (;), AWKPATH variable and: PC Using. (line 10)
* semicolon (;), separating statements in actions <1>: Statements.
(line 10)
@@ -33569,14 +33614,14 @@ Index
* sidebar, A Constant's Base Does Not Affect Its Value: Nondecimal-numbers.
(line 64)
* sidebar, Backslash Before Regular Characters: Escape Sequences.
- (line 116)
+ (line 118)
* sidebar, Changing FS Does Not Affect the Fields: Field Splitting Summary.
(line 38)
-* sidebar, Changing NR and FNR: Auto-set. (line 299)
+* sidebar, Changing NR and FNR: Auto-set. (line 307)
* sidebar, Controlling Output Buffering with system(): I/O Functions.
(line 138)
* sidebar, Escape Sequences for Metacharacters: Escape Sequences.
- (line 134)
+ (line 136)
* sidebar, FS and IGNORECASE: Field Splitting Summary.
(line 64)
* sidebar, Interactive Versus Noninteractive Buffering: I/O Functions.
@@ -33609,8 +33654,8 @@ Index
* SIGUSR1 signal, for dynamic profiling: Profiling. (line 188)
* silent debugger command: Debugger Execution Control.
(line 10)
-* sin: Numeric Functions. (line 76)
-* sine: Numeric Functions. (line 76)
+* sin: Numeric Functions. (line 91)
+* sine: Numeric Functions. (line 91)
* single quote ('): One-shot. (line 15)
* single quote (') in gawk command lines: Long. (line 33)
* single quote ('), in shell commands: Quoting. (line 48)
@@ -33660,10 +33705,10 @@ Index
* sprintf() function, OFMT variable and: User-modified. (line 114)
* sprintf() function, print/printf statements and: Round Function.
(line 6)
-* sqrt: Numeric Functions. (line 79)
+* sqrt: Numeric Functions. (line 94)
* square brackets ([]), regexp operator: Regexp Operators. (line 56)
-* square root: Numeric Functions. (line 79)
-* srand: Numeric Functions. (line 83)
+* square root: Numeric Functions. (line 94)
+* srand: Numeric Functions. (line 98)
* stack frame: Debugging Terms. (line 10)
* Stallman, Richard <1>: Glossary. (line 296)
* Stallman, Richard <2>: Contributors. (line 23)
@@ -33735,9 +33780,9 @@ Index
* substr: String Functions. (line 479)
* substring: String Functions. (line 479)
* Sumner, Andrew: Other Versions. (line 64)
-* supplementary groups of gawk process: Auto-set. (line 229)
+* supplementary groups of gawk process: Auto-set. (line 237)
* switch statement: Switch Statement. (line 6)
-* SYMTAB array: Auto-set. (line 261)
+* SYMTAB array: Auto-set. (line 269)
* syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops.
(line 148)
* system: I/O Functions. (line 75)
@@ -33804,7 +33849,7 @@ Index
(line 37)
* troubleshooting, awk uses FS not IFS: Field Separators. (line 30)
* troubleshooting, backslash before nonspecial character: Escape Sequences.
- (line 118)
+ (line 120)
* troubleshooting, division: Arithmetic Ops. (line 44)
* troubleshooting, fatal errors, field widths, specifying: Constant Size.
(line 23)
@@ -33860,7 +33905,7 @@ Index
* uniq.awk program: Uniq Program. (line 65)
* Unix: Glossary. (line 611)
* Unix awk, backslashes in escape sequences: Escape Sequences.
- (line 130)
+ (line 132)
* Unix awk, close() function and: Close Files And Pipes.
(line 131)
* Unix awk, password files, field separators and: Command Line Field Separator.
@@ -33915,10 +33960,10 @@ Index
* variables, uninitialized, as array subscripts: Uninitialized Subscripts.
(line 6)
* variables, user-defined: Variables. (line 6)
-* version of gawk: Auto-set. (line 199)
-* version of gawk extension API: Auto-set. (line 224)
-* version of GNU MP library: Auto-set. (line 210)
-* version of GNU MPFR library: Auto-set. (line 206)
+* version of gawk: Auto-set. (line 207)
+* version of gawk extension API: Auto-set. (line 232)
+* version of GNU MP library: Auto-set. (line 218)
+* version of GNU MPFR library: Auto-set. (line 214)
* vertical bar (|): Regexp Operators. (line 70)
* vertical bar (|), | operator (I/O) <1>: Precedence. (line 65)
* vertical bar (|), | operator (I/O): Getline/Pipe. (line 9)
@@ -33952,7 +33997,7 @@ Index
* whitespace, as field separators: Default Field Splitting.
(line 6)
* whitespace, functions, calling: Calling Built-in. (line 10)
-* whitespace, newlines as: Options. (line 260)
+* whitespace, newlines as: Options. (line 258)
* Williams, Kent: Contributors. (line 34)
* Woehlke, Matthew: Contributors. (line 79)
* Woods, John: Contributors. (line 27)
@@ -34044,513 +34089,513 @@ Node: Intro Summary110068
Node: Invoking Gawk110951
Node: Command Line112466
Node: Options113257
-Ref: Options-Footnote-1129033
-Node: Other Arguments129058
-Node: Naming Standard Input131886
-Node: Environment Variables132979
-Node: AWKPATH Variable133537
-Ref: AWKPATH Variable-Footnote-1136403
-Ref: AWKPATH Variable-Footnote-2136448
-Node: AWKLIBPATH Variable136708
-Node: Other Environment Variables137467
-Node: Exit Status141124
-Node: Include Files141799
-Node: Loading Shared Libraries145377
-Node: Obsolete146761
-Node: Undocumented147458
-Node: Invoking Summary147725
-Node: Regexp149325
-Node: Regexp Usage150784
-Node: Escape Sequences152817
-Node: Regexp Operators158805
-Ref: Regexp Operators-Footnote-1166236
-Ref: Regexp Operators-Footnote-2166383
-Node: Bracket Expressions166481
-Ref: table-char-classes168499
-Node: Leftmost Longest171439
-Node: Computed Regexps172643
-Node: GNU Regexp Operators176021
-Node: Case-sensitivity179727
-Ref: Case-sensitivity-Footnote-1182617
-Ref: Case-sensitivity-Footnote-2182852
-Node: Regexp Summary182960
-Node: Reading Files184429
-Node: Records186521
-Node: awk split records187243
-Node: gawk split records192101
-Ref: gawk split records-Footnote-1196622
-Node: Fields196659
-Ref: Fields-Footnote-1199623
-Node: Nonconstant Fields199709
-Ref: Nonconstant Fields-Footnote-1201939
-Node: Changing Fields202141
-Node: Field Separators208095
-Node: Default Field Splitting210797
-Node: Regexp Field Splitting211914
-Node: Single Character Fields215241
-Node: Command Line Field Separator216300
-Node: Full Line Fields219726
-Ref: Full Line Fields-Footnote-1220234
-Node: Field Splitting Summary220280
-Ref: Field Splitting Summary-Footnote-1223412
-Node: Constant Size223513
-Node: Splitting By Content228119
-Ref: Splitting By Content-Footnote-1232192
-Node: Multiple Line232232
-Ref: Multiple Line-Footnote-1238088
-Node: Getline238267
-Node: Plain Getline240478
-Node: Getline/Variable243184
-Node: Getline/File244331
-Node: Getline/Variable/File245715
-Ref: Getline/Variable/File-Footnote-1247314
-Node: Getline/Pipe247401
-Node: Getline/Variable/Pipe250087
-Node: Getline/Coprocess251194
-Node: Getline/Variable/Coprocess252446
-Node: Getline Notes253183
-Node: Getline Summary255987
-Ref: table-getline-variants256395
-Node: Read Timeout257307
-Ref: Read Timeout-Footnote-1261134
-Node: Command-line directories261192
-Node: Input Summary262096
-Node: Input Exercises265233
-Node: Printing265961
-Node: Print267683
-Node: Print Examples269176
-Node: Output Separators271955
-Node: OFMT273971
-Node: Printf275329
-Node: Basic Printf276235
-Node: Control Letters277774
-Node: Format Modifiers281765
-Node: Printf Examples287792
-Node: Redirection290256
-Node: Special Files297228
-Node: Special FD297761
-Ref: Special FD-Footnote-1301358
-Node: Special Network301432
-Node: Special Caveats302282
-Node: Close Files And Pipes303078
-Ref: Close Files And Pipes-Footnote-1310239
-Ref: Close Files And Pipes-Footnote-2310387
-Node: Output Summary310537
-Node: Output Exercises311534
-Node: Expressions312214
-Node: Values313399
-Node: Constants314075
-Node: Scalar Constants314755
-Ref: Scalar Constants-Footnote-1315614
-Node: Nondecimal-numbers315864
-Node: Regexp Constants318864
-Node: Using Constant Regexps319389
-Node: Variables322461
-Node: Using Variables323116
-Node: Assignment Options324840
-Node: Conversion326715
-Node: Strings And Numbers327239
-Ref: Strings And Numbers-Footnote-1330301
-Node: Locale influences conversions330410
-Ref: table-locale-affects333127
-Node: All Operators333715
-Node: Arithmetic Ops334345
-Node: Concatenation336850
-Ref: Concatenation-Footnote-1339669
-Node: Assignment Ops339775
-Ref: table-assign-ops344758
-Node: Increment Ops346061
-Node: Truth Values and Conditions349499
-Node: Truth Values350582
-Node: Typing and Comparison351631
-Node: Variable Typing352424
-Node: Comparison Operators356076
-Ref: table-relational-ops356486
-Node: POSIX String Comparison360036
-Ref: POSIX String Comparison-Footnote-1361120
-Node: Boolean Ops361258
-Ref: Boolean Ops-Footnote-1365597
-Node: Conditional Exp365688
-Node: Function Calls367415
-Node: Precedence371295
-Node: Locales374964
-Node: Expressions Summary376595
-Node: Patterns and Actions379136
-Node: Pattern Overview380252
-Node: Regexp Patterns381929
-Node: Expression Patterns382472
-Node: Ranges386252
-Node: BEGIN/END389358
-Node: Using BEGIN/END390120
-Ref: Using BEGIN/END-Footnote-1392856
-Node: I/O And BEGIN/END392962
-Node: BEGINFILE/ENDFILE395233
-Node: Empty398164
-Node: Using Shell Variables398481
-Node: Action Overview400764
-Node: Statements403091
-Node: If Statement404939
-Node: While Statement406437
-Node: Do Statement408481
-Node: For Statement409637
-Node: Switch Statement412789
-Node: Break Statement415177
-Node: Continue Statement417218
-Node: Next Statement419043
-Node: Nextfile Statement421433
-Node: Exit Statement424090
-Node: Built-in Variables426494
-Node: User-modified427621
-Ref: User-modified-Footnote-1435310
-Node: Auto-set435372
-Ref: Auto-set-Footnote-1447954
-Ref: Auto-set-Footnote-2448159
-Node: ARGC and ARGV448215
-Node: Pattern Action Summary452119
-Node: Arrays454342
-Node: Array Basics455891
-Node: Array Intro456717
-Ref: figure-array-elements458690
-Ref: Array Intro-Footnote-1461214
-Node: Reference to Elements461342
-Node: Assigning Elements463792
-Node: Array Example464283
-Node: Scanning an Array466015
-Node: Controlling Scanning469016
-Ref: Controlling Scanning-Footnote-1474189
-Node: Delete474505
-Ref: Delete-Footnote-1477256
-Node: Numeric Array Subscripts477313
-Node: Uninitialized Subscripts479496
-Node: Multidimensional481123
-Node: Multiscanning484236
-Node: Arrays of Arrays485825
-Node: Arrays Summary490488
-Node: Functions492593
-Node: Built-in493466
-Node: Calling Built-in494544
-Node: Numeric Functions496532
-Ref: Numeric Functions-Footnote-1500566
-Ref: Numeric Functions-Footnote-2500923
-Ref: Numeric Functions-Footnote-3500971
-Node: String Functions501240
-Ref: String Functions-Footnote-1524237
-Ref: String Functions-Footnote-2524366
-Ref: String Functions-Footnote-3524614
-Node: Gory Details524701
-Ref: table-sub-escapes526474
-Ref: table-sub-proposed527994
-Ref: table-posix-sub529358
-Ref: table-gensub-escapes530898
-Ref: Gory Details-Footnote-1532074
-Node: I/O Functions532225
-Ref: I/O Functions-Footnote-1539335
-Node: Time Functions539482
-Ref: Time Functions-Footnote-1549946
-Ref: Time Functions-Footnote-2550014
-Ref: Time Functions-Footnote-3550172
-Ref: Time Functions-Footnote-4550283
-Ref: Time Functions-Footnote-5550395
-Ref: Time Functions-Footnote-6550622
-Node: Bitwise Functions550888
-Ref: table-bitwise-ops551450
-Ref: Bitwise Functions-Footnote-1555695
-Node: Type Functions555879
-Node: I18N Functions557021
-Node: User-defined558666
-Node: Definition Syntax559470
-Ref: Definition Syntax-Footnote-1564783
-Node: Function Example564852
-Ref: Function Example-Footnote-1567492
-Node: Function Caveats567514
-Node: Calling A Function568032
-Node: Variable Scope568987
-Node: Pass By Value/Reference571975
-Node: Return Statement575485
-Node: Dynamic Typing578469
-Node: Indirect Calls579398
-Node: Functions Summary589111
-Node: Library Functions591650
-Ref: Library Functions-Footnote-1595268
-Ref: Library Functions-Footnote-2595411
-Node: Library Names595582
-Ref: Library Names-Footnote-1599055
-Ref: Library Names-Footnote-2599275
-Node: General Functions599361
-Node: Strtonum Function600389
-Node: Assert Function603263
-Node: Round Function606589
-Node: Cliff Random Function608130
-Node: Ordinal Functions609146
-Ref: Ordinal Functions-Footnote-1612211
-Ref: Ordinal Functions-Footnote-2612463
-Node: Join Function612674
-Ref: Join Function-Footnote-1614445
-Node: Getlocaltime Function614645
-Node: Readfile Function618381
-Ref: Readfile Function-Footnote-1620259
-Node: Data File Management620487
-Node: Filetrans Function621119
-Node: Rewind Function625188
-Node: File Checking626746
-Ref: File Checking-Footnote-1627878
-Node: Empty Files628079
-Node: Ignoring Assigns630058
-Node: Getopt Function631612
-Ref: Getopt Function-Footnote-1642876
-Node: Passwd Functions643079
-Ref: Passwd Functions-Footnote-1652058
-Node: Group Functions652146
-Ref: Group Functions-Footnote-1660077
-Node: Walking Arrays660290
-Node: Library Functions Summary661893
-Node: Library Exercises663281
-Node: Sample Programs664561
-Node: Running Examples665331
-Node: Clones666059
-Node: Cut Program667283
-Node: Egrep Program677141
-Ref: Egrep Program-Footnote-1684728
-Node: Id Program684838
-Node: Split Program688492
-Ref: Split Program-Footnote-1692030
-Node: Tee Program692158
-Node: Uniq Program694945
-Node: Wc Program702366
-Ref: Wc Program-Footnote-1706631
-Node: Miscellaneous Programs706723
-Node: Dupword Program707936
-Node: Alarm Program709967
-Node: Translate Program714771
-Ref: Translate Program-Footnote-1719162
-Ref: Translate Program-Footnote-2719432
-Node: Labels Program719566
-Ref: Labels Program-Footnote-1722927
-Node: Word Sorting723011
-Node: History Sorting727054
-Node: Extract Program728890
-Node: Simple Sed736426
-Node: Igawk Program739488
-Ref: Igawk Program-Footnote-1753792
-Ref: Igawk Program-Footnote-2753993
-Node: Anagram Program754131
-Node: Signature Program757199
-Node: Programs Summary758446
-Node: Programs Exercises759661
-Node: Advanced Features763312
-Node: Nondecimal Data765260
-Node: Array Sorting766837
-Node: Controlling Array Traversal767534
-Node: Array Sorting Functions775814
-Ref: Array Sorting Functions-Footnote-1779721
-Node: Two-way I/O779915
-Ref: Two-way I/O-Footnote-1784859
-Ref: Two-way I/O-Footnote-2785038
-Node: TCP/IP Networking785120
-Node: Profiling787965
-Node: Advanced Features Summary795507
-Node: Internationalization797371
-Node: I18N and L10N798851
-Node: Explaining gettext799537
-Ref: Explaining gettext-Footnote-1804563
-Ref: Explaining gettext-Footnote-2804747
-Node: Programmer i18n804912
-Ref: Programmer i18n-Footnote-1809706
-Node: Translator i18n809755
-Node: String Extraction810549
-Ref: String Extraction-Footnote-1811682
-Node: Printf Ordering811768
-Ref: Printf Ordering-Footnote-1814550
-Node: I18N Portability814614
-Ref: I18N Portability-Footnote-1817063
-Node: I18N Example817126
-Ref: I18N Example-Footnote-1819832
-Node: Gawk I18N819904
-Node: I18N Summary820542
-Node: Debugger821881
-Node: Debugging822903
-Node: Debugging Concepts823344
-Node: Debugging Terms825200
-Node: Awk Debugging827797
-Node: Sample Debugging Session828689
-Node: Debugger Invocation829209
-Node: Finding The Bug830542
-Node: List of Debugger Commands837024
-Node: Breakpoint Control838356
-Node: Debugger Execution Control842020
-Node: Viewing And Changing Data845380
-Node: Execution Stack848738
-Node: Debugger Info850251
-Node: Miscellaneous Debugger Commands854245
-Node: Readline Support859429
-Node: Limitations860321
-Node: Debugging Summary862595
-Node: Arbitrary Precision Arithmetic863763
-Node: Computer Arithmetic865250
-Ref: Computer Arithmetic-Footnote-1869637
-Node: Math Definitions869694
-Ref: table-ieee-formats872983
-Ref: Math Definitions-Footnote-1873523
-Node: MPFR features873626
-Node: FP Math Caution875243
-Ref: FP Math Caution-Footnote-1876293
-Node: Inexactness of computations876662
-Node: Inexact representation877610
-Node: Comparing FP Values878965
-Node: Errors accumulate879929
-Node: Getting Accuracy881362
-Node: Try To Round884021
-Node: Setting precision884920
-Ref: table-predefined-precision-strings885602
-Node: Setting the rounding mode887395
-Ref: table-gawk-rounding-modes887759
-Ref: Setting the rounding mode-Footnote-1891213
-Node: Arbitrary Precision Integers891392
-Ref: Arbitrary Precision Integers-Footnote-1894373
-Node: POSIX Floating Point Problems894522
-Ref: POSIX Floating Point Problems-Footnote-1898398
-Node: Floating point summary898436
-Node: Dynamic Extensions900640
-Node: Extension Intro902192
-Node: Plugin License903457
-Node: Extension Mechanism Outline904142
-Ref: figure-load-extension904566
-Ref: figure-load-new-function906051
-Ref: figure-call-new-function907053
-Node: Extension API Description909037
-Node: Extension API Functions Introduction910487
-Node: General Data Types915354
-Ref: General Data Types-Footnote-1921047
-Node: Requesting Values921346
-Ref: table-value-types-returned922083
-Node: Memory Allocation Functions923041
-Ref: Memory Allocation Functions-Footnote-1925788
-Node: Constructor Functions925884
-Node: Registration Functions927642
-Node: Extension Functions928327
-Node: Exit Callback Functions930629
-Node: Extension Version String931877
-Node: Input Parsers932527
-Node: Output Wrappers942341
-Node: Two-way processors946857
-Node: Printing Messages949061
-Ref: Printing Messages-Footnote-1950138
-Node: Updating `ERRNO'950290
-Node: Accessing Parameters951029
-Node: Symbol Table Access952259
-Node: Symbol table by name952773
-Node: Symbol table by cookie954749
-Ref: Symbol table by cookie-Footnote-1958882
-Node: Cached values958945
-Ref: Cached values-Footnote-1962449
-Node: Array Manipulation962540
-Ref: Array Manipulation-Footnote-1963638
-Node: Array Data Types963677
-Ref: Array Data Types-Footnote-1966380
-Node: Array Functions966472
-Node: Flattening Arrays970346
-Node: Creating Arrays977198
-Node: Extension API Variables981929
-Node: Extension Versioning982565
-Node: Extension API Informational Variables984466
-Node: Extension API Boilerplate985552
-Node: Finding Extensions989356
-Node: Extension Example989916
-Node: Internal File Description990646
-Node: Internal File Ops994737
-Ref: Internal File Ops-Footnote-11006169
-Node: Using Internal File Ops1006309
-Ref: Using Internal File Ops-Footnote-11008656
-Node: Extension Samples1008924
-Node: Extension Sample File Functions1010448
-Node: Extension Sample Fnmatch1018016
-Node: Extension Sample Fork1019498
-Node: Extension Sample Inplace1020711
-Node: Extension Sample Ord1022386
-Node: Extension Sample Readdir1023222
-Ref: table-readdir-file-types1024078
-Node: Extension Sample Revout1024877
-Node: Extension Sample Rev2way1025468
-Node: Extension Sample Read write array1026209
-Node: Extension Sample Readfile1028088
-Node: Extension Sample API Tests1029188
-Node: Extension Sample Time1029713
-Node: gawkextlib1031028
-Node: Extension summary1033841
-Node: Extension Exercises1037534
-Node: Language History1038256
-Node: V7/SVR3.11039899
-Node: SVR41042219
-Node: POSIX1043661
-Node: BTL1045047
-Node: POSIX/GNU1045781
-Node: Feature History1051497
-Node: Common Extensions1064588
-Node: Ranges and Locales1065900
-Ref: Ranges and Locales-Footnote-11070517
-Ref: Ranges and Locales-Footnote-21070544
-Ref: Ranges and Locales-Footnote-31070778
-Node: Contributors1070999
-Node: History summary1076424
-Node: Installation1077793
-Node: Gawk Distribution1078744
-Node: Getting1079228
-Node: Extracting1080052
-Node: Distribution contents1081694
-Node: Unix Installation1087411
-Node: Quick Installation1088028
-Node: Additional Configuration Options1090470
-Node: Configuration Philosophy1092208
-Node: Non-Unix Installation1094559
-Node: PC Installation1095017
-Node: PC Binary Installation1096328
-Node: PC Compiling1098176
-Ref: PC Compiling-Footnote-11101175
-Node: PC Testing1101280
-Node: PC Using1102456
-Node: Cygwin1106608
-Node: MSYS1107417
-Node: VMS Installation1107931
-Node: VMS Compilation1108727
-Ref: VMS Compilation-Footnote-11109949
-Node: VMS Dynamic Extensions1110007
-Node: VMS Installation Details1111380
-Node: VMS Running1113632
-Node: VMS GNV1116466
-Node: VMS Old Gawk1117189
-Node: Bugs1117659
-Node: Other Versions1121663
-Node: Installation summary1127890
-Node: Notes1128946
-Node: Compatibility Mode1129811
-Node: Additions1130593
-Node: Accessing The Source1131518
-Node: Adding Code1132954
-Node: New Ports1139132
-Node: Derived Files1143613
-Ref: Derived Files-Footnote-11148694
-Ref: Derived Files-Footnote-21148728
-Ref: Derived Files-Footnote-31149324
-Node: Future Extensions1149438
-Node: Implementation Limitations1150044
-Node: Extension Design1151292
-Node: Old Extension Problems1152446
-Ref: Old Extension Problems-Footnote-11153963
-Node: Extension New Mechanism Goals1154020
-Ref: Extension New Mechanism Goals-Footnote-11157380
-Node: Extension Other Design Decisions1157569
-Node: Extension Future Growth1159675
-Node: Old Extension Mechanism1160511
-Node: Notes summary1162273
-Node: Basic Concepts1163459
-Node: Basic High Level1164140
-Ref: figure-general-flow1164412
-Ref: figure-process-flow1165011
-Ref: Basic High Level-Footnote-11168240
-Node: Basic Data Typing1168425
-Node: Glossary1171753
-Node: Copying1196905
-Node: GNU Free Documentation License1234461
-Node: Index1259597
+Ref: Options-Footnote-1128904
+Node: Other Arguments128929
+Node: Naming Standard Input131757
+Node: Environment Variables132850
+Node: AWKPATH Variable133408
+Ref: AWKPATH Variable-Footnote-1136274
+Ref: AWKPATH Variable-Footnote-2136319
+Node: AWKLIBPATH Variable136579
+Node: Other Environment Variables137338
+Node: Exit Status140790
+Node: Include Files141465
+Node: Loading Shared Libraries145043
+Node: Obsolete146427
+Node: Undocumented147124
+Node: Invoking Summary147391
+Node: Regexp148991
+Node: Regexp Usage150450
+Node: Escape Sequences152483
+Node: Regexp Operators158554
+Ref: Regexp Operators-Footnote-1165985
+Ref: Regexp Operators-Footnote-2166132
+Node: Bracket Expressions166230
+Ref: table-char-classes168248
+Node: Leftmost Longest171188
+Node: Computed Regexps172392
+Node: GNU Regexp Operators175770
+Node: Case-sensitivity179476
+Ref: Case-sensitivity-Footnote-1182366
+Ref: Case-sensitivity-Footnote-2182601
+Node: Regexp Summary182709
+Node: Reading Files184178
+Node: Records186270
+Node: awk split records186992
+Node: gawk split records191850
+Ref: gawk split records-Footnote-1196371
+Node: Fields196408
+Ref: Fields-Footnote-1199372
+Node: Nonconstant Fields199458
+Ref: Nonconstant Fields-Footnote-1201688
+Node: Changing Fields201890
+Node: Field Separators207844
+Node: Default Field Splitting210546
+Node: Regexp Field Splitting211663
+Node: Single Character Fields214990
+Node: Command Line Field Separator216049
+Node: Full Line Fields219475
+Ref: Full Line Fields-Footnote-1219983
+Node: Field Splitting Summary220029
+Ref: Field Splitting Summary-Footnote-1223161
+Node: Constant Size223262
+Node: Splitting By Content227868
+Ref: Splitting By Content-Footnote-1231941
+Node: Multiple Line231981
+Ref: Multiple Line-Footnote-1237837
+Node: Getline238016
+Node: Plain Getline240227
+Node: Getline/Variable242933
+Node: Getline/File244080
+Node: Getline/Variable/File245464
+Ref: Getline/Variable/File-Footnote-1247063
+Node: Getline/Pipe247150
+Node: Getline/Variable/Pipe249836
+Node: Getline/Coprocess250943
+Node: Getline/Variable/Coprocess252195
+Node: Getline Notes252932
+Node: Getline Summary255736
+Ref: table-getline-variants256144
+Node: Read Timeout257056
+Ref: Read Timeout-Footnote-1260883
+Node: Command-line directories260941
+Node: Input Summary261845
+Node: Input Exercises264982
+Node: Printing265710
+Node: Print267432
+Node: Print Examples268925
+Node: Output Separators271704
+Node: OFMT273720
+Node: Printf275078
+Node: Basic Printf275984
+Node: Control Letters277523
+Node: Format Modifiers281514
+Node: Printf Examples287541
+Node: Redirection290005
+Node: Special Files296977
+Node: Special FD297510
+Ref: Special FD-Footnote-1301107
+Node: Special Network301181
+Node: Special Caveats302031
+Node: Close Files And Pipes302827
+Ref: Close Files And Pipes-Footnote-1309988
+Ref: Close Files And Pipes-Footnote-2310136
+Node: Output Summary310286
+Node: Output Exercises311283
+Node: Expressions311963
+Node: Values313148
+Node: Constants313824
+Node: Scalar Constants314504
+Ref: Scalar Constants-Footnote-1315363
+Node: Nondecimal-numbers315613
+Node: Regexp Constants318613
+Node: Using Constant Regexps319138
+Node: Variables322210
+Node: Using Variables322865
+Node: Assignment Options324589
+Node: Conversion326464
+Node: Strings And Numbers326988
+Ref: Strings And Numbers-Footnote-1330050
+Node: Locale influences conversions330159
+Ref: table-locale-affects332876
+Node: All Operators333464
+Node: Arithmetic Ops334094
+Node: Concatenation336599
+Ref: Concatenation-Footnote-1339418
+Node: Assignment Ops339524
+Ref: table-assign-ops344507
+Node: Increment Ops345810
+Node: Truth Values and Conditions349248
+Node: Truth Values350331
+Node: Typing and Comparison351380
+Node: Variable Typing352173
+Node: Comparison Operators355825
+Ref: table-relational-ops356235
+Node: POSIX String Comparison359785
+Ref: POSIX String Comparison-Footnote-1360869
+Node: Boolean Ops361007
+Ref: Boolean Ops-Footnote-1365346
+Node: Conditional Exp365437
+Node: Function Calls367164
+Node: Precedence371044
+Node: Locales374713
+Node: Expressions Summary376344
+Node: Patterns and Actions378885
+Node: Pattern Overview380001
+Node: Regexp Patterns381678
+Node: Expression Patterns382221
+Node: Ranges386001
+Node: BEGIN/END389107
+Node: Using BEGIN/END389869
+Ref: Using BEGIN/END-Footnote-1392605
+Node: I/O And BEGIN/END392711
+Node: BEGINFILE/ENDFILE394982
+Node: Empty397913
+Node: Using Shell Variables398230
+Node: Action Overview400513
+Node: Statements402840
+Node: If Statement404688
+Node: While Statement406186
+Node: Do Statement408230
+Node: For Statement409386
+Node: Switch Statement412538
+Node: Break Statement414926
+Node: Continue Statement416967
+Node: Next Statement418792
+Node: Nextfile Statement421182
+Node: Exit Statement423839
+Node: Built-in Variables426243
+Node: User-modified427370
+Ref: User-modified-Footnote-1435059
+Node: Auto-set435121
+Ref: Auto-set-Footnote-1448040
+Ref: Auto-set-Footnote-2448245
+Node: ARGC and ARGV448301
+Node: Pattern Action Summary452205
+Node: Arrays454428
+Node: Array Basics455977
+Node: Array Intro456803
+Ref: figure-array-elements458776
+Ref: Array Intro-Footnote-1461300
+Node: Reference to Elements461428
+Node: Assigning Elements463878
+Node: Array Example464369
+Node: Scanning an Array466101
+Node: Controlling Scanning469102
+Ref: Controlling Scanning-Footnote-1474275
+Node: Delete474591
+Ref: Delete-Footnote-1477342
+Node: Numeric Array Subscripts477399
+Node: Uninitialized Subscripts479582
+Node: Multidimensional481209
+Node: Multiscanning484322
+Node: Arrays of Arrays485911
+Node: Arrays Summary490574
+Node: Functions492679
+Node: Built-in493552
+Node: Calling Built-in494630
+Node: Numeric Functions496618
+Ref: Numeric Functions-Footnote-1501454
+Ref: Numeric Functions-Footnote-2501811
+Ref: Numeric Functions-Footnote-3501859
+Node: String Functions502128
+Ref: String Functions-Footnote-1525125
+Ref: String Functions-Footnote-2525254
+Ref: String Functions-Footnote-3525502
+Node: Gory Details525589
+Ref: table-sub-escapes527362
+Ref: table-sub-proposed528882
+Ref: table-posix-sub530246
+Ref: table-gensub-escapes531786
+Ref: Gory Details-Footnote-1532962
+Node: I/O Functions533113
+Ref: I/O Functions-Footnote-1540223
+Node: Time Functions540370
+Ref: Time Functions-Footnote-1550834
+Ref: Time Functions-Footnote-2550902
+Ref: Time Functions-Footnote-3551060
+Ref: Time Functions-Footnote-4551171
+Ref: Time Functions-Footnote-5551283
+Ref: Time Functions-Footnote-6551510
+Node: Bitwise Functions551776
+Ref: table-bitwise-ops552338
+Ref: Bitwise Functions-Footnote-1556583
+Node: Type Functions556767
+Node: I18N Functions557909
+Node: User-defined559554
+Node: Definition Syntax560358
+Ref: Definition Syntax-Footnote-1565671
+Node: Function Example565740
+Ref: Function Example-Footnote-1568380
+Node: Function Caveats568402
+Node: Calling A Function568920
+Node: Variable Scope569875
+Node: Pass By Value/Reference572863
+Node: Return Statement576373
+Node: Dynamic Typing579357
+Node: Indirect Calls580286
+Node: Functions Summary589999
+Node: Library Functions592538
+Ref: Library Functions-Footnote-1596156
+Ref: Library Functions-Footnote-2596299
+Node: Library Names596470
+Ref: Library Names-Footnote-1599943
+Ref: Library Names-Footnote-2600163
+Node: General Functions600249
+Node: Strtonum Function601277
+Node: Assert Function604151
+Node: Round Function607477
+Node: Cliff Random Function609018
+Node: Ordinal Functions610034
+Ref: Ordinal Functions-Footnote-1613099
+Ref: Ordinal Functions-Footnote-2613351
+Node: Join Function613562
+Ref: Join Function-Footnote-1615333
+Node: Getlocaltime Function615533
+Node: Readfile Function619269
+Ref: Readfile Function-Footnote-1621147
+Node: Data File Management621375
+Node: Filetrans Function622007
+Node: Rewind Function626076
+Node: File Checking627634
+Ref: File Checking-Footnote-1628766
+Node: Empty Files628967
+Node: Ignoring Assigns630946
+Node: Getopt Function632500
+Ref: Getopt Function-Footnote-1643764
+Node: Passwd Functions643967
+Ref: Passwd Functions-Footnote-1652946
+Node: Group Functions653034
+Ref: Group Functions-Footnote-1660965
+Node: Walking Arrays661178
+Node: Library Functions Summary662781
+Node: Library Exercises664169
+Node: Sample Programs665449
+Node: Running Examples666219
+Node: Clones666947
+Node: Cut Program668171
+Node: Egrep Program678029
+Ref: Egrep Program-Footnote-1685616
+Node: Id Program685726
+Node: Split Program689380
+Ref: Split Program-Footnote-1692918
+Node: Tee Program693046
+Node: Uniq Program695833
+Node: Wc Program703254
+Ref: Wc Program-Footnote-1707519
+Node: Miscellaneous Programs707611
+Node: Dupword Program708824
+Node: Alarm Program710855
+Node: Translate Program715659
+Ref: Translate Program-Footnote-1720050
+Ref: Translate Program-Footnote-2720320
+Node: Labels Program720454
+Ref: Labels Program-Footnote-1723815
+Node: Word Sorting723899
+Node: History Sorting727942
+Node: Extract Program729778
+Node: Simple Sed737314
+Node: Igawk Program740376
+Ref: Igawk Program-Footnote-1754680
+Ref: Igawk Program-Footnote-2754881
+Node: Anagram Program755019
+Node: Signature Program758087
+Node: Programs Summary759334
+Node: Programs Exercises760549
+Node: Advanced Features764200
+Node: Nondecimal Data766148
+Node: Array Sorting767725
+Node: Controlling Array Traversal768422
+Node: Array Sorting Functions776702
+Ref: Array Sorting Functions-Footnote-1780609
+Node: Two-way I/O780803
+Ref: Two-way I/O-Footnote-1785747
+Ref: Two-way I/O-Footnote-2785926
+Node: TCP/IP Networking786008
+Node: Profiling788853
+Node: Advanced Features Summary796404
+Node: Internationalization798268
+Node: I18N and L10N799748
+Node: Explaining gettext800434
+Ref: Explaining gettext-Footnote-1805460
+Ref: Explaining gettext-Footnote-2805644
+Node: Programmer i18n805809
+Ref: Programmer i18n-Footnote-1810603
+Node: Translator i18n810652
+Node: String Extraction811446
+Ref: String Extraction-Footnote-1812579
+Node: Printf Ordering812665
+Ref: Printf Ordering-Footnote-1815447
+Node: I18N Portability815511
+Ref: I18N Portability-Footnote-1817960
+Node: I18N Example818023
+Ref: I18N Example-Footnote-1820729
+Node: Gawk I18N820801
+Node: I18N Summary821439
+Node: Debugger822778
+Node: Debugging823800
+Node: Debugging Concepts824241
+Node: Debugging Terms826097
+Node: Awk Debugging828694
+Node: Sample Debugging Session829586
+Node: Debugger Invocation830106
+Node: Finding The Bug831439
+Node: List of Debugger Commands837921
+Node: Breakpoint Control839253
+Node: Debugger Execution Control842917
+Node: Viewing And Changing Data846277
+Node: Execution Stack849635
+Node: Debugger Info851148
+Node: Miscellaneous Debugger Commands855142
+Node: Readline Support860326
+Node: Limitations861218
+Node: Debugging Summary863492
+Node: Arbitrary Precision Arithmetic864660
+Node: Computer Arithmetic866147
+Ref: Computer Arithmetic-Footnote-1870534
+Node: Math Definitions870591
+Ref: table-ieee-formats873880
+Ref: Math Definitions-Footnote-1874420
+Node: MPFR features874523
+Node: FP Math Caution876140
+Ref: FP Math Caution-Footnote-1877190
+Node: Inexactness of computations877559
+Node: Inexact representation878507
+Node: Comparing FP Values879862
+Node: Errors accumulate880826
+Node: Getting Accuracy882259
+Node: Try To Round884918
+Node: Setting precision885817
+Ref: table-predefined-precision-strings886499
+Node: Setting the rounding mode888292
+Ref: table-gawk-rounding-modes888656
+Ref: Setting the rounding mode-Footnote-1892110
+Node: Arbitrary Precision Integers892289
+Ref: Arbitrary Precision Integers-Footnote-1896062
+Node: POSIX Floating Point Problems896211
+Ref: POSIX Floating Point Problems-Footnote-1900087
+Node: Floating point summary900125
+Node: Dynamic Extensions902329
+Node: Extension Intro903881
+Node: Plugin License905146
+Node: Extension Mechanism Outline905831
+Ref: figure-load-extension906255
+Ref: figure-load-new-function907740
+Ref: figure-call-new-function908742
+Node: Extension API Description910726
+Node: Extension API Functions Introduction912176
+Node: General Data Types917043
+Ref: General Data Types-Footnote-1922736
+Node: Requesting Values923035
+Ref: table-value-types-returned923772
+Node: Memory Allocation Functions924730
+Ref: Memory Allocation Functions-Footnote-1927477
+Node: Constructor Functions927573
+Node: Registration Functions929331
+Node: Extension Functions930016
+Node: Exit Callback Functions932318
+Node: Extension Version String933566
+Node: Input Parsers934216
+Node: Output Wrappers944030
+Node: Two-way processors948546
+Node: Printing Messages950750
+Ref: Printing Messages-Footnote-1951827
+Node: Updating `ERRNO'951979
+Node: Accessing Parameters952718
+Node: Symbol Table Access953948
+Node: Symbol table by name954462
+Node: Symbol table by cookie956438
+Ref: Symbol table by cookie-Footnote-1960571
+Node: Cached values960634
+Ref: Cached values-Footnote-1964138
+Node: Array Manipulation964229
+Ref: Array Manipulation-Footnote-1965327
+Node: Array Data Types965366
+Ref: Array Data Types-Footnote-1968069
+Node: Array Functions968161
+Node: Flattening Arrays972035
+Node: Creating Arrays978887
+Node: Extension API Variables983618
+Node: Extension Versioning984254
+Node: Extension API Informational Variables986155
+Node: Extension API Boilerplate987241
+Node: Finding Extensions991045
+Node: Extension Example991605
+Node: Internal File Description992335
+Node: Internal File Ops996426
+Ref: Internal File Ops-Footnote-11007858
+Node: Using Internal File Ops1007998
+Ref: Using Internal File Ops-Footnote-11010345
+Node: Extension Samples1010613
+Node: Extension Sample File Functions1012137
+Node: Extension Sample Fnmatch1019705
+Node: Extension Sample Fork1021187
+Node: Extension Sample Inplace1022400
+Node: Extension Sample Ord1024075
+Node: Extension Sample Readdir1024911
+Ref: table-readdir-file-types1025767
+Node: Extension Sample Revout1026566
+Node: Extension Sample Rev2way1027157
+Node: Extension Sample Read write array1027898
+Node: Extension Sample Readfile1029777
+Node: Extension Sample API Tests1030877
+Node: Extension Sample Time1031402
+Node: gawkextlib1032717
+Node: Extension summary1035530
+Node: Extension Exercises1039223
+Node: Language History1039945
+Node: V7/SVR3.11041588
+Node: SVR41043908
+Node: POSIX1045350
+Node: BTL1046736
+Node: POSIX/GNU1047470
+Node: Feature History1053246
+Node: Common Extensions1066337
+Node: Ranges and Locales1067649
+Ref: Ranges and Locales-Footnote-11072266
+Ref: Ranges and Locales-Footnote-21072293
+Ref: Ranges and Locales-Footnote-31072527
+Node: Contributors1072748
+Node: History summary1078173
+Node: Installation1079542
+Node: Gawk Distribution1080493
+Node: Getting1080977
+Node: Extracting1081801
+Node: Distribution contents1083443
+Node: Unix Installation1089213
+Node: Quick Installation1089830
+Node: Additional Configuration Options1092272
+Node: Configuration Philosophy1094010
+Node: Non-Unix Installation1096361
+Node: PC Installation1096819
+Node: PC Binary Installation1098130
+Node: PC Compiling1099978
+Ref: PC Compiling-Footnote-11102977
+Node: PC Testing1103082
+Node: PC Using1104258
+Node: Cygwin1108410
+Node: MSYS1109219
+Node: VMS Installation1109733
+Node: VMS Compilation1110529
+Ref: VMS Compilation-Footnote-11111751
+Node: VMS Dynamic Extensions1111809
+Node: VMS Installation Details1113182
+Node: VMS Running1115434
+Node: VMS GNV1118268
+Node: VMS Old Gawk1118991
+Node: Bugs1119461
+Node: Other Versions1123465
+Node: Installation summary1129692
+Node: Notes1130748
+Node: Compatibility Mode1131613
+Node: Additions1132395
+Node: Accessing The Source1133320
+Node: Adding Code1134756
+Node: New Ports1140934
+Node: Derived Files1145415
+Ref: Derived Files-Footnote-11150496
+Ref: Derived Files-Footnote-21150530
+Ref: Derived Files-Footnote-31151126
+Node: Future Extensions1151240
+Node: Implementation Limitations1151846
+Node: Extension Design1153094
+Node: Old Extension Problems1154248
+Ref: Old Extension Problems-Footnote-11155765
+Node: Extension New Mechanism Goals1155822
+Ref: Extension New Mechanism Goals-Footnote-11159182
+Node: Extension Other Design Decisions1159371
+Node: Extension Future Growth1161477
+Node: Old Extension Mechanism1162313
+Node: Notes summary1164075
+Node: Basic Concepts1165261
+Node: Basic High Level1165942
+Ref: figure-general-flow1166214
+Ref: figure-process-flow1166813
+Ref: Basic High Level-Footnote-11170042
+Node: Basic Data Typing1170227
+Node: Glossary1173555
+Node: Copying1198707
+Node: GNU Free Documentation License1236263
+Node: Index1261399

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 53b159f1..74dd35f8 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -3899,10 +3899,8 @@ No space is allowed between the @option{-o} and @var{file}, if
@var{file} is supplied.
@quotation NOTE
-Due to the way @command{gawk} has evolved, with this option
-your program is still executed. This will change in the
-next major release such that @command{gawk} will only
-pretty-print the program and not run it.
+In the past, this option would also execute your program.
+This is no longer the case.
@end quotation
@item @option{-O}
@@ -4393,11 +4391,6 @@ two regexp matchers that @command{gawk} uses internally. (There aren't
supposed to be differences, but occasionally theory and practice don't
coordinate with each other.)
-@item GAWK_NO_PP_RUN
-If this variable exists, then when invoked with the @option{--pretty-print}
-option, @command{gawk} skips running the program. This variable will
-not survive into the next major release.
-
@item GAWK_STACKSIZE
This specifies the amount by which @command{gawk} should grow its
internal evaluation stack, when needed.
@@ -4971,17 +4964,18 @@ between @samp{0} and @samp{7}. For example, the code for the ASCII ESC
@item \x@var{hh}@dots{}
The hexadecimal value @var{hh}, where @var{hh} stands for a sequence
of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F}
-or @samp{a}--@samp{f}). Like the same construct
-in ISO C, the escape sequence continues until the first nonhexadecimal
-digit is seen. @value{COMMONEXT}
-However, using more than two hexadecimal digits produces
-undefined results. (The @samp{\x} escape sequence is not allowed in
-POSIX @command{awk}.)
+or @samp{a}--@samp{f}). A maximum of two digts are allowed after
+the @samp{\x}. Any further hexadecimal digits are treated as simple
+letters or numbers. @value{COMMONEXT}
@quotation CAUTION
-The next major relase of @command{gawk} will change, such
-that a maximum of two hexadecimal digits following the
-@samp{\x} will be used.
+In ISO C, the escape sequence continues until the first nonhexadecimal
+digit is seen.
+@c FIXME: Add exact version here.
+For many years, @command{gawk} would continue incorporating
+hexadecimal digits into the value until a non-hexadecimal digit
+or the end of the string was encountered.
+However, using more than two hexadecimal digits produces
@end quotation
@cindex @code{\} (backslash), @code{\/} escape sequence
@@ -14624,10 +14618,18 @@ next file is opened.
An associative array containing the values of the environment. The array
indices are the environment variable names; the elements are the values of
the particular environment variables. For example,
-@code{ENVIRON["HOME"]} might be @code{"/home/arnold"}. Changing this array
-does not affect the environment passed on to any programs that
-@command{awk} may spawn via redirection or the @code{system()} function.
-(In a future version of @command{gawk}, it may do so.)
+@code{ENVIRON["HOME"]} might be @code{/home/arnold}.
+
+For POSIX @command{awk}, changing this array does not affect the
+environment passed on to any programs that @command{awk} may spawn via
+redirection or the @code{system()} function.
+
+However, beginning with version 4.2, if not in POSIX
+compatibility mode, @command{gawk} does update its own environment when
+@code{ENVIRON} is changed, thus changing the environment seen by programs
+that it creates. You should therefore be especially careful if you
+modify @code{ENVIRON["PATH"]"}, which is the search path for finding
+executable programs.
Some operating systems may not have environment variables.
On such systems, the @code{ENVIRON} array is empty (except for
@@ -16722,6 +16724,23 @@ You can use @samp{pi = atan2(0, -1)} to retrieve the value of
@cindex cosine
Return the cosine of @var{x}, with @var{x} in radians.
+@item @code{div(@var{numerator}, @var{denominator}, @var{result})}
+@cindexawkfunc{div}
+@cindex div
+Perform integer division, similar to the standard C function of the
+same name. First, truncate @code{numerator} and @code{denominator}
+towards zero, creating integer values. Clear the @code{result}
+array, and then set @code{result["quotient"]} to the result of
+@samp{numerator / denominator}, truncated towards zero to an integer,
+and set @code{result["remainder"]} to the result of @samp{numerator %
+denominator}, truncated towards zero to an integer. This function is
+primarily intended for use with arbitrary length integers; it avoids
+creating MPFR arbitrary precision floating-point values (@pxref{Arbitrary
+Precision Integers}).
+
+This function is a @code{gawk} extension. It is not available in
+compatibility mode (@pxref{Options}).
+
@item @code{exp(@var{x})}
@cindexawkfunc{exp}
@cindex exponent
@@ -27582,8 +27601,8 @@ When called this way, @command{gawk} ``pretty prints'' the program into
@file{awkprof.out}, without any execution counts.
@quotation NOTE
-The @option{--pretty-print} option still runs your program.
-This will change in the next major release.
+Once upon a time, the @option{--pretty-print} option would also run
+your program. This is is no longer the case.
@end quotation
@c ENDOFRANGE awkp
@c ENDOFRANGE proawk
@@ -30624,6 +30643,45 @@ to just use the following:
gawk -M 'BEGIN @{ n = 13; print n % 2 @}'
@end example
+When dividing two arbitrary precision integers with either
+@samp{/} or @samp{%}, the result is typically an arbitrary
+precision floating point value (unless the denominator evenly
+divides into the numerator). In order to do integer division
+or remainder with arbitrary precision integers, use the built-in
+@code{div()} function (@pxref{Numeric Functions}).
+
+You can simulate the @code{div()} function in standard @command{awk}
+using this user-defined function:
+
+@example
+@c file eg/lib/div.awk
+# div --- do integer division
+
+@c endfile
+@ignore
+@c file eg/lib/div.awk
+#
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
+# July, 2014
+
+@c endfile
+
+@end ignore
+@c file eg/lib/div.awk
+function div(numerator, denominator, result, i)
+@{
+ split("", result)
+
+ numerator = int(numerator)
+ denominator = int(denominator)
+ result["quotient"] = int(numerator / denominator)
+ result["remainder"] = int(numerator % denominator)
+
+ return 0.0
+@}
+@c endfile
+@end example
+
@node POSIX Floating Point Problems
@section Standards Versus Existing Practice
@@ -35447,6 +35505,10 @@ and the documentation for @command{gawk} @value{PVERSION} 4.1:
Ultrix
@end itemize
+@item
+@c FIXME: Verify the version here.
+Support for MirBSD was removed at @command{gawk} @value{PVERSION} 4.2.
+
@end itemize
@c XXX ADD MORE STUFF HERE
@@ -36728,6 +36790,8 @@ The generated Info file for
The @command{troff} source for a manual page describing the @command{igawk}
program presented in
@ref{Igawk Program}.
+(Since @command{gawk} can do its own @code{@@include} processing,
+neither @command{igawk} nor @file{igawk.1} are installed.)
@item doc/Makefile.in
The input file used during the configuration process to generate the
@@ -36772,8 +36836,6 @@ source file for this @value{DOCUMENT}. It also contains a @file{Makefile.in} fil
@file{Makefile.am} is used by GNU Automake to create @file{Makefile.in}.
The library functions from
@ref{Library Functions},
-and the @command{igawk} program from
-@ref{Igawk Program},
are included as ready-to-use files in the @command{gawk} distribution.
They are installed as part of the installation process.
The rest of the programs in this @value{DOCUMENT} are available in appropriate
@@ -37819,9 +37881,10 @@ mail at the Internet address noted previously.
If you find bugs in one of the non-Unix ports of @command{gawk}, please send
an electronic mail message to the person who maintains that port. They
-are named in the following list, as well as in the @file{README} file in the @command{gawk}
-distribution. Information in the @file{README} file should be considered
-authoritative if it conflicts with this @value{DOCUMENT}.
+are named in the following list, as well as in the @file{README} file
+in the @command{gawk} distribution. Information in the @file{README}
+file should be considered authoritative if it conflicts with this
+@value{DOCUMENT}.
The people maintaining the non-Unix ports of @command{gawk} are
as follows:
@@ -37849,7 +37912,8 @@ John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net}.
@end multitable
If your bug is also reproducible under Unix, please send a copy of your
-report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email list as well.
+report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email
+list as well.
@c ENDOFRANGE dbugg
@c ENDOFRANGE tblgawb
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index d9846cbe..8091e16c 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -3810,10 +3810,8 @@ No space is allowed between the @option{-o} and @var{file}, if
@var{file} is supplied.
@quotation NOTE
-Due to the way @command{gawk} has evolved, with this option
-your program is still executed. This will change in the
-next major release such that @command{gawk} will only
-pretty-print the program and not run it.
+In the past, this option would also execute your program.
+This is no longer the case.
@end quotation
@item @option{-O}
@@ -4304,11 +4302,6 @@ two regexp matchers that @command{gawk} uses internally. (There aren't
supposed to be differences, but occasionally theory and practice don't
coordinate with each other.)
-@item GAWK_NO_PP_RUN
-If this variable exists, then when invoked with the @option{--pretty-print}
-option, @command{gawk} skips running the program. This variable will
-not survive into the next major release.
-
@item GAWK_STACKSIZE
This specifies the amount by which @command{gawk} should grow its
internal evaluation stack, when needed.
@@ -4882,17 +4875,18 @@ between @samp{0} and @samp{7}. For example, the code for the ASCII ESC
@item \x@var{hh}@dots{}
The hexadecimal value @var{hh}, where @var{hh} stands for a sequence
of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F}
-or @samp{a}--@samp{f}). Like the same construct
-in ISO C, the escape sequence continues until the first nonhexadecimal
-digit is seen. @value{COMMONEXT}
-However, using more than two hexadecimal digits produces
-undefined results. (The @samp{\x} escape sequence is not allowed in
-POSIX @command{awk}.)
+or @samp{a}--@samp{f}). A maximum of two digts are allowed after
+the @samp{\x}. Any further hexadecimal digits are treated as simple
+letters or numbers. @value{COMMONEXT}
@quotation CAUTION
-The next major relase of @command{gawk} will change, such
-that a maximum of two hexadecimal digits following the
-@samp{\x} will be used.
+In ISO C, the escape sequence continues until the first nonhexadecimal
+digit is seen.
+@c FIXME: Add exact version here.
+For many years, @command{gawk} would continue incorporating
+hexadecimal digits into the value until a non-hexadecimal digit
+or the end of the string was encountered.
+However, using more than two hexadecimal digits produces
@end quotation
@cindex @code{\} (backslash), @code{\/} escape sequence
@@ -13958,10 +13952,18 @@ next file is opened.
An associative array containing the values of the environment. The array
indices are the environment variable names; the elements are the values of
the particular environment variables. For example,
-@code{ENVIRON["HOME"]} might be @code{"/home/arnold"}. Changing this array
-does not affect the environment passed on to any programs that
-@command{awk} may spawn via redirection or the @code{system()} function.
-(In a future version of @command{gawk}, it may do so.)
+@code{ENVIRON["HOME"]} might be @code{/home/arnold}.
+
+For POSIX @command{awk}, changing this array does not affect the
+environment passed on to any programs that @command{awk} may spawn via
+redirection or the @code{system()} function.
+
+However, beginning with version 4.2, if not in POSIX
+compatibility mode, @command{gawk} does update its own environment when
+@code{ENVIRON} is changed, thus changing the environment seen by programs
+that it creates. You should therefore be especially careful if you
+modify @code{ENVIRON["PATH"]"}, which is the search path for finding
+executable programs.
Some operating systems may not have environment variables.
On such systems, the @code{ENVIRON} array is empty (except for
@@ -16010,6 +16012,23 @@ You can use @samp{pi = atan2(0, -1)} to retrieve the value of
@cindex cosine
Return the cosine of @var{x}, with @var{x} in radians.
+@item @code{div(@var{numerator}, @var{denominator}, @var{result})}
+@cindexawkfunc{div}
+@cindex div
+Perform integer division, similar to the standard C function of the
+same name. First, truncate @code{numerator} and @code{denominator}
+towards zero, creating integer values. Clear the @code{result}
+array, and then set @code{result["quotient"]} to the result of
+@samp{numerator / denominator}, truncated towards zero to an integer,
+and set @code{result["remainder"]} to the result of @samp{numerator %
+denominator}, truncated towards zero to an integer. This function is
+primarily intended for use with arbitrary length integers; it avoids
+creating MPFR arbitrary precision floating-point values (@pxref{Arbitrary
+Precision Integers}).
+
+This function is a @code{gawk} extension. It is not available in
+compatibility mode (@pxref{Options}).
+
@item @code{exp(@var{x})}
@cindexawkfunc{exp}
@cindex exponent
@@ -26680,8 +26699,8 @@ When called this way, @command{gawk} ``pretty prints'' the program into
@file{awkprof.out}, without any execution counts.
@quotation NOTE
-The @option{--pretty-print} option still runs your program.
-This will change in the next major release.
+Once upon a time, the @option{--pretty-print} option would also run
+your program. This is is no longer the case.
@end quotation
@c ENDOFRANGE awkp
@c ENDOFRANGE proawk
@@ -29722,6 +29741,45 @@ to just use the following:
gawk -M 'BEGIN @{ n = 13; print n % 2 @}'
@end example
+When dividing two arbitrary precision integers with either
+@samp{/} or @samp{%}, the result is typically an arbitrary
+precision floating point value (unless the denominator evenly
+divides into the numerator). In order to do integer division
+or remainder with arbitrary precision integers, use the built-in
+@code{div()} function (@pxref{Numeric Functions}).
+
+You can simulate the @code{div()} function in standard @command{awk}
+using this user-defined function:
+
+@example
+@c file eg/lib/div.awk
+# div --- do integer division
+
+@c endfile
+@ignore
+@c file eg/lib/div.awk
+#
+# Arnold Robbins, arnold@@skeeve.com, Public Domain
+# July, 2014
+
+@c endfile
+
+@end ignore
+@c file eg/lib/div.awk
+function div(numerator, denominator, result, i)
+@{
+ split("", result)
+
+ numerator = int(numerator)
+ denominator = int(denominator)
+ result["quotient"] = int(numerator / denominator)
+ result["remainder"] = int(numerator % denominator)
+
+ return 0.0
+@}
+@c endfile
+@end example
+
@node POSIX Floating Point Problems
@section Standards Versus Existing Practice
@@ -34545,6 +34603,10 @@ and the documentation for @command{gawk} @value{PVERSION} 4.1:
Ultrix
@end itemize
+@item
+@c FIXME: Verify the version here.
+Support for MirBSD was removed at @command{gawk} @value{PVERSION} 4.2.
+
@end itemize
@c XXX ADD MORE STUFF HERE
@@ -35826,6 +35888,8 @@ The generated Info file for
The @command{troff} source for a manual page describing the @command{igawk}
program presented in
@ref{Igawk Program}.
+(Since @command{gawk} can do its own @code{@@include} processing,
+neither @command{igawk} nor @file{igawk.1} are installed.)
@item doc/Makefile.in
The input file used during the configuration process to generate the
@@ -35870,8 +35934,6 @@ source file for this @value{DOCUMENT}. It also contains a @file{Makefile.in} fil
@file{Makefile.am} is used by GNU Automake to create @file{Makefile.in}.
The library functions from
@ref{Library Functions},
-and the @command{igawk} program from
-@ref{Igawk Program},
are included as ready-to-use files in the @command{gawk} distribution.
They are installed as part of the installation process.
The rest of the programs in this @value{DOCUMENT} are available in appropriate
@@ -36917,9 +36979,10 @@ mail at the Internet address noted previously.
If you find bugs in one of the non-Unix ports of @command{gawk}, please send
an electronic mail message to the person who maintains that port. They
-are named in the following list, as well as in the @file{README} file in the @command{gawk}
-distribution. Information in the @file{README} file should be considered
-authoritative if it conflicts with this @value{DOCUMENT}.
+are named in the following list, as well as in the @file{README} file
+in the @command{gawk} distribution. Information in the @file{README}
+file should be considered authoritative if it conflicts with this
+@value{DOCUMENT}.
The people maintaining the non-Unix ports of @command{gawk} are
as follows:
@@ -36947,7 +37010,8 @@ John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net}.
@end multitable
If your bug is also reproducible under Unix, please send a copy of your
-report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email list as well.
+report to the @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org} email
+list as well.
@c ENDOFRANGE dbugg
@c ENDOFRANGE tblgawb
diff --git a/extension/CMakeLists.txt b/extension/CMakeLists.txt
new file mode 100644
index 00000000..1bb4ceb1
--- /dev/null
+++ b/extension/CMakeLists.txt
@@ -0,0 +1,84 @@
+#
+# extension/CMakeLists.txt --- CMake input file for gawk
+#
+# Copyright (C) 2013
+# the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## process this file with CMake to produce Makefile
+
+# Remove the definition of GAWK because of gawkapi.h.
+remove_definitions(-DGAWK)
+
+MACRO(BuildExtension name sources)
+ add_library (${name} MODULE ${sources} ${ARGN})
+ target_link_libraries(${name} ${EXTRA_LIBS})
+ set_target_properties(${name} PROPERTIES PREFIX "")
+ install(PROGRAMS ${CMAKE_BINARY_DIR}/extension/${name}${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION lib)
+ENDMACRO(BuildExtension)
+
+if (${HAVE_STRUCT_STAT_ST_BLKSIZE})
+ BuildExtension(filefuncs filefuncs.c stack.c gawkfts.c)
+else()
+ message(STATUS "extension filefuncs cannot be built because HAVE_STRUCT_STAT_ST_BLKSIZE is missing")
+endif()
+
+if (HAVE_FNMATCH AND HAVE_FNMATCH_H)
+ BuildExtension(fnmatch fnmatch.c)
+else()
+ message(STATUS "extension fnmatch cannot be built because function fnmatch or fnmatch.h is missing")
+endif()
+
+if (${HAVE_SYS_WAIT_H})
+ BuildExtension(fork fork.c)
+else()
+ message(STATUS "extension fork cannot be built because HAVE_SYS_WAIT_H is missing")
+endif()
+
+if (${HAVE_MKSTEMP})
+ BuildExtension(inplace inplace.c)
+else()
+ message(STATUS "extension inplace cannot be built because HAVE_MKSTEMP is missing")
+endif()
+
+BuildExtension(ordchr ordchr.c)
+
+if (HAVE_DIRENT_H AND HAVE_DIRFD)
+ BuildExtension(readdir readdir.c)
+else()
+ message(STATUS "extension readdir cannot be built because function readdir is missing")
+endif()
+
+BuildExtension(readfile readfile.c)
+
+BuildExtension(revoutput revoutput.c)
+
+if (${HAVE_GETDTABLESIZE})
+ BuildExtension(revtwoway revtwoway.c)
+else()
+ message(STATUS "extension revtwoway cannot be built because function getdtablesize is missing")
+endif()
+
+BuildExtension(rwarray rwarray.c)
+
+BuildExtension(time time.c)
+
+BuildExtension(testext testext.c)
+
diff --git a/main.c b/main.c
index 4ce39ba0..fc87d605 100644
--- a/main.c
+++ b/main.c
@@ -262,17 +262,6 @@ main(int argc, char **argv)
*/
gawk_mb_cur_max = MB_CUR_MAX;
/* Without MBS_SUPPORT, gawk_mb_cur_max is 1. */
-#ifdef LIBC_IS_BORKED
-{
- const char *env_lc;
-
- env_lc = getenv("LC_ALL");
- if (env_lc == NULL)
- env_lc = getenv("LANG");
- if (env_lc != NULL && env_lc[1] == '\0' && tolower(env_lc[0]) == 'c')
- gawk_mb_cur_max = 1;
-}
-#endif
/* init the cache for checking bytes if they're characters */
init_btowc_cache();
@@ -741,9 +730,8 @@ out:
if (do_debug)
debug_prog(code_block);
- else if (do_pretty_print && ! do_debug && getenv("GAWK_NO_PP_RUN") != NULL)
- /* hack to run pretty printer only. need a better solution */
- ;
+ else if (do_pretty_print && ! do_profile)
+ ; /* run pretty printer only. */
else
interpret(code_block);
@@ -1127,6 +1115,10 @@ load_environ()
*/
path_environ("AWKPATH", defpath);
path_environ("AWKLIBPATH", deflibpath);
+
+ /* set up array functions */
+ init_env_array(ENVIRON_node);
+
return ENVIRON_node;
}
diff --git a/mpfr.c b/mpfr.c
index e53af616..758adfb1 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -1188,6 +1188,95 @@ do_mpfr_srand(int nargs)
return res;
}
+/* do_mpfr_div --- do integer division, return quotient and remainder in dest array */
+
+/*
+ * We define the semantics as:
+ * numerator = int(numerator)
+ * denominator = int(denonmator)
+ * quotient = int(numerator / denomator)
+ * remainder = int(numerator % denomator)
+ */
+
+NODE *
+do_mpfr_div(int nargs)
+{
+ NODE *numerator, *denominator, *result;
+ NODE *num, *denom;
+ NODE *quotient, *remainder;
+ NODE *sub, **lhs;
+
+ result = POP_PARAM();
+ if (result->type != Node_var_array)
+ fatal(_("div: third argument is not an array"));
+ assoc_clear(result);
+
+ denominator = POP_SCALAR();
+ numerator = POP_SCALAR();
+
+ if (do_lint) {
+ if ((numerator->flags & (NUMCUR|NUMBER)) == 0)
+ lintwarn(_("div: received non-numeric first argument"));
+ if ((denominator->flags & (NUMCUR|NUMBER)) == 0)
+ lintwarn(_("div: received non-numeric second argument"));
+ }
+
+ (void) force_number(numerator);
+ (void) force_number(denominator);
+
+ /* convert numerator and denominator to integer */
+ if (is_mpg_integer(numerator)) {
+ num = mpg_integer();
+ mpz_set(num->mpg_i, numerator->mpg_i);
+ } else {
+ if (! mpfr_number_p(numerator->mpg_numbr)) {
+ /* [+-]inf or NaN */
+ return numerator;
+ }
+
+ num = mpg_integer();
+ mpfr_get_z(num->mpg_i, numerator->mpg_numbr, MPFR_RNDZ);
+ }
+
+ if (is_mpg_integer(denominator)) {
+ denom = mpg_integer();
+ mpz_set(denom->mpg_i, denominator->mpg_i);
+ } else {
+ if (! mpfr_number_p(denominator->mpg_numbr)) {
+ /* [+-]inf or NaN */
+ return denominator;
+ }
+
+ denom = mpg_integer();
+ mpfr_get_z(denom->mpg_i, denominator->mpg_numbr, MPFR_RNDZ);
+ }
+
+ if (mpz_sgn(denom->mpg_i) == 0)
+ fatal(_("div: division by zero attempted"));
+
+ quotient = mpg_integer();
+ remainder = mpg_integer();
+
+ /* do the division */
+ mpz_tdiv_qr(quotient->mpg_i, remainder->mpg_i, num->mpg_i, denom->mpg_i);
+ unref(num);
+ unref(denom);
+ unref(numerator);
+ unref(denominator);
+
+ sub = make_string("quotient", 8);
+ lhs = assoc_lookup(result, sub);
+ unref(*lhs);
+ *lhs = quotient;
+
+ sub = make_string("remainder", 9);
+ lhs = assoc_lookup(result, sub);
+ unref(*lhs);
+ *lhs = remainder;
+
+ return make_number((AWKNUM) 0.0);
+}
+
/*
* mpg_tofloat --- convert an arbitrary-precision integer operand to
* a float without loss of precision. It is assumed that the
diff --git a/node.c b/node.c
index 1c896342..213b5335 100644
--- a/node.c
+++ b/node.c
@@ -557,9 +557,8 @@ parse_escape(const char **string_ptr)
warning(_("no hex digits in `\\x' escape sequence"));
return ('x');
}
- i = j = 0;
start = *string_ptr;
- for (;; j++) {
+ for (i = j = 0; j < 2; j++) {
/* do outside test to avoid multiple side effects */
c = *(*string_ptr)++;
if (isxdigit(c)) {
diff --git a/pc/config.h b/pc/config.h
index 85389eb2..c5d78a96 100644
--- a/pc/config.h
+++ b/pc/config.h
@@ -423,7 +423,7 @@
#define PACKAGE_NAME "GNU Awk"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "GNU Awk 4.1.1a"
+#define PACKAGE_STRING "GNU Awk 4.1.60"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gawk"
@@ -432,7 +432,7 @@
#define PACKAGE_URL "http://www.gnu.org/software/gawk/"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "4.1.1a"
+#define PACKAGE_VERSION "4.1.60"
/* Define to 1 if *printf supports %F format */
#undef PRINTF_HAS_F_FORMAT
@@ -494,7 +494,7 @@
/* Version number of package */
-#define VERSION "4.1.1a"
+#define VERSION "4.1.60"
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 00000000..cd930077
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1,133 @@
+# Most of this copied from the repository of Stellarium
+# http://sourceforge.net/projects/stellarium/
+
+# Special targets for translations:
+#
+# translations
+# Converts all PO files to GMO files. Note that it does *not* update
+# the PO files or the PO templates -- in fact, these files are never
+# updated automatically.
+#
+# generate-pot
+# Re-creates all POT files unconditionally.
+#
+# update-po
+# Updates all PO files unconditionally. Note that it takes care of
+# updating the POT files.
+#
+# translations-<DOMAIN>
+# generate-pot-<DOMAIN>
+# update-po-<DOMAIN>
+# Same as above, but only affect the files in the corresponding
+# po/<DOMAIN> directory. (DOMAIN is actually the base name of the POT
+# file in the subdirectory, but that should match the directory name
+# anyway.)
+
+ADD_CUSTOM_TARGET(translations)
+ADD_CUSTOM_TARGET(generate-pot)
+ADD_CUSTOM_TARGET(update-po)
+
+# GETTEXT_CREATE_TRANSLATIONS(domain [DEFAULT_TARGET] lang1 ... langN)
+#
+# Creates custom build rules to create and install (G)MO files for the
+# specified languages. If the DEFAULT_TARGET option is used, the
+# translations will also be created when building the default target.
+#
+# "domain" is the translation domain, eg. "gawk". A POT file
+# with the name ${domain}.pot must exist in the directory of the
+# CMakeLists.txt file invoking the macro.
+#
+# This macro also creates the "translations-${domain}" and
+# "update-po-${domain}" targets (see above for an explanation).
+#
+MACRO(GETTEXT_CREATE_TRANSLATIONS _domain _firstLang)
+
+ SET(_gmoFiles)
+ GET_FILENAME_COMPONENT(_absPotFile ${_domain}.pot ABSOLUTE)
+
+ # Update these PO files when building the "update-po-<DOMAIN>" and
+ # "update-po" targets.
+ ADD_CUSTOM_TARGET(update-po-${_domain})
+ ADD_DEPENDENCIES(update-po update-po-${_domain})
+
+ # Make sure the POT file is updated before updating the PO files.
+ ADD_DEPENDENCIES(update-po-${_domain} generate-pot-${_domain})
+
+ SET(_addToAll)
+ IF(${_firstLang} STREQUAL "DEFAULT_TARGET")
+ SET(_addToAll "ALL")
+ SET(_firstLang)
+ ENDIF(${_firstLang} STREQUAL "DEFAULT_TARGET")
+
+ FOREACH (_lang ${ARGN})
+ GET_FILENAME_COMPONENT(_absFile ${_lang}.po ABSOLUTE)
+ FILE(RELATIVE_PATH _relFile ${PROJECT_SOURCE_DIR} ${_absFile})
+ SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
+
+ # Convert a PO file into a GMO file.
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_gmoFile}
+ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
+ DEPENDS ${_absFile}
+ )
+
+ # Update the PO file unconditionally when building the
+ # "update-po-<DOMAIN>" target. Note that to see the file being
+ # processed, we have to run "cmake -E echo", because the
+ # COMMENT is not displayed by cmake...
+ ADD_CUSTOM_COMMAND(
+ TARGET update-po-${_domain}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E echo "** Updating ${_relFile}"
+ COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE}
+ --quiet --update -m --backup=none -s
+ ${_absFile} ${_absPotFile}
+ VERBATIM
+ )
+
+ INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_domain}.mo)
+ SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
+
+ ENDFOREACH (_lang)
+
+ # Create the GMO files when building the "translations-<DOMAIN>" and
+ # "translations" targets.
+ ADD_CUSTOM_TARGET(translations-${_domain} ${_addToAll} DEPENDS ${_gmoFiles})
+ ADD_DEPENDENCIES(translations translations-${_domain})
+
+ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
+
+SET(gawk_DOMAIN gawk)
+SET(gawk_POT ${gawk_DOMAIN}.pot)
+
+file(READ LINGUAS linguas)
+string(REGEX REPLACE "\n" ";" linguas ${linguas})
+GETTEXT_CREATE_TRANSLATIONS(${gawk_DOMAIN} DEFAULT_TARGET ${linguas})
+
+ADD_CUSTOM_TARGET(
+ generate-pot-${gawk_DOMAIN}
+ ${GETTEXT_XGETTEXT_EXECUTABLE}
+ -o ${CMAKE_CURRENT_SOURCE_DIR}/${gawk_POT}
+ -C
+ --keyword=_
+ --keyword=N_
+ --keyword=q_
+ --keyword=translate:2
+ --add-comments=TRANSLATORS:
+ --directory=${CMAKE_BINARY_DIR}
+ --directory=${CMAKE_SOURCE_DIR}
+ --output-dir=${CMAKE_BINARY_DIR}
+ --files-from=${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in
+ --copyright-holder=FSF
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ COMMENT "Generating ${gawk_POT}"
+ VERBATIM
+)
+# TODO: It would be nice to just depend on the exact files in POTFILES.in
+#file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${gawk_POT} UiHeaders)
+#ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} UiHeaders)
+#ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} gawk_UIS_H)
+# Make sure the UI headers are created first.
+ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} StelGuiLib) # ??? FIXME
+# Generate this POT file when building the "generate-pot" target.
+ADD_DEPENDENCIES(generate-pot generate-pot-${gawk_DOMAIN})
diff --git a/po/it.po b/po/it.po
index 68f2d7f0..a5578723 100644
--- a/po/it.po
+++ b/po/it.po
@@ -1,5 +1,5 @@
# Italian messages for GNU Awk
-# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+# Copyright (C) 2002-2014 Free Software Foundation, Inc.
# Antonio Colombo <azc100@gmail.com>.
#
msgid ""
@@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: GNU Awk 4.0.73, API: 0.0\n"
"Report-Msgid-Bugs-To: arnold@skeeve.com\n"
"POT-Creation-Date: 2014-04-08 19:23+0300\n"
-"PO-Revision-Date: 2014-01-15 10:39+0100\n"
+"PO-Revision-Date: 2014-06-14 17:50+0100\n"
"Last-Translator: Antonio Colombo <azc100@gmail.com>\n"
"Language-Team: Italian <it@li.org>\n"
"Language: it\n"
@@ -211,7 +211,7 @@ msgstr "`getline' invalida all'interno della regola `%s'"
#: awkgram.y:1425
msgid "non-redirected `getline' undefined inside END action"
-msgstr "`getline' non re-diretta indefinita dentro `azione' END"
+msgstr "`getline' non ri-diretta indefinita dentro `azione' END"
#: awkgram.y:1444
msgid "old awk does not support multidimensional arrays"
@@ -1141,7 +1141,7 @@ msgstr ""
#: command.y:855
msgid "list [-|+|[filename:]lineno|function|range] - list specified line(s)."
msgstr ""
-"list [-|+|[nome-file:]num_linea|funzione|intervallo] - elenca riga/he "
+"list [-|+|[nome-file:]num_riga|funzione|intervallo] - elenca riga/he "
"richiesta/e."
#: command.y:857
@@ -1229,7 +1229,7 @@ msgid ""
"line or line N within current frame."
msgstr ""
"until [[nome-file:]N|funzione] - esegui finché il programma arriva una "
-"rigadifferente, o alla riga N nell'elemento di stack corrente."
+"riga differente, o alla riga N nell'elemento di stack corrente."
#: command.y:895
msgid "unwatch [N] - remove variable(s) from watch list."
@@ -2615,23 +2615,23 @@ msgstr "chiusura di fd %d (`%s') non riuscita (%s)"
#: io.c:716
msgid "redirection not allowed in sandbox mode"
-msgstr "re-direzione non consentita in modo `sandbox'"
+msgstr "ri-direzione non consentita in modo `sandbox'"
#: io.c:750
#, c-format
msgid "expression in `%s' redirection only has numeric value"
-msgstr "espressione nella re-direzione `%s' ha solo un valore numerico"
+msgstr "espressione nella ri-direzione `%s' ha solo un valore numerico"
#: io.c:756
#, c-format
msgid "expression for `%s' redirection has null string value"
-msgstr "espressione nella re-direzione `%s' ha per valore la stringa nulla"
+msgstr "espressione nella ri-direzione `%s' ha per valore la stringa nulla"
#: io.c:761
#, c-format
msgid "filename `%s' for `%s' redirection may be result of logical expression"
msgstr ""
-"nome-file `%s' per la re-direzione `%s' può essere il risultato di una "
+"nome-file `%s' per la ri-direzione `%s' può essere il risultato di una "
"espressione logica"
#: io.c:809
@@ -2658,12 +2658,12 @@ msgstr ""
#: io.c:986
#, c-format
msgid "can't redirect from `%s' (%s)"
-msgstr "non riesco a re-dirigere da `%s' (%s)"
+msgstr "non riesco a ri-dirigere da `%s' (%s)"
#: io.c:989
#, c-format
msgid "can't redirect to `%s' (%s)"
-msgstr "non riesco a re-dirigere a `%s' (%s)"
+msgstr "non riesco a ri-dirigere a `%s' (%s)"
#: io.c:1040
msgid ""
@@ -2692,12 +2692,12 @@ msgstr "close: `%.*s' non è un file aperto, una `pipe' o un co-processo"
#: io.c:1108
msgid "close of redirection that was never opened"
-msgstr "chiusura di una re-direzione mai aperta"
+msgstr "chiusura di una ri-direzione mai aperta"
#: io.c:1205
#, c-format
msgid "close: redirection `%s' not opened with `|&', second argument ignored"
-msgstr "close: re-direzione `%s' non aperta con `|&', ignoro secondo argomento"
+msgstr "close: ri-direzione `%s' non aperta con `|&', ignoro secondo argomento"
#: io.c:1222
#, c-format
@@ -3313,7 +3313,7 @@ msgstr "%s: argomento #%d con valore negativo %Zd, darà risultati strani"
#: msg.c:68
#, c-format
msgid "cmd. line:"
-msgstr "linea com.:"
+msgstr "riga com.:"
#: node.c:421
msgid "backslash at end of string"
@@ -3427,7 +3427,7 @@ msgstr ""
#: profile.c:1513
#, c-format
msgid "redir2str: unknown redirection type %d"
-msgstr "redir2str: tipo di re-direzione non noto %d"
+msgstr "redir2str: tipo di ri-direzione non noto %d"
#: re.c:607
#, c-format
@@ -3503,5 +3503,3 @@ msgstr "Nessuna espressione regolare precedente"
msgid "can not pop main context"
msgstr "non posso salire più in alto nello stack"
-#~ msgid "range of the form `[%c-%c]' is locale dependent"
-#~ msgstr "intervallo della forma `[%c-%c]' dipende da `locale'"
diff --git a/regcomp.c b/regcomp.c
index d394efa9..1f6d978a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -856,10 +856,6 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
#ifndef _LIBC
char *codeset_name;
#endif
-#if defined(GAWK) && defined(LIBC_IS_BORKED)
- /* Needed for brain damaged systems */
- extern int gawk_mb_cur_max;
-#endif
memset (dfa, '\0', sizeof (re_dfa_t));
@@ -881,11 +877,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
dfa->state_hash_mask = table_size - 1;
-#if defined(GAWK) && defined(LIBC_IS_BORKED)
- dfa->mb_cur_max = gawk_mb_cur_max;
-#else
dfa->mb_cur_max = MB_CUR_MAX;
-#endif
#ifdef _LIBC
if (dfa->mb_cur_max == 6
&& strcmp (_NL_CURRENT (LC_CTYPE, _NL_CTYPE_CODESET_NAME), "UTF-8") == 0)
@@ -910,10 +902,6 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
if (strcasecmp (codeset_name, "UTF-8") == 0
|| strcasecmp (codeset_name, "UTF8") == 0)
dfa->is_utf8 = 1;
-#if defined(GAWK) && defined(LIBC_IS_BORKED)
- if (gawk_mb_cur_max == 1)
- dfa->is_utf8 = 0;
-#endif /* defined(GAWK) && defined(LIBC_IS_BORKED) */
/* We check exhaustively in the loop below if this charset is a
superset of ASCII. */
diff --git a/regex.h b/regex.h
index 56602961..3d26a606 100644
--- a/regex.h
+++ b/regex.h
@@ -470,7 +470,7 @@ typedef struct
#ifdef __USE_GNU
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the `re_syntax_options' variable. */
-extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
+extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
/* Compile the regular expression PATTERN, with length LENGTH
and syntax given by the global `re_syntax_options', into the buffer
@@ -480,14 +480,14 @@ extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
Note that the translate table must either have been initialised by
`regcomp', with a malloc'ed value, or set to NULL before calling
`regfree'. */
-extern const char *re_compile_pattern (const char *__pattern, size_t __length,
- struct re_pattern_buffer *__buffer);
+extern const char *re_compile_pattern (const char *pattern, size_t length,
+ struct re_pattern_buffer *buffer);
/* Compile a fastmap for the compiled pattern in BUFFER; used to
accelerate searches. Return 0 if successful and -2 if was an
internal error. */
-extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
+extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
/* Search in the string STRING (with length LENGTH) for the pattern
@@ -495,30 +495,30 @@ extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
characters. Return the starting position of the match, -1 for no
match, or -2 for an internal error. Also return register
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search (struct re_pattern_buffer *__buffer, const char *__cstring,
- int __length, int __start, int __range,
- struct re_registers *__regs);
+extern int re_search (struct re_pattern_buffer *buffer, const char *c_string,
+ int length, int start, int range,
+ struct re_registers *regs);
/* Like `re_search', but search in the concatenation of STRING1 and
STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2 (struct re_pattern_buffer *__buffer,
- const char *__string1, int __length1,
- const char *__string2, int __length2, int __start,
- int __range, struct re_registers *__regs, int __stop);
+extern int re_search_2 (struct re_pattern_buffer *buffer,
+ const char *string1, int length1,
+ const char *string2, int length2, int start,
+ int range, struct re_registers *regs, int stop);
/* Like `re_search', but return how many characters in STRING the regexp
in BUFFER matched, starting at position START. */
-extern int re_match (struct re_pattern_buffer *__buffer, const char *__cstring,
- int __length, int __start, struct re_registers *__regs);
+extern int re_match (struct re_pattern_buffer *buffer, const char *c_string,
+ int length, int start, struct re_registers *regs);
/* Relates to `re_match' as `re_search_2' relates to `re_search'. */
-extern int re_match_2 (struct re_pattern_buffer *__buffer,
- const char *__string1, int __length1,
- const char *__string2, int __length2, int __start,
- struct re_registers *__regs, int __stop);
+extern int re_match_2 (struct re_pattern_buffer *buffer,
+ const char *string1, int length1,
+ const char *string2, int length2, int start,
+ struct re_registers *regs, int stop);
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
@@ -533,10 +533,10 @@ extern int re_match_2 (struct re_pattern_buffer *__buffer,
Unless this function is called, the first search or match using
PATTERN_BUFFER will allocate its own register data, without
freeing the old data. */
-extern void re_set_registers (struct re_pattern_buffer *__buffer,
- struct re_registers *__regs,
- unsigned int __num_regs,
- regoff_t *__starts, regoff_t *__ends);
+extern void re_set_registers (struct re_pattern_buffer *buffer,
+ struct re_registers *regs,
+ unsigned int num_regs,
+ regoff_t *starts, regoff_t *ends);
#endif /* Use GNU */
#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_MISC)
@@ -569,19 +569,19 @@ extern int re_exec (const char *);
#endif
/* POSIX compatibility. */
-extern int regcomp (regex_t *__restrict __preg,
- const char *__restrict __pattern,
- int __cflags);
+extern int regcomp (regex_t *__restrict preg,
+ const char *__restrict pattern,
+ int cflags);
-extern int regexec (const regex_t *__restrict __preg,
- const char *__restrict __cstring, size_t __nmatch,
- regmatch_t __pmatch[__restrict_arr],
- int __eflags);
+extern int regexec (const regex_t *__restrict preg,
+ const char *__restrict c_string, size_t nmatch,
+ regmatch_t pmatch[__restrict_arr],
+ int eflags);
-extern size_t regerror (int __errcode, const regex_t *__restrict __preg,
- char *__restrict __errbuf, size_t __errbuf_size);
+extern size_t regerror (int errcode, const regex_t *__restrict preg,
+ char *__restrict errbuf, size_t errbuf_size);
-extern void regfree (regex_t *__preg);
+extern void regfree (regex_t *preg);
#ifdef __cplusplus
diff --git a/str_array.c b/str_array.c
index aa82d71b..33c9ddcc 100644
--- a/str_array.c
+++ b/str_array.c
@@ -69,6 +69,25 @@ afunc_t str_array_func[] = {
(afunc_t) 0,
};
+static NODE **env_remove(NODE *symbol, NODE *subs);
+static NODE **env_store(NODE *symbol, NODE *subs);
+static NODE **env_clear(NODE *symbol, NODE *subs);
+
+/* special case for ENVIRON */
+afunc_t env_array_func[] = {
+ str_array_init,
+ (afunc_t) 0,
+ null_length,
+ str_lookup,
+ str_exists,
+ env_clear,
+ env_remove,
+ str_list,
+ str_copy,
+ str_dump,
+ env_store,
+};
+
static inline NODE **str_find(NODE *symbol, NODE *s1, size_t code1, unsigned long hash1);
static void grow_table(NODE *symbol);
@@ -737,3 +756,63 @@ scramble(unsigned long x)
return x;
}
+
+/* env_remove --- for ENVIRON, remove value from real environment */
+
+static NODE **
+env_remove(NODE *symbol, NODE *subs)
+{
+ NODE **val = str_remove(symbol, subs);
+
+ if (val != NULL)
+ (void) unsetenv(subs->stptr);
+
+ return val;
+}
+
+/* env_clear --- clear out the environment when ENVIRON is deleted */
+
+static NODE **
+env_clear(NODE *symbol, NODE *subs)
+{
+ extern char **environ;
+ NODE **val = str_clear(symbol, subs);
+
+ environ = NULL; /* ZAP! */
+
+ /* str_clear zaps the vtable, reset it */
+ symbol->array_funcs = env_array_func;
+
+ return val;
+}
+
+/* env_store --- post assign function for ENVIRON, put new value into env */
+
+static NODE **
+env_store(NODE *symbol, NODE *subs)
+{
+ NODE **val = str_exists(symbol, subs);
+ const char *newval;
+
+ assert(val != NULL);
+
+ newval = (*val)->stptr;
+ if (newval == NULL)
+ newval = "";
+
+ (void) setenv(subs->stptr, newval, 1);
+
+ return val;
+}
+
+/* init_env_array --- set up the pointers for ENVIRON. A bit hacky. */
+
+void
+init_env_array(NODE *env_node)
+{
+ /* If POSIX simply don't reset the vtable and things work as before */
+ if (do_posix)
+ return;
+
+ env_node->array_funcs = env_array_func;
+}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 00000000..fee5eeca
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,90 @@
+#
+# test/CMakeLists.txt --- CMake input file for gawk
+#
+# Copyright (C) 2013
+# the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GAWK is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+
+## process this file with CMake to produce Makefile
+
+if(WIN32)
+ set(SHELL_PREFIX "C:\\MinGW\\msys\\1.0\\bin\\sh")
+endif()
+
+# Find the names of the groups of tests in Makefile.am.
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ALL_GROUPS)
+string(REGEX MATCHALL "[A-Z_]*_TESTS " ALL_GROUPS "${ALL_GROUPS}")
+string(REGEX REPLACE "_TESTS " ";" ALL_GROUPS "${ALL_GROUPS}")
+# For each group of test cases, search through Makefile.am and find the test cases.
+foreach(testgroup ${ALL_GROUPS} )
+ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ONE_GROUP)
+ string(REGEX MATCH "${testgroup}_TESTS = [a-z0-9_ \\\n\t]*" ONE_GROUP "${ONE_GROUP}")
+ string(REGEX REPLACE "${testgroup}_TESTS = " "" ONE_GROUP "${ONE_GROUP}")
+ string(REGEX REPLACE "[\\\n\t]" "" ONE_GROUP "${ONE_GROUP}")
+ string(REGEX REPLACE " " ";" ONE_GROUP "${ONE_GROUP}")
+ # Use each name of a test case to start a script that executes the test case.
+ foreach(testcase ${ONE_GROUP} )
+ add_test("${testgroup}.${testcase}" ${SHELL_PREFIX} ${CMAKE_SOURCE_DIR}/cmake/basictest ${CMAKE_BINARY_DIR}/gawk${CMAKE_EXECUTABLE_SUFFIX} ${testcase})
+ endforeach(testcase)
+endforeach(testgroup)
+
+# Create an empty configuration file for customizing test execution.
+set(CTestCustom ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
+file(WRITE ${CTestCustom} "# DO NOT EDIT, THIS FILE WILL BE OVERWRITTEN\n" )
+# Test case SHLIB.filefuncs needs a file named gawkapi.o in source directory.
+file(APPEND ${CTestCustom} "file(COPY ${CMAKE_SOURCE_DIR}/README DESTINATION ${CMAKE_SOURCE_DIR}/gawkapi.o)\n")
+# Exclude test cases from execution that make no sense on a certain platform.
+file(APPEND ${CTestCustom} "set(CTEST_CUSTOM_TESTS_IGNORE\n")
+if(WIN32)
+ file(APPEND ${CTestCustom} " BASIC.exitval2\n")
+ file(APPEND ${CTestCustom} " BASIC.hsprint\n")
+ file(APPEND ${CTestCustom} " BASIC.rstest4\n")
+ file(APPEND ${CTestCustom} " BASIC.rstest5\n")
+ file(APPEND ${CTestCustom} " UNIX.getlnhd\n")
+ file(APPEND ${CTestCustom} " UNIX.pid\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.beginfile1\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.beginfile2\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.clos1way\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.devfd\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.devfd1\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.devfd2\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.getlndir\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.posix\n")
+ file(APPEND ${CTestCustom} " GAWK_EXT.pty1\n")
+ file(APPEND ${CTestCustom} " INET.inetdayu\n")
+ file(APPEND ${CTestCustom} " INET.inetdayt\n")
+ file(APPEND ${CTestCustom} " INET.inetechu\n")
+ file(APPEND ${CTestCustom} " INET.inetecht\n")
+ file(APPEND ${CTestCustom} " MACHINE.double2\n")
+ file(APPEND ${CTestCustom} " LOCALE_CHARSET.fmttest\n")
+ file(APPEND ${CTestCustom} " LOCALE_CHARSET.lc_num1\n")
+ file(APPEND ${CTestCustom} " LOCALE_CHARSET.mbfw1\n")
+ file(APPEND ${CTestCustom} " SHLIB.filefuncs\n")
+ file(APPEND ${CTestCustom} " SHLIB.fnmatch\n")
+ file(APPEND ${CTestCustom} " SHLIB.fork\n")
+ file(APPEND ${CTestCustom} " SHLIB.fork2\n")
+ file(APPEND ${CTestCustom} " SHLIB.fts\n")
+ file(APPEND ${CTestCustom} " SHLIB.functab4\n")
+ file(APPEND ${CTestCustom} " SHLIB.readdir\n")
+ file(APPEND ${CTestCustom} " SHLIB.revtwoway\n")
+ file(APPEND ${CTestCustom} " SHLIB.rwarray\n")
+endif()
+file(APPEND ${CTestCustom} ")\n")
+
diff --git a/test/ChangeLog b/test/ChangeLog
index ba9bef3b..8f8c9c31 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -27,6 +27,11 @@
* printhuge.awk, printhuge.ok: New files.
Test from mail.green.fox@gmail.com.
+2014-06-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (profile1, profile4, profile5): Adjust for change to
+ --pretty-print option.
+
2014-06-19 Michael Forney <forney@google.com>
* Makefile.am (poundbang): Fix relative path of AWKPROG.
@@ -243,6 +248,12 @@
* Makefile.am (badassign1): New test.
* badassign1.awk, badassign1.ok: New files.
+2013-09-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makfile.am (randtest): New test.
+ * randtest.sh, randtest.ok: New files.
+ * rand.ok: Updated to reflect new results based on code change.
+
2013-09-13 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am: Fix quoting for generation of Maketests file so
diff --git a/test/Makefile.am b/test/Makefile.am
index ede44523..f28b381e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -711,6 +711,8 @@ EXTRA_DIST = \
rand-mpfr.ok \
rand.awk \
rand.ok \
+ randtest.sh \
+ randtest.ok \
range1.awk \
range1.in \
range1.ok \
@@ -985,7 +987,7 @@ BASIC_TESTS = \
paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
prt1eval prtoeval \
- rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \
+ rand randtest range1 rebt8b1 redfilnm regeq regexprange regrange reindops \
reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
rstest3 rstest4 rstest5 rswhite \
scalar sclforin sclifin sortempty splitargv splitarr splitdef \
@@ -1663,10 +1665,11 @@ dumpvars::
profile1:
@echo $@
- @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1
+ @$(AWK) -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1
+ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk
@$(AWK) -f ap-$@.out "$(srcdir)"/dtdgport.awk > _$@.out2 ; rm ap-$@.out
@$(CMP) _$@.out1 _$@.out2 && rm _$@.out[12] || { echo EXIT CODE: $$? >>_$@ ; \
- cp "$(srcdir)"/dtdgport.awk > $@.ok ; }
+ cp "$(srcdir)"/dtdgport.awk $@.ok ; }
profile2:
@@ -1683,13 +1686,13 @@ profile3:
profile4:
@echo $@
- @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
+ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
@sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
profile5:
@echo $@
- @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
+ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
@sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -1932,6 +1935,12 @@ dfamb1:
AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+randtest::
+ @echo $@
+ @GAWK="$(AWKPROG)" "$(srcdir)"/randtest.sh >_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backbigs1:
@echo $@
@[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
diff --git a/test/Makefile.in b/test/Makefile.in
index 196e125c..f3b537f3 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -957,6 +957,8 @@ EXTRA_DIST = \
rand-mpfr.ok \
rand.awk \
rand.ok \
+ randtest.sh \
+ randtest.ok \
range1.awk \
range1.in \
range1.ok \
@@ -1230,7 +1232,7 @@ BASIC_TESTS = \
paramdup paramres paramtyp paramuninitglobal parse1 parsefld parseme \
pcntplus posix2008sub prdupval prec printf0 printf1 prmarscl prmreuse \
prt1eval prtoeval \
- rand range1 rebt8b1 redfilnm regeq regexprange regrange reindops \
+ rand randtest range1 rebt8b1 redfilnm regeq regexprange regrange reindops \
reparse resplit rri1 rs rsnul1nl rsnulbig rsnulbig2 rstest1 rstest2 \
rstest3 rstest4 rstest5 rswhite \
scalar sclforin sclifin sortempty splitargv splitarr splitdef \
@@ -2088,10 +2090,11 @@ dumpvars::
profile1:
@echo $@
- @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1
+ @$(AWK) -f "$(srcdir)"/xref.awk "$(srcdir)"/dtdgport.awk > _$@.out1
+ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/xref.awk
@$(AWK) -f ap-$@.out "$(srcdir)"/dtdgport.awk > _$@.out2 ; rm ap-$@.out
@$(CMP) _$@.out1 _$@.out2 && rm _$@.out[12] || { echo EXIT CODE: $$? >>_$@ ; \
- cp "$(srcdir)"/dtdgport.awk > $@.ok ; }
+ cp "$(srcdir)"/dtdgport.awk $@.ok ; }
profile2:
@echo $@
@@ -2107,13 +2110,13 @@ profile3:
profile4:
@echo $@
- @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
+ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
@sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
profile5:
@echo $@
- @GAWK_NO_PP_RUN=1 $(AWK) --profile=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
+ @$(AWK) --pretty-print=ap-$@.out -f "$(srcdir)"/$@.awk > /dev/null
@sed 1,2d < ap-$@.out > _$@; rm ap-$@.out
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -2356,6 +2359,11 @@ dfamb1:
AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+randtest::
+ @echo $@
+ @GAWK="$(AWKPROG)" "$(srcdir)"/randtest.sh >_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backbigs1:
@echo $@
@[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
diff --git a/test/rand.ok b/test/rand.ok
index 60432b95..1df4ba39 100644
--- a/test/rand.ok
+++ b/test/rand.ok
@@ -1 +1 @@
- 62 67 88 6 35 77 3 68 30 96 90 26 35 8 88 93 49 53 37
+ 67 6 77 68 96 26 8 93 53 74 53 95 78 74 96 77 33 58 91
diff --git a/test/randtest.ok b/test/randtest.ok
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/randtest.ok
diff --git a/test/randtest.sh b/test/randtest.sh
new file mode 100755
index 00000000..b17fda73
--- /dev/null
+++ b/test/randtest.sh
@@ -0,0 +1,113 @@
+# THIS PURPOSELY DOES NOT HAVE A !# LINE !!!!
+#
+# Date: Mon, 9 Sep 2013 14:49:43 -0700
+# From: Bob Jewett <jewett@bill.scs.agilent.com>
+# Message-Id: <201309092149.r89Lnh94010909@bill.scs.agilent.com>
+# To: arnold@skeeve.com
+# Subject: Re: [bug-gawk] Bug in random() in builtin.c
+#
+# Hi Arnold,
+#
+# Attached below is a script that tests gawk for this particular
+# rand() problem. The pair-wise combinations show a strong
+# autocorrelation for a delay of 31 pairs of rand() samples.
+#
+# The script prints out the measured autocorrelation for a record
+# of NSAMPLES pairs. It also prints a fail message at the end if
+# it fails.
+#
+# If you want to see the autocorrelation values, there is a print
+# statement that if uncommented will save them to a file.
+#
+# Please let me know if the mailer screws up the transfer or
+# if you have any questions about the test.
+#
+# Best regards,
+# Bob
+#
+# -------------- test_pair_power_autocorrelation -----------------------
+#
+#!/bin/ksh
+
+#GAWK=/bin/gawk
+
+# ADR: Get GAWK from the environment.
+# Additional note: This wants ksh/bash for the use of $RANDOM below to
+# seed the generator. However, shells that don't provide it won't be
+# a problem since gawk will then seed the generator with the time of day,
+# as srand() will be called without an argument.
+
+# large NSAMPLES and NRUNS will bring any correlation out of the noise better
+NSAMPLES=1024; MAX_ALLOWED_SIGMA=5; NRUNS=50;
+
+$GAWK 'BEGIN{
+ srand('$RANDOM');
+ nsamples=('$NSAMPLES');
+ max_allowed_sigma=('$MAX_ALLOWED_SIGMA');
+ nruns=('$NRUNS');
+ for(tau=0;tau<nsamples/2;tau++) corr[tau]=0;
+
+ for(run=0;run<nruns;run++) {
+ sum=0;
+
+ # Fill an array with a sequence of samples that are a
+ # function of pairs of rand() values.
+
+ for(i=0;i<nsamples;i++) {
+ samp[i]=((rand()-0.5)*(rand()-0.5))^2;
+ sum=sum+samp[i];
+ }
+
+ # Subtract off the mean of the sequence:
+
+ mean=sum/nsamples;
+ for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
+
+ # Calculate an autocorrelation function on the sequence.
+ # Because the values of rand() should be independent, there
+ # should be no peaks in the autocorrelation.
+
+ for(tau=0;tau<nsamples/2;tau++) {
+ sum=0;
+ for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
+ corr[tau]=corr[tau]+sum;
+ }
+
+ }
+ # Normalize the autocorrelation to the tau=0 value.
+
+ max_corr=corr[0];
+ for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
+
+ # OPTIONALLY Print out the autocorrelation values:
+
+ # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
+
+ # Calculate the sigma for the non-zero tau values:
+
+ power_sum=0;
+
+ for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
+
+ sigma=sqrt(power_sum/(nsamples/2-1));
+
+ # See if any of the correlations exceed a reasonable number of sigma:
+
+ passed=1;
+ for(tau=1;tau<nsamples/2;tau++) {
+ if ( abs(corr[tau])/sigma > max_allowed_sigma ) {
+ print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
+ passed=0;
+ }
+ }
+ if(!passed) {
+ print "Test failed."
+ exit(1);
+ }
+ else exit (0);
+ }
+
+function abs(abs_input) { return(sqrt(abs_input^2)) ; }
+'
+
+exit 0