gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. 0b4ff99fec136012af7a54f


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. 0b4ff99fec136012af7a54f179bdf601e55e6274
Date: Sun, 26 Aug 2012 18:53:00 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, master has been updated
       via  0b4ff99fec136012af7a54f179bdf601e55e6274 (commit)
       via  8e34526a147a2e07c08c950b9f28c2e2132b6fd3 (commit)
       via  439d946a0e936267f7f478b22d0754e882bf7cf0 (commit)
       via  5cc7f618cb125b389538db5a75e1f0de33139f9b (commit)
       via  b49f18335837eed25c1ef823d2ccb88c8c3b9e97 (commit)
      from  3c09996d7efa635947c357efb3ccc5ed05b1ea31 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0b4ff99fec136012af7a54f179bdf601e55e6274

commit 0b4ff99fec136012af7a54f179bdf601e55e6274
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Aug 26 21:52:12 2012 +0300

    Use config.h properly. Add AC_SYS_LARGEFILE.

diff --git a/extension/ChangeLog b/extension/ChangeLog
index be3cf08..74ad26a 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,11 @@
+2012-08-26         Arnold D. Robbins     <address@hidden>
+
+       * configure.ac (AC_SYS_LARGEFILE): Added. Needed for consistency
+       with gawk, to get the same size struct stat everywhere.
+       * filefuncs.c, fnmatch.c, fork.c, ordchr.c, readdir.c, readfile.c,
+       revoutput.c, revtwoway.c, rwarray.c, rwarray0.c, testext.c,
+       time.c: Move include of config.h to top (or add it!)
+
 2012-08-24         Arnold D. Robbins     <address@hidden>
 
        * filefuncs.c, fnmatch.c, fork.c, ordchr.c, readdir.c, readfile.c,
diff --git a/extension/configh.in b/extension/configh.in
index 571b7a7..e621a13 100644
--- a/extension/configh.in
+++ b/extension/configh.in
@@ -128,6 +128,17 @@
 /* Version number of package */
 #undef VERSION
 
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
 /* Define to `__inline__' or `__inline' if that's what the C compiler
    calls it, or to nothing if 'inline' is not supported under any name.  */
 #ifndef __cplusplus
diff --git a/extension/configure b/extension/configure
index 7030c8b..632c0d7 100755
--- a/extension/configure
+++ b/extension/configure
@@ -771,6 +771,7 @@ with_gnu_ld
 enable_rpath
 with_libiconv_prefix
 with_libintl_prefix
+enable_largefile
 enable_static
 enable_shared
 with_pic
@@ -1411,6 +1412,7 @@ Optional Features:
   --disable-dependency-tracking
                           speeds up one-time build
   --disable-rpath         do not hardcode runtime library paths
+  --disable-largefile     omit support for large files
   --enable-static[=PKGS]  build static libraries [default=no]
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -6257,6 +6259,206 @@ unknown)
   ;;
 esac
 
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then :
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler 
options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... 
" >&6; }
+if ${ac_cv_sys_largefile_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+        # IRIX 6.2 and later do not support large files by default,
+        # so use the C compiler's -n32 option if that helps.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+        if ac_fn_c_try_compile "$LINENO"; then :
+  break
+fi
+rm -f core conftest.err conftest.$ac_objext
+        CC="$CC -n32"
+        if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_largefile_CC=' -n32'; break
+fi
+rm -f core conftest.err conftest.$ac_objext
+        break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS 
value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " 
>&6; }
+if ${ac_cv_sys_file_offset_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_file_offset_bits=64; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" 
>&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value 
needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if ${ac_cv_sys_large_files+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_sys_large_files=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
+  break
+done
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+  fi
+
+
+fi
+
 # Check whether --enable-static was given.
 if test "${enable_static+set}" = set; then :
   enableval=$enable_static; p=${PACKAGE-default}
diff --git a/extension/configure.ac b/extension/configure.ac
index 4869584..9a3ddd9 100644
--- a/extension/configure.ac
+++ b/extension/configure.ac
@@ -37,6 +37,7 @@ AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.18.1])
 
 AM_PROG_AR
+AC_SYS_LARGEFILE
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 dnl AC_PROG_INSTALL
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 9f49870..89eaffc 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -30,6 +30,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
@@ -40,7 +44,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "config.h"
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/fnmatch.c b/extension/fnmatch.c
index 6a4d463..727c9da 100644
--- a/extension/fnmatch.c
+++ b/extension/fnmatch.c
@@ -27,16 +27,18 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
-#include <assert.h>
-#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "config.h"
+
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/fork.c b/extension/fork.c
index 9f9fc08..6f96e4b 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -26,6 +26,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
@@ -36,7 +40,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "config.h"
+
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/ordchr.c b/extension/ordchr.c
index 5abb623..7e3eda5 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -29,16 +29,19 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
-#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "config.h"
+
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/readdir.c b/extension/readdir.c
index 6ce7bea..220d172 100644
--- a/extension/readdir.c
+++ b/extension/readdir.c
@@ -27,9 +27,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #define _BSD_SOURCE
 #include <stdio.h>
-#include <assert.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -38,8 +41,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "config.h"
-
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
 #else
diff --git a/extension/readfile.c b/extension/readfile.c
index 5abb576..7d5f78a 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -31,6 +31,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
@@ -41,7 +45,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "config.h"
+
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/revoutput.c b/extension/revoutput.c
index bb195a2..7430e61 100644
--- a/extension/revoutput.c
+++ b/extension/revoutput.c
@@ -27,6 +27,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -35,8 +39,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "config.h"
-
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/revtwoway.c b/extension/revtwoway.c
index 9ce0c73..0c1d9b0 100644
--- a/extension/revtwoway.c
+++ b/extension/revtwoway.c
@@ -27,9 +27,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
-#include <assert.h>
-#include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -37,8 +39,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "config.h"
-
 #include "gawkapi.h"
 
 #include "gettext.h"
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 371078e..d8a54fd 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -27,6 +27,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
diff --git a/extension/rwarray0.c b/extension/rwarray0.c
index c511ce0..c50c6a3 100644
--- a/extension/rwarray0.c
+++ b/extension/rwarray0.c
@@ -27,6 +27,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
diff --git a/extension/testext.c b/extension/testext.c
index d0215d9..bb62fa0 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -24,6 +24,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
@@ -34,7 +38,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "config.h"
 #include "gawkapi.h"
 
 static const gawk_api_t *api;  /* for convenience macros to work */
diff --git a/extension/time.c b/extension/time.c
index 24c7572..89811c4 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -25,6 +25,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <assert.h>
 #include <errno.h>
@@ -34,7 +38,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
-#include "config.h"
+
 #include "gawkapi.h"
 
 #include "gettext.h"

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=8e34526a147a2e07c08c950b9f28c2e2132b6fd3

commit 8e34526a147a2e07c08c950b9f28c2e2132b6fd3
Merge: 3c09996 439d946
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Aug 26 21:49:01 2012 +0300

    Merge branch 'gawk-4.0-stable'

diff --cc command.c
index 2872228,529a195..5334978
--- a/command.c
+++ b/command.c
@@@ -1,8 -1,8 +1,8 @@@
--/* A Bison parser, made by GNU Bison 2.5.  */
++/* A Bison parser, made by GNU Bison 2.6.2.  */
  
  /* Bison implementation for Yacc-like parsers in C
     
--      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
++      Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
     
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@@ -44,7 -44,7 +44,7 @@@
  #define YYBISON 1
  
  /* Bison version.  */
--#define YYBISON_VERSION "2.5"
++#define YYBISON_VERSION "2.6.2"
  
  /* Skeleton name.  */
  #define YYSKELETON_NAME "yacc.c"
@@@ -58,8 -58,8 +58,6 @@@
  /* Pull parsers.  */
  #define YYPULL 1
  
--/* Using locations.  */
--#define YYLSP_NEEDED 0
  
  /* Substitute the variable and function names.  */
  #define yyparse         zzparse
@@@ -70,10 -70,10 +68,8 @@@
  #define yydebug         zzdebug
  #define yynerrs         zznerrs
  
--
  /* Copy the first part of user declarations.  */
--
--/* Line 268 of yacc.c  */
++/* Line 336 of yacc.c  */
  #line 26 "command.y"
  
  #include "awk.h"
@@@ -141,14 -141,14 +137,16 @@@ static void append_cmdarg(CMDARG *arg)
  static int find_argument(CMDARG *arg);
  #define YYSTYPE CMDARG *
  
++/* Line 336 of yacc.c  */
++#line 142 "command.c"
  
--/* Line 268 of yacc.c  */
--#line 147 "command.c"
--
--/* Enabling traces.  */
--#ifndef YYDEBUG
--# define YYDEBUG 0
--#endif
++# ifndef YY_NULL
++#  if defined __cplusplus && 201103L <= __cplusplus
++#   define YY_NULL nullptr
++#  else
++#   define YY_NULL 0
++#  endif
++# endif
  
  /* Enabling verbose error messages.  */
  #ifdef YYERROR_VERBOSE
@@@ -158,11 -158,11 +156,17 @@@
  # define YYERROR_VERBOSE 0
  #endif
  
--/* Enabling the token table.  */
--#ifndef YYTOKEN_TABLE
--# define YYTOKEN_TABLE 0
++/* In a future release of Bison, this section will be replaced
++   by #include "".  */
++#ifndef ZZ_
++# define ZZ_
++/* Enabling traces.  */
++#ifndef YYDEBUG
++# define YYDEBUG 0
++#endif
++#if YYDEBUG
++extern int zzdebug;
  #endif
--
  
  /* Tokens.  */
  #ifndef YYTOKENTYPE
@@@ -268,7 -268,7 +272,6 @@@
  
  
  
--
  #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
  typedef int YYSTYPE;
  # define YYSTYPE_IS_TRIVIAL 1
@@@ -276,12 -276,12 +279,28 @@@
  # define YYSTYPE_IS_DECLARED 1
  #endif
  
++extern YYSTYPE zzlval;
  
--/* Copy the second part of user declarations.  */
++#ifdef YYPARSE_PARAM
++#if defined __STDC__ || defined __cplusplus
++int zzparse (void *YYPARSE_PARAM);
++#else
++int zzparse ();
++#endif
++#else /* ! YYPARSE_PARAM */
++#if defined __STDC__ || defined __cplusplus
++int zzparse (void);
++#else
++int zzparse ();
++#endif
++#endif /* ! YYPARSE_PARAM */
  
++#endif /* !ZZ_  */
  
--/* Line 343 of yacc.c  */
--#line 285 "command.c"
++/* Copy the second part of user declarations.  */
++
++/* Line 353 of yacc.c  */
++#line 304 "command.c"
  
  #ifdef short
  # undef short
@@@ -386,6 -386,6 +405,7 @@@ YYID (yyi
  #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || 
defined __C99__FUNC__ \
       || defined __cplusplus || defined _MSC_VER)
  #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
++      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
  #     ifndef EXIT_SUCCESS
  #      define EXIT_SUCCESS 0
  #     endif
@@@ -475,20 -475,20 +495,20 @@@ union yyallo
  #endif
  
  #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
--/* Copy COUNT objects from FROM to TO.  The source and destination do
++/* Copy COUNT objects from SRC to DST.  The source and destination do
     not overlap.  */
  # ifndef YYCOPY
  #  if defined __GNUC__ && 1 < __GNUC__
--#   define YYCOPY(To, From, Count) \
--      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
++#   define YYCOPY(Dst, Src, Count) \
++      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
  #  else
--#   define YYCOPY(To, From, Count)            \
--      do                                      \
--      {                                       \
--        YYSIZE_T yyi;                         \
--        for (yyi = 0; yyi < (Count); yyi++)   \
--          (To)[yyi] = (From)[yyi];            \
--      }                                       \
++#   define YYCOPY(Dst, Src, Count)              \
++      do                                        \
++        {                                       \
++          YYSIZE_T yyi;                         \
++          for (yyi = 0; yyi < (Count); yyi++)   \
++            (Dst)[yyi] = (Src)[yyi];            \
++        }                                       \
        while (YYID (0))
  #  endif
  # endif
@@@ -640,7 -640,7 +660,7 @@@ static const yytype_uint16 yyrline[] 
  };
  #endif
  
--#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
++#if YYDEBUG || YYERROR_VERBOSE || 0
  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
     First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
  static const char *const yytname[] =
@@@ -664,7 -664,7 +684,7 @@@
    "printf_args", "list_args", "integer_range", "opt_integer_list",
    "integer_list", "exp_list", "subscript", "subscript_list", "variable",
    "node", "opt_plus_integer", "opt_integer", "plus_integer", "integer",
--  "nls", 0
++  "nls", YY_NULL
  };
  #endif
  
@@@ -916,17 -916,17 +936,18 @@@ static const yytype_uint8 yystos[] 
  
  #define YYRECOVERING()  (!!yyerrstatus)
  
--#define YYBACKUP(Token, Value)                                        \
--do                                                            \
--  if (yychar == YYEMPTY && yylen == 1)                                \
--    {                                                         \
--      yychar = (Token);                                               \
--      yylval = (Value);                                               \
--      YYPOPSTACK (1);                                         \
--      goto yybackup;                                          \
--    }                                                         \
--  else                                                                \
--    {                                                         \
++#define YYBACKUP(Token, Value)                                  \
++do                                                              \
++  if (yychar == YYEMPTY)                                        \
++    {                                                           \
++      yychar = (Token);                                         \
++      yylval = (Value);                                         \
++      YYPOPSTACK (yylen);                                       \
++      yystate = *yyssp;                                         \
++      goto yybackup;                                            \
++    }                                                           \
++  else                                                          \
++    {                                                           \
        yyerror (YY_("syntax error: cannot back up")); \
        YYERROR;                                                        \
      }                                                         \
@@@ -936,32 -936,32 +957,33 @@@ while (YYID (0)
  #define YYTERROR      1
  #define YYERRCODE     256
  
--
  /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
     If N is 0, then set CURRENT to the empty location which ends
     the previous symbol: RHS[0] (always defined).  */
  
--#define YYRHSLOC(Rhs, K) ((Rhs)[K])
  #ifndef YYLLOC_DEFAULT
--# define YYLLOC_DEFAULT(Current, Rhs, N)                              \
--    do                                                                        
\
--      if (YYID (N))                                                    \
--      {                                                               \
--        (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
--        (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
--        (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
--        (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
--      }                                                               \
--      else                                                            \
--      {                                                               \
--        (Current).first_line   = (Current).last_line   =              \
--          YYRHSLOC (Rhs, 0).last_line;                                \
--        (Current).first_column = (Current).last_column =              \
--          YYRHSLOC (Rhs, 0).last_column;                              \
--      }                                                               \
++# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
++    do                                                                  \
++      if (YYID (N))                                                     \
++        {                                                               \
++          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
++          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
++          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
++          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
++        }                                                               \
++      else                                                              \
++        {                                                               \
++          (Current).first_line   = (Current).last_line   =              \
++            YYRHSLOC (Rhs, 0).last_line;                                \
++          (Current).first_column = (Current).last_column =              \
++            YYRHSLOC (Rhs, 0).last_column;                              \
++        }                                                               \
      while (YYID (0))
  #endif
  
++#define YYRHSLOC(Rhs, K) ((Rhs)[K])
++
++
  
  /* This macro is provided for backward compatibility. */
  
@@@ -1020,6 -1020,6 +1042,8 @@@ yy_symbol_value_print (yyoutput, yytype
      YYSTYPE const * const yyvaluep;
  #endif
  {
++  FILE *yyo = yyoutput;
++  YYUSE (yyo);
    if (!yyvaluep)
      return;
  # ifdef YYPRINT
@@@ -1266,12 -1266,12 +1290,12 @@@ static in
  yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                  yytype_int16 *yyssp, int yytoken)
  {
--  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
++  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
    YYSIZE_T yysize = yysize0;
    YYSIZE_T yysize1;
    enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
    /* Internationalized format string. */
--  const char *yyformat = 0;
++  const char *yyformat = YY_NULL;
    /* Arguments of yyformat. */
    char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
    /* Number of reported tokens (one for the "unexpected", one per
@@@ -1331,7 -1331,7 +1355,7 @@@
                      break;
                    }
                  yyarg[yycount++] = yytname[yyx];
--                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
++                yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
                  if (! (yysize <= yysize1
                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                    return 2;
@@@ -1422,20 -1422,20 +1446,6 @@@ yydestruct (yymsg, yytype, yyvaluep
  }
  
  
--/* Prevent warnings from -Wmissing-prototypes.  */
--#ifdef YYPARSE_PARAM
--#if defined __STDC__ || defined __cplusplus
--int yyparse (void *YYPARSE_PARAM);
--#else
--int yyparse ();
--#endif
--#else /* ! YYPARSE_PARAM */
--#if defined __STDC__ || defined __cplusplus
--int yyparse (void);
--#else
--int yyparse ();
--#endif
--#endif /* ! YYPARSE_PARAM */
  
  
  /* The lookahead symbol.  */
@@@ -1480,7 -1480,7 +1490,7 @@@ yyparse (
         `yyss': related to states.
         `yyvs': related to semantic values.
  
--       Refer to the stacks thru separate pointers, to allow yyoverflow
++       Refer to the stacks through separate pointers, to allow yyoverflow
         to reallocate them elsewhere.  */
  
      /* The state stack.  */
@@@ -1534,7 -1534,7 +1544,6 @@@
       The wasted elements are never initialized.  */
    yyssp = yyss;
    yyvsp = yyvs;
--
    goto yysetstate;
  
  /*------------------------------------------------------------.
@@@ -1712,8 -1712,8 +1721,7 @@@ yyreduce
    switch (yyn)
      {
          case 3:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 109 "command.y"
      {
                cmd_idx = -1;
@@@ -1732,8 -1732,8 +1740,7 @@@
      break;
  
    case 5:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 128 "command.y"
      {
                if (errcount == 0 && cmd_idx >= 0) {
@@@ -1787,8 -1787,8 +1794,7 @@@
      break;
  
    case 6:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 178 "command.y"
      {
                yyerrok;
@@@ -1796,15 -1796,15 +1802,13 @@@
      break;
  
    case 22:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 212 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 23:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 217 "command.y"
      {
                if (errcount == 0) {
@@@ -1824,8 -1824,8 +1828,7 @@@
      break;
  
    case 24:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 236 "command.y"
      {
                (yyval) = append_statement(arg_list, (char *) start_EVAL);
@@@ -1837,15 -1837,15 +1840,13 @@@
      break;
  
    case 25:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 243 "command.y"
      { (yyval) = append_statement((yyvsp[(1) - (2)]), lexptr_begin); }
      break;
  
    case 26:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 244 "command.y"
      {
                (yyval) = (yyvsp[(3) - (4)]);
@@@ -1853,8 -1853,8 +1854,7 @@@
      break;
  
    case 27:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 251 "command.y"
      {
                arg_list = append_statement((yyvsp[(2) - (3)]), (char *) 
end_EVAL);
@@@ -1874,8 -1874,8 +1874,7 @@@
      break;
  
    case 28:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 267 "command.y"
      {
                NODE *n;
@@@ -1890,8 -1890,8 +1889,7 @@@
      break;
  
    case 34:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 286 "command.y"
      {
                if (cmdtab[cmd_idx].class == D_FRAME
@@@ -1901,8 -1901,8 +1899,7 @@@
      break;
  
    case 35:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 292 "command.y"
      {
                int idx = find_argument((yyvsp[(2) - (2)]));
@@@ -1918,50 -1918,50 +1915,43 @@@
      break;
  
    case 38:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 305 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 40:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 306 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 46:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 311 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 49:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 313 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 51:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 314 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 53:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 315 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 57:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 319 "command.y"
      {
                if (in_cmd_src((yyvsp[(2) - (2)])->a_string))
@@@ -1970,8 -1970,8 +1960,7 @@@
      break;
  
    case 58:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 324 "command.y"
      {
                if (! input_from_tty)
@@@ -1980,8 -1980,8 +1969,7 @@@
      break;
  
    case 59:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 329 "command.y"
      {
                int type = 0;
@@@ -2011,8 -2011,8 +1999,7 @@@
      break;
  
    case 60:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 355 "command.y"
      {
                if (! in_commands)
@@@ -2026,8 -2026,8 +2013,7 @@@
      break;
  
    case 61:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 365 "command.y"
      {
                if (! in_commands)
@@@ -2036,8 -2036,8 +2022,7 @@@
      break;
  
    case 62:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 370 "command.y"
      {
                int idx = find_argument((yyvsp[(2) - (2)]));
@@@ -2053,15 -2053,15 +2038,13 @@@
      break;
  
    case 63:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 381 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 64:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 382 "command.y"
      {
                int type;
@@@ -2073,8 -2073,8 +2056,7 @@@
      break;
  
    case 65:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 390 "command.y"
      {
                if (in_commands) {
@@@ -2089,8 -2089,8 +2071,7 @@@
      break;
  
    case 66:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 404 "command.y"
      {
                if ((yyvsp[(1) - (1)]) != NULL) {
@@@ -2104,43 -2104,43 +2085,37 @@@
      break;
  
    case 68:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 418 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 69:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 423 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 74:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 432 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 75:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 437 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 77:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 440 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 78:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 445 "command.y"
      {
                NODE *n;
@@@ -2151,15 -2151,15 +2126,13 @@@
      break;
  
    case 79:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 455 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 80:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 457 "command.y"
      {
                if (find_option((yyvsp[(1) - (1)])->a_string) < 0)
@@@ -2168,8 -2168,8 +2141,7 @@@
      break;
  
    case 81:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 462 "command.y"
      {
                if (find_option((yyvsp[(1) - (3)])->a_string) < 0)
@@@ -2178,8 -2178,8 +2150,7 @@@
      break;
  
    case 82:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 470 "command.y"
      {
                NODE *n;
@@@ -2196,57 -2196,57 +2167,49 @@@
      break;
  
    case 83:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 486 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 88:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 495 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 89:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 496 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 92:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 498 "command.y"
 -    { want_nodeval = TRUE; }
 +    { want_nodeval = true; }
      break;
  
    case 95:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 504 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 97:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 510 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 99:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 516 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 104:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 528 "command.y"
      {
                int idx = find_argument((yyvsp[(1) - (2)]));
@@@ -2262,8 -2262,8 +2225,7 @@@
      break;
  
    case 106:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 544 "command.y"
      {
                (yyvsp[(2) - (2)])->type = D_array;     /* dump all items */
@@@ -2272,8 -2272,8 +2234,7 @@@
      break;
  
    case 107:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 549 "command.y"
      {
                (yyvsp[(2) - (3)])->type = D_array;
@@@ -2282,22 -2282,22 +2243,19 @@@
      break;
  
    case 117:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 575 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 118:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 577 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 119:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 579 "command.y"
      {
                CMDARG *a;
@@@ -2308,8 -2308,8 +2266,7 @@@
      break;
  
    case 126:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 595 "command.y"
      {
                if ((yyvsp[(1) - (3)])->a_int > (yyvsp[(3) - (3)])->a_int)
@@@ -2322,29 -2322,29 +2279,25 @@@
      break;
  
    case 127:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 607 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 134:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 621 "command.y"
      { (yyval) = (yyvsp[(1) - (1)]); }
      break;
  
    case 135:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 623 "command.y"
      { (yyval) = (yyvsp[(1) - (3)]); }
      break;
  
    case 137:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 629 "command.y"
      {
                CMDARG *a;
@@@ -2363,22 -2363,22 +2316,19 @@@
      break;
  
    case 139:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 648 "command.y"
      { (yyval) = (yyvsp[(1) - (1)]); num_dim = 1; }
      break;
  
    case 140:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 650 "command.y"
      { (yyval) = (yyvsp[(1) - (2)]); num_dim++; }
      break;
  
    case 142:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 656 "command.y"
      {
                NODE *n = (yyvsp[(2) - (2)])->a_node;
@@@ -2391,8 -2391,8 +2341,7 @@@
      break;
  
    case 143:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 665 "command.y"
      {
                /* a_string is array name, a_count is dimension count */
@@@ -2403,15 -2403,15 +2352,13 @@@
      break;
  
    case 144:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 675 "command.y"
      { (yyval) = (yyvsp[(1) - (1)]); }
      break;
  
    case 145:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 677 "command.y"
      { 
                NODE *n = (yyvsp[(2) - (2)])->a_node;
@@@ -2422,8 -2422,8 +2369,7 @@@
      break;
  
    case 146:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 684 "command.y"
      { 
                NODE *n = (yyvsp[(2) - (2)])->a_node;
@@@ -2436,36 -2436,36 +2382,31 @@@
      break;
  
    case 147:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 696 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 148:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 698 "command.y"
      { (yyval) = (yyvsp[(1) - (1)]); }
      break;
  
    case 149:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 703 "command.y"
      { (yyval) = NULL; }
      break;
  
    case 150:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 705 "command.y"
      { (yyval) = (yyvsp[(1) - (1)]); }
      break;
  
    case 151:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 710 "command.y"
      {
                if ((yyvsp[(1) - (1)])->a_int == 0)
@@@ -2475,8 -2475,8 +2416,7 @@@
      break;
  
    case 152:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 716 "command.y"
      {
                if ((yyvsp[(2) - (2)])->a_int == 0)
@@@ -2486,22 -2486,22 +2426,19 @@@
      break;
  
    case 153:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 725 "command.y"
      { (yyval) = (yyvsp[(1) - (1)]); }
      break;
  
    case 154:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 727 "command.y"
      { (yyval) = (yyvsp[(2) - (2)]); }
      break;
  
    case 155:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 729 "command.y"
      {
                (yyvsp[(2) - (2)])->a_int = - (yyvsp[(2) - (2)])->a_int;
@@@ -2510,8 -2510,8 +2447,7 @@@
      break;
  
    case 156:
--
--/* Line 1806 of yacc.c  */
++/* Line 1787 of yacc.c  */
  #line 737 "command.y"
      {
                if (lexptr_begin != NULL) {
@@@ -2524,9 -2524,9 +2460,8 @@@
      break;
  
  
--
--/* Line 1806 of yacc.c  */
--#line 2542 "command.c"
++/* Line 1787 of yacc.c  */
++#line 2477 "command.c"
        default: break;
      }
    /* User semantic actions sometimes alter yychar, and that requires
@@@ -2713,7 -2713,7 +2648,7 @@@ yyabortlab
    yyresult = 1;
    goto yyreturn;
  
--#if !defined(yyoverflow) || YYERROR_VERBOSE
++#if !defined yyoverflow || YYERROR_VERBOSE
  /*-------------------------------------------------.
  | yyexhaustedlab -- memory exhaustion comes here.  |
  `-------------------------------------------------*/
@@@ -2755,8 -2755,8 +2690,7 @@@ yyreturn
  }
  
  
--
--/* Line 2067 of yacc.c  */
++/* Line 2048 of yacc.c  */
  #line 747 "command.y"
  
  
@@@ -3704,4 -3692,5 +3638,3 @@@ history_expand_line(char **line
  }
  
  #endif
--
 -
diff --cc doc/gawk.info
index 4c10ab1,275188e..797a35a
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@@ -96,9 -94,7 +94,11 @@@ texts being (a) (see below), and with t
  * Library Functions::              A Library of `awk' Functions.
  * Sample Programs::                Many `awk' programs with complete
                                     explanations.
 -* Debugger::                       The `dgawk' debugger.
 +* Debugger::                       The `gawk' debugger.
++* Arbitrary Precision Arithmetic:: Arbitrary precision arithmetic with
++                                   `gawk'.
 +* Dynamic Extensions::             Adding new built-in functions to
 +                                   `gawk'.
  * Language History::               The evolution of the `awk'
                                     language.
  * Installation::                   Installing `gawk' under various
@@@ -448,28 -417,23 +425,51 @@@
  * Anagram Program::                Finding anagrams from a dictionary.
  * Signature Program::              People do amazing things with too much time
                                     on their hands.
 -* Debugging::                      Introduction to `dgawk'.
 -* Debugging Concepts::             Debugging In General.
 +* Debugging::                      Introduction to `gawk' debugger.
 +* Debugging Concepts::             Debugging in General.
  * Debugging Terms::                Additional Debugging Concepts.
  * Awk Debugging::                  Awk Debugging.
 -* Sample dgawk session::           Sample `dgawk' session.
 -* dgawk invocation::               `dgawk' Invocation.
 -* Finding The Bug::                Finding The Bug.
 -* List of Debugger Commands::      Main `dgawk' Commands.
 -* Breakpoint Control::             Control of breakpoints.
 -* Dgawk Execution Control::        Control of execution.
 -* Viewing And Changing Data::      Viewing and changing data.
 -* Dgawk Stack::                    Dealing with the stack.
 -* Dgawk Info::                     Obtaining information about the program and
 -                                   the debugger state.
 -* Miscellaneous Dgawk Commands::   Miscellaneous Commands.
 -* Readline Support::               Readline Support.
 -* Dgawk Limitations::              Limitations and future plans.
 +* Sample Debugging Session::       Sample debugging session.
 +* Debugger Invocation::            How to Start the Debugger.
 +* Finding The Bug::                Finding the Bug.
 +* List of Debugger Commands::      Main debugger commands.
 +* Breakpoint Control::             Control of Breakpoints.
 +* Debugger Execution Control::     Control of Execution.
 +* Viewing And Changing Data::      Viewing and Changing Data.
 +* Execution Stack::                Dealing with the Stack.
 +* Debugger Info::                  Obtaining Information about the Program and
 +                                   the Debugger State.
 +* Miscellaneous Debugger Commands:: Miscellaneous Commands.
 +* Readline Support::               Readline support.
 +* Limitations::                    Limitations and future plans.
++* General Arithmetic::             An introduction to computer arithmetic.
++* Floating Point Issues::          Stuff to know about floating-point numbers.
++* String Conversion Precision::    The String Value Can Lie.
++* Unexpected Results::             Floating Point Numbers Are Not Abstract
++                                   Numbers.
++* POSIX Floating Point Problems::  Standards Versus Existing Practice.
++* Integer Programming::            Effective integer programming.
++* Floating-point Programming::     Effective Floating-point Programming.
++* Floating-point Representation::  Binary floating-point representation.
++* Floating-point Context::         Floating-point context.
++* Rounding Mode::                  Floating-point rounding mode.
++* Gawk and MPFR::                  How `gawk' provides
++                                   aribitrary-precision arithmetic.
++* Arbitrary Precision Floats::     Arbitrary Precision Floating-point
++                                   Arithmetic with `gawk'.
++* Setting Precision::              Setting the working precision.
++* Setting Rounding Mode::          Setting the rounding mode.
++* Floating-point Constants::       Representing floating-point constants.
++* Changing Precision::             Changing the precision of a number.
++* Exact Arithmetic::               Exact arithmetic with floating-point
++                                   numbers.
++* Arbitrary Precision Integers::   Arbitrary Precision Integer Arithmetic with
++                                   `gawk'.
 +* Plugin License::                 A note about licensing.
 +* Sample Library::                 A example of new functions.
 +* Internal File Description::      What the new functions will do.
 +* Internal File Ops::              The code for internal file operations.
 +* Using Internal File Ops::        How to use an external extension.
  * V7/SVR3.1::                      The major changes between V7 and System V
                                     Release 3.1.
  * SVR4::                           Minor changes between System V Releases 3.1
@@@ -873,11 -849,8 +873,14 @@@ and profile your `awk' programs
  sample `awk' programs.  Reading them allows you to see `awk' solving
  real problems.
  
 -   *note Debugger::, describes the `awk' debugger, `dgawk'.
 +   *note Debugger::, describes the `awk' debugger.
 +
 +   *note Arbitrary Precision Arithmetic::, describes advanced
 +arithmetic facilities provided by `gawk'.
 +
++   *note Dynamic Extensions::, describes how to add new variables and
++functions to `gawk' by writing extensions in C.
+ 
     *note Language History::, describes how the `awk' language has
  evolved since its first release to present.  It also describes how
  `gawk' has acquired features over time.
@@@ -18982,10 -18734,10 +18985,10 @@@ supplies the following copyright terms
     We leave it to you to determine what the program does.
  
  
- File: gawk.info,  Node: Debugger,  Next: Dynamic Extensions,  Prev: Sample 
Programs,  Up: Top
 -File: gawk.info,  Node: Debugger,  Next: Language History,  Prev: Sample 
Programs,  Up: Top
++File: gawk.info,  Node: Debugger,  Next: Arbitrary Precision Arithmetic,  
Prev: Sample Programs,  Up: Top
  
 -14 `dgawk': The `awk' Debugger
 -******************************
 +14 Debugging `awk' Programs
 +***************************
  
  It would be nice if computer programs worked perfectly the first time
  they were run, but in real life, this rarely happens for programs of
@@@ -20034,2487 -19778,1323 +20037,2487 @@@ features may be added, and of 
course fe
  yourself!
  
  
- File: gawk.info,  Node: Dynamic Extensions,  Next: Language History,  Prev: 
Debugger,  Up: Top
 -File: gawk.info,  Node: Language History,  Next: Installation,  Prev: 
Debugger,  Up: Top
++File: gawk.info,  Node: Arbitrary Precision Arithmetic,  Next: Dynamic 
Extensions,  Prev: Debugger,  Up: Top
  
- 15 Writing Extensions for `gawk'
- ********************************
 -Appendix A The Evolution of the `awk' Language
 -**********************************************
++15 Arithmetic and Arbitrary Precision Arithmetic with `gawk'
++************************************************************
  
- This chapter is a placeholder, pending a rewrite for the new API.  Some
- of the old bits remain, since they can be partially reused.
 -This Info file describes the GNU implementation of `awk', which follows
 -the POSIX specification.  Many long-time `awk' users learned `awk'
 -programming with the original `awk' implementation in Version 7 Unix.
 -(This implementation was the basis for `awk' in Berkeley Unix, through
 -4.3-Reno.  Subsequent versions of Berkeley Unix, and some systems
 -derived from 4.4BSD-Lite, use various versions of `gawk' for their
 -`awk'.)  This major node briefly describes the evolution of the `awk'
 -language, with cross-references to other parts of the Info file where
 -you can find more information.
++     There's a credibility gap: We don't know how much of the
++     computer's answers to believe. Novice computer users solve this
++     problem by implicitly trusting in the computer as an infallible
++     authority; they tend to believe that all digits of a printed
++     answer are significant. Disillusioned computer users have just the
++     opposite approach; they are constantly afraid that their answers
++     are almost meaningless.
++     Donald Knuth(1)
  
-    It is possible to add new built-in functions to `gawk' using
- dynamically loaded libraries. This facility is available on systems
- (such as GNU/Linux) that support the C `dlopen()' and `dlsym()'
- functions.  This major node describes how to write and use dynamically
- loaded extensions for `gawk'.  Experience with programming in C or C++
- is necessary when reading this minor node.
 -* Menu:
++   This major node discusses issues that you may encounter when
++performing arithmetic.  It begins by discussing some of the general
++atributes of computer arithmetic, along with how this can influence
++what you see when running `awk' programs.  This discussion applies to
++all versions of `awk'.
  
-      NOTE: When `--sandbox' is specified, extensions are disabled
-      (*note Options::.
 -* V7/SVR3.1::                   The major changes between V7 and System V
 -                                Release 3.1.
 -* SVR4::                        Minor changes between System V Releases 3.1
 -                                and 4.
 -* POSIX::                       New features from the POSIX standard.
 -* BTL::                         New features from Brian Kernighan's version of
 -                                `awk'.
 -* POSIX/GNU::                   The extensions in `gawk' not in POSIX
 -                                `awk'.
 -* Common Extensions::           Common Extensions Summary.
 -* Ranges and Locales::          How locales used to affect regexp ranges.
 -* Contributors::                The major contributors to `gawk'.
++   Then the discussion moves on to "arbitrary precsion arithmetic", a
++feature which is specific to `gawk'.
  
 -
 -File: gawk.info,  Node: V7/SVR3.1,  Next: SVR4,  Up: Language History
 +* Menu:
  
- * Plugin License::              A note about licensing.
- * Sample Library::              A example of new functions.
 -A.1 Major Changes Between V7 and SVR3.1
 -=======================================
++* General Arithmetic::          An introduction to computer arithmetic.
++* Floating-point Programming::  Effective Floating-point Programming.
++* Gawk and MPFR::               How `gawk' provides
++                                aribitrary-precision arithmetic.
++* Arbitrary Precision Floats::  Arbitrary Precision Floating-point Arithmetic
++                                with `gawk'.
++* Arbitrary Precision Integers:: Arbitrary Precision Integer Arithmetic with
++                                `gawk'.
  
- 
- File: gawk.info,  Node: Plugin License,  Next: Sample Library,  Up: Dynamic 
Extensions
 -The `awk' language evolved considerably between the release of Version
 -7 Unix (1978) and the new version that was first made generally
 -available in System V Release 3.1 (1987).  This minor node summarizes
 -the changes, with cross-references to further details:
++   ---------- Footnotes ----------
  
- 15.1 Extension Licensing
- ========================
 -   * The requirement for `;' to separate rules on a line (*note
 -     Statements/Lines::).
++   (1) Donald E. Knuth.  `The Art of Computer Programming'. Volume 2,
++`Seminumerical Algorithms', third edition, 1998, ISBN 0-201-89683-4, p.
++229.
  
- Every dynamic extension should define the global symbol
- `plugin_is_GPL_compatible' to assert that it has been licensed under a
- GPL-compatible license.  If this symbol does not exist, `gawk' will
- emit a fatal error and exit.
 -   * User-defined functions and the `return' statement (*note
 -     User-defined::).
++
++File: gawk.info,  Node: General Arithmetic,  Next: Floating-point 
Programming,  Up: Arbitrary Precision Arithmetic
  
-    The declared type of the symbol should be `int'.  It does not need
- to be in any allocated section, though.  The code merely asserts that
- the symbol exists in the global scope.  Something like this is enough:
 -   * The `delete' statement (*note Delete::).
++15.1 A General Description of Computer Arithmetic
++=================================================
  
-      int plugin_is_GPL_compatible;
 -   * The `do'-`while' statement (*note Do Statement::).
++Within computers, there are two kinds of numeric values: "integers" and
++"floating-point".  In school, integer values were referred to as
++"whole" numbers--that is, numbers without any fractional part, such as
++1, 42, or -17.  The advantage to integer numbers is that they represent
++values exactly.  The disadvantage is that their range is limited.  On
++most systems, this range is -2,147,483,648 to 2,147,483,647.  However,
++many systems now support a range from -9,223,372,036,854,775,808 to
++9,223,372,036,854,775,807.
  
- 
- File: gawk.info,  Node: Sample Library,  Prev: Plugin License,  Up: Dynamic 
Extensions
 -   * The built-in functions `atan2()', `cos()', `sin()', `rand()', and
 -     `srand()' (*note Numeric Functions::).
++   Integer values come in two flavors: "signed" and "unsigned".  Signed
++values may be negative or positive, with the range of values just
++described.  Unsigned values are always positive.  On most systems, the
++range is from 0 to 4,294,967,295.  However, many systems now support a
++range from 0 to 18,446,744,073,709,551,615.
  
- 15.2 Example: Directory and File Operation Built-ins
- ====================================================
 -   * The built-in functions `gsub()', `sub()', and `match()' (*note
 -     String Functions::).
++   Floating-point numbers represent what are called "real" numbers;
++i.e., those that do have a fractional part, such as 3.1415927.  The
++advantage to floating-point numbers is that they can represent a much
++larger range of values.  The disadvantage is that there are numbers
++that they cannot represent exactly.  `awk' uses "double precision"
++floating-point numbers, which can hold more digits than "single
++precision" floating-point numbers.
  
- Two useful functions that are not in `awk' are `chdir()' (so that an
- `awk' program can change its directory) and `stat()' (so that an `awk'
- program can gather information about a file).  This minor node
- implements these functions for `gawk' in an external extension library.
 -   * The built-in functions `close()' and `system()' (*note I/O
 -     Functions::).
++   There a several important issues to be aware of, described next.
  
 -   * The `ARGC', `ARGV', `FNR', `RLENGTH', `RSTART', and `SUBSEP'
 -     built-in variables (*note Built-in Variables::).
 +* Menu:
  
- * Internal File Description::   What the new functions will do.
- * Internal File Ops::           The code for internal file operations.
- * Using Internal File Ops::     How to use an external extension.
 -   * Assignable `$0' (*note Changing Fields::).
++* Floating Point Issues::       Stuff to know about floating-point numbers.
++* Integer Programming::         Effective integer programming.
  
 -   * The conditional expression using the ternary operator `?:' (*note
 -     Conditional Exp::).
 +
- File: gawk.info,  Node: Internal File Description,  Next: Internal File Ops,  
Up: Sample Library
++File: gawk.info,  Node: Floating Point Issues,  Next: Integer Programming,  
Up: General Arithmetic
  
- 15.2.1 Using `chdir()' and `stat()'
- -----------------------------------
 -   * The expression `INDEX-VARIABLE in ARRAY' outside of `for'
 -     statements (*note Reference to Elements::).
++15.1.1 Floating-Point Number Caveats
++------------------------------------
  
- This minor node shows how to use the new functions at the `awk' level
- once they've been integrated into the running `gawk' interpreter.
- Using `chdir()' is very straightforward. It takes one argument, the new
- directory to change to:
 -   * The exponentiation operator `^' (*note Arithmetic Ops::) and its
 -     assignment operator form `^=' (*note Assignment Ops::).
++As mentioned earlier, floating-point numbers represent what are called
++"real" numbers, i.e., those that have a fractional part.  `awk' uses
++double precision floating-point numbers to represent all numeric
++values.  This minor node describes some of the issues involved in using
++floating-point numbers.
  
-      ...
-      newdir = "/home/arnold/funstuff"
-      ret = chdir(newdir)
-      if (ret < 0) {
-          printf("could not change to %s: %s\n",
-                         newdir, ERRNO) > "/dev/stderr"
-          exit 1
-      }
-      ...
 -   * C-compatible operator precedence, which breaks some old `awk'
 -     programs (*note Precedence::).
++   There is a very nice paper on floating-point arithmetic
++(http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What
++Every Computer Scientist Should Know About Floating-point Arithmetic,"
++`ACM Computing Surveys' *23*, 1 (1991-03), 5-48.  This is worth reading
++if you are interested in the details, but it does require a background
++in computer science.
  
-    The return value is negative if the `chdir' failed, and `ERRNO'
- (*note Built-in Variables::) is set to a string indicating the error.
 -   * Regexps as the value of `FS' (*note Field Separators::) and as the
 -     third argument to the `split()' function (*note String
 -     Functions::), rather than using only the first character of `FS'.
++* Menu:
  
-    Using `stat()' is a bit more complicated.  The C `stat()' function
- fills in a structure that has a fair amount of information.  The right
- way to model this in `awk' is to fill in an associative array with the
- appropriate information:
 -   * Dynamic regexps as operands of the `~' and `!~' operators (*note
 -     Regexp Usage::).
++* String Conversion Precision:: The String Value Can Lie.
++* Unexpected Results::          Floating Point Numbers Are Not Abstract
++                                Numbers.
++* POSIX Floating Point Problems:: Standards Versus Existing Practice.
  
-      file = "/home/arnold/.profile"
-      fdata[1] = "x"    # force `fdata' to be an array
-      ret = stat(file, fdata)
-      if (ret < 0) {
-          printf("could not stat %s: %s\n",
-                   file, ERRNO) > "/dev/stderr"
-          exit 1
-      }
-      printf("size of %s is %d bytes\n", file, fdata["size"])
 -   * The escape sequences `\b', `\f', and `\r' (*note Escape
 -     Sequences::).  (Some vendors have updated their old versions of
 -     `awk' to recognize `\b', `\f', and `\r', but this is not something
 -     you can rely on.)
++
++File: gawk.info,  Node: String Conversion Precision,  Next: Unexpected 
Results,  Up: Floating Point Issues
  
-    The `stat()' function always clears the data array, even if the
- `stat()' fails.  It fills in the following elements:
 -   * Redirection of input for the `getline' function (*note Getline::).
++15.1.1.1 The String Value Can Lie
++.................................
  
- `"name"'
-      The name of the file that was `stat()''ed.
 -   * Multiple `BEGIN' and `END' rules (*note BEGIN/END::).
++Internally, `awk' keeps both the numeric value (double precision
++floating-point) and the string value for a variable.  Separately, `awk'
++keeps track of what type the variable has (*note Typing and
++Comparison::), which plays a role in how variables are used in
++comparisons.
  
- `"dev"'
- `"ino"'
-      The file's device and inode numbers, respectively.
 -   * Multidimensional arrays (*note Multi-dimensional::).
++   It is important to note that the string value for a number may not
++reflect the full value (all the digits) that the numeric value actually
++contains.  The following program (`values.awk') illustrates this:
  
- `"mode"'
-      The file's mode, as a numeric value. This includes both the file's
-      type and its permissions.
 -
 -File: gawk.info,  Node: SVR4,  Next: POSIX,  Prev: V7/SVR3.1,  Up: Language 
History
++     {
++        sum = $1 + $2
++        # see it for what it is
++        printf("sum = %.12g\n", sum)
++        # use CONVFMT
++        a = "<" sum ">"
++        print "a =", a
++        # use OFMT
++        print "sum =", sum
++     }
  
- `"nlink"'
-      The number of hard links (directory entries) the file has.
 -A.2 Changes Between SVR3.1 and SVR4
 -===================================
++This program shows the full value of the sum of `$1' and `$2' using
++`printf', and then prints the string values obtained from both
++automatic conversion (via `CONVFMT') and from printing (via `OFMT').
  
- `"uid"'
- `"gid"'
-      The numeric user and group ID numbers of the file's owner.
 -The System V Release 4 (1989) version of Unix `awk' added these features
 -(some of which originated in `gawk'):
++   Here is what happens when the program is run:
  
- `"size"'
-      The size in bytes of the file.
 -   * The `ENVIRON' array (*note Built-in Variables::).
++     $ echo 3.654321 1.2345678 | awk -f values.awk
++     -| sum = 4.8888888
++     -| a = <4.88889>
++     -| sum = 4.88889
  
- `"blocks"'
-      The number of disk blocks the file actually occupies. This may not
-      be a function of the file's size if the file has holes.
 -   * Multiple `-f' options on the command line (*note Options::).
++   This makes it clear that the full numeric value is different from
++what the default string representations show.
  
- `"atime"'
- `"mtime"'
- `"ctime"'
-      The file's last access, modification, and inode update times,
-      respectively.  These are numeric timestamps, suitable for
-      formatting with `strftime()' (*note Built-in::).
 -   * The `-v' option for assigning variables before program execution
 -     begins (*note Options::).
++   `CONVFMT''s default value is `"%.6g"', which yields a value with at
++least six significant digits.  For some applications, you might want to
++change it to specify more precision.  On most modern machines, most of
++the time, 17 digits is enough to capture a floating-point number's
++value exactly.(1)
  
- `"pmode"'
-      The file's "printable mode."  This is a string representation of
-      the file's type and permissions, such as what is produced by `ls
-      -l'--for example, `"drwxr-xr-x"'.
 -   * The `--' option for terminating command-line options.
++   ---------- Footnotes ----------
  
- `"type"'
-      A printable string representation of the file's type.  The value
-      is one of the following:
 -   * The `\a', `\v', and `\x' escape sequences (*note Escape
 -     Sequences::).
++   (1) Pathological cases can require up to 752 digits (!), but we
++doubt that you need to worry about this.
  
-     `"blockdev"'
-     `"chardev"'
-           The file is a block or character device ("special file").
 -   * A defined return value for the `srand()' built-in function (*note
 -     Numeric Functions::).
++
++File: gawk.info,  Node: Unexpected Results,  Next: POSIX Floating Point 
Problems,  Prev: String Conversion Precision,  Up: Floating Point Issues
  
-     `"directory"'
-           The file is a directory.
 -   * The `toupper()' and `tolower()' built-in string functions for case
 -     translation (*note String Functions::).
++15.1.1.2 Floating Point Numbers Are Not Abstract Numbers
++........................................................
  
-     `"fifo"'
-           The file is a named-pipe (also known as a FIFO).
 -   * A cleaner specification for the `%c' format-control letter in the
 -     `printf' function (*note Control Letters::).
++Unlike numbers in the abstract sense (such as what you studied in high
++school or college arithmetic), numbers stored in computers are limited
++in certain ways.  They cannot represent an infinite number of digits,
++nor can they always represent things exactly.  In particular,
++floating-point numbers cannot always represent values exactly.  Here is
++an example:
  
-     `"file"'
-           The file is just a regular file.
 -   * The ability to dynamically pass the field width and precision
 -     (`"%*.*d"') in the argument list of the `printf' function (*note
 -     Control Letters::).
++     $ awk '{ printf("%010d\n", $1 * 100) }'
++     515.79
++     -| 0000051579
++     515.80
++     -| 0000051579
++     515.81
++     -| 0000051580
++     515.82
++     -| 0000051582
++     Ctrl-d
  
-     `"socket"'
-           The file is an `AF_UNIX' ("Unix domain") socket in the
-           filesystem.
 -   * The use of regexp constants, such as `/foo/', as expressions, where
 -     they are equivalent to using the matching operator, as in `$0 ~
 -     /foo/' (*note Using Constant Regexps::).
++This shows that some values can be represented exactly, whereas others
++are only approximated.  This is not a "bug" in `awk', but simply an
++artifact of how computers represent numbers.
  
-     `"symlink"'
-           The file is a symbolic link.
 -   * Processing of escape sequences inside command-line variable
 -     assignments (*note Assignment Options::).
++     NOTE: It cannot be emphasized enough that the behavior just
++     described is fundamental to modern computers. You will see this
++     kind of thing happen in _any_ programming language using hardware
++     floating-point numbers. It is _not_ a bug in `gawk', nor is it
++     something that can be "just fixed."
 +
-    Several additional elements may be present depending upon the
- operating system and the type of the file.  You can test for them in
- your `awk' program by using the `in' operator (*note Reference to
- Elements::):
++   Another peculiarity of floating-point numbers on modern systems is
++that they often have more than one representation for the number zero!
++In particular, it is possible to represent "minus zero" as well as
++regular, or "positive" zero.
 +
- `"blksize"'
-      The preferred block size for I/O to the file. This field is not
-      present on all POSIX-like systems in the C `stat' structure.
++   This example shows that negative and positive zero are distinct
++values when stored internally, but that they are in fact equal to each
++other, as well as to "regular" zero:
 +
- `"linkval"'
-      If the file is a symbolic link, this element is the name of the
-      file the link points to (i.e., the value of the link).
++     $ gawk 'BEGIN { mz = -0 ; pz = 0
++     > printf "-0 = %g, +0 = %g, (-0 == +0) -> %d\n", mz, pz, mz == pz
++     > printf "mz == 0 -> %d, pz == 0 -> %d\n", mz == 0, pz == 0
++     > }'
++     -| -0 = -0, +0 = 0, (-0 == +0) -> 1
++     -| mz == 0 -> 1, pz == 0 -> 1
 +
- `"rdev"'
- `"major"'
- `"minor"'
-      If the file is a block or character device file, then these values
-      represent the numeric device number and the major and minor
-      components of that number, respectively.
++   It helps to keep this in mind should you process numeric data that
++contains negative zero values; the fact that the zero is negative is
++noted and can affect comparisons.
  
  
- File: gawk.info,  Node: Internal File Ops,  Next: Using Internal File Ops,  
Prev: Internal File Description,  Up: Sample Library
- 
- 15.2.2 C Code for `chdir()' and `stat()'
- ----------------------------------------
 -File: gawk.info,  Node: POSIX,  Next: BTL,  Prev: SVR4,  Up: Language History
++File: gawk.info,  Node: POSIX Floating Point Problems,  Prev: Unexpected 
Results,  Up: Floating Point Issues
  
- Here is the C code for these extensions.  They were written for
- GNU/Linux.  The code needs some more work for complete portability to
- other POSIX-compliant systems:(1)
 -A.3 Changes Between SVR4 and POSIX `awk'
 -========================================
++15.1.1.3 Standards Versus Existing Practice
++...........................................
  
-      #include "awk.h"
 -The POSIX Command Language and Utilities standard for `awk' (1992)
 -introduced the following changes into the language:
++Historically, `awk' has converted any non-numeric looking string to the
++numeric value zero, when required.  Furthermore, the original
++definition of the language and the original POSIX standards specified
++that `awk' only understands decimal numbers (base 10), and not octal
++(base 8) or hexadecimal numbers (base 16).
  
-      #include <sys/sysmacros.h>
 -   * The use of `-W' for implementation-specific options (*note
 -     Options::).
++   Changes in the language of the 2001 and 2004 POSIX standards can be
++interpreted to imply that `awk' should support additional features.
++These features are:
  
-      int plugin_is_GPL_compatible;
 -   * The use of `CONVFMT' for controlling the conversion of numbers to
 -     strings (*note Conversion::).
++   * Interpretation of floating point data values specified in
++     hexadecimal notation (`0xDEADBEEF'). (Note: data values, _not_
++     source code constants.)
  
-      /*  do_chdir --- provide dynamically loaded chdir() builtin for gawk */
 -   * The concept of a numeric string and tighter comparison rules to go
 -     with it (*note Typing and Comparison::).
++   * Support for the special IEEE 754 floating point values "Not A
++     Number" (NaN), positive Infinity ("inf") and negative Infinity
++     ("-inf").  In particular, the format for these values is as
++     specified by the ISO 1999 C standard, which ignores case and can
++     allow machine-dependent additional characters after the `nan' and
++     allow either `inf' or `infinity'.
  
-      static NODE *
-      do_chdir(int nargs)
-      {
-          NODE *newdir;
-          int ret = -1;
 -   * The use of built-in variables as function parameter names is
 -     forbidden (*note Definition Syntax::.
++   The first problem is that both of these are clear changes to
++historical practice:
  
-          if (do_lint && nargs != 1)
-              lintwarn("chdir: called with incorrect number of arguments");
 -   * More complete documentation of many of the previously undocumented
 -     features of the language.
++   * The `gawk' maintainer feels that supporting hexadecimal floating
++     point values, in particular, is ugly, and was never intended by the
++     original designers to be part of the language.
  
-          newdir = get_scalar_argument(0, FALSE);
 -   *Note Common Extensions::, for a list of common extensions not
 -permitted by the POSIX standard.
++   * Allowing completely alphabetic strings to have valid numeric
++     values is also a very severe departure from historical practice.
  
-    The file includes the `"awk.h"' header file for definitions for the
- `gawk' internals.  It includes `<sys/sysmacros.h>' for access to the
- `major()' and `minor'() macros.
 -   The 2008 POSIX standard can be found online at
 -`http://www.opengroup.org/onlinepubs/9699919799/'.
++   The second problem is that the `gawk' maintainer feels that this
++interpretation of the standard, which requires a certain amount of
++"language lawyering" to arrive at in the first place, was not even
++intended by the standard developers.  In other words, "we see how you
++got where you are, but we don't think that that's where you want to be."
  
-    By convention, for an `awk' function `foo', the function that
- implements it is called `do_foo'.  The function should take a `int'
- argument, usually called `nargs', that represents the number of defined
- arguments for the function.  The `newdir' variable represents the new
- directory to change to, retrieved with `get_scalar_argument()'.  Note
- that the first argument is numbered zero.
 -
 -File: gawk.info,  Node: BTL,  Next: POSIX/GNU,  Prev: POSIX,  Up: Language 
History
++   Recognizing the above issues, but attempting to provide compatibility
++with the earlier versions of the standard, the 2008 POSIX standard
++added explicit wording to allow, but not require, that `awk' support
++hexadecimal floating point values and special values for "Not A Number"
++and infinity.
  
-    This code actually accomplishes the `chdir()'. It first forces the
- argument to be a string and passes the string value to the `chdir()'
- system call. If the `chdir()' fails, `ERRNO' is updated.
 -A.4 Extensions in Brian Kernighan's `awk'
 -=========================================
++   Although the `gawk' maintainer continues to feel that providing
++those features is inadvisable, nevertheless, on systems that support
++IEEE floating point, it seems reasonable to provide _some_ way to
++support NaN and Infinity values.  The solution implemented in `gawk' is
++as follows:
  
-          (void) force_string(newdir);
-          ret = chdir(newdir->stptr);
-          if (ret < 0)
-              update_ERRNO_int(errno);
 -Brian Kernighan has made his version available via his home page (*note
 -Other Versions::).
++   * With the `--posix' command-line option, `gawk' becomes "hands
++     off." String values are passed directly to the system library's
++     `strtod()' function, and if it successfully returns a numeric
++     value, that is what's used.(1) By definition, the results are not
++     portable across different systems.  They are also a little
++     surprising:
  
-    Finally, the function returns the return value to the `awk' level:
 -   This minor node describes common extensions that originally appeared
 -in his version of `awk'.
++          $ echo nanny | gawk --posix '{ print $1 + 0 }'
++          -| nan
++          $ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }'
++          -| 3735928559
  
-          return make_number((AWKNUM) ret);
-      }
 -   * The `**' and `**=' operators (*note Arithmetic Ops:: and *note
 -     Assignment Ops::).
++   * Without `--posix', `gawk' interprets the four strings `+inf',
++     `-inf', `+nan', and `-nan' specially, producing the corresponding
++     special numeric values.  The leading sign acts a signal to `gawk'
++     (and the user) that the value is really numeric.  Hexadecimal
++     floating point is not supported (unless you also use
++     `--non-decimal-data', which is _not_ recommended). For example:
  
-    The `stat()' built-in is more involved.  First comes a function that
- turns a numeric mode into a printable representation (e.g., 644 becomes
- `-rw-r--r--'). This is omitted here for brevity:
 -   * The use of `func' as an abbreviation for `function' (*note
 -     Definition Syntax::).
++          $ echo nanny | gawk '{ print $1 + 0 }'
++          -| 0
++          $ echo +nan | gawk '{ print $1 + 0 }'
++          -| nan
++          $ echo 0xDeadBeef | gawk '{ print $1 + 0 }'
++          -| 0
  
-      /* format_mode --- turn a stat mode field into something readable */
 -   * The `fflush()' built-in function for flushing buffered output
 -     (*note I/O Functions::).
++     `gawk' does ignore case in the four special values.  Thus `+nan'
++     and `+NaN' are the same.
  
-      static char *
-      format_mode(unsigned long fmode)
-      {
-          ...
-      }
++   ---------- Footnotes ----------
  
-    Next comes the `do_stat()' function. It starts with variable
- declarations and argument checking:
 -   *Note Common Extensions::, for a full list of the extensions
 -available in his `awk'.
++   (1) You asked for it, you got it.
  
-      /* do_stat --- provide a stat() function for gawk */
+ 
 -File: gawk.info,  Node: POSIX/GNU,  Next: Common Extensions,  Prev: BTL,  Up: 
Language History
++File: gawk.info,  Node: Integer Programming,  Prev: Floating Point Issues,  
Up: General Arithmetic
  
-      static NODE *
-      do_stat(int nargs)
-      {
-          NODE *file, *array, *tmp;
-          struct stat sbuf;
-          int ret;
-          NODE **aptr;
-          char *pmode;    /* printable mode */
-          char *type = "unknown";
 -A.5 Extensions in `gawk' Not in POSIX `awk'
 -===========================================
++15.1.2 Mixing Integers And Floating-point
++-----------------------------------------
  
-          if (do_lint && nargs > 2)
-              lintwarn("stat: called with too many arguments");
 -The GNU implementation, `gawk', adds a large number of features.  They
 -can all be disabled with either the `--traditional' or `--posix' options
 -(*note Options::).
++As has been mentioned already, `gawk' ordinarily uses hardware double
++precision with 64-bit IEEE binary floating-point representation for
++numbers on most systems. A large integer like 9007199254740997 has a
++binary representation that, although finite, is more than 53 bits long;
++it must also be rounded to 53 bits.  The biggest integer that can be
++stored in a C `double' is usually the same as the largest possible
++value of a `double'. If your system `double' is an IEEE 64-bit
++`double', this largest possible value is an integer and can be
++represented precisely.  What more should one know about integers?
 +
-    Then comes the actual work. First, the function gets the arguments.
- Then, it always clears the array.  The code use `lstat()' (instead of
- `stat()') to get the file information, in case the file is a symbolic
- link.  If there's an error, it sets `ERRNO' and returns:
++   If you want to know what is the largest integer, such that it and
++all smaller integers can be stored in 64-bit doubles without losing
++precision, then the answer is 2^53.  The next representable number is
++the even number 2^53 + 2, meaning it is unlikely that you will be able
++to make `gawk' print 2^53 + 1 in integer format.  The range of integers
++exactly representable by a 64-bit double is [-2^53, 2^53].  If you ever
++see an integer outside this range in `gawk' using 64-bit doubles, you
++have reason to be very suspicious about the accuracy of the output.
++Here is a simple program with erroneous output:
 +
-          /* file is first arg, array to hold results is second */
-          file = get_scalar_argument(0, FALSE);
-          array = get_array_argument(1, FALSE);
++     $ gawk 'BEGIN { i = 2^53 - 1; for (j = 0; j < 4; j++) print i + j }'
++     -| 9007199254740991
++     -| 9007199254740992
++     -| 9007199254740992
++     -| 9007199254740994
 +
-          /* empty out the array */
-          assoc_clear(array);
++   The lesson is to not assume that any large integer printed by `gawk'
++represents an exact result from your computation, especially if it wraps
++around on your screen.
 +
-          /* lstat the file, if error, set ERRNO and return */
-          (void) force_string(file);
-          ret = lstat(file->stptr, & sbuf);
-          if (ret < 0) {
-              update_ERRNO_int(errno);
-              return make_number((AWKNUM) ret);
-          }
++
++File: gawk.info,  Node: Floating-point Programming,  Next: Gawk and MPFR,  
Prev: General Arithmetic,  Up: Arbitrary Precision Arithmetic
 +
-    Now comes the tedious part: filling in the array.  Only a few of the
- calls are shown here, since they all follow the same pattern:
++15.2 Understanding Floating-point Programming
++=============================================
  
-          /* fill in the array */
-          aptr = assoc_lookup(array, tmp = make_string("name", 4));
-          *aptr = dupnode(file);
-          unref(tmp);
- 
-          aptr = assoc_lookup(array, tmp = make_string("mode", 4));
-          *aptr = make_number((AWKNUM) sbuf.st_mode);
-          unref(tmp);
- 
-          aptr = assoc_lookup(array, tmp = make_string("pmode", 5));
-          pmode = format_mode(sbuf.st_mode);
-          *aptr = make_string(pmode, strlen(pmode));
-          unref(tmp);
- 
-    When done, return the `lstat()' return value:
 -   A number of features have come and gone over the years. This minor
 -node summarizes the additional features over POSIX `awk' that are in
 -the current version of `gawk'.
++Numerical programming is an extensive area; if you need to develop
++sophisticated numerical algorithms then `gawk' may not be the ideal
++tool, and this documentation may not be sufficient.  It might require
++digesting a book or two to really internalize how to compute with ideal
++accuracy and precision and the result often depends on the particular
++application.
 +
++     NOTE: A floating-point calculation's "accuracy" is how close it
++     comes to the real value.  This is as opposed to the "precision",
++     which usually refers to the number of bits used to represent the
++     number (see the Wikipedia article
++     (http://en.wikipedia.org/wiki/Accuracy_and_precision) for more
++     information).
 +
-          return make_number((AWKNUM) ret);
-      }
++   There are two options for doing floating-point calculations:
++hardware floating-point (as used by standard `awk' and the default for
++`gawk'), and "arbitrary-precision" floating-point, which is software
++based.  This major node aims to provide enough information to
++understand both, and then will focus on `gawk''s facilities for the
++latter.(1)
 +
-    Finally, it's necessary to provide the "glue" that loads the new
- function(s) into `gawk'.  By convention, each library has a routine
- named `dl_load()' that does the job.  The simplest way is to use the
- `dl_load_func' macro in `gawkapi.h'.
++   Binary floating-point representations and arithmetic are inexact.
++Simple values like 0.1 cannot be precisely represented using binary
++floating-point numbers, and the limited precision of floating-point
++numbers means that slight changes in the order of operations or the
++precision of intermediate storage can change the result. To make
++matters worse, with arbitrary precision floating-point, you can set the
++precision before starting a computation, but then you cannot be sure of
++the number of significant decimal places in the final result.
 +
-    And that's it!  As an exercise, consider adding functions to
- implement system calls such as `chown()', `chmod()', and `umask()'.
++   Sometimes, before you start to write any code, you should think more
++about what you really want and what's really happening. Consider the
++two numbers in the following example:
 +
-    ---------- Footnotes ----------
++     x = 0.875             # 1/2 + 1/4 + 1/8
++     y = 0.425
 +
-    (1) This version is edited slightly for presentation.  See
- `extension/filefuncs.c' in the `gawk' distribution for the complete
- version.
++   Unlike the number in `y', the number stored in `x' is exactly
++representable in binary since it can be written as a finite sum of one
++or more fractions whose denominators are all powers of two.  When
++`gawk' reads a floating-point number from program source, it
++automatically rounds that number to whatever precision your machine
++supports. If you try to print the numeric content of a variable using
++an output format string of `"%.17g"', it may not produce the same
++number as you assigned to it:
 +
- 
- File: gawk.info,  Node: Using Internal File Ops,  Prev: Internal File Ops,  
Up: Sample Library
++     $ gawk 'BEGIN { x = 0.875; y = 0.425
++     >               printf("%0.17g, %0.17g\n", x, y) }'
++     -| 0.875, 0.42499999999999999
 +
- 15.2.3 Integrating the Extensions
- ---------------------------------
++   Often the error is so small you do not even notice it, and if you do,
++you can always specify how much precision you would like in your output.
++Usually this is a format string like `"%.15g"', which when used in the
++previous example, produces an output identical to the input.
 +
- Now that the code is written, it must be possible to add it at runtime
- to the running `gawk' interpreter.  First, the code must be compiled.
- Assuming that the functions are in a file named `filefuncs.c', and IDIR
- is the location of the `gawk' include files, the following steps create
- a GNU/Linux shared library:
++   Because the underlying representation can be little bit off from the
++exact value, comparing floating-point values to see if they are equal
++is generally not a good idea.  Here is an example where it does not
++work like you expect:
 +
-      $ gcc -fPIC -shared -DHAVE_CONFIG_H -c -O -g -IIDIR filefuncs.c
-      $ ld -o filefuncs.so -shared filefuncs.o
++     $ gawk 'BEGIN { print (0.1 + 12.2 == 12.3) }'
++     -| 0
  
-    Once the library exists, it is loaded by calling the `extension()'
- built-in function.  This function takes two arguments: the name of the
- library to load and the name of a function to call when the library is
- first loaded. This function adds the new functions to `gawk'.  It
- returns the value returned by the initialization function within the
- shared library:
 -   * Additional built-in variables:
++   The loss of accuracy during a single computation with floating-point
++numbers usually isn't enough to worry about. However, if you compute a
++value which is the result of a sequence of floating point operations,
++the error can accumulate and greatly affect the computation itself.
++Here is an attempt to compute the value of the constant pi using one of
++its many series representations:
  
-      # file testff.awk
 -        - The `ARGIND' `BINMODE', `ERRNO', `FIELDWIDTHS', `FPAT',
 -          `IGNORECASE', `LINT', `PROCINFO', `RT', and `TEXTDOMAIN'
 -          variables (*note Built-in Variables::).
 +     BEGIN {
-          extension("./filefuncs.so", "dl_load")
++         x = 1.0 / sqrt(3.0)
++         n = 6
++         for (i = 1; i < 30; i++) {
++             n = n * 2.0
++             x = (sqrt(x * x + 1) - 1) / x
++             printf("%.15f\n", n * x)
++         }
++     }
  
-          chdir(".")  # no-op
 -   * Special files in I/O redirections:
++   When run, the early errors propagating through later computations
++cause the loop to terminate prematurely after an attempt to divide by
++zero.
  
-          data[1] = 1 # force `data' to be an array
-          print "Info for testff.awk"
-          ret = stat("testff.awk", data)
-          print "ret =", ret
-          for (i in data)
-              printf "data[\"%s\"] = %s\n", i, data[i]
-          print "testff.awk modified:",
-              strftime("%m %d %y %H:%M:%S", data["mtime"])
 -        - The `/dev/stdin', `/dev/stdout', `/dev/stderr' and
 -          `/dev/fd/N' special file names (*note Special Files::).
++     $ gawk -f pi.awk
++     -| 3.215390309173475
++     -| 3.159659942097510
++     -| 3.146086215131467
++     -| 3.142714599645573
++     ...
++     -| 3.224515243534819
++     -| 2.791117213058638
++     -| 0.000000000000000
++     error--> gawk: pi.awk:6: fatal: division by zero attempted
  
-          print "\nInfo for JUNK"
-          ret = stat("JUNK", data)
-          print "ret =", ret
-          for (i in data)
-              printf "data[\"%s\"] = %s\n", i, data[i]
-          print "JUNK modified:", strftime("%m %d %y %H:%M:%S", data["mtime"])
-      }
 -        - The `/inet', `/inet4', and `/inet6' special files for TCP/IP
 -          networking using `|&' to specify which version of the IP
 -          protocol to use.  (*note TCP/IP Networking::).
++   Here is one more example where the inaccuracies in internal
++representations yield an unexpected result:
  
-    Here are the results of running the program:
 -   * Changes and/or additions to the language:
++     $ gawk 'BEGIN {
++     >   for (d = 1.1; d <= 1.5; d += 0.1)
++     >       i++
++     >   print i
++     > }'
++     -| 4
  
-      $ gawk -f testff.awk
-      -| Info for testff.awk
-      -| ret = 0
-      -| data["size"] = 607
-      -| data["ino"] = 14945891
-      -| data["name"] = testff.awk
-      -| data["pmode"] = -rw-rw-r--
-      -| data["nlink"] = 1
-      -| data["atime"] = 1293993369
-      -| data["mtime"] = 1288520752
-      -| data["mode"] = 33204
-      -| data["blksize"] = 4096
-      -| data["dev"] = 2054
-      -| data["type"] = file
-      -| data["gid"] = 500
-      -| data["uid"] = 500
-      -| data["blocks"] = 8
-      -| data["ctime"] = 1290113572
-      -| testff.awk modified: 10 31 10 12:25:52
-      -|
-      -| Info for JUNK
-      -| ret = -1
-      -| JUNK modified: 01 01 70 02:00:00
 -        - The `\x' escape sequence (*note Escape Sequences::).
++   Can computation using aribitrary precision help with the previous
++examples?  If you are impatient to know, see *note Exact Arithmetic::.
  
- 
- File: gawk.info,  Node: Arbitrary Precision Arithmetic,  Next: Advanced 
Features,  Prev: Internationalization,  Up: Top
 -        - Full support for both POSIX and GNU regexps (*note Regexp::).
++   Instead of aribitrary precision floating-point arithmetic, often all
++you need is an adjustment of your logic or a different order for the
++operations in your calculation.  The stability and the accuracy of the
++computation of the constant pi in the previous example can be enhanced
++by using the following simple algebraic transformation:
  
- 16 Arithmetic and Arbitrary Precision Arithmetic with `gawk'
- ************************************************************
 -        - The ability for `FS' and for the third argument to `split()'
 -          to be null strings (*note Single Character Fields::).
++     (sqrt(x * x + 1) - 1) / x = x / (sqrt(x * x + 1) + 1)
  
-      There's a credibility gap: We don't know how much of the
-      computer's answers to believe. Novice computer users solve this
-      problem by implicitly trusting in the computer as an infallible
-      authority; they tend to believe that all digits of a printed
-      answer are significant. Disillusioned computer users have just the
-      opposite approach; they are constantly afraid that their answers
-      are almost meaningless.
-      Donald Knuth(1)
 -        - The ability for `RS' to be a regexp (*note Records::).
++After making this, change the program does converge to pi in under 30
++iterations:
  
-    This major node discusses issues that you may encounter when
- performing arithmetic.  It begins by discussing some of the general
- atributes of computer arithmetic, along with how this can influence
- what you see when running `awk' programs.  This discussion applies to
- all versions of `awk'.
 -        - The ability to use octal and hexadecimal constants in `awk'
 -          program source code (*note Nondecimal-numbers::).
++     $ gawk -f /tmp/pi2.awk
++     -| 3.215390309173473
++     -| 3.159659942097501
++     -| 3.146086215131436
++     -| 3.142714599645370
++     -| 3.141873049979825
++     ...
++     -| 3.141592653589797
++     -| 3.141592653589797
 +
-    Then the discussion moves on to "arbitrary precsion arithmetic", a
- feature which is specific to `gawk'.
++   There is no need to be unduly suspicious about the results from
++floating-point arithmetic. The lesson to remember is that
++floating-point arithmetic is always more complex than the arithmetic
++using pencil and paper. In order to take advantage of the power of
++computer floating-point, you need to know its limitations and work
++within them. For most casual use of floating-point arithmetic, you will
++often get the expected result in the end if you simply round the
++display of your final results to the correct number of significant
++decimal digits. And, avoid presenting numerical data in a manner that
++implies better precision than is actually the case.
  
 -        - The `|&' operator for two-way I/O to a coprocess (*note
 -          Two-way I/O::).
 +* Menu:
  
- * General Arithmetic::          An introduction to computer arithmetic.
- * Floating-point Programming::  Effective Floating-point Programming.
- * Gawk and MPFR::               How `gawk' provides
-                                 aribitrary-precision arithmetic.
- * Arbitrary Precision Floats::  Arbitrary Precision Floating-point Arithmetic
-                                 with `gawk'.
- * Arbitrary Precision Integers:: Arbitrary Precision Integer Arithmetic with
-                                 `gawk'.
 -        - Indirect function calls (*note Indirect Calls::).
++* Floating-point Representation:: Binary floating-point representation.
++* Floating-point Context::        Floating-point context.
++* Rounding Mode::                 Floating-point rounding mode.
  
 -        - Directories on the command line produce a warning and are
 -          skipped (*note Command line directories::).
 +   ---------- Footnotes ----------
  
-    (1) Donald E. Knuth.  `The Art of Computer Programming'. Volume 2,
- `Seminumerical Algorithms', third edition, 1998, ISBN 0-201-89683-4, p.
- 229.
 -   * New keywords:
++   (1) If you are interested in other tools that perform arbitrary
++precision arithmetic, you may want to investigate the POSIX `bc' tool.
++See the POSIX specification for it
++(http://pubs.opengroup.org/onlinepubs/009695399/utilities/bc.html), for
++more information.
  
 -        - The `BEGINFILE' and `ENDFILE' special patterns.  (*note
 -          BEGINFILE/ENDFILE::).
 +
- File: gawk.info,  Node: General Arithmetic,  Next: Floating-point 
Programming,  Up: Arbitrary Precision Arithmetic
++File: gawk.info,  Node: Floating-point Representation,  Next: Floating-point 
Context,  Up: Floating-point Programming
  
- 16.1 A General Description of Computer Arithmetic
- =================================================
 -        - The ability to delete all of an array at once with `delete
 -          ARRAY' (*note Delete::).
++15.2.1 Binary Floating-point Representation
++-------------------------------------------
  
- Within computers, there are two kinds of numeric values: "integers" and
- "floating-point".  In school, integer values were referred to as
- "whole" numbers--that is, numbers without any fractional part, such as
- 1, 42, or -17.  The advantage to integer numbers is that they represent
- values exactly.  The disadvantage is that their range is limited.  On
- most systems, this range is -2,147,483,648 to 2,147,483,647.  However,
- many systems now support a range from -9,223,372,036,854,775,808 to
- 9,223,372,036,854,775,807.
 -        - The `nextfile' statement (*note Nextfile Statement::).
++Although floating-point representations vary from machine to machine,
++the most commonly encountered representation is that defined by the
++IEEE 754 Standard. An IEEE-754 format value has three components:
  
-    Integer values come in two flavors: "signed" and "unsigned".  Signed
- values may be negative or positive, with the range of values just
- described.  Unsigned values are always positive.  On most systems, the
- range is from 0 to 4,294,967,295.  However, many systems now support a
- range from 0 to 18,446,744,073,709,551,615.
 -        - The `switch' statement (*note Switch Statement::).
++   * A sign bit telling whether the number is positive or negative.
  
-    Floating-point numbers represent what are called "real" numbers;
- i.e., those that do have a fractional part, such as 3.1415927.  The
- advantage to floating-point numbers is that they can represent a much
- larger range of values.  The disadvantage is that there are numbers
- that they cannot represent exactly.  `awk' uses "double precision"
- floating-point numbers, which can hold more digits than "single
- precision" floating-point numbers.
 -   * Changes to standard `awk' functions:
++   * An "exponent" giving its order of magnitude, E.
  
-    There a several important issues to be aware of, described next.
 -        - The optional second argument to `close()' that allows closing
 -          one end of a two-way pipe to a coprocess (*note Two-way
 -          I/O::).
++   * A "significand", S, specifying the actual digits of the number.
  
- * Menu:
 -        - POSIX compliance for `gsub()' and `sub()'.
++   The value of the number is then S * 2^E.  The first bit of a
++non-zero binary significand is always one, so the significand in an
++IEEE-754 format only includes the fractional part, leaving the leading
++one implicit.
  
- * Floating Point Issues::       Stuff to know about floating-point numbers.
- * Integer Programming::         Effective integer programming.
 -        - The `length()' function accepts an array argument and returns
 -          the number of elements in the array (*note String
 -          Functions::).
++   Three of the standard IEEE-754 types are 32-bit single precision,
++64-bit double precision and 128-bit quadruple precision.  The standard
++also specifies extended precision formats to allow greater precisions
++and larger exponent ranges.
+ 
 -        - The optional third argument to the `match()' function for
 -          capturing text-matching subexpressions within a regexp (*note
 -          String Functions::).
++   The significand is stored in "normalized" format, which means that
++the first bit is always a one.
  
 -        - Positional specifiers in `printf' formats for making
 -          translations easier (*note Printf Ordering::).
 +
- File: gawk.info,  Node: Floating Point Issues,  Next: Integer Programming,  
Up: General Arithmetic
++File: gawk.info,  Node: Floating-point Context,  Next: Rounding Mode,  Prev: 
Floating-point Representation,  Up: Floating-point Programming
  
- 16.1.1 Floating-Point Number Caveats
- ------------------------------------
 -        - The `split()' function's additional optional fourth argument
 -          which is an array to hold the text of the field separators.
 -          (*note String Functions::).
++15.2.2 Floating-point Context
++-----------------------------
  
- As mentioned earlier, floating-point numbers represent what are called
- "real" numbers, i.e., those that have a fractional part.  `awk' uses
- double precision floating-point numbers to represent all numeric
- values.  This minor node describes some of the issues involved in using
- floating-point numbers.
 -   * Additional functions only in `gawk':
++A floating-point "context" defines the environment for arithmetic
++operations.  It governs precision, sets rules for rounding, and limits
++the range for exponents.  The context has the following primary
++components:
  
-    There is a very nice paper on floating-point arithmetic
- (http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What
- Every Computer Scientist Should Know About Floating-point Arithmetic,"
- `ACM Computing Surveys' *23*, 1 (1991-03), 5-48.  This is worth reading
- if you are interested in the details, but it does require a background
- in computer science.
 -        - The `and()', `compl()', `lshift()', `or()', `rshift()', and
 -          `xor()' functions for bit manipulation (*note Bitwise
 -          Functions::).
++"Precision"
++     Precision of the floating-point format in bits.
  
- * Menu:
 -        - The `asort()' and `asorti()' functions for sorting arrays
 -          (*note Array Sorting::).
++"emax"
++     Maximum exponent allowed for this format.
  
- * String Conversion Precision:: The String Value Can Lie.
- * Unexpected Results::          Floating Point Numbers Are Not Abstract
-                                 Numbers.
- * POSIX Floating Point Problems:: Standards Versus Existing Practice.
 -        - The `bindtextdomain()', `dcgettext()' and `dcngettext()'
 -          functions for internationalization (*note Programmer i18n::).
++"emin"
++     Minimum exponent allowed for this format.
  
- 
- File: gawk.info,  Node: String Conversion Precision,  Next: Unexpected 
Results,  Up: Floating Point Issues
 -        - The `extension()' built-in function and the ability to add
 -          new functions dynamically (*note Dynamic Extensions::).
++"Underflow behavior"
++     The format may or may not support gradual underflow.
  
- 16.1.1.1 The String Value Can Lie
- .................................
 -        - The `fflush()' function from Brian Kernighan's version of
 -          `awk' (*note I/O Functions::).
++"Rounding"
++     The rounding mode of this context.
  
- Internally, `awk' keeps both the numeric value (double precision
- floating-point) and the string value for a variable.  Separately, `awk'
- keeps track of what type the variable has (*note Typing and
- Comparison::), which plays a role in how variables are used in
- comparisons.
 -        - The `gensub()', `patsplit()', and `strtonum()' functions for
 -          more powerful text manipulation (*note String Functions::).
++   *note table-ieee-formats:: lists the precision and exponent field
++values for the basic IEEE-754 binary formats:
  
-    It is important to note that the string value for a number may not
- reflect the full value (all the digits) that the numeric value actually
- contains.  The following program (`values.awk') illustrates this:
 -        - The `mktime()', `systime()', and `strftime()' functions for
 -          working with timestamps (*note Time Functions::).
++Name           Total bits     Precision      emin           emax
++--------------------------------------------------------------------------- 
++Single         32             24             -126           +127
++Double         64             53             -1022          +1023
++Quadruple      128            113            -16382         +16383
  
-      {
-         sum = $1 + $2
-         # see it for what it is
-         printf("sum = %.12g\n", sum)
-         # use CONVFMT
-         a = "<" sum ">"
-         print "a =", a
-         # use OFMT
-         print "sum =", sum
-      }
 -   * Changes and/or additions in the command-line options:
++Table 15.1: Basic IEEE Format Context Values
  
- This program shows the full value of the sum of `$1' and `$2' using
- `printf', and then prints the string values obtained from both
- automatic conversion (via `CONVFMT') and from printing (via `OFMT').
 -        - The `AWKPATH' environment variable for specifying a path
 -          search for the `-f' command-line option (*note Options::).
++     NOTE: The precision numbers include the implied leading one that
++     gives them one extra bit of significand.
  
-    Here is what happens when the program is run:
 -        - The ability to use GNU-style long-named options that start
 -          with `--' and the `--characters-as-bytes', `--compat',
 -          `--dump-variables', `--exec', `--gen-pot', `--lint',
 -          `--lint-old', `--non-decimal-data', `--posix', `--profile',
 -          `--re-interval', `--sandbox', `--source', `--traditional', and
 -          `--use-lc-numeric' options (*note Options::).
++   A floating-point context can also determine which signals are treated
++as exceptions, and can set rules for arithmetic with special values.
++Please consult the IEEE-754 standard or other resources for details.
  
-      $ echo 3.654321 1.2345678 | awk -f values.awk
-      -| sum = 4.8888888
-      -| a = <4.88889>
-      -| sum = 4.88889
 -   * Support for the following obsolete systems was removed from the
 -     code and the documentation for `gawk' version 4.0:
++   `gawk' ordinarily uses the hardware double precision representation
++for numbers.  On most systems, this is IEEE-754 floating-point format,
++corresponding to 64-bit binary with 53 bits of precision.
  
-    This makes it clear that the full numeric value is different from
- what the default string representations show.
 -        - Amiga
++     NOTE: In case an underflow occurs, the standard allows, but does
++     not require, the result from an arithmetic operation to be a
++     number smaller than the smallest nonzero normalized number. Such
++     numbers do not have as many significant digits as normal numbers,
++     and are called "denormals" or "subnormals". The alternative,
++     simply returning a zero, is called "flush to zero". The basic
++     IEEE-754 binary formats support subnormal numbers.
  
-    `CONVFMT''s default value is `"%.6g"', which yields a value with at
- least six significant digits.  For some applications, you might want to
- change it to specify more precision.  On most modern machines, most of
- the time, 17 digits is enough to capture a floating-point number's
- value exactly.(1)
 -        - Atari
++
++File: gawk.info,  Node: Rounding Mode,  Prev: Floating-point Context,  Up: 
Floating-point Programming
  
-    ---------- Footnotes ----------
 -        - BeOS
++15.2.3 Floating-point Rounding Mode
++-----------------------------------
  
-    (1) Pathological cases can require up to 752 digits (!), but we
- doubt that you need to worry about this.
 -        - Cray
++The "rounding mode" specifies the behavior for the results of numerical
++operations when discarding extra precision. Each rounding mode indicates
++how the least significant returned digit of a rounded result is to be
++calculated.  *note table-rounding-modes:: lists the IEEE-754 defined
++rounding modes:
  
- 
- File: gawk.info,  Node: Unexpected Results,  Next: POSIX Floating Point 
Problems,  Prev: String Conversion Precision,  Up: Floating Point Issues
 -        - MIPS RiscOS
++Rounding Mode                    IEEE Name
++-------------------------------------------------------------------------- 
++Round to nearest, ties to even   `roundTiesToEven'
++Round toward plus Infinity       `roundTowardPositive'
++Round toward negative Infinity   `roundTowardNegative'
++Round toward zero                `roundTowardZero'
++Round to nearest, ties away      `roundTiesToAway'
++from zero                        
 +
- 16.1.1.2 Floating Point Numbers Are Not Abstract Numbers
- ........................................................
++Table 15.2: IEEE 754 Rounding Modes
 +
- Unlike numbers in the abstract sense (such as what you studied in high
- school or college arithmetic), numbers stored in computers are limited
- in certain ways.  They cannot represent an infinite number of digits,
- nor can they always represent things exactly.  In particular,
- floating-point numbers cannot always represent values exactly.  Here is
- an example:
++   The default mode `roundTiesToEven' is the most preferred, but the
++least intuitive. This method does the obvious thing for most values, by
++rounding them up or down to the nearest digit.  For example, rounding
++1.132 to two digits yields 1.13, and rounding 1.157 yields 1.16.
 +
-      $ awk '{ printf("%010d\n", $1 * 100) }'
-      515.79
-      -| 0000051579
-      515.80
-      -| 0000051579
-      515.81
-      -| 0000051580
-      515.82
-      -| 0000051582
-      Ctrl-d
++   However, when it comes to rounding a value that is exactly halfway
++between, things do not work the way you probably learned in school.  In
++this case, the number is rounded to the nearest even digit.  So
++rounding 0.125 to two digits rounds down to 0.12, but rounding 0.6875
++to three digits rounds up to 0.688.  You probably have already
++encountered this rounding mode when using the `printf' routine to
++format floating-point numbers.  For example:
  
- This shows that some values can be represented exactly, whereas others
- are only approximated.  This is not a "bug" in `awk', but simply an
- artifact of how computers represent numbers.
 -        - MS-DOS with the Microsoft Compiler
++     BEGIN {
++         x = -4.5
++         for (i = 1; i < 10; i++) {
++             x += 1.0
++             printf("%4.1f => %2.0f\n", x, x)
++         }
++     }
  
-      NOTE: It cannot be emphasized enough that the behavior just
-      described is fundamental to modern computers. You will see this
-      kind of thing happen in _any_ programming language using hardware
-      floating-point numbers. It is _not_ a bug in `gawk', nor is it
-      something that can be "just fixed."
 -        - MS-Windows with the Microsoft Compiler
++produces the following output when run:(1)
 +
-    Another peculiarity of floating-point numbers on modern systems is
- that they often have more than one representation for the number zero!
- In particular, it is possible to represent "minus zero" as well as
- regular, or "positive" zero.
++     -3.5 => -4
++     -2.5 => -2
++     -1.5 => -2
++     -0.5 => 0
++      0.5 => 0
++      1.5 => 2
++      2.5 => 2
++      3.5 => 4
++      4.5 => 4
 +
-    This example shows that negative and positive zero are distinct
- values when stored internally, but that they are in fact equal to each
- other, as well as to "regular" zero:
++   The theory behind the rounding mode `roundTiesToEven' is that it
++more or less evenly distributes upward and downward rounds of exact
++halves, which might cause the round-off error to cancel itself out.
++This is the default rounding mode used in IEEE-754 computing functions
++and operators.
 +
-      $ gawk 'BEGIN { mz = -0 ; pz = 0
-      > printf "-0 = %g, +0 = %g, (-0 == +0) -> %d\n", mz, pz, mz == pz
-      > printf "mz == 0 -> %d, pz == 0 -> %d\n", mz == 0, pz == 0
-      > }'
-      -| -0 = -0, +0 = 0, (-0 == +0) -> 1
-      -| mz == 0 -> 1, pz == 0 -> 1
++   The other rounding modes are rarely used.  Round toward positive
++infinity (`roundTowardPositive') and round toward negative infinity
++(`roundTowardNegative') are often used to implement interval arithmetic,
++where you adjust the rounding mode to calculate upper and lower bounds
++for the range of output. The `roundTowardZero' mode can be used for
++converting floating-point numbers to integers.  The rounding mode
++`roundTiesToAway' rounds the result to the nearest number and selects
++the number with the larger magnitude if a tie occurs.
 +
-    It helps to keep this in mind should you process numeric data that
- contains negative zero values; the fact that the zero is negative is
- noted and can affect comparisons.
++   Some numerical analysts will tell you that your choice of rounding
++style has tremendous impact on the final outcome, and advise you to
++wait until final output for any rounding. Instead, you can often avoid
++round-off error problems by setting the precision initially to some
++value sufficiently larger than the final desired precision, so that the
++accumulation of round-off error does not influence the outcome.  If you
++suspect that results from your computation are sensitive to
++accumulation of round-off error, one way to be sure is to look for a
++significant difference in output when you change the rounding mode.
  
- 
- File: gawk.info,  Node: POSIX Floating Point Problems,  Prev: Unexpected 
Results,  Up: Floating Point Issues
 -        - NeXT
++   ---------- Footnotes ----------
  
- 16.1.1.3 Standards Versus Existing Practice
- ...........................................
 -        - SunOS 3.x, Sun 386 (Road Runner)
++   (1) It is possible for the output to be completely different if the
++C library in your system does not use the IEEE-754 even-rounding rule
++to round halfway cases for `printf()'.
  
- Historically, `awk' has converted any non-numeric looking string to the
- numeric value zero, when required.  Furthermore, the original
- definition of the language and the original POSIX standards specified
- that `awk' only understands decimal numbers (base 10), and not octal
- (base 8) or hexadecimal numbers (base 16).
 -        - Tandem (non-POSIX)
++
++File: gawk.info,  Node: Gawk and MPFR,  Next: Arbitrary Precision Floats,  
Prev: Floating-point Programming,  Up: Arbitrary Precision Arithmetic
  
-    Changes in the language of the 2001 and 2004 POSIX standards can be
- interpreted to imply that `awk' should support additional features.
- These features are:
 -        - Prestandard VAX C compiler for VAX/VMS
++15.3 `gawk' + MPFR = Powerful Arithmetic
++========================================
  
-    * Interpretation of floating point data values specified in
-      hexadecimal notation (`0xDEADBEEF'). (Note: data values, _not_
-      source code constants.)
++The rest of this major node decsribes how to use the arbitrary precision
++(also known as "multiple precision" or "infinite precision") numeric
++capabilites in `gawk' to produce maximally accurate results when you
++need it.
  
-    * Support for the special IEEE 754 floating point values "Not A
-      Number" (NaN), positive Infinity ("inf") and negative Infinity
-      ("-inf").  In particular, the format for these values is as
-      specified by the ISO 1999 C standard, which ignores case and can
-      allow machine-dependent additional characters after the `nan' and
-      allow either `inf' or `infinity'.
++   But first you should check if your version of `gawk' supports
++arbitrary precision arithmetic.  The easiest way to find out is to look
++at the output of the following command:
  
-    The first problem is that both of these are clear changes to
- historical practice:
 -
 -File: gawk.info,  Node: Common Extensions,  Next: Ranges and Locales,  Prev: 
POSIX/GNU,  Up: Language History
++     $ gawk --version
++     -| GNU Awk 4.1.0 (GNU MPFR 3.1.0, GNU MP 5.0.3)
++     -| Copyright (C) 1989, 1991-2012 Free Software Foundation.
++     ...
  
-    * The `gawk' maintainer feels that supporting hexadecimal floating
-      point values, in particular, is ugly, and was never intended by the
-      original designers to be part of the language.
 -A.6 Common Extensions Summary
 -=============================
++   `gawk' uses the GNU MPFR (http://www.mpfr.org) and GNU MP
++(http://gmplib.org) (GMP) libraries for arbitrary precision arithmetic
++on numbers. So if you do not see the names of these libraries in the
++output, then your version of `gawk' does not support arbitrary
++precision arithmetic.
 +
-    * Allowing completely alphabetic strings to have valid numeric
-      values is also a very severe departure from historical practice.
++   Additionally, there are a few elements available in the `PROCINFO'
++array to provide information about the MPFR and GMP libraries.  *Note
++Auto-set::, for more information.
 +
-    The second problem is that the `gawk' maintainer feels that this
- interpretation of the standard, which requires a certain amount of
- "language lawyering" to arrive at in the first place, was not even
- intended by the standard developers.  In other words, "we see how you
- got where you are, but we don't think that that's where you want to be."
++
++File: gawk.info,  Node: Arbitrary Precision Floats,  Next: Arbitrary 
Precision Integers,  Prev: Gawk and MPFR,  Up: Arbitrary Precision Arithmetic
 +
-    Recognizing the above issues, but attempting to provide compatibility
- with the earlier versions of the standard, the 2008 POSIX standard
- added explicit wording to allow, but not require, that `awk' support
- hexadecimal floating point values and special values for "Not A Number"
- and infinity.
++15.4 Arbitrary Precision Floating-point Arithmetic with `gawk'
++==============================================================
 +
-    Although the `gawk' maintainer continues to feel that providing
- those features is inadvisable, nevertheless, on systems that support
- IEEE floating point, it seems reasonable to provide _some_ way to
- support NaN and Infinity values.  The solution implemented in `gawk' is
- as follows:
++`gawk' uses the GNU MPFR library for arbitrary precision floating-point
++arithmetic.  The MPFR library provides precise control over precisions
++and rounding modes, and gives correctly rounded reproducible
++platform-independent results.  With the command-line option `--bignum'
++or `-M', all floating-point arithmetic operators and numeric functions
++can yield results to any desired precision level supported by MPFR.
++Two built-in variables `PREC' (*note Setting Precision::) and
++`ROUNDMODE' (*note Setting Rounding Mode::) provide control over the
++working precision and the rounding mode.  The precision and the
++rounding mode are set globally for every operation to follow.
 +
-    * With the `--posix' command-line option, `gawk' becomes "hands
-      off." String values are passed directly to the system library's
-      `strtod()' function, and if it successfully returns a numeric
-      value, that is what's used.(1) By definition, the results are not
-      portable across different systems.  They are also a little
-      surprising:
++   The default working precision for arbitrary precision floating-point
++values is 53, and the default value for `ROUNDMODE' is `"N"', which
++selects the IEEE-754 `roundTiesToEven' (*note Rounding Mode::) rounding
++mode.(1) `gawk' uses the default exponent range in MPFR (EMAX = 2^30 -
++1, EMIN = -EMAX) for all floating-point contexts.  There is no explicit
++mechanism to adjust the exponent range.  MPFR does not implement
++subnormal numbers by default, and this behavior cannot be changed in
++`gawk'.
 +
-           $ echo nanny | gawk --posix '{ print $1 + 0 }'
-           -| nan
-           $ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }'
-           -| 3735928559
++     NOTE: When emulating an IEEE-754 format (*note Setting
++     Precision::), `gawk' internally adjusts the exponent range to the
++     value defined for the format and also performs computations needed
++     for gradual underflow (subnormal numbers).
 +
-    * Without `--posix', `gawk' interprets the four strings `+inf',
-      `-inf', `+nan', and `-nan' specially, producing the corresponding
-      special numeric values.  The leading sign acts a signal to `gawk'
-      (and the user) that the value is really numeric.  Hexadecimal
-      floating point is not supported (unless you also use
-      `--non-decimal-data', which is _not_ recommended). For example:
++     NOTE: MPFR numbers are variable-size entities, consuming only as
++     much space as needed to store the significant digits. Since the
++     performance using MPFR numbers pales in comparison to doing
++     arithmetic using the underlying machine types, you should consider
++     using only as much precision as needed by your program.
  
-           $ echo nanny | gawk '{ print $1 + 0 }'
-           -| 0
-           $ echo +nan | gawk '{ print $1 + 0 }'
-           -| nan
-           $ echo 0xDeadBeef | gawk '{ print $1 + 0 }'
-           -| 0
 -This minor node summarizes the common extensions supported by `gawk',
 -Brian Kernighan's `awk', and `mawk', the three most widely-used freely
 -available versions of `awk' (*note Other Versions::).
++* Menu:
  
-      `gawk' does ignore case in the four special values.  Thus `+nan'
-      and `+NaN' are the same.
 -Feature                      BWK Awk   Mawk   GNU Awk
 --------------------------------------------------------- 
 -`\x' Escape sequence         X         X      X
 -`RS' as regexp                         X      X
 -`FS' as null string          X         X      X
 -`/dev/stdin' special file    X         X      X
 -`/dev/stdout' special file   X         X      X
 -`/dev/stderr' special file   X         X      X
 -`**' and `**=' operators     X                X
 -`func' keyword               X                X
 -`nextfile' statement         X         X      X
 -`delete' without subscript   X         X      X
 -`length()' of an array       X                X
 -`fflush()' function          X         X      X
 -`BINMODE' variable                     X      X
++* Setting Precision::           Setting the working precision.
++* Setting Rounding Mode::       Setting the rounding mode.
++* Floating-point Constants::    Representing floating-point constants.
++* Changing Precision::          Changing the precision of a number.
++* Exact Arithmetic::            Exact arithmetic with floating-point numbers.
  
 -
 -File: gawk.info,  Node: Ranges and Locales,  Next: Contributors,  Prev: 
Common Extensions,  Up: Language History
 +   ---------- Footnotes ----------
  
-    (1) You asked for it, you got it.
 -A.7 Regexp Ranges and Locales: A Long Sad Story
 -===============================================
++   (1) The default precision is 53, since according to the MPFR
++documentation, the library should be able to exactly reproduce all
++computations with double-precision machine floating-point numbers
++(`double' type in C), except the default exponent range is much wider
++and subnormal numbers are not implemented.
  
 -This minor node describes the confusing history of ranges within
 -regular expressions and their interactions with locales, and how this
 -affected different versions of `gawk'.
 +
- File: gawk.info,  Node: Integer Programming,  Prev: Floating Point Issues,  
Up: General Arithmetic
- 
- 16.1.2 Mixing Integers And Floating-point
- -----------------------------------------
++File: gawk.info,  Node: Setting Precision,  Next: Setting Rounding Mode,  Up: 
Arbitrary Precision Floats
  
- As has been mentioned already, `gawk' ordinarily uses hardware double
- precision with 64-bit IEEE binary floating-point representation for
- numbers on most systems. A large integer like 9007199254740997 has a
- binary representation that, although finite, is more than 53 bits long;
- it must also be rounded to 53 bits.  The biggest integer that can be
- stored in a C `double' is usually the same as the largest possible
- value of a `double'. If your system `double' is an IEEE 64-bit
- `double', this largest possible value is an integer and can be
- represented precisely.  What more should one know about integers?
 -   The original Unix tools that worked with regular expressions defined
 -character ranges (such as `[a-z]') to match any character between the
 -first character in the range and the last character in the range,
 -inclusive.  Ordering was based on the numeric value of each character
 -in the machine's native character set.  Thus, on ASCII-based systems,
 -`[a-z]' matched all the lowercase letters, and only the lowercase
 -letters, since the numeric values for the letters from `a' through `z'
 -were contiguous.  (On an EBCDIC system, the range `[a-z]' includes
 -additional, non-alphabetic characters as well.)
++15.4.1 Setting the Working Precision
++------------------------------------
  
-    If you want to know what is the largest integer, such that it and
- all smaller integers can be stored in 64-bit doubles without losing
- precision, then the answer is 2^53.  The next representable number is
- the even number 2^53 + 2, meaning it is unlikely that you will be able
- to make `gawk' print 2^53 + 1 in integer format.  The range of integers
- exactly representable by a 64-bit double is [-2^53, 2^53].  If you ever
- see an integer outside this range in `gawk' using 64-bit doubles, you
- have reason to be very suspicious about the accuracy of the output.
- Here is a simple program with erroneous output:
 -   Almost all introductory Unix literature explained range expressions
 -as working in this fashion, and in particular, would teach that the
 -"correct" way to match lowercase letters was with `[a-z]', and that
 -`[A-Z]' was the "correct" way to match uppercase letters.  And indeed,
 -this was true.(1)
++`gawk' uses a global working precision; it does not keep track of the
++precision or accuracy of individual numbers. Performing an arithmetic
++operation or calling a built-in function rounds the result to the
++current working precision. The default working precision is 53 which
++can be modified using the built-in variable `PREC'. You can also set the
++value to one of the following pre-defined case-insensitive strings to
++emulate an IEEE-754 binary format:
 +
-      $ gawk 'BEGIN { i = 2^53 - 1; for (j = 0; j < 4; j++) print i + j }'
-      -| 9007199254740991
-      -| 9007199254740992
-      -| 9007199254740992
-      -| 9007199254740994
++`PREC'       IEEE-754 Binary Format
++--------------------------------------------------- 
++`"half"'     16-bit half-precision.
++`"single"'   Basic 32-bit single precision.
++`"double"'   Basic 64-bit double precision.
++`"quad"'     Basic 128-bit quadruple precision.
++`"oct"'      256-bit octuple precision.
 +
-    The lesson is to not assume that any large integer printed by `gawk'
- represents an exact result from your computation, especially if it wraps
- around on your screen.
++   The following example illustrates the effects of changing precision
++on arithmetic operations:
 +
- 
- File: gawk.info,  Node: Floating-point Programming,  Next: Gawk and MPFR,  
Prev: General Arithmetic,  Up: Arbitrary Precision Arithmetic
++     $ gawk -M -vPREC=100 'BEGIN { x = 1.0e-400; print x + 0; \
++     >   PREC = "double"; print x + 0 }'
++     -| 1e-400
++     -| 0
  
- 16.2 Understanding Floating-point Programming
- =============================================
 -   The 1993 POSIX standard introduced the idea of locales (*note
 -Locales::).  Since many locales include other letters besides the plain
 -twenty-six letters of the American English alphabet, the POSIX standard
 -added character classes (*note Bracket Expressions::) as a way to match
 -different kinds of characters besides the traditional ones in the ASCII
 -character set.
++   Binary and decimal precisions are related approximately according to
++the formula:
 +
- Numerical programming is an extensive area; if you need to develop
- sophisticated numerical algorithms then `gawk' may not be the ideal
- tool, and this documentation may not be sufficient.  It might require
- digesting a book or two to really internalize how to compute with ideal
- accuracy and precision and the result often depends on the particular
- application.
++   PREC = 3.322 * DPS
 +
-      NOTE: A floating-point calculation's "accuracy" is how close it
-      comes to the real value.  This is as opposed to the "precision",
-      which usually refers to the number of bits used to represent the
-      number (see the Wikipedia article
-      (http://en.wikipedia.org/wiki/Accuracy_and_precision) for more
-      information).
++Here, PREC denotes the binary precision (measured in bits) and DPS
++(short for decimal places) is the decimal digits. We can easily
++calculate how many decimal digits the 53-bit significand of an IEEE
++double is equivalent to: 53 / 3.332 which is equal to about 15.95.  But
++what does 15.95 digits actually mean? It depends whether you are
++concerned about how many digits you can rely on, or how many digits you
++need.
 +
-    There are two options for doing floating-point calculations:
- hardware floating-point (as used by standard `awk' and the default for
- `gawk'), and "arbitrary-precision" floating-point, which is software
- based.  This major node aims to provide enough information to
- understand both, and then will focus on `gawk''s facilities for the
- latter.(1)
++   It is important to know how many bits it takes to uniquely identify
++a double-precision value (the C type `double').  If you want to convert
++from `double' to decimal and back to `double' (e.g., saving a `double'
++representing an intermediate result to a file, and later reading it
++back to restart the computation), then a few more decimal digits are
++required. 17 digits is generally enough for a `double'.
 +
-    Binary floating-point representations and arithmetic are inexact.
- Simple values like 0.1 cannot be precisely represented using binary
- floating-point numbers, and the limited precision of floating-point
- numbers means that slight changes in the order of operations or the
- precision of intermediate storage can change the result. To make
- matters worse, with arbitrary precision floating-point, you can set the
- precision before starting a computation, but then you cannot be sure of
- the number of significant decimal places in the final result.
++   It can also be important to know what decimal numbers can be uniquely
++represented with a `double'. If you want to convert from decimal to
++`double' and back again, 15 digits is the most that you can get. Stated
++differently, you should not present the numbers from your
++floating-point computations with more than 15 significant digits in
++them.
  
-    Sometimes, before you start to write any code, you should think more
- about what you really want and what's really happening. Consider the
- two numbers in the following example:
 -   However, the standard _changed_ the interpretation of range
 -expressions.  In the `"C"' and `"POSIX"' locales, a range expression
 -like `[a-dx-z]' is still equivalent to `[abcdxyz]', as in ASCII.  But
 -outside those locales, the ordering was defined to be based on
 -"collation order".
++   Conversely, it takes a precision of 332 bits to hold an approximation
++of the constant pi that is accurate to 100 decimal places.  You should
++always add some extra bits in order to avoid the confusing round-off
++issues that occur because numbers are stored internally in binary.
  
-      x = 0.875             # 1/2 + 1/4 + 1/8
-      y = 0.425
 -   In many locales, `A' and `a' are both less than `B'.  In other
 -words, these locales sort characters in dictionary order, and
 -`[a-dx-z]' is typically not equivalent to `[abcdxyz]'; instead it might
 -be equivalent to `[ABCXYabcdxyz]', for example.
++
++File: gawk.info,  Node: Setting Rounding Mode,  Next: Floating-point 
Constants,  Prev: Setting Precision,  Up: Arbitrary Precision Floats
  
-    Unlike the number in `y', the number stored in `x' is exactly
- representable in binary since it can be written as a finite sum of one
- or more fractions whose denominators are all powers of two.  When
- `gawk' reads a floating-point number from program source, it
- automatically rounds that number to whatever precision your machine
- supports. If you try to print the numeric content of a variable using
- an output format string of `"%.17g"', it may not produce the same
- number as you assigned to it:
 -   This point needs to be emphasized: Much literature teaches that you
 -should use `[a-z]' to match a lowercase character.  But on systems with
 -non-ASCII locales, this also matched all of the uppercase characters
 -except `A' or `Z'!  This was a continuous cause of confusion, even well
 -into the twenty-first century.
++15.4.2 Setting the Rounding Mode
++--------------------------------
  
-      $ gawk 'BEGIN { x = 0.875; y = 0.425
-      >               printf("%0.17g, %0.17g\n", x, y) }'
-      -| 0.875, 0.42499999999999999
 -   To demonstrate these issues, the following example uses the `sub()'
 -function, which does text replacement (*note String Functions::).  Here,
 -the intent is to remove trailing uppercase characters:
++The `ROUNDMODE' variable provides program level control over the
++rounding mode.  The correspondance between `ROUNDMODE' and the IEEE
++rounding modes is shown in *note table-gawk-rounding-modes::.
  
-    Often the error is so small you do not even notice it, and if you do,
- you can always specify how much precision you would like in your output.
- Usually this is a format string like `"%.15g"', which when used in the
- previous example, produces an output identical to the input.
 -     $ echo something1234abc | gawk-3.1.8 '{ sub("[A-Z]*$", ""); print }'
 -     -| something1234a
++Rounding Mode                    IEEE Name              `ROUNDMODE'
++--------------------------------------------------------------------------- 
++Round to nearest, ties to even   `roundTiesToEven'      `"N"' or `"n"'
++Round toward plus Infinity       `roundTowardPositive'  `"U"' or `"u"'
++Round toward negative Infinity   `roundTowardNegative'  `"D"' or `"d"'
++Round toward zero                `roundTowardZero'      `"Z"' or `"z"'
++Round to nearest, ties away      `roundTiesToAway'      `"A"' or `"a"'
++from zero                                               
  
-    Because the underlying representation can be little bit off from the
- exact value, comparing floating-point values to see if they are equal
- is generally not a good idea.  Here is an example where it does not
- work like you expect:
 -This output is unexpected, since the `bc' at the end of
 -`something1234abc' should not normally match `[A-Z]*'.  This result is
 -due to the locale setting (and thus you may not see it on your system).
++Table 15.3: `gawk' Rounding Modes
  
-      $ gawk 'BEGIN { print (0.1 + 12.2 == 12.3) }'
-      -| 0
 -   Similar considerations apply to other ranges.  For example, `["-/]'
 -is perfectly valid in ASCII, but is not valid in many Unicode locales,
 -such as `en_US.UTF-8'.
++   `ROUNDMODE' has the default value `"N"', which selects the IEEE-754
++rounding mode `roundTiesToEven'.  Besides the values listed in *note
++Table 15.3: table-gawk-rounding-modes, `gawk' also accepts `"A"' to
++select the IEEE-754 mode `roundTiesToAway' if your version of the MPFR
++library supports it; otherwise setting `ROUNDMODE' to this value has no
++effect. *Note Rounding Mode::, for the meanings of the various rounding
++modes.
  
-    The loss of accuracy during a single computation with floating-point
- numbers usually isn't enough to worry about. However, if you compute a
- value which is the result of a sequence of floating point operations,
- the error can accumulate and greatly affect the computation itself.
- Here is an attempt to compute the value of the constant pi using one of
- its many series representations:
 -   Early versions of `gawk' used regexp matching code that was not
 -locale aware, so ranges had their traditional interpretation.
++   Here is an example of how to change the default rounding behavior of
++`printf''s output:
  
-      BEGIN {
-          x = 1.0 / sqrt(3.0)
-          n = 6
-          for (i = 1; i < 30; i++) {
-              n = n * 2.0
-              x = (sqrt(x * x + 1) - 1) / x
-              printf("%.15f\n", n * x)
-          }
-      }
 -   When `gawk' switched to using locale-aware regexp matchers, the
 -problems began; especially as both GNU/Linux and commercial Unix
 -vendors started implementing non-ASCII locales, _and making them the
 -default_.  Perhaps the most frequently asked question became something
 -like "why does `[A-Z]' match lowercase letters?!?"
++     $ gawk -M -vROUNDMODE="Z" 'BEGIN { printf("%.2f\n", 1.378) }'
++     -| 1.37
  
-    When run, the early errors propagating through later computations
- cause the loop to terminate prematurely after an attempt to divide by
- zero.
 -   This situation existed for close to 10 years, if not more, and the
 -`gawk' maintainer grew weary of trying to explain that `gawk' was being
 -nicely standards-compliant, and that the issue was in the user's
 -locale.  During the development of version 4.0, he modified `gawk' to
 -always treat ranges in the original, pre-POSIX fashion, unless
 -`--posix' was used (*note Options::).(2)
++
++File: gawk.info,  Node: Floating-point Constants,  Next: Changing Precision,  
Prev: Setting Rounding Mode,  Up: Arbitrary Precision Floats
  
-      $ gawk -f pi.awk
-      -| 3.215390309173475
-      -| 3.159659942097510
-      -| 3.146086215131467
-      -| 3.142714599645573
-      ...
-      -| 3.224515243534819
-      -| 2.791117213058638
-      -| 0.000000000000000
-      error--> gawk: pi.awk:6: fatal: division by zero attempted
 -   Fortunately, shortly before the final release of `gawk' 4.0, the
 -maintainer learned that the 2008 standard had changed the definition of
 -ranges, such that outside the `"C"' and `"POSIX"' locales, the meaning
 -of range expressions was _undefined_.(3)
++15.4.3 Representing Floating-point Constants
++--------------------------------------------
  
-    Here is one more example where the inaccuracies in internal
- representations yield an unexpected result:
 -   By using this lovely technical term, the standard gives license to
 -implementors to implement ranges in whatever way they choose.  The
 -`gawk' maintainer chose to apply the pre-POSIX meaning in all cases:
 -the default regexp matching; with `--traditional', and with `--posix';
 -in all cases, `gawk' remains POSIX compliant.
++Be wary of floating-point constants! When reading a floating-point
++constant from program source code, `gawk' uses the default precision,
++unless overridden by an assignment to the special variable `PREC' on
++the command line, to store it internally as a MPFR number.  Changing
++the precision using `PREC' in the program text does not change the
++precision of a constant. If you need to represent a floating-point
++constant at a higher precision than the default and cannot use a
++command line assignment to `PREC', you should either specify the
++constant as a string, or as a rational number whenever possible. The
++following example illustrates the differences among various ways to
++print a floating-point constant:
 +
-      $ gawk 'BEGIN {
-      >   for (d = 1.1; d <= 1.5; d += 0.1)
-      >       i++
-      >   print i
-      > }'
-      -| 4
++     $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }'
++     -| 0.1000000000000000055511151
++     $ gawk -M -vPREC = 113 'BEGIN { printf("%0.25f\n", 0.1) }'
++     -| 0.1000000000000000000000000
++     $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }'
++     -| 0.1000000000000000000000000
++     $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }'
++     -| 0.1000000000000000000000000
 +
-    Can computation using aribitrary precision help with the previous
- examples?  If you are impatient to know, see *note Exact Arithmetic::.
++   In the first case, the number is stored with the default precision
++of 53.
 +
-    Instead of aribitrary precision floating-point arithmetic, often all
- you need is an adjustment of your logic or a different order for the
- operations in your calculation.  The stability and the accuracy of the
- computation of the constant pi in the previous example can be enhanced
- by using the following simple algebraic transformation:
++
++File: gawk.info,  Node: Changing Precision,  Next: Exact Arithmetic,  Prev: 
Floating-point Constants,  Up: Arbitrary Precision Floats
 +
-      (sqrt(x * x + 1) - 1) / x = x / (sqrt(x * x + 1) + 1)
++15.4.4 Changing the Precision of a Number
++-----------------------------------------
  
- After making this, change the program does converge to pi in under 30
- iterations:
 -   ---------- Footnotes ----------
++     The point is that in any variable-precision package, a decision is
++     made on how to treat numbers given as data, or arising in
++     intermediate results, which are represented in floating-point
++     format to a precision lower than working precision.  Do we promote
++     them to full membership of the high-precision club, or do we treat
++     them and all their associates as second-class citizens?  Sometimes
++     the first course is proper, sometimes the second, and it takes
++     careful analysis to tell which.
 +
-      $ gawk -f /tmp/pi2.awk
-      -| 3.215390309173473
-      -| 3.159659942097501
-      -| 3.146086215131436
-      -| 3.142714599645370
-      -| 3.141873049979825
-      ...
-      -| 3.141592653589797
-      -| 3.141592653589797
++     Dirk Laurie(1)
 +
-    There is no need to be unduly suspicious about the results from
- floating-point arithmetic. The lesson to remember is that
- floating-point arithmetic is always more complex than the arithmetic
- using pencil and paper. In order to take advantage of the power of
- computer floating-point, you need to know its limitations and work
- within them. For most casual use of floating-point arithmetic, you will
- often get the expected result in the end if you simply round the
- display of your final results to the correct number of significant
- decimal digits. And, avoid presenting numerical data in a manner that
- implies better precision than is actually the case.
++   `gawk' does not implicitly modify the precision of any previously
++computed results when the working precision is changed with an
++assignment to `PREC'.  The precision of a number is always the one that
++was used at the time of its creation, and there is no way for the user
++to explicitly change it afterwards. However, since the result of a
++floating-point arithmetic operation is always an arbitrary precision
++floating-point value--with a precision set by the value of `PREC'--one
++of the following workarounds effectively accomplishes the desired
++behavior:
 +
- * Menu:
++     x = x + 0.0
  
- * Floating-point Representation:: Binary floating-point representation.
- * Floating-point Context::        Floating-point context.
- * Rounding Mode::                 Floating-point rounding mode.
 -   (1) And Life was good.
++or:
+ 
 -   (2) And thus was born the Campain for Rational Range Interpretation
 -(or RRI). A number of GNU tools, such as `grep' and `sed', have either
 -implemented this change, or will soon.  Thanks to Karl Berry for
 -coining the phrase "Rational Range Interpretation."
++     x += 0.0
  
 -   (3) See the standard
 
-(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05)
 -and its rationale
 
-(http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap09.html#tag_21_09_03_05).
 +   ---------- Footnotes ----------
  
-    (1) If you are interested in other tools that perform arbitrary
- precision arithmetic, you may want to investigate the POSIX `bc' tool.
- See the POSIX specification for it
- (http://pubs.opengroup.org/onlinepubs/009695399/utilities/bc.html), for
- more information.
 -
 -File: gawk.info,  Node: Contributors,  Prev: Ranges and Locales,  Up: 
Language History
++   (1) Dirk Laurie.  `Variable-precision Arithmetic Considered Perilous
++-- A Detective Story'.  Electronic Transactions on Numerical Analysis.
++Volume 28, pp. 168-173, 2008.
  
 -A.8 Major Contributors to `gawk'
 -================================
 +
- File: gawk.info,  Node: Floating-point Representation,  Next: Floating-point 
Context,  Up: Floating-point Programming
++File: gawk.info,  Node: Exact Arithmetic,  Prev: Changing Precision,  Up: 
Arbitrary Precision Floats
  
- 16.2.1 Binary Floating-point Representation
- -------------------------------------------
 -     Always give credit where credit is due.
 -     Anonymous
++15.4.5 Exact Arithmetic with Floating-point Numbers
++---------------------------------------------------
  
- Although floating-point representations vary from machine to machine,
- the most commonly encountered representation is that defined by the
- IEEE 754 Standard. An IEEE-754 format value has three components:
 -   This minor node names the major contributors to `gawk' and/or this
 -Info file, in approximate chronological order:
++     CAUTION: Never depend on the exactness of floating-point
++     arithmetic, even for apparently simple expressions!
  
-    * A sign bit telling whether the number is positive or negative.
 -   * Dr. Alfred V. Aho, Dr. Peter J. Weinberger, and Dr. Brian W.
 -     Kernighan, all of Bell Laboratories, designed and implemented Unix
 -     `awk', from which `gawk' gets the majority of its feature set.
++   Can arbitrary precision arithmetic give exact results? There are no
++easy answers. The standard rules of algebra often do not apply when
++using floating-point arithmetic.  Among other things, the distributive
++and associative laws do not hold completely, and order of operation may
++be important for your computation. Rounding error, cumulative precision
++loss and underflow are often troublesome.
  
-    * An "exponent" giving its order of magnitude, E.
 -   * Paul Rubin did the initial design and implementation in 1986, and
 -     wrote the first draft (around 40 pages) of this Info file.
++   When `gawk' tests the expressions `0.1 + 12.2' and `12.3' for
++equality using the machine double precision arithmetic, it decides that
++they are not equal!  (*Note Floating-point Programming::.)  You can get
++the result you want by increasing the precision; 56 in this case will
++get the job done:
  
-    * A "significand", S, specifying the actual digits of the number.
 -   * Jay Fenlason finished the initial implementation.
++     $ gawk -M -vPREC=56 'BEGIN { print (0.1 + 12.2 == 12.3) }'
++     -| 1
  
-    The value of the number is then S * 2^E.  The first bit of a
- non-zero binary significand is always one, so the significand in an
- IEEE-754 format only includes the fractional part, leaving the leading
- one implicit.
 -   * Diane Close revised the first draft of this Info file, bringing it
 -     to around 90 pages.
++   If adding more bits is good, perhaps adding even more bits of
++precision is better?  Here is what happens if we use an even larger
++value of `PREC':
  
-    Three of the standard IEEE-754 types are 32-bit single precision,
- 64-bit double precision and 128-bit quadruple precision.  The standard
- also specifies extended precision formats to allow greater precisions
- and larger exponent ranges.
 -   * Richard Stallman helped finish the implementation and the initial
 -     draft of this Info file.  He is also the founder of the FSF and
 -     the GNU project.
++     $ gawk -M -vPREC=201 'BEGIN { print (0.1 + 12.2 == 12.3) }'
++     -| 0
  
-    The significand is stored in "normalized" format, which means that
- the first bit is always a one.
 -   * John Woods contributed parts of the code (mostly fixes) in the
 -     initial version of `gawk'.
++   This is not a bug in `gawk' or in the MPFR library.  It is easy to
++forget that the finite number of bits used to store the value is often
++just an approximation after proper rounding.  The test for equality
++succeeds if and only if _all_ bits in the two operands are exactly the
++same. Since this is not necessarily true after floating-point
++computations with a particular precision and effective rounding rule, a
++straight test for equality may not work.
 +
- 
- File: gawk.info,  Node: Floating-point Context,  Next: Rounding Mode,  Prev: 
Floating-point Representation,  Up: Floating-point Programming
++   So, don't assume that floating-point values can be compared for
++equality.  You should also exercise caution when using other forms of
++comparisons.  The standard way to compare between floating-point
++numbers is to determine how much error (or "tolerance") you will allow
++in a comparison and check to see if one value is within this error
++range of the other.
++
++   In applications where 15 or fewer decimal places suffice, hardware
++double precision arithmetic can be adequate, and is usually much faster.
++But you do need to keep in mind that every floating-point operation can
++suffer a new rounding error with catastrophic consequences as
++illustrated by our attempt to compute the value of the constant pi
++(*note Floating-point Programming::).  Extra precision can greatly
++enhance the stability and the accuracy of your computation in such
++cases.
++
++   Repeated addition is not necessarily equivalent to multiplication in
++floating-point arithmetic. In the example in *note Floating-point
++Programming:::
+ 
 -   * In 1988, David Trueman took over primary maintenance of `gawk',
 -     making it compatible with "new" `awk', and greatly improving its
 -     performance.
++     $ gawk 'BEGIN {
++     >   for (d = 1.1; d <= 1.5; d += 0.1)
++     >       i++
++     >   print i
++     > }'
++     -| 4
  
- 16.2.2 Floating-point Context
- -----------------------------
 -   * Conrad Kwok, Scott Garfinkle, and Kent Williams did the initial
 -     ports to MS-DOS with various versions of MSC.
++you may or may not succeed in getting the correct result by choosing an
++arbitrarily large value for `PREC'. Reformulation of the problem at
++hand is often the correct approach in such situations.
  
- A floating-point "context" defines the environment for arithmetic
- operations.  It governs precision, sets rules for rounding, and limits
- the range for exponents.  The context has the following primary
- components:
 -   * Pat Rankin provided the VMS port and its documentation.
++
++File: gawk.info,  Node: Arbitrary Precision Integers,  Prev: Arbitrary 
Precision Floats,  Up: Arbitrary Precision Arithmetic
  
- "Precision"
-      Precision of the floating-point format in bits.
 -   * Hal Peterson provided help in porting `gawk' to Cray systems.
 -     (This is no longer supported.)
++15.5 Arbitrary Precision Integer Arithmetic with `gawk'
++=======================================================
  
- "emax"
-      Maximum exponent allowed for this format.
 -   * Kai Uwe Rommel provided the initial port to OS/2 and its
 -     documentation.
++If the option `--bignum' or `-M' is specified, `gawk' performs all
++integer arithmetic using GMP arbitrary precision integers.  Any number
++that looks like an integer in a program source or data file is stored
++as an arbitrary precision integer.  The size of the integer is limited
++only by your computer's memory.  The current floating-point context has
++no effect on operations involving integers.  For example, the following
++computes 5^4^3^2, the result of which is beyond the limits of ordinary
++`gawk' numbers:
  
- "emin"
-      Minimum exponent allowed for this format.
 -   * Michal Jaegermann provided the port to Atari systems and its
 -     documentation.  (This port is no longer supported.)  He continues
 -     to provide portability checking with DEC Alpha systems, and has
 -     done a lot of work to make sure `gawk' works on non-32-bit systems.
++     $ gawk -M 'BEGIN {
++     >   x = 5^4^3^2
++     >   print "# of digits =", length(x)
++     >   print substr(x, 1, 20), "...", substr(x, length(x) - 19, 20)
++     > }'
++     -| # of digits = 183231
++     -| 62060698786608744707 ... 92256259918212890625
 +
- "Underflow behavior"
-      The format may or may not support gradual underflow.
++   If you were to compute the same value using arbitrary precision
++floating-point values instead, the precision needed for correct output
++(using the formula `prec = 3.322 * dps'), would be 3.322 x 183231, or
++608693.  (Thus, the floating-point representation requires over 30
++times as many decimal digits!)
 +
- "Rounding"
-      The rounding mode of this context.
++   The result from an arithmetic operation with an integer and a
++floating-point value is a floating-point value with a precision equal
++to the working precision.  The following program calculates the eighth
++term in Sylvester's sequence(1) using a recurrence:
 +
-    *note table-ieee-formats:: lists the precision and exponent field
- values for the basic IEEE-754 binary formats:
++     $ gawk -M 'BEGIN {
++     >   s = 2.0
++     >   for (i = 1; i <= 7; i++)
++     >       s = s * (s - 1) + 1
++     >   print s
++     > }'
++     -| 113423713055421845118910464
 +
- Name           Total bits     Precision      emin           emax
- --------------------------------------------------------------------------- 
- Single         32             24             -126           +127
- Double         64             53             -1022          +1023
- Quadruple      128            113            -16382         +16383
++   The output differs from the acutal number,
++113423713055421844361000443, because the default precision of 53 is not
++enough to represent the floating-point results exactly. You can either
++increase the precision (100 is enough in this case), or replace the
++floating-point constant `2.0' with an integer, to perform all
++computations using integer arithmetic to get the correct output.
 +
- Table 16.1: Basic IEEE Format Context Values
++   It will sometimes be necessary for `gawk' to implicitly convert an
++arbitrary precision integer into an arbitrary precision floating-point
++value.  This is primarily because the MPFR library does not always
++provide the relevant interface to process arbitrary precision integers
++or mixed-mode numbers as needed by an operation or function.  In such a
++case, the precision is set to the minimum value necessary for exact
++conversion, and the working precision is not used for this purpose.  If
++this is not what you need or want, you can employ a subterfuge like
++this:
  
-      NOTE: The precision numbers include the implied leading one that
-      gives them one extra bit of significand.
 -   * Fred Fish provided the port to Amiga systems and its documentation.
 -     (With Fred's sad passing, this is no longer supported.)
++     gawk -M 'BEGIN { n = 13; print (n + 0.0) % 2.0 }'
  
-    A floating-point context can also determine which signals are treated
- as exceptions, and can set rules for arithmetic with special values.
- Please consult the IEEE-754 standard or other resources for details.
 -   * Scott Deifik currently maintains the MS-DOS port using DJGPP.
++   You can avoid this issue altogether by specifying the number as a
++floating-point value to begin with:
  
-    `gawk' ordinarily uses the hardware double precision representation
- for numbers.  On most systems, this is IEEE-754 floating-point format,
- corresponding to 64-bit binary with 53 bits of precision.
 -   * Eli Zaretskii currently maintains the MS-Windows port using MinGW.
++     gawk -M 'BEGIN { n = 13.0; print n % 2.0 }'
  
-      NOTE: In case an underflow occurs, the standard allows, but does
-      not require, the result from an arithmetic operation to be a
-      number smaller than the smallest nonzero normalized number. Such
-      numbers do not have as many significant digits as normal numbers,
-      and are called "denormals" or "subnormals". The alternative,
-      simply returning a zero, is called "flush to zero". The basic
-      IEEE-754 binary formats support subnormal numbers.
 -   * Juan Grigera provided a port to Windows32 systems.  (This is no
 -     longer supported.)
++   Note that for the particular example above, there is likely best to
++just use the following:
  
- 
- File: gawk.info,  Node: Rounding Mode,  Prev: Floating-point Context,  Up: 
Floating-point Programming
 -   * For many years, Dr. Darrel Hankerson acted as coordinator for the
 -     various ports to different PC platforms and created binary
 -     distributions for various PC operating systems.  He was also
 -     instrumental in keeping the documentation up to date for the
 -     various PC platforms.
++     gawk -M 'BEGIN { n = 13; print n % 2 }'
  
- 16.2.3 Floating-point Rounding Mode
- -----------------------------------
 -   * Christos Zoulas provided the `extension()' built-in function for
 -     dynamically adding new modules.
++   ---------- Footnotes ----------
  
- The "rounding mode" specifies the behavior for the results of numerical
- operations when discarding extra precision. Each rounding mode indicates
- how the least significant returned digit of a rounded result is to be
- calculated.  *note table-rounding-modes:: lists the IEEE-754 defined
- rounding modes:
 -   * Ju"rgen Kahrs contributed the initial version of the TCP/IP
 -     networking code and documentation, and motivated the inclusion of
 -     the `|&' operator.
++   (1) Weisstein, Eric W.  `Sylvester's Sequence'. From MathWorld--A
++Wolfram Web Resource.
++`http://mathworld.wolfram.com/SylvestersSequence.html'
  
- Rounding Mode                    IEEE Name
- -------------------------------------------------------------------------- 
- Round to nearest, ties to even   `roundTiesToEven'
- Round toward plus Infinity       `roundTowardPositive'
- Round toward negative Infinity   `roundTowardNegative'
- Round toward zero                `roundTowardZero'
- Round to nearest, ties away      `roundTiesToAway'
- from zero                        
 -   * Stephen Davies provided the initial port to Tandem systems and its
 -     documentation.  (However, this is no longer supported.)  He was
 -     also instrumental in the initial work to integrate the byte-code
 -     internals into the `gawk' code base.
++
++File: gawk.info,  Node: Dynamic Extensions,  Next: Language History,  Prev: 
Arbitrary Precision Arithmetic,  Up: Top
  
- Table 16.2: IEEE 754 Rounding Modes
 -   * Matthew Woehlke provided improvements for Tandem's POSIX-compliant
 -     systems.
++16 Writing Extensions for `gawk'
++********************************
  
-    The default mode `roundTiesToEven' is the most preferred, but the
- least intuitive. This method does the obvious thing for most values, by
- rounding them up or down to the nearest digit.  For example, rounding
- 1.132 to two digits yields 1.13, and rounding 1.157 yields 1.16.
 -   * Martin Brown provided the port to BeOS and its documentation.
 -     (This is no longer supported.)
++This chapter is a placeholder, pending a rewrite for the new API.  Some
++of the old bits remain, since they can be partially reused.
  
-    However, when it comes to rounding a value that is exactly halfway
- between, things do not work the way you probably learned in school.  In
- this case, the number is rounded to the nearest even digit.  So
- rounding 0.125 to two digits rounds down to 0.12, but rounding 0.6875
- to three digits rounds up to 0.688.  You probably have already
- encountered this rounding mode when using the `printf' routine to
- format floating-point numbers.  For example:
 -   * Arno Peters did the initial work to convert `gawk' to use GNU
 -     Automake and GNU `gettext'.
++   It is possible to add new built-in functions to `gawk' using
++dynamically loaded libraries. This facility is available on systems
++(such as GNU/Linux) that support the C `dlopen()' and `dlsym()'
++functions.  This major node describes how to write and use dynamically
++loaded extensions for `gawk'.  Experience with programming in C or C++
++is necessary when reading this minor node.
  
-      BEGIN {
-          x = -4.5
-          for (i = 1; i < 10; i++) {
-              x += 1.0
-              printf("%4.1f => %2.0f\n", x, x)
-          }
-      }
 -   * Alan J. Broder provided the initial version of the `asort()'
 -     function as well as the code for the optional third argument to the
 -     `match()' function.
++     NOTE: When `--sandbox' is specified, extensions are disabled
++     (*note Options::.
  
- produces the following output when run:(1)
 -   * Andreas Buening updated the `gawk' port for OS/2.
++* Menu:
  
-      -3.5 => -4
-      -2.5 => -2
-      -1.5 => -2
-      -0.5 => 0
-       0.5 => 0
-       1.5 => 2
-       2.5 => 2
-       3.5 => 4
-       4.5 => 4
 -   * Isamu Hasegawa, of IBM in Japan, contributed support for multibyte
 -     characters.
++* Plugin License::              A note about licensing.
++* Sample Library::              A example of new functions.
  
-    The theory behind the rounding mode `roundTiesToEven' is that it
- more or less evenly distributes upward and downward rounds of exact
- halves, which might cause the round-off error to cancel itself out.
- This is the default rounding mode used in IEEE-754 computing functions
- and operators.
 -   * Michael Benzinger contributed the initial code for `switch'
 -     statements.
++
++File: gawk.info,  Node: Plugin License,  Next: Sample Library,  Up: Dynamic 
Extensions
  
-    The other rounding modes are rarely used.  Round toward positive
- infinity (`roundTowardPositive') and round toward negative infinity
- (`roundTowardNegative') are often used to implement interval arithmetic,
- where you adjust the rounding mode to calculate upper and lower bounds
- for the range of output. The `roundTowardZero' mode can be used for
- converting floating-point numbers to integers.  The rounding mode
- `roundTiesToAway' rounds the result to the nearest number and selects
- the number with the larger magnitude if a tie occurs.
 -   * Patrick T.J. McPhee contributed the code for dynamic loading in
 -     Windows32 environments.  (This is no longer supported)
++16.1 Extension Licensing
++========================
  
-    Some numerical analysts will tell you that your choice of rounding
- style has tremendous impact on the final outcome, and advise you to
- wait until final output for any rounding. Instead, you can often avoid
- round-off error problems by setting the precision initially to some
- value sufficiently larger than the final desired precision, so that the
- accumulation of round-off error does not influence the outcome.  If you
- suspect that results from your computation are sensitive to
- accumulation of round-off error, one way to be sure is to look for a
- significant difference in output when you change the rounding mode.
 -   * John Haque reworked the `gawk' internals to use a byte-code engine,
 -     providing the `dgawk' debugger for `awk' programs.
++Every dynamic extension should define the global symbol
++`plugin_is_GPL_compatible' to assert that it has been licensed under a
++GPL-compatible license.  If this symbol does not exist, `gawk' will
++emit a fatal error and exit.
  
-    ---------- Footnotes ----------
 -   * Efraim Yawitz contributed the original text for *note Debugger::.
++   The declared type of the symbol should be `int'.  It does not need
++to be in any allocated section, though.  The code merely asserts that
++the symbol exists in the global scope.  Something like this is enough:
  
-    (1) It is possible for the output to be completely different if the
- C library in your system does not use the IEEE-754 even-rounding rule
- to round halfway cases for `printf()'.
 -   * Arnold Robbins has been working on `gawk' since 1988, at first
 -     helping David Trueman, and as the primary maintainer since around
 -     1994.
++     int plugin_is_GPL_compatible;
  
  
- File: gawk.info,  Node: Gawk and MPFR,  Next: Arbitrary Precision Floats,  
Prev: Floating-point Programming,  Up: Arbitrary Precision Arithmetic
- 
- 16.3 `gawk' + MPFR = Powerful Arithmetic
- ========================================
- 
- The rest of this major node decsribes how to use the arbitrary precision
- (also known as "multiple precision" or "infinite precision") numeric
- capabilites in `gawk' to produce maximally accurate results when you
- need it.
 -File: gawk.info,  Node: Installation,  Next: Notes,  Prev: Language History,  
Up: Top
++File: gawk.info,  Node: Sample Library,  Prev: Plugin License,  Up: Dynamic 
Extensions
  
-    But first you should check if your version of `gawk' supports
- arbitrary precision arithmetic.  The easiest way to find out is to look
- at the output of the following command:
 -Appendix B Installing `gawk'
 -****************************
++16.2 Example: Directory and File Operation Built-ins
++====================================================
  
-      $ gawk --version
-      -| GNU Awk 4.1.0 (GNU MPFR 3.1.0, GNU MP 5.0.3)
-      -| Copyright (C) 1989, 1991-2012 Free Software Foundation.
-      ...
 -This appendix provides instructions for installing `gawk' on the
 -various platforms that are supported by the developers.  The primary
 -developer supports GNU/Linux (and Unix), whereas the other ports are
 -contributed.  *Note Bugs::, for the electronic mail addresses of the
 -people who did the respective ports.
++Two useful functions that are not in `awk' are `chdir()' (so that an
++`awk' program can change its directory) and `stat()' (so that an `awk'
++program can gather information about a file).  This minor node
++implements these functions for `gawk' in an external extension library.
  
-    `gawk' uses the GNU MPFR (http://www.mpfr.org) and GNU MP
- (http://gmplib.org) (GMP) libraries for arbitrary precision arithmetic
- on numbers. So if you do not see the names of these libraries in the
- output, then your version of `gawk' does not support arbitrary
- precision arithmetic.
+ * Menu:
  
-    Additionally, there are a few elements available in the `PROCINFO'
- array to provide information about the MPFR and GMP libraries.  *Note
- Auto-set::, for more information.
 -* Gawk Distribution::           What is in the `gawk' distribution.
 -* Unix Installation::           Installing `gawk' under various
 -                                versions of Unix.
 -* Non-Unix Installation::       Installation on Other Operating Systems.
 -* Bugs::                        Reporting Problems and Bugs.
 -* Other Versions::              Other freely available `awk'
 -                                implementations.
++* Internal File Description::   What the new functions will do.
++* Internal File Ops::           The code for internal file operations.
++* Using Internal File Ops::     How to use an external extension.
  
  
- File: gawk.info,  Node: Arbitrary Precision Floats,  Next: Arbitrary 
Precision Integers,  Prev: Gawk and MPFR,  Up: Arbitrary Precision Arithmetic
 -File: gawk.info,  Node: Gawk Distribution,  Next: Unix Installation,  Up: 
Installation
++File: gawk.info,  Node: Internal File Description,  Next: Internal File Ops,  
Up: Sample Library
  
- 16.4 Arbitrary Precision Floating-point Arithmetic with `gawk'
- ==============================================================
 -B.1 The `gawk' Distribution
 -===========================
++16.2.1 Using `chdir()' and `stat()'
++-----------------------------------
  
- `gawk' uses the GNU MPFR library for arbitrary precision floating-point
- arithmetic.  The MPFR library provides precise control over precisions
- and rounding modes, and gives correctly rounded reproducible
- platform-independent results.  With the command-line option `--bignum'
- or `-M', all floating-point arithmetic operators and numeric functions
- can yield results to any desired precision level supported by MPFR.
- Two built-in variables `PREC' (*note Setting Precision::) and
- `ROUNDMODE' (*note Setting Rounding Mode::) provide control over the
- working precision and the rounding mode.  The precision and the
- rounding mode are set globally for every operation to follow.
 -This minor node describes how to get the `gawk' distribution, how to
 -extract it, and then what is in the various files and subdirectories.
++This minor node shows how to use the new functions at the `awk' level
++once they've been integrated into the running `gawk' interpreter.
++Using `chdir()' is very straightforward. It takes one argument, the new
++directory to change to:
+ 
 -* Menu:
++     ...
++     newdir = "/home/arnold/funstuff"
++     ret = chdir(newdir)
++     if (ret < 0) {
++         printf("could not change to %s: %s\n",
++                        newdir, ERRNO) > "/dev/stderr"
++         exit 1
++     }
++     ...
  
-    The default working precision for arbitrary precision floating-point
- values is 53, and the default value for `ROUNDMODE' is `"N"', which
- selects the IEEE-754 `roundTiesToEven' (*note Rounding Mode::) rounding
- mode.(1) `gawk' uses the default exponent range in MPFR (EMAX = 2^30 -
- 1, EMIN = -EMAX) for all floating-point contexts.  There is no explicit
- mechanism to adjust the exponent range.  MPFR does not implement
- subnormal numbers by default, and this behavior cannot be changed in
- `gawk'.
 -* Getting::                     How to get the distribution.
 -* Extracting::                  How to extract the distribution.
 -* Distribution contents::       What is in the distribution.
++   The return value is negative if the `chdir' failed, and `ERRNO'
++(*note Built-in Variables::) is set to a string indicating the error.
  
-      NOTE: When emulating an IEEE-754 format (*note Setting
-      Precision::), `gawk' internally adjusts the exponent range to the
-      value defined for the format and also performs computations needed
-      for gradual underflow (subnormal numbers).
 -
 -File: gawk.info,  Node: Getting,  Next: Extracting,  Up: Gawk Distribution
++   Using `stat()' is a bit more complicated.  The C `stat()' function
++fills in a structure that has a fair amount of information.  The right
++way to model this in `awk' is to fill in an associative array with the
++appropriate information:
  
-      NOTE: MPFR numbers are variable-size entities, consuming only as
-      much space as needed to store the significant digits. Since the
-      performance using MPFR numbers pales in comparison to doing
-      arithmetic using the underlying machine types, you should consider
-      using only as much precision as needed by your program.
 -B.1.1 Getting the `gawk' Distribution
 --------------------------------------
++     file = "/home/arnold/.profile"
++     fdata[1] = "x"    # force `fdata' to be an array
++     ret = stat(file, fdata)
++     if (ret < 0) {
++         printf("could not stat %s: %s\n",
++                  file, ERRNO) > "/dev/stderr"
++         exit 1
++     }
++     printf("size of %s is %d bytes\n", file, fdata["size"])
  
- * Menu:
 -There are three ways to get GNU software:
++   The `stat()' function always clears the data array, even if the
++`stat()' fails.  It fills in the following elements:
  
- * Setting Precision::           Setting the working precision.
- * Setting Rounding Mode::       Setting the rounding mode.
- * Floating-point Constants::    Representing floating-point constants.
- * Changing Precision::          Changing the precision of a number.
- * Exact Arithmetic::            Exact arithmetic with floating-point numbers.
 -   * Copy it from someone else who already has it.
++`"name"'
++     The name of the file that was `stat()''ed.
  
-    ---------- Footnotes ----------
 -   * Retrieve `gawk' from the Internet host `ftp.gnu.org', in the
 -     directory `/gnu/gawk'.  Both anonymous `ftp' and `http' access are
 -     supported.  If you have the `wget' program, you can use a command
 -     like the following:
++`"dev"'
++`"ino"'
++     The file's device and inode numbers, respectively.
  
-    (1) The default precision is 53, since according to the MPFR
- documentation, the library should be able to exactly reproduce all
- computations with double-precision machine floating-point numbers
- (`double' type in C), except the default exponent range is much wider
- and subnormal numbers are not implemented.
 -          wget http://ftp.gnu.org/gnu/gawk/gawk-4.0.1.tar.gz
++`"mode"'
++     The file's mode, as a numeric value. This includes both the file's
++     type and its permissions.
  
- 
- File: gawk.info,  Node: Setting Precision,  Next: Setting Rounding Mode,  Up: 
Arbitrary Precision Floats
 -   The GNU software archive is mirrored around the world.  The
 -up-to-date list of mirror sites is available from the main FSF web site
 -(http://www.gnu.org/order/ftp.html).  Try to use one of the mirrors;
 -they will be less busy, and you can usually find one closer to your
 -site.
++`"nlink"'
++     The number of hard links (directory entries) the file has.
  
- 16.4.1 Setting the Working Precision
- ------------------------------------
 -
 -File: gawk.info,  Node: Extracting,  Next: Distribution contents,  Prev: 
Getting,  Up: Gawk Distribution
++`"uid"'
++`"gid"'
++     The numeric user and group ID numbers of the file's owner.
  
- `gawk' uses a global working precision; it does not keep track of the
- precision or accuracy of individual numbers. Performing an arithmetic
- operation or calling a built-in function rounds the result to the
- current working precision. The default working precision is 53 which
- can be modified using the built-in variable `PREC'. You can also set the
- value to one of the following pre-defined case-insensitive strings to
- emulate an IEEE-754 binary format:
 -B.1.2 Extracting the Distribution
 ----------------------------------
++`"size"'
++     The size in bytes of the file.
  
- `PREC'       IEEE-754 Binary Format
- --------------------------------------------------- 
- `"half"'     16-bit half-precision.
- `"single"'   Basic 32-bit single precision.
- `"double"'   Basic 64-bit double precision.
- `"quad"'     Basic 128-bit quadruple precision.
- `"oct"'      256-bit octuple precision.
 -`gawk' is distributed as several `tar' files compressed with different
 -compression programs: `gzip', `bzip2', and `xz'. For simplicity, the
 -rest of these instructions assume you are using the one compressed with
 -the GNU Zip program, `gzip'.
++`"blocks"'
++     The number of disk blocks the file actually occupies. This may not
++     be a function of the file's size if the file has holes.
  
-    The following example illustrates the effects of changing precision
- on arithmetic operations:
 -   Once you have the distribution (for example, `gawk-4.0.1.tar.gz'),
 -use `gzip' to expand the file and then use `tar' to extract it.  You
 -can use the following pipeline to produce the `gawk' distribution:
++`"atime"'
++`"mtime"'
++`"ctime"'
++     The file's last access, modification, and inode update times,
++     respectively.  These are numeric timestamps, suitable for
++     formatting with `strftime()' (*note Built-in::).
  
-      $ gawk -M -vPREC=100 'BEGIN { x = 1.0e-400; print x + 0; \
-      >   PREC = "double"; print x + 0 }'
-      -| 1e-400
-      -| 0
 -     # Under System V, add 'o' to the tar options
 -     gzip -d -c gawk-4.0.1.tar.gz | tar -xvpf -
++`"pmode"'
++     The file's "printable mode."  This is a string representation of
++     the file's type and permissions, such as what is produced by `ls
++     -l'--for example, `"drwxr-xr-x"'.
  
-    Binary and decimal precisions are related approximately according to
- the formula:
 -   On a system with GNU `tar', you can let `tar' do the decompression
 -for you:
++`"type"'
++     A printable string representation of the file's type.  The value
++     is one of the following:
  
-    PREC = 3.322 * DPS
 -     tar -xvpzf gawk-4.0.1.tar.gz
++    `"blockdev"'
++    `"chardev"'
++          The file is a block or character device ("special file").
  
- Here, PREC denotes the binary precision (measured in bits) and DPS
- (short for decimal places) is the decimal digits. We can easily
- calculate how many decimal digits the 53-bit significand of an IEEE
- double is equivalent to: 53 / 3.332 which is equal to about 15.95.  But
- what does 15.95 digits actually mean? It depends whether you are
- concerned about how many digits you can rely on, or how many digits you
- need.
 -Extracting the archive creates a directory named `gawk-4.0.1' in the
 -current directory.
++    `"directory"'
++          The file is a directory.
  
-    It is important to know how many bits it takes to uniquely identify
- a double-precision value (the C type `double').  If you want to convert
- from `double' to decimal and back to `double' (e.g., saving a `double'
- representing an intermediate result to a file, and later reading it
- back to restart the computation), then a few more decimal digits are
- required. 17 digits is generally enough for a `double'.
 -   The distribution file name is of the form `gawk-V.R.P.tar.gz'.  The
 -V represents the major version of `gawk', the R represents the current
 -release of version V, and the P represents a "patch level", meaning
 -that minor bugs have been fixed in the release.  The current patch
 -level is 1, but when retrieving distributions, you should get the
 -version with the highest version, release, and patch level.  (Note,
 -however, that patch levels greater than or equal to 70 denote "beta" or
 -nonproduction software; you might not want to retrieve such a version
 -unless you don't mind experimenting.)  If you are not on a Unix or
 -GNU/Linux system, you need to make other arrangements for getting and
 -extracting the `gawk' distribution.  You should consult a local expert.
++    `"fifo"'
++          The file is a named-pipe (also known as a FIFO).
  
-    It can also be important to know what decimal numbers can be uniquely
- represented with a `double'. If you want to convert from decimal to
- `double' and back again, 15 digits is the most that you can get. Stated
- differently, you should not present the numbers from your
- floating-point computations with more than 15 significant digits in
- them.
 -
 -File: gawk.info,  Node: Distribution contents,  Prev: Extracting,  Up: Gawk 
Distribution
++    `"file"'
++          The file is just a regular file.
  
-    Conversely, it takes a precision of 332 bits to hold an approximation
- of the constant pi that is accurate to 100 decimal places.  You should
- always add some extra bits in order to avoid the confusing round-off
- issues that occur because numbers are stored internally in binary.
 -B.1.3 Contents of the `gawk' Distribution
 ------------------------------------------
++    `"socket"'
++          The file is an `AF_UNIX' ("Unix domain") socket in the
++          filesystem.
  
- 
- File: gawk.info,  Node: Setting Rounding Mode,  Next: Floating-point 
Constants,  Prev: Setting Precision,  Up: Arbitrary Precision Floats
 -The `gawk' distribution has a number of C source files, documentation
 -files, subdirectories, and files related to the configuration process
 -(*note Unix Installation::), as well as several subdirectories related
 -to different non-Unix operating systems:
++    `"symlink"'
++          The file is a symbolic link.
  
- 16.4.2 Setting the Rounding Mode
- --------------------------------
 -Various `.c', `.y', and `.h' files
 -     The actual `gawk' source code.
++   Several additional elements may be present depending upon the
++operating system and the type of the file.  You can test for them in
++your `awk' program by using the `in' operator (*note Reference to
++Elements::):
  
- The `ROUNDMODE' variable provides program level control over the
- rounding mode.  The correspondance between `ROUNDMODE' and the IEEE
- rounding modes is shown in *note table-gawk-rounding-modes::.
 -`README'
 -`README_d/README.*'
 -     Descriptive files: `README' for `gawk' under Unix and the rest for
 -     the various hardware and software combinations.
++`"blksize"'
++     The preferred block size for I/O to the file. This field is not
++     present on all POSIX-like systems in the C `stat' structure.
  
- Rounding Mode                    IEEE Name              `ROUNDMODE'
- --------------------------------------------------------------------------- 
- Round to nearest, ties to even   `roundTiesToEven'      `"N"' or `"n"'
- Round toward plus Infinity       `roundTowardPositive'  `"U"' or `"u"'
- Round toward negative Infinity   `roundTowardNegative'  `"D"' or `"d"'
- Round toward zero                `roundTowardZero'      `"Z"' or `"z"'
- Round to nearest, ties away      `roundTiesToAway'      `"A"' or `"a"'
- from zero                                               
 -`INSTALL'
 -     A file providing an overview of the configuration and installation
 -     process.
++`"linkval"'
++     If the file is a symbolic link, this element is the name of the
++     file the link points to (i.e., the value of the link).
  
- Table 16.3: `gawk' Rounding Modes
 -`ChangeLog'
 -     A detailed list of source code changes as bugs are fixed or
 -     improvements made.
++`"rdev"'
++`"major"'
++`"minor"'
++     If the file is a block or character device file, then these values
++     represent the numeric device number and the major and minor
++     components of that number, respectively.
  
-    `ROUNDMODE' has the default value `"N"', which selects the IEEE-754
- rounding mode `roundTiesToEven'.  Besides the values listed in *note
- Table 16.3: table-gawk-rounding-modes, `gawk' also accepts `"A"' to
- select the IEEE-754 mode `roundTiesToAway' if your version of the MPFR
- library supports it; otherwise setting `ROUNDMODE' to this value has no
- effect. *Note Rounding Mode::, for the meanings of the various rounding
- modes.
 -`ChangeLog.0'
 -     An older list of source code changes.
++
++File: gawk.info,  Node: Internal File Ops,  Next: Using Internal File Ops,  
Prev: Internal File Description,  Up: Sample Library
  
-    Here is an example of how to change the default rounding behavior of
- `printf''s output:
 -`NEWS'
 -     A list of changes to `gawk' since the last release or patch.
++16.2.2 C Code for `chdir()' and `stat()'
++----------------------------------------
  
-      $ gawk -M -vROUNDMODE="Z" 'BEGIN { printf("%.2f\n", 1.378) }'
-      -| 1.37
 -`NEWS.0'
 -     An older list of changes to `gawk'.
++Here is the C code for these extensions.  They were written for
++GNU/Linux.  The code needs some more work for complete portability to
++other POSIX-compliant systems:(1)
  
- 
- File: gawk.info,  Node: Floating-point Constants,  Next: Changing Precision,  
Prev: Setting Rounding Mode,  Up: Arbitrary Precision Floats
 -`COPYING'
 -     The GNU General Public License.
++     #include "awk.h"
  
- 16.4.3 Representing Floating-point Constants
- --------------------------------------------
 -`FUTURES'
 -     A brief list of features and changes being contemplated for future
 -     releases, with some indication of the time frame for the feature,
 -     based on its difficulty.
++     #include <sys/sysmacros.h>
  
- Be wary of floating-point constants! When reading a floating-point
- constant from program source code, `gawk' uses the default precision,
- unless overridden by an assignment to the special variable `PREC' on
- the command line, to store it internally as a MPFR number.  Changing
- the precision using `PREC' in the program text does not change the
- precision of a constant. If you need to represent a floating-point
- constant at a higher precision than the default and cannot use a
- command line assignment to `PREC', you should either specify the
- constant as a string, or as a rational number whenever possible. The
- following example illustrates the differences among various ways to
- print a floating-point constant:
 -`LIMITATIONS'
 -     A list of those factors that limit `gawk''s performance.  Most of
 -     these depend on the hardware or operating system software and are
 -     not limits in `gawk' itself.
++     int plugin_is_GPL_compatible;
  
-      $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }'
-      -| 0.1000000000000000055511151
-      $ gawk -M -vPREC = 113 'BEGIN { printf("%0.25f\n", 0.1) }'
-      -| 0.1000000000000000000000000
-      $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }'
-      -| 0.1000000000000000000000000
-      $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }'
-      -| 0.1000000000000000000000000
 -`POSIX.STD'
 -     A description of behaviors in the POSIX standard for `awk' which
 -     are left undefined, or where `gawk' may not comply fully, as well
 -     as a list of things that the POSIX standard should describe but
 -     does not.
++     /*  do_chdir --- provide dynamically loaded chdir() builtin for gawk */
  
-    In the first case, the number is stored with the default precision
- of 53.
 -`doc/awkforai.txt'
 -     A short article describing why `gawk' is a good language for
 -     Artificial Intelligence (AI) programming.
++     static NODE *
++     do_chdir(int nargs)
++     {
++         NODE *newdir;
++         int ret = -1;
  
- 
- File: gawk.info,  Node: Changing Precision,  Next: Exact Arithmetic,  Prev: 
Floating-point Constants,  Up: Arbitrary Precision Floats
 -`doc/bc_notes'
 -     A brief description of `gawk''s "byte code" internals.
++         if (do_lint && nargs != 1)
++             lintwarn("chdir: called with incorrect number of arguments");
  
- 16.4.4 Changing the Precision of a Number
- -----------------------------------------
 -`doc/README.card'
 -`doc/ad.block'
 -`doc/awkcard.in'
 -`doc/cardfonts'
 -`doc/colors'
 -`doc/macros'
 -`doc/no.colors'
 -`doc/setter.outline'
 -     The `troff' source for a five-color `awk' reference card.  A
 -     modern version of `troff' such as GNU `troff' (`groff') is needed
 -     to produce the color version. See the file `README.card' for
 -     instructions if you have an older `troff'.
++         newdir = get_scalar_argument(0, FALSE);
  
-      The point is that in any variable-precision package, a decision is
-      made on how to treat numbers given as data, or arising in
-      intermediate results, which are represented in floating-point
-      format to a precision lower than working precision.  Do we promote
-      them to full membership of the high-precision club, or do we treat
-      them and all their associates as second-class citizens?  Sometimes
-      the first course is proper, sometimes the second, and it takes
-      careful analysis to tell which.
 -`doc/gawk.1'
 -     The `troff' source for a manual page describing `gawk'.  This is
 -     distributed for the convenience of Unix users.
++   The file includes the `"awk.h"' header file for definitions for the
++`gawk' internals.  It includes `<sys/sysmacros.h>' for access to the
++`major()' and `minor'() macros.
  
-      Dirk Laurie(1)
 -`doc/gawk.texi'
 -     The Texinfo source file for this Info file.  It should be
 -     processed with TeX (via `texi2dvi' or `texi2pdf') to produce a
 -     printed document, and with `makeinfo' to produce an Info or HTML
 -     file.
++   By convention, for an `awk' function `foo', the function that
++implements it is called `do_foo'.  The function should take a `int'
++argument, usually called `nargs', that represents the number of defined
++arguments for the function.  The `newdir' variable represents the new
++directory to change to, retrieved with `get_scalar_argument()'.  Note
++that the first argument is numbered zero.
  
-    `gawk' does not implicitly modify the precision of any previously
- computed results when the working precision is changed with an
- assignment to `PREC'.  The precision of a number is always the one that
- was used at the time of its creation, and there is no way for the user
- to explicitly change it afterwards. However, since the result of a
- floating-point arithmetic operation is always an arbitrary precision
- floating-point value--with a precision set by the value of `PREC'--one
- of the following workarounds effectively accomplishes the desired
- behavior:
 -`doc/gawk.info'
 -     The generated Info file for this Info file.
++   This code actually accomplishes the `chdir()'. It first forces the
++argument to be a string and passes the string value to the `chdir()'
++system call. If the `chdir()' fails, `ERRNO' is updated.
  
-      x = x + 0.0
 -`doc/gawkinet.texi'
 -     The Texinfo source file for *note (General Introduction)Top::
 -     gawkinet, TCP/IP Internetworking with `gawk'.  It should be
 -     processed with TeX (via `texi2dvi' or `texi2pdf') to produce a
 -     printed document and with `makeinfo' to produce an Info or HTML
 -     file.
++         (void) force_string(newdir);
++         ret = chdir(newdir->stptr);
++         if (ret < 0)
++             update_ERRNO_int(errno);
  
- or:
 -`doc/gawkinet.info'
 -     The generated Info file for `TCP/IP Internetworking with `gawk''.
++   Finally, the function returns the return value to the `awk' level:
  
-      x += 0.0
 -`doc/igawk.1'
 -     The `troff' source for a manual page describing the `igawk'
 -     program presented in *note Igawk Program::.
 -
 -`doc/Makefile.in'
 -     The input file used during the configuration process to generate
 -     the actual `Makefile' for creating the documentation.
 -
 -`Makefile.am'
 -`*/Makefile.am'
 -     Files used by the GNU `automake' software for generating the
 -     `Makefile.in' files used by `autoconf' and `configure'.
 -
 -`Makefile.in'
 -`aclocal.m4'
 -`configh.in'
 -`configure.ac'
 -`configure'
 -`custom.h'
 -`missing_d/*'
 -`m4/*'
 -     These files and subdirectories are used when configuring `gawk'
 -     for various Unix systems.  They are explained in *note Unix
 -     Installation::.
++         return make_number((AWKNUM) ret);
++     }
  
-    ---------- Footnotes ----------
 -`po/*'
 -     The `po' library contains message translations.
++   The `stat()' built-in is more involved.  First comes a function that
++turns a numeric mode into a printable representation (e.g., 644 becomes
++`-rw-r--r--'). This is omitted here for brevity:
  
-    (1) Dirk Laurie.  `Variable-precision Arithmetic Considered Perilous
- -- A Detective Story'.  Electronic Transactions on Numerical Analysis.
- Volume 28, pp. 168-173, 2008.
 -`awklib/extract.awk'
 -`awklib/Makefile.am'
 -`awklib/Makefile.in'
 -`awklib/eg/*'
 -     The `awklib' directory contains a copy of `extract.awk' (*note
 -     Extract Program::), which can be used to extract the sample
 -     programs from the Texinfo source file for this Info file. It also
 -     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'.
++     /* format_mode --- turn a stat mode field into something readable */
  
- 
- File: gawk.info,  Node: Exact Arithmetic,  Prev: Changing Precision,  Up: 
Arbitrary Precision Floats
 -`posix/*'
 -     Files needed for building `gawk' on POSIX-compliant systems.
++     static char *
++     format_mode(unsigned long fmode)
++     {
++         ...
++     }
  
- 16.4.5 Exact Arithmetic with Floating-point Numbers
- ---------------------------------------------------
 -`pc/*'
 -     Files needed for building `gawk' under MS-Windows and OS/2 (*note
 -     PC Installation::, for details).
++   Next comes the `do_stat()' function. It starts with variable
++declarations and argument checking:
  
-      CAUTION: Never depend on the exactness of floating-point
-      arithmetic, even for apparently simple expressions!
 -`vms/*'
 -     Files needed for building `gawk' under VMS (*note VMS
 -     Installation::, for details).
++     /* do_stat --- provide a stat() function for gawk */
  
-    Can arbitrary precision arithmetic give exact results? There are no
- easy answers. The standard rules of algebra often do not apply when
- using floating-point arithmetic.  Among other things, the distributive
- and associative laws do not hold completely, and order of operation may
- be important for your computation. Rounding error, cumulative precision
- loss and underflow are often troublesome.
 -`test/*'
 -     A test suite for `gawk'.  You can use `make check' from the
 -     top-level `gawk' directory to run your version of `gawk' against
 -     the test suite.  If `gawk' successfully passes `make check', then
 -     you can be confident of a successful port.
++     static NODE *
++     do_stat(int nargs)
++     {
++         NODE *file, *array, *tmp;
++         struct stat sbuf;
++         int ret;
++         NODE **aptr;
++         char *pmode;    /* printable mode */
++         char *type = "unknown";
  
-    When `gawk' tests the expressions `0.1 + 12.2' and `12.3' for
- equality using the machine double precision arithmetic, it decides that
- they are not equal!  (*Note Floating-point Programming::.)  You can get
- the result you want by increasing the precision; 56 in this case will
- get the job done:
 -
 -File: gawk.info,  Node: Unix Installation,  Next: Non-Unix Installation,  
Prev: Gawk Distribution,  Up: Installation
++         if (do_lint && nargs > 2)
++             lintwarn("stat: called with too many arguments");
  
-      $ gawk -M -vPREC=56 'BEGIN { print (0.1 + 12.2 == 12.3) }'
-      -| 1
 -B.2 Compiling and Installing `gawk' on Unix-like Systems
 -========================================================
++   Then comes the actual work. First, the function gets the arguments.
++Then, it always clears the array.  The code use `lstat()' (instead of
++`stat()') to get the file information, in case the file is a symbolic
++link.  If there's an error, it sets `ERRNO' and returns:
  
-    If adding more bits is good, perhaps adding even more bits of
- precision is better?  Here is what happens if we use an even larger
- value of `PREC':
 -Usually, you can compile and install `gawk' by typing only two
 -commands.  However, if you use an unusual system, you may need to
 -configure `gawk' for your system yourself.
++         /* file is first arg, array to hold results is second */
++         file = get_scalar_argument(0, FALSE);
++         array = get_array_argument(1, FALSE);
  
-      $ gawk -M -vPREC=201 'BEGIN { print (0.1 + 12.2 == 12.3) }'
-      -| 0
 -* Menu:
++         /* empty out the array */
++         assoc_clear(array);
  
-    This is not a bug in `gawk' or in the MPFR library.  It is easy to
- forget that the finite number of bits used to store the value is often
- just an approximation after proper rounding.  The test for equality
- succeeds if and only if _all_ bits in the two operands are exactly the
- same. Since this is not necessarily true after floating-point
- computations with a particular precision and effective rounding rule, a
- straight test for equality may not work.
 -* Quick Installation::               Compiling `gawk' under Unix.
 -* Additional Configuration Options:: Other compile-time options.
 -* Configuration Philosophy::         How it's all supposed to work.
++         /* lstat the file, if error, set ERRNO and return */
++         (void) force_string(file);
++         ret = lstat(file->stptr, & sbuf);
++         if (ret < 0) {
++             update_ERRNO_int(errno);
++             return make_number((AWKNUM) ret);
++         }
  
-    So, don't assume that floating-point values can be compared for
- equality.  You should also exercise caution when using other forms of
- comparisons.  The standard way to compare between floating-point
- numbers is to determine how much error (or "tolerance") you will allow
- in a comparison and check to see if one value is within this error
- range of the other.
 -
 -File: gawk.info,  Node: Quick Installation,  Next: Additional Configuration 
Options,  Up: Unix Installation
++   Now comes the tedious part: filling in the array.  Only a few of the
++calls are shown here, since they all follow the same pattern:
  
-    In applications where 15 or fewer decimal places suffice, hardware
- double precision arithmetic can be adequate, and is usually much faster.
- But you do need to keep in mind that every floating-point operation can
- suffer a new rounding error with catastrophic consequences as
- illustrated by our attempt to compute the value of the constant pi
- (*note Floating-point Programming::).  Extra precision can greatly
- enhance the stability and the accuracy of your computation in such
- cases.
 -B.2.1 Compiling `gawk' for Unix-like Systems
 ---------------------------------------------
++         /* fill in the array */
++         aptr = assoc_lookup(array, tmp = make_string("name", 4));
++         *aptr = dupnode(file);
++         unref(tmp);
  
-    Repeated addition is not necessarily equivalent to multiplication in
- floating-point arithmetic. In the example in *note Floating-point
- Programming:::
 -The normal installation steps should work on all modern commercial
 -Unix-derived systems, GNU/Linux, BSD-based systems, and the Cygwin
 -environment for MS-Windows.
++         aptr = assoc_lookup(array, tmp = make_string("mode", 4));
++         *aptr = make_number((AWKNUM) sbuf.st_mode);
++         unref(tmp);
  
-      $ gawk 'BEGIN {
-      >   for (d = 1.1; d <= 1.5; d += 0.1)
-      >       i++
-      >   print i
-      > }'
-      -| 4
 -   After you have extracted the `gawk' distribution, `cd' to
 -`gawk-4.0.1'.  Like most GNU software, `gawk' is configured
 -automatically for your system by running the `configure' program.  This
 -program is a Bourne shell script that is generated automatically using
 -GNU `autoconf'.  (The `autoconf' software is described fully starting
 -with *note (Autoconf)Top:: autoconf,Autoconf--Generating Automatic
 -Configuration Scripts.)
++         aptr = assoc_lookup(array, tmp = make_string("pmode", 5));
++         pmode = format_mode(sbuf.st_mode);
++         *aptr = make_string(pmode, strlen(pmode));
++         unref(tmp);
  
- you may or may not succeed in getting the correct result by choosing an
- arbitrarily large value for `PREC'. Reformulation of the problem at
- hand is often the correct approach in such situations.
 -   To configure `gawk', simply run `configure':
++   When done, return the `lstat()' return value:
  
- 
- File: gawk.info,  Node: Arbitrary Precision Integers,  Prev: Arbitrary 
Precision Floats,  Up: Arbitrary Precision Arithmetic
 -     sh ./configure
  
- 16.5 Arbitrary Precision Integer Arithmetic with `gawk'
- =======================================================
 -   This produces a `Makefile' and `config.h' tailored to your system.
 -The `config.h' file describes various facts about your system.  You
 -might want to edit the `Makefile' to change the `CFLAGS' variable,
 -which controls the command-line options that are passed to the C
 -compiler (such as optimization levels or compiling for debugging).
++         return make_number((AWKNUM) ret);
++     }
  
- If the option `--bignum' or `-M' is specified, `gawk' performs all
- integer arithmetic using GMP arbitrary precision integers.  Any number
- that looks like an integer in a program source or data file is stored
- as an arbitrary precision integer.  The size of the integer is limited
- only by your computer's memory.  The current floating-point context has
- no effect on operations involving integers.  For example, the following
- computes 5^4^3^2, the result of which is beyond the limits of ordinary
- `gawk' numbers:
 -   Alternatively, you can add your own values for most `make' variables
 -on the command line, such as `CC' and `CFLAGS', when running
 -`configure':
++   Finally, it's necessary to provide the "glue" that loads the new
++function(s) into `gawk'.  By convention, each library has a routine
++named `dl_load()' that does the job.  The simplest way is to use the
++`dl_load_func' macro in `gawkapi.h'.
  
-      $ gawk -M 'BEGIN {
-      >   x = 5^4^3^2
-      >   print "# of digits =", length(x)
-      >   print substr(x, 1, 20), "...", substr(x, length(x) - 19, 20)
-      > }'
-      -| # of digits = 183231
-      -| 62060698786608744707 ... 92256259918212890625
 -     CC=cc CFLAGS=-g sh ./configure
++   And that's it!  As an exercise, consider adding functions to
++implement system calls such as `chown()', `chmod()', and `umask()'.
  
-    If you were to compute the same value using arbitrary precision
- floating-point values instead, the precision needed for correct output
- (using the formula `prec = 3.322 * dps'), would be 3.322 x 183231, or
- 608693.  (Thus, the floating-point representation requires over 30
- times as many decimal digits!)
 -See the file `INSTALL' in the `gawk' distribution for all the details.
++   ---------- Footnotes ----------
  
-    The result from an arithmetic operation with an integer and a
- floating-point value is a floating-point value with a precision equal
- to the working precision.  The following program calculates the eighth
- term in Sylvester's sequence(1) using a recurrence:
 -   After you have run `configure' and possibly edited the `Makefile',
 -type:
++   (1) This version is edited slightly for presentation.  See
++`extension/filefuncs.c' in the `gawk' distribution for the complete
++version.
  
-      $ gawk -M 'BEGIN {
-      >   s = 2.0
-      >   for (i = 1; i <= 7; i++)
-      >       s = s * (s - 1) + 1
-      >   print s
-      > }'
-      -| 113423713055421845118910464
 -     make
++
++File: gawk.info,  Node: Using Internal File Ops,  Prev: Internal File Ops,  
Up: Sample Library
  
-    The output differs from the acutal number,
- 113423713055421844361000443, because the default precision of 53 is not
- enough to represent the floating-point results exactly. You can either
- increase the precision (100 is enough in this case), or replace the
- floating-point constant `2.0' with an integer, to perform all
- computations using integer arithmetic to get the correct output.
 -Shortly thereafter, you should have an executable version of `gawk'.
 -That's all there is to it!  To verify that `gawk' is working properly,
 -run `make check'.  All of the tests should succeed.  If these steps do
 -not work, or if any of the tests fail, check the files in the
 -`README_d' directory to see if you've found a known problem.  If the
 -failure is not described there, please send in a bug report (*note
 -Bugs::).
++16.2.3 Integrating the Extensions
++---------------------------------
  
-    It will sometimes be necessary for `gawk' to implicitly convert an
- arbitrary precision integer into an arbitrary precision floating-point
- value.  This is primarily because the MPFR library does not always
- provide the relevant interface to process arbitrary precision integers
- or mixed-mode numbers as needed by an operation or function.  In such a
- case, the precision is set to the minimum value necessary for exact
- conversion, and the working precision is not used for this purpose.  If
- this is not what you need or want, you can employ a subterfuge like
- this:
 -
 -File: gawk.info,  Node: Additional Configuration Options,  Next: 
Configuration Philosophy,  Prev: Quick Installation,  Up: Unix Installation
++Now that the code is written, it must be possible to add it at runtime
++to the running `gawk' interpreter.  First, the code must be compiled.
++Assuming that the functions are in a file named `filefuncs.c', and IDIR
++is the location of the `gawk' include files, the following steps create
++a GNU/Linux shared library:
  
-      gawk -M 'BEGIN { n = 13; print (n + 0.0) % 2.0 }'
 -B.2.2 Additional Configuration Options
 ---------------------------------------
++     $ gcc -fPIC -shared -DHAVE_CONFIG_H -c -O -g -IIDIR filefuncs.c
++     $ ld -o filefuncs.so -shared filefuncs.o
  
-    You can avoid this issue altogether by specifying the number as a
- floating-point value to begin with:
 -There are several additional options you may use on the `configure'
 -command line when compiling `gawk' from scratch, including:
++   Once the library exists, it is loaded by calling the `extension()'
++built-in function.  This function takes two arguments: the name of the
++library to load and the name of a function to call when the library is
++first loaded. This function adds the new functions to `gawk'.  It
++returns the value returned by the initialization function within the
++shared library:
  
-      gawk -M 'BEGIN { n = 13.0; print n % 2.0 }'
 -`--disable-lint'
 -     Disable all lint checking within `gawk'.  The `--lint' and
 -     `--lint-old' options (*note Options::) are accepted, but silently
 -     do nothing.  Similarly, setting the `LINT' variable (*note
 -     User-modified::) has no effect on the running `awk' program.
++     # file testff.awk
++     BEGIN {
++         extension("./filefuncs.so", "dl_load")
  
-    Note that for the particular example above, there is likely best to
- just use the following:
 -     When used with GCC's automatic dead-code-elimination, this option
 -     cuts almost 200K bytes off the size of the `gawk' executable on
 -     GNU/Linux x86 systems.  Results on other systems and with other
 -     compilers are likely to vary.  Using this option may bring you
 -     some slight performance improvement.
++         chdir(".")  # no-op
  
-      gawk -M 'BEGIN { n = 13; print n % 2 }'
 -     Using this option will cause some of the tests in the test suite
 -     to fail.  This option may be removed at a later date.
++         data[1] = 1 # force `data' to be an array
++         print "Info for testff.awk"
++         ret = stat("testff.awk", data)
++         print "ret =", ret
++         for (i in data)
++             printf "data[\"%s\"] = %s\n", i, data[i]
++         print "testff.awk modified:",
++             strftime("%m %d %y %H:%M:%S", data["mtime"])
  
-    ---------- Footnotes ----------
 -`--disable-nls'
 -     Disable all message-translation facilities.  This is usually not
 -     desirable, but it may bring you some slight performance
 -     improvement.
++         print "\nInfo for JUNK"
++         ret = stat("JUNK", data)
++         print "ret =", ret
++         for (i in data)
++             printf "data[\"%s\"] = %s\n", i, data[i]
++         print "JUNK modified:", strftime("%m %d %y %H:%M:%S", data["mtime"])
++     }
  
-    (1) Weisstein, Eric W.  `Sylvester's Sequence'. From MathWorld--A
- Wolfram Web Resource.
- `http://mathworld.wolfram.com/SylvestersSequence.html'
 -`--with-whiny-user-strftime'
 -     Force use of the included version of the `strftime()' function for
 -     deficient systems.
++   Here are the results of running the program:
+ 
 -   Use the command `./configure --help' to see the full list of options
 -that `configure' supplies.
++     $ gawk -f testff.awk
++     -| Info for testff.awk
++     -| ret = 0
++     -| data["size"] = 607
++     -| data["ino"] = 14945891
++     -| data["name"] = testff.awk
++     -| data["pmode"] = -rw-rw-r--
++     -| data["nlink"] = 1
++     -| data["atime"] = 1293993369
++     -| data["mtime"] = 1288520752
++     -| data["mode"] = 33204
++     -| data["blksize"] = 4096
++     -| data["dev"] = 2054
++     -| data["type"] = file
++     -| data["gid"] = 500
++     -| data["uid"] = 500
++     -| data["blocks"] = 8
++     -| data["ctime"] = 1290113572
++     -| testff.awk modified: 10 31 10 12:25:52
++     -|
++     -| Info for JUNK
++     -| ret = -1
++     -| JUNK modified: 01 01 70 02:00:00
  
  
 -File: gawk.info,  Node: Configuration Philosophy,  Prev: Additional 
Configuration Options,  Up: Unix Installation
 -
 -B.2.3 The Configuration Process
 --------------------------------
 +File: gawk.info,  Node: Language History,  Next: Installation,  Prev: Dynamic 
Extensions,  Up: Top
  
 -This minor node is of interest only if you know something about using
 -the C language and Unix-like operating systems.
 +Appendix A The Evolution of the `awk' Language
 +**********************************************
  
 -   The source code for `gawk' generally attempts to adhere to formal
 -standards wherever possible.  This means that `gawk' uses library
 -routines that are specified by the ISO C standard and by the POSIX
 -operating system interface standard.  The `gawk' source code requires
 -using an ISO C compiler (the 1990 standard).
 +This Info file describes the GNU implementation of `awk', which follows
 +the POSIX specification.  Many long-time `awk' users learned `awk'
 +programming with the original `awk' implementation in Version 7 Unix.
 +(This implementation was the basis for `awk' in Berkeley Unix, through
 +4.3-Reno.  Subsequent versions of Berkeley Unix, and some systems
 +derived from 4.4BSD-Lite, use various versions of `gawk' for their
 +`awk'.)  This major node briefly describes the evolution of the `awk'
 +language, with cross-references to other parts of the Info file where
 +you can find more information.
  
 -   Many Unix systems do not support all of either the ISO or the POSIX
 -standards.  The `missing_d' subdirectory in the `gawk' distribution
 -contains replacement versions of those functions that are most likely
 -to be missing.
 +* Menu:
  
 -   The `config.h' file that `configure' creates contains definitions
 -that describe features of the particular operating system where you are
 -attempting to compile `gawk'.  The three things described by this file
 -are: what header files are available, so that they can be correctly
 -included, what (supposedly) standard functions are actually available
 -in your C libraries, and various miscellaneous facts about your
 -operating system.  For example, there may not be an `st_blksize'
 -element in the `stat' structure.  In this case, `HAVE_ST_BLKSIZE' is
 -undefined.
 +* V7/SVR3.1::                   The major changes between V7 and System V
 +                                Release 3.1.
 +* SVR4::                        Minor changes between System V Releases 3.1
 +                                and 4.
 +* POSIX::                       New features from the POSIX standard.
 +* BTL::                         New features from Brian Kernighan's version of
 +                                `awk'.
 +* POSIX/GNU::                   The extensions in `gawk' not in POSIX
 +                                `awk'.
 +* Common Extensions::           Common Extensions Summary.
 +* Ranges and Locales::          How locales used to affect regexp ranges.
 +* Contributors::                The major contributors to `gawk'.
  
 -   It is possible for your C compiler to lie to `configure'. It may do
 -so by not exiting with an error when a library function is not
 -available.  To get around this, edit the file `custom.h'.  Use an
 -`#ifdef' that is appropriate for your system, and either `#define' any
 -constants that `configure' should have defined but didn't, or `#undef'
 -any constants that `configure' defined and should not have.  `custom.h'
 -is automatically included by `config.h'.
 +
 +File: gawk.info,  Node: V7/SVR3.1,  Next: SVR4,  Up: Language History
  
 -   It is also possible that the `configure' program generated by
 -`autoconf' will not work on your system in some other fashion.  If you
 -do have a problem, the file `configure.ac' is the input for `autoconf'.
 -You may be able to change this file and generate a new version of
 -`configure' that works on your system (*note Bugs::, for information on
 -how to report problems in configuring `gawk').  The same mechanism may
 -be used to send in updates to `configure.ac' and/or `custom.h'.
 +A.1 Major Changes Between V7 and SVR3.1
 +=======================================
  
 -
 -File: gawk.info,  Node: Non-Unix Installation,  Next: Bugs,  Prev: Unix 
Installation,  Up: Installation
 +The `awk' language evolved considerably between the release of Version
 +7 Unix (1978) and the new version that was first made generally
 +available in System V Release 3.1 (1987).  This minor node summarizes
 +the changes, with cross-references to further details:
  
 -B.3 Installation on Other Operating Systems
 -===========================================
 +   * The requirement for `;' to separate rules on a line (*note
 +     Statements/Lines::).
  
 -This minor node describes how to install `gawk' on various non-Unix
 -systems.
 +   * User-defined functions and the `return' statement (*note
 +     User-defined::).
  
 -* Menu:
 +   * The `delete' statement (*note Delete::).
  
 -* PC Installation::             Installing and Compiling `gawk' on
 -                                MS-DOS and OS/2.
 -* VMS Installation::            Installing `gawk' on VMS.
 +   * The `do'-`while' statement (*note Do Statement::).
 +
 +   * The built-in functions `atan2()', `cos()', `sin()', `rand()', and
 +     `srand()' (*note Numeric Functions::).
 +
 +   * The built-in functions `gsub()', `sub()', and `match()' (*note
 +     String Functions::).
 +
 +   * The built-in functions `close()' and `system()' (*note I/O
 +     Functions::).
 +
 +   * The `ARGC', `ARGV', `FNR', `RLENGTH', `RSTART', and `SUBSEP'
 +     built-in variables (*note Built-in Variables::).
 +
 +   * Assignable `$0' (*note Changing Fields::).
 +
 +   * The conditional expression using the ternary operator `?:' (*note
 +     Conditional Exp::).
 +
 +   * The expression `INDEX-VARIABLE in ARRAY' outside of `for'
 +     statements (*note Reference to Elements::).
 +
 +   * The exponentiation operator `^' (*note Arithmetic Ops::) and its
 +     assignment operator form `^=' (*note Assignment Ops::).
 +
 +   * C-compatible operator precedence, which breaks some old `awk'
 +     programs (*note Precedence::).
 +
 +   * Regexps as the value of `FS' (*note Field Separators::) and as the
 +     third argument to the `split()' function (*note String
 +     Functions::), rather than using only the first character of `FS'.
 +
 +   * Dynamic regexps as operands of the `~' and `!~' operators (*note
 +     Regexp Usage::).
 +
 +   * The escape sequences `\b', `\f', and `\r' (*note Escape
 +     Sequences::).  (Some vendors have updated their old versions of
 +     `awk' to recognize `\b', `\f', and `\r', but this is not something
 +     you can rely on.)
 +
 +   * Redirection of input for the `getline' function (*note Getline::).
 +
 +   * Multiple `BEGIN' and `END' rules (*note BEGIN/END::).
 +
 +   * Multidimensional arrays (*note Multi-dimensional::).
  
  
 -File: gawk.info,  Node: PC Installation,  Next: VMS Installation,  Up: 
Non-Unix Installation
 +File: gawk.info,  Node: SVR4,  Next: POSIX,  Prev: V7/SVR3.1,  Up: Language 
History
  
 -B.3.1 Installation on PC Operating Systems
 -------------------------------------------
 +A.2 Changes Between SVR3.1 and SVR4
 +===================================
  
 -This minor node covers installation and usage of `gawk' on x86 machines
 -running MS-DOS, any version of MS-Windows, or OS/2.  In this minor
 -node, the term "Windows32" refers to any of Microsoft
 -Windows-95/98/ME/NT/2000/XP/Vista/7.
 +The System V Release 4 (1989) version of Unix `awk' added these features
 +(some of which originated in `gawk'):
  
 -   The limitations of MS-DOS (and MS-DOS shells under Windows32 or
 -OS/2) has meant that various "DOS extenders" are often used with
 -programs such as `gawk'.  The varying capabilities of Microsoft Windows
 -3.1 and Windows32 can add to the confusion.  For an overview of the
 -considerations, please refer to `README_d/README.pc' in the
 -distribution.
 +   * The `ENVIRON' array (*note Built-in Variables::).
  
 -* Menu:
 +   * Multiple `-f' options on the command line (*note Options::).
  
 -* PC Binary Installation::      Installing a prepared distribution.
 -* PC Compiling::                Compiling `gawk' for MS-DOS,
 -                                Windows32, and OS/2.
 -* PC Testing::                  Testing `gawk' on PC systems.
 -* PC Using::                    Running `gawk' on MS-DOS, Windows32
 -                                and OS/2.
 -* Cygwin::                      Building and running `gawk' for
 -                                Cygwin.
 -* MSYS::                        Using `gawk' In The MSYS Environment.
 +   * The `-v' option for assigning variables before program execution
 +     begins (*note Options::).
 +
 +   * The `--' option for terminating command-line options.
 +
 +   * The `\a', `\v', and `\x' escape sequences (*note Escape
 +     Sequences::).
 +
 +   * A defined return value for the `srand()' built-in function (*note
 +     Numeric Functions::).
 +
 +   * The `toupper()' and `tolower()' built-in string functions for case
 +     translation (*note String Functions::).
 +
 +   * A cleaner specification for the `%c' format-control letter in the
 +     `printf' function (*note Control Letters::).
 +
 +   * The ability to dynamically pass the field width and precision
 +     (`"%*.*d"') in the argument list of the `printf' function (*note
 +     Control Letters::).
 +
 +   * The use of regexp constants, such as `/foo/', as expressions, where
 +     they are equivalent to using the matching operator, as in `$0 ~
 +     /foo/' (*note Using Constant Regexps::).
 +
 +   * Processing of escape sequences inside command-line variable
 +     assignments (*note Assignment Options::).
  
  
 -File: gawk.info,  Node: PC Binary Installation,  Next: PC Compiling,  Up: PC 
Installation
 +File: gawk.info,  Node: POSIX,  Next: BTL,  Prev: SVR4,  Up: Language History
  
 -B.3.1.1 Installing a Prepared Distribution for PC Systems
 -.........................................................
 +A.3 Changes Between SVR4 and POSIX `awk'
 +========================================
  
 -If you have received a binary distribution prepared by the MS-DOS
 -maintainers, then `gawk' and the necessary support files appear under
 -the `gnu' directory, with executables in `gnu/bin', libraries in
 -`gnu/lib/awk', and manual pages under `gnu/man'.  This is designed for
 -easy installation to a `/gnu' directory on your drive--however, the
 -files can be installed anywhere provided `AWKPATH' is set properly.
 -Regardless of the installation directory, the first line of `igawk.cmd'
 -and `igawk.bat' (in `gnu/bin') may need to be edited.
 +The POSIX Command Language and Utilities standard for `awk' (1992)
 +introduced the following changes into the language:
  
 -   The binary distribution contains a separate file describing the
 -contents. In particular, it may include more than one version of the
 -`gawk' executable.
 +   * The use of `-W' for implementation-specific options (*note
 +     Options::).
  
 -   OS/2 (32 bit, EMX) binary distributions are prepared for the `/usr'
 -directory of your preferred drive. Set `UNIXROOT' to your installation
 -drive (e.g., `e:') if you want to install `gawk' onto another drive
 -than the hardcoded default `c:'. Executables appear in `/usr/bin',
 -libraries under `/usr/share/awk', manual pages under `/usr/man',
 -Texinfo documentation under `/usr/info', and NLS files under
 -`/usr/share/locale'.  Note that the files can be installed anywhere
 -provided `AWKPATH' is set properly.
 +   * The use of `CONVFMT' for controlling the conversion of numbers to
 +     strings (*note Conversion::).
  
 -   If you already have a file `/usr/info/dir' from another package _do
 -not overwrite it!_ Instead enter the following commands at your prompt
 -(replace `x:' by your installation drive):
 +   * The concept of a numeric string and tighter comparison rules to go
 +     with it (*note Typing and Comparison::).
  
 -     install-info --info-dir=x:/usr/info x:/usr/info/gawk.info
 -     install-info --info-dir=x:/usr/info x:/usr/info/gawkinet.info
 +   * The use of built-in variables as function parameter names is
 +     forbidden (*note Definition Syntax::.
  
 -   The binary distribution may contain a separate file containing
 -additional or more detailed installation instructions.
 +   * More complete documentation of many of the previously undocumented
 +     features of the language.
 +
 +   *Note Common Extensions::, for a list of common extensions not
 +permitted by the POSIX standard.
  
 -   As of April, 2012, up to date `gawk' binaries for MS Windows are
 -available from Eli Zaretskii's ports project
 -(http://sourceforge.net/projects/ezwinports/files/).
 +   The 2008 POSIX standard can be found online at
 +`http://www.opengroup.org/onlinepubs/9699919799/'.
  
  
 -File: gawk.info,  Node: PC Compiling,  Next: PC Testing,  Prev: PC Binary 
Installation,  Up: PC Installation
 +File: gawk.info,  Node: BTL,  Next: POSIX/GNU,  Prev: POSIX,  Up: Language 
History
  
 -B.3.1.2 Compiling `gawk' for PC Operating Systems
 -.................................................
 +A.4 Extensions in Brian Kernighan's `awk'
 +=========================================
  
 -`gawk' can be compiled for MS-DOS, Windows32, and OS/2 using the GNU
 -development tools from DJ Delorie (DJGPP: MS-DOS only) or Eberhard
 -Mattes (EMX: MS-DOS, Windows32 and OS/2).  The file
 -`README_d/README.pc' in the `gawk' distribution contains additional
 -notes, and `pc/Makefile' contains important information on compilation
 -options.
 +Brian Kernighan has made his version available via his home page (*note
 +Other Versions::).
  
 -   To build `gawk' for MS-DOS and Windows32, copy the files in the `pc'
 -directory (_except_ for `ChangeLog') to the directory with the rest of
 -the `gawk' sources, then invoke `make' with the appropriate target name
 -as an argument to build `gawk'.  The `Makefile' copied from the `pc'
 -directory contains a configuration section with comments and may need
 -to be edited in order to work with your `make' utility.
 +   This minor node describes common extensions that originally appeared
 +in his version of `awk'.
  
 -   The `Makefile' supports a number of targets for building various
 -MS-DOS and Windows32 versions.  A list of targets is printed if the
 -`make' command is given without a target.  As an example, to build
 -`gawk' using the DJGPP tools, enter `make djgpp'.  (The DJGPP tools
 -needed for the build may be found at
 -`ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/'.)  To build a native
 -MS-Windows binary of `gawk', type `make mingw32'.
 +   * The `**' and `**=' operators (*note Arithmetic Ops:: and *note
 +     Assignment Ops::).
 +
 +   * The use of `func' as an abbreviation for `function' (*note
 +     Definition Syntax::).
 +
 +   * The `fflush()' built-in function for flushing buffered output
 +     (*note I/O Functions::).
 +
 +
 +   *Note Common Extensions::, for a full list of the extensions
 +available in his `awk'.
 +
 +
 +File: gawk.info,  Node: POSIX/GNU,  Next: Common Extensions,  Prev: BTL,  Up: 
Language History
 +
 +A.5 Extensions in `gawk' Not in POSIX `awk'
 +===========================================
 +
 +The GNU implementation, `gawk', adds a large number of features.  They
 +can all be disabled with either the `--traditional' or `--posix' options
 +(*note Options::).
 +
 +   A number of features have come and gone over the years. This minor
 +node summarizes the additional features over POSIX `awk' that are in
 +the current version of `gawk'.
 +
 +   * Additional built-in variables:
 +
 +        - The `ARGIND' `BINMODE', `ERRNO', `FIELDWIDTHS', `FPAT',
 +          `IGNORECASE', `LINT', `PROCINFO', `RT', and `TEXTDOMAIN'
 +          variables (*note Built-in Variables::).
 +
 +   * Special files in I/O redirections:
 +
 +        - The `/dev/stdin', `/dev/stdout', `/dev/stderr' and
 +          `/dev/fd/N' special file names (*note Special Files::).
 +
 +        - The `/inet', `/inet4', and `/inet6' special files for TCP/IP
 +          networking using `|&' to specify which version of the IP
 +          protocol to use.  (*note TCP/IP Networking::).
 +
 +   * Changes and/or additions to the language:
 +
 +        - The `\x' escape sequence (*note Escape Sequences::).
 +
 +        - Full support for both POSIX and GNU regexps (*note Regexp::).
 +
 +        - The ability for `FS' and for the third argument to `split()'
 +          to be null strings (*note Single Character Fields::).
 +
 +        - The ability for `RS' to be a regexp (*note Records::).
 +
 +        - The ability to use octal and hexadecimal constants in `awk'
 +          program source code (*note Nondecimal-numbers::).
 +
 +        - The `|&' operator for two-way I/O to a coprocess (*note
 +          Two-way I/O::).
 +
 +        - Indirect function calls (*note Indirect Calls::).
 +
 +        - Directories on the command line produce a warning and are
 +          skipped (*note Command line directories::).
 +
 +   * New keywords:
 +
 +        - The `BEGINFILE' and `ENDFILE' special patterns.  (*note
 +          BEGINFILE/ENDFILE::).
 +
 +        - The ability to delete all of an array at once with `delete
 +          ARRAY' (*note Delete::).
 +
 +        - The `nextfile' statement (*note Nextfile Statement::).
 +
 +        - The `switch' statement (*note Switch Statement::).
 +
 +   * Changes to standard `awk' functions:
 +
 +        - The optional second argument to `close()' that allows closing
 +          one end of a two-way pipe to a coprocess (*note Two-way
 +          I/O::).
 +
 +        - POSIX compliance for `gsub()' and `sub()'.
 +
 +        - The `length()' function accepts an array argument and returns
 +          the number of elements in the array (*note String
 +          Functions::).
 +
 +        - The optional third argument to the `match()' function for
 +          capturing text-matching subexpressions within a regexp (*note
 +          String Functions::).
 +
 +        - Positional specifiers in `printf' formats for making
 +          translations easier (*note Printf Ordering::).
 +
 +        - The `split()' function's additional optional fourth argument
 +          which is an array to hold the text of the field separators.
 +          (*note String Functions::).
 +
 +   * Additional functions only in `gawk':
 +
 +        - The `and()', `compl()', `lshift()', `or()', `rshift()', and
 +          `xor()' functions for bit manipulation (*note Bitwise
 +          Functions::).
 +
 +        - The `asort()' and `asorti()' functions for sorting arrays
 +          (*note Array Sorting::).
 +
 +        - The `bindtextdomain()', `dcgettext()' and `dcngettext()'
 +          functions for internationalization (*note Programmer i18n::).
 +
 +        - The `fflush()' function from Brian Kernighan's version of
 +          `awk' (*note I/O Functions::).
 +
 +        - The `gensub()', `patsplit()', and `strtonum()' functions for
 +          more powerful text manipulation (*note String Functions::).
 +
 +        - The `mktime()', `systime()', and `strftime()' functions for
 +          working with timestamps (*note Time Functions::).
 +
 +   * Changes and/or additions in the command-line options:
 +
 +        - The `AWKPATH' environment variable for specifying a path
 +          search for the `-f' command-line option (*note Options::).
 +
 +        - The `AWKLIBPATH' environment variable for specifying a path
 +          search for the `-l' command-line option (*note Options::).
 +
 +        - The `-b', `-c', `-C', `-d', `-D', `-e', `-E', `-g', `-h',
 +          `-i', `-l', `-L', `-M', `-n', `-N', `-o', `-O', `-p', `-P',
 +          `-r', `-S', `-t', and `-V' short options. Also, the ability
 +          to use GNU-style long-named options that start with `--' and
 +          the `--assign', `--bignum', `--characters-as-bytes',
 +          `--copyright', `--debug', `--dump-variables', `--execle',
 +          `--field-separator', `--file', `--gen-pot', `--help',
 +          `--include', `--lint', `--lint-old', `--load',
 +          `--non-decimal-data', `--optimize', `--posix',
 +          `--pretty-print', `--profile', `--re-interval', `--sandbox',
 +          `--source', `--traditional', `--use-lc-numeric', and
 +          `--version' long options (*note Options::).
 +
 +   * Support for the following obsolete systems was removed from the
 +     code and the documentation for `gawk' version 4.0:
 +
 +        - Amiga
 +
 +        - Atari
 +
 +        - BeOS
 +
 +        - Cray
 +
 +        - MIPS RiscOS
 +
 +        - MS-DOS with the Microsoft Compiler
 +
 +        - MS-Windows with the Microsoft Compiler
 +
 +        - NeXT
 +
 +        - SunOS 3.x, Sun 386 (Road Runner)
 +
 +        - Tandem (non-POSIX)
 +
 +        - Prestandard VAX C compiler for VAX/VMS
 +
 +
 +
 +
 +File: gawk.info,  Node: Common Extensions,  Next: Ranges and Locales,  Prev: 
POSIX/GNU,  Up: Language History
 +
 +A.6 Common Extensions Summary
 +=============================
 +
 +This minor node summarizes the common extensions supported by `gawk',
 +Brian Kernighan's `awk', and `mawk', the three most widely-used freely
 +available versions of `awk' (*note Other Versions::).
 +
 +Feature                      BWK Awk   Mawk   GNU Awk
 +-------------------------------------------------------- 
 +`\x' Escape sequence         X         X      X
 +`RS' as regexp                         X      X
 +`FS' as null string          X         X      X
 +`/dev/stdin' special file    X                X
 +`/dev/stdout' special file   X         X      X
 +`/dev/stderr' special file   X         X      X
 +`**' and `**=' operators     X                X
 +`func' keyword               X                X
 +`nextfile' statement         X         X      X
 +`delete' without subscript   X         X      X
 +`length()' of an array       X                X
 +`fflush()' function          X         X      X
 +`BINMODE' variable                     X      X
 +
 +
 +File: gawk.info,  Node: Ranges and Locales,  Next: Contributors,  Prev: 
Common Extensions,  Up: Language History
 +
 +A.7 Regexp Ranges and Locales: A Long Sad Story
 +===============================================
 +
 +This minor node describes the confusing history of ranges within
 +regular expressions and their interactions with locales, and how this
 +affected different versions of `gawk'.
 +
 +   The original Unix tools that worked with regular expressions defined
 +character ranges (such as `[a-z]') to match any character between the
 +first character in the range and the last character in the range,
 +inclusive.  Ordering was based on the numeric value of each character
 +in the machine's native character set.  Thus, on ASCII-based systems,
 +`[a-z]' matched all the lowercase letters, and only the lowercase
 +letters, since the numeric values for the letters from `a' through `z'
 +were contiguous.  (On an EBCDIC system, the range `[a-z]' includes
 +additional, non-alphabetic characters as well.)
 +
 +   Almost all introductory Unix literature explained range expressions
 +as working in this fashion, and in particular, would teach that the
 +"correct" way to match lowercase letters was with `[a-z]', and that
 +`[A-Z]' was the "correct" way to match uppercase letters.  And indeed,
 +this was true.(1)
 +
 +   The 1993 POSIX standard introduced the idea of locales (*note
 +Locales::).  Since many locales include other letters besides the plain
 +twenty-six letters of the American English alphabet, the POSIX standard
 +added character classes (*note Bracket Expressions::) as a way to match
 +different kinds of characters besides the traditional ones in the ASCII
 +character set.
 +
 +   However, the standard _changed_ the interpretation of range
 +expressions.  In the `"C"' and `"POSIX"' locales, a range expression
 +like `[a-dx-z]' is still equivalent to `[abcdxyz]', as in ASCII.  But
 +outside those locales, the ordering was defined to be based on
 +"collation order".
 +
 +   In many locales, `A' and `a' are both less than `B'.  In other
 +words, these locales sort characters in dictionary order, and
 +`[a-dx-z]' is typically not equivalent to `[abcdxyz]'; instead it might
 +be equivalent to `[ABCXYabcdxyz]', for example.
 +
 +   This point needs to be emphasized: Much literature teaches that you
 +should use `[a-z]' to match a lowercase character.  But on systems with
 +non-ASCII locales, this also matched all of the uppercase characters
 +except `A' or `Z'!  This was a continuous cause of confusion, even well
 +into the twenty-first century.
 +
 +   To demonstrate these issues, the following example uses the `sub()'
 +function, which does text replacement (*note String Functions::).  Here,
 +the intent is to remove trailing uppercase characters:
 +
 +     $ echo something1234abc | gawk-3.1.8 '{ sub("[A-Z]*$", ""); print }'
 +     -| something1234a
 +
 +This output is unexpected, since the `bc' at the end of
 +`something1234abc' should not normally match `[A-Z]*'.  This result is
 +due to the locale setting (and thus you may not see it on your system).
 +
 +   Similar considerations apply to other ranges.  For example, `["-/]'
 +is perfectly valid in ASCII, but is not valid in many Unicode locales,
 +such as `en_US.UTF-8'.
 +
 +   Early versions of `gawk' used regexp matching code that was not
 +locale aware, so ranges had their traditional interpretation.
 +
 +   When `gawk' switched to using locale-aware regexp matchers, the
 +problems began; especially as both GNU/Linux and commercial Unix
 +vendors started implementing non-ASCII locales, _and making them the
 +default_.  Perhaps the most frequently asked question became something
 +like "why does `[A-Z]' match lowercase letters?!?"
 +
 +   This situation existed for close to 10 years, if not more, and the
 +`gawk' maintainer grew weary of trying to explain that `gawk' was being
 +nicely standards-compliant, and that the issue was in the user's
 +locale.  During the development of version 4.0, he modified `gawk' to
 +always treat ranges in the original, pre-POSIX fashion, unless
 +`--posix' was used (*note Options::).(2)
 +
 +   Fortunately, shortly before the final release of `gawk' 4.0, the
 +maintainer learned that the 2008 standard had changed the definition of
 +ranges, such that outside the `"C"' and `"POSIX"' locales, the meaning
 +of range expressions was _undefined_.(3)
 +
 +   By using this lovely technical term, the standard gives license to
 +implementors to implement ranges in whatever way they choose.  The
 +`gawk' maintainer chose to apply the pre-POSIX meaning in all cases:
 +the default regexp matching; with `--traditional', and with `--posix';
 +in all cases, `gawk' remains POSIX compliant.
 +
 +   ---------- Footnotes ----------
 +
 +   (1) And Life was good.
 +
 +   (2) And thus was born the Campain for Rational Range Interpretation
 +(or RRI). A number of GNU tools, such as `grep' and `sed', have either
 +implemented this change, or will soon.  Thanks to Karl Berry for
 +coining the phrase "Rational Range Interpretation."
 +
 +   (3) See the standard
 
+(http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05)
 +and its rationale
 
+(http://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap09.html#tag_21_09_03_05).
 +
 +
 +File: gawk.info,  Node: Contributors,  Prev: Ranges and Locales,  Up: 
Language History
 +
 +A.8 Major Contributors to `gawk'
 +================================
 +
 +     Always give credit where credit is due.
 +     Anonymous
 +
 +   This minor node names the major contributors to `gawk' and/or this
 +Info file, in approximate chronological order:
 +
 +   * Dr. Alfred V. Aho, Dr. Peter J. Weinberger, and Dr. Brian W.
 +     Kernighan, all of Bell Laboratories, designed and implemented Unix
 +     `awk', from which `gawk' gets the majority of its feature set.
 +
 +   * Paul Rubin did the initial design and implementation in 1986, and
 +     wrote the first draft (around 40 pages) of this Info file.
 +
 +   * Jay Fenlason finished the initial implementation.
 +
 +   * Diane Close revised the first draft of this Info file, bringing it
 +     to around 90 pages.
 +
 +   * Richard Stallman helped finish the implementation and the initial
 +     draft of this Info file.  He is also the founder of the FSF and
 +     the GNU project.
 +
 +   * John Woods contributed parts of the code (mostly fixes) in the
 +     initial version of `gawk'.
 +
 +   * In 1988, David Trueman took over primary maintenance of `gawk',
 +     making it compatible with "new" `awk', and greatly improving its
 +     performance.
 +
 +   * Conrad Kwok, Scott Garfinkle, and Kent Williams did the initial
 +     ports to MS-DOS with various versions of MSC.
 +
 +   * Pat Rankin provided the VMS port and its documentation.
 +
 +   * Hal Peterson provided help in porting `gawk' to Cray systems.
 +     (This is no longer supported.)
 +
 +   * Kai Uwe Rommel provided the initial port to OS/2 and its
 +     documentation.
 +
 +   * Michal Jaegermann provided the port to Atari systems and its
 +     documentation.  (This port is no longer supported.)  He continues
 +     to provide portability checking with DEC Alpha systems, and has
 +     done a lot of work to make sure `gawk' works on non-32-bit systems.
 +
 +   * Fred Fish provided the port to Amiga systems and its documentation.
 +     (With Fred's sad passing, this is no longer supported.)
 +
 +   * Scott Deifik currently maintains the MS-DOS port using DJGPP.
 +
 +   * Eli Zaretskii currently maintains the MS-Windows port using MinGW.
 +
 +   * Juan Grigera provided a port to Windows32 systems.  (This is no
 +     longer supported.)
 +
 +   * For many years, Dr. Darrel Hankerson acted as coordinator for the
 +     various ports to different PC platforms and created binary
 +     distributions for various PC operating systems.  He was also
 +     instrumental in keeping the documentation up to date for the
 +     various PC platforms.
 +
 +   * Christos Zoulas provided the `extension()' built-in function for
 +     dynamically adding new modules.  (This was removed at `gawk' 4.1.)
 +
 +   * Ju"rgen Kahrs contributed the initial version of the TCP/IP
 +     networking code and documentation, and motivated the inclusion of
 +     the `|&' operator.
 +
 +   * Stephen Davies provided the initial port to Tandem systems and its
 +     documentation.  (However, this is no longer supported.)  He was
 +     also instrumental in the initial work to integrate the byte-code
 +     internals into the `gawk' code base.
 +
 +   * Matthew Woehlke provided improvements for Tandem's POSIX-compliant
 +     systems.
 +
 +   * Martin Brown provided the port to BeOS and its documentation.
 +     (This is no longer supported.)
 +
 +   * Arno Peters did the initial work to convert `gawk' to use GNU
 +     Automake and GNU `gettext'.
 +
 +   * Alan J. Broder provided the initial version of the `asort()'
 +     function as well as the code for the optional third argument to the
 +     `match()' function.
 +
 +   * Andreas Buening updated the `gawk' port for OS/2.
 +
 +   * Isamu Hasegawa, of IBM in Japan, contributed support for multibyte
 +     characters.
 +
 +   * Michael Benzinger contributed the initial code for `switch'
 +     statements.
 +
 +   * Patrick T.J. McPhee contributed the code for dynamic loading in
 +     Windows32 environments.  (This is no longer supported)
 +
 +   * John Haque reworked the `gawk' internals to use a byte-code engine,
 +     providing the `gawk' debugger for `awk' programs.
 +
 +   * Efraim Yawitz contributed the original text for *note Debugger::.
 +
 +   * Arnold Robbins has been working on `gawk' since 1988, at first
 +     helping David Trueman, and as the primary maintainer since around
 +     1994.
 +
 +
 +File: gawk.info,  Node: Installation,  Next: Notes,  Prev: Language History,  
Up: Top
 +
 +Appendix B Installing `gawk'
 +****************************
 +
 +This appendix provides instructions for installing `gawk' on the
 +various platforms that are supported by the developers.  The primary
 +developer supports GNU/Linux (and Unix), whereas the other ports are
 +contributed.  *Note Bugs::, for the electronic mail addresses of the
 +people who did the respective ports.
 +
 +* Menu:
 +
 +* Gawk Distribution::           What is in the `gawk' distribution.
 +* Unix Installation::           Installing `gawk' under various
 +                                versions of Unix.
 +* Non-Unix Installation::       Installation on Other Operating Systems.
 +* Bugs::                        Reporting Problems and Bugs.
 +* Other Versions::              Other freely available `awk'
 +                                implementations.
 +
 +
 +File: gawk.info,  Node: Gawk Distribution,  Next: Unix Installation,  Up: 
Installation
 +
 +B.1 The `gawk' Distribution
 +===========================
 +
 +This minor node describes how to get the `gawk' distribution, how to
 +extract it, and then what is in the various files and subdirectories.
 +
 +* Menu:
 +
 +* Getting::                     How to get the distribution.
 +* Extracting::                  How to extract the distribution.
 +* Distribution contents::       What is in the distribution.
 +
 +
 +File: gawk.info,  Node: Getting,  Next: Extracting,  Up: Gawk Distribution
 +
 +B.1.1 Getting the `gawk' Distribution
 +-------------------------------------
 +
 +There are three ways to get GNU software:
 +
 +   * Copy it from someone else who already has it.
 +
 +   * Retrieve `gawk' from the Internet host `ftp.gnu.org', in the
 +     directory `/gnu/gawk'.  Both anonymous `ftp' and `http' access are
 +     supported.  If you have the `wget' program, you can use a command
 +     like the following:
 +
 +          wget http://ftp.gnu.org/gnu/gawk/gawk-4.0.1.tar.gz
 +
 +   The GNU software archive is mirrored around the world.  The
 +up-to-date list of mirror sites is available from the main FSF web site
 +(http://www.gnu.org/order/ftp.html).  Try to use one of the mirrors;
 +they will be less busy, and you can usually find one closer to your
 +site.
 +
 +
 +File: gawk.info,  Node: Extracting,  Next: Distribution contents,  Prev: 
Getting,  Up: Gawk Distribution
 +
 +B.1.2 Extracting the Distribution
 +---------------------------------
 +
 +`gawk' is distributed as several `tar' files compressed with different
 +compression programs: `gzip', `bzip2', and `xz'. For simplicity, the
 +rest of these instructions assume you are using the one compressed with
 +the GNU Zip program, `gzip'.
 +
 +   Once you have the distribution (for example, `gawk-4.0.1.tar.gz'),
 +use `gzip' to expand the file and then use `tar' to extract it.  You
 +can use the following pipeline to produce the `gawk' distribution:
 +
 +     # Under System V, add 'o' to the tar options
 +     gzip -d -c gawk-4.0.1.tar.gz | tar -xvpf -
 +
 +   On a system with GNU `tar', you can let `tar' do the decompression
 +for you:
 +
 +     tar -xvpzf gawk-4.0.1.tar.gz
 +
 +Extracting the archive creates a directory named `gawk-4.0.1' in the
 +current directory.
 +
 +   The distribution file name is of the form `gawk-V.R.P.tar.gz'.  The
 +V represents the major version of `gawk', the R represents the current
 +release of version V, and the P represents a "patch level", meaning
 +that minor bugs have been fixed in the release.  The current patch
 +level is 1, but when retrieving distributions, you should get the
 +version with the highest version, release, and patch level.  (Note,
 +however, that patch levels greater than or equal to 70 denote "beta" or
 +nonproduction software; you might not want to retrieve such a version
 +unless you don't mind experimenting.)  If you are not on a Unix or
 +GNU/Linux system, you need to make other arrangements for getting and
 +extracting the `gawk' distribution.  You should consult a local expert.
 +
 +
 +File: gawk.info,  Node: Distribution contents,  Prev: Extracting,  Up: Gawk 
Distribution
 +
 +B.1.3 Contents of the `gawk' Distribution
 +-----------------------------------------
 +
 +The `gawk' distribution has a number of C source files, documentation
 +files, subdirectories, and files related to the configuration process
 +(*note Unix Installation::), as well as several subdirectories related
 +to different non-Unix operating systems:
 +
 +Various `.c', `.y', and `.h' files
 +     The actual `gawk' source code.
 +
 +`README'
 +`README_d/README.*'
 +     Descriptive files: `README' for `gawk' under Unix and the rest for
 +     the various hardware and software combinations.
 +
 +`INSTALL'
 +     A file providing an overview of the configuration and installation
 +     process.
 +
 +`ChangeLog'
 +     A detailed list of source code changes as bugs are fixed or
 +     improvements made.
 +
 +`ChangeLog.0'
 +     An older list of source code changes.
 +
 +`NEWS'
 +     A list of changes to `gawk' since the last release or patch.
 +
 +`NEWS.0'
 +     An older list of changes to `gawk'.
 +
 +`COPYING'
 +     The GNU General Public License.
 +
 +`FUTURES'
 +     A brief list of features and changes being contemplated for future
 +     releases, with some indication of the time frame for the feature,
 +     based on its difficulty.
 +
 +`LIMITATIONS'
 +     A list of those factors that limit `gawk''s performance.  Most of
 +     these depend on the hardware or operating system software and are
 +     not limits in `gawk' itself.
 +
 +`POSIX.STD'
 +     A description of behaviors in the POSIX standard for `awk' which
 +     are left undefined, or where `gawk' may not comply fully, as well
 +     as a list of things that the POSIX standard should describe but
 +     does not.
 +
 +`doc/awkforai.txt'
 +     A short article describing why `gawk' is a good language for
 +     Artificial Intelligence (AI) programming.
 +
 +`doc/bc_notes'
 +     A brief description of `gawk''s "byte code" internals.
 +
 +`doc/README.card'
 +`doc/ad.block'
 +`doc/awkcard.in'
 +`doc/cardfonts'
 +`doc/colors'
 +`doc/macros'
 +`doc/no.colors'
 +`doc/setter.outline'
 +     The `troff' source for a five-color `awk' reference card.  A
 +     modern version of `troff' such as GNU `troff' (`groff') is needed
 +     to produce the color version. See the file `README.card' for
 +     instructions if you have an older `troff'.
 +
 +`doc/gawk.1'
 +     The `troff' source for a manual page describing `gawk'.  This is
 +     distributed for the convenience of Unix users.
 +
 +`doc/gawk.texi'
 +     The Texinfo source file for this Info file.  It should be
 +     processed with TeX (via `texi2dvi' or `texi2pdf') to produce a
 +     printed document, and with `makeinfo' to produce an Info or HTML
 +     file.
 +
 +`doc/gawk.info'
 +     The generated Info file for this Info file.
 +
 +`doc/gawkinet.texi'
 +     The Texinfo source file for *note (General Introduction)Top::
 +     gawkinet, TCP/IP Internetworking with `gawk'.  It should be
 +     processed with TeX (via `texi2dvi' or `texi2pdf') to produce a
 +     printed document and with `makeinfo' to produce an Info or HTML
 +     file.
 +
 +`doc/gawkinet.info'
 +     The generated Info file for `TCP/IP Internetworking with `gawk''.
 +
 +`doc/igawk.1'
 +     The `troff' source for a manual page describing the `igawk'
 +     program presented in *note Igawk Program::.
 +
 +`doc/Makefile.in'
 +     The input file used during the configuration process to generate
 +     the actual `Makefile' for creating the documentation.
 +
 +`Makefile.am'
 +`*/Makefile.am'
 +     Files used by the GNU `automake' software for generating the
 +     `Makefile.in' files used by `autoconf' and `configure'.
 +
 +`Makefile.in'
 +`aclocal.m4'
 +`configh.in'
 +`configure.ac'
 +`configure'
 +`custom.h'
 +`missing_d/*'
 +`m4/*'
 +     These files and subdirectories are used when configuring `gawk'
 +     for various Unix systems.  They are explained in *note Unix
 +     Installation::.
 +
 +`po/*'
 +     The `po' library contains message translations.
 +
 +`awklib/extract.awk'
 +`awklib/Makefile.am'
 +`awklib/Makefile.in'
 +`awklib/eg/*'
 +     The `awklib' directory contains a copy of `extract.awk' (*note
 +     Extract Program::), which can be used to extract the sample
 +     programs from the Texinfo source file for this Info file. It also
 +     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'.
  
 -   The 32 bit EMX version of `gawk' works "out of the box" under OS/2.
 -However, it is highly recommended to use GCC 2.95.3 for the compilation.
 -In principle, it is possible to compile `gawk' the following way:
 +`posix/*'
 +     Files needed for building `gawk' on POSIX-compliant systems.
  
 -     $ ./configure
 -     $ make
 +`pc/*'
 +     Files needed for building `gawk' under MS-Windows and OS/2 (*note
 +     PC Installation::, for details).
  
 -   This is not recommended, though.  To get an OMF executable you should
 -use the following commands at your `sh' prompt:
 +`vms/*'
 +     Files needed for building `gawk' under VMS (*note VMS
 +     Installation::, for details).
  
 -     $ CFLAGS="-O2 -Zomf -Zmt"
 -     $ export CFLAGS
 -     $ LDFLAGS="-s -Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 
0x6000"
 -     $ export LDFLAGS
 -     $ RANLIB="echo"
 -     $ export RANLIB
 -     $ ./configure --prefix=c:/usr
 -     $ make AR=emxomfar
 +`test/*'
 +     A test suite for `gawk'.  You can use `make check' from the
 +     top-level `gawk' directory to run your version of `gawk' against
 +     the test suite.  If `gawk' successfully passes `make check', then
 +     you can be confident of a successful port.
  
 -   These are just suggestions for use with GCC 2.x.  You may use any
 -other set of (self-consistent) environment variables and compiler flags.
 +
 +File: gawk.info,  Node: Unix Installation,  Next: Non-Unix Installation,  
Prev: Gawk Distribution,  Up: Installation
  
 -   If you use GCC 2.95 it is recommended to use also:
 +B.2 Compiling and Installing `gawk' on Unix-like Systems
 +========================================================
  
 -     $ LIBS="-lgcc"
 -     $ export LIBS
 +Usually, you can compile and install `gawk' by typing only two
 +commands.  However, if you use an unusual system, you may need to
 +configure `gawk' for your system yourself.
  
 -   You can also get an `a.out' executable if you prefer:
 +* Menu:
  
 -     $ CFLAGS="-O2 -Zmt"
 -     $ export CFLAGS
 -     $ LDFLAGS="-s -Zstack 0x6000"
 -     $ LIBS="-lgcc"
 -     $ unset RANLIB
 -     $ ./configure --prefix=c:/usr
 -     $ make
 +* Quick Installation::               Compiling `gawk' under Unix.
 +* Additional Configuration Options:: Other compile-time options.
 +* Configuration Philosophy::         How it's all supposed to work.
  
 -     NOTE: Compilation of `a.out' executables also works with GCC 3.2.
 -     Versions later than GCC 3.2 have not been tested successfully.
 +
 +File: gawk.info,  Node: Quick Installation,  Next: Additional Configuration 
Options,  Up: Unix Installation
  
 -   `make install' works as expected with the EMX build.
 +B.2.1 Compiling `gawk' for Unix-like Systems
 +--------------------------------------------
  
 -     NOTE: Ancient OS/2 ports of GNU `make' are not able to handle the
 -     Makefiles of this package.  If you encounter any problems with
 -     `make', try GNU Make 3.79.1 or later versions.  You should find
 -     the latest version on `ftp://hobbes.nmsu.edu/pub/os2/'.
 +The normal installation steps should work on all modern commercial
 +Unix-derived systems, GNU/Linux, BSD-based systems, and the Cygwin
 +environment for MS-Windows.
  
 -
 -File: gawk.info,  Node: PC Testing,  Next: PC Using,  Prev: PC Compiling,  
Up: PC Installation
 +   After you have extracted the `gawk' distribution, `cd' to
 +`gawk-4.0.1'.  Like most GNU software, `gawk' is configured
 +automatically for your system by running the `configure' program.  This
 +program is a Bourne shell script that is generated automatically using
 +GNU `autoconf'.  (The `autoconf' software is described fully starting
 +with *note (Autoconf)Top:: autoconf,Autoconf--Generating Automatic
 +Configuration Scripts.)
  
 -B.3.1.3 Testing `gawk' on PC Operating Systems
 -..............................................
 +   To configure `gawk', simply run `configure':
  
 -Using `make' to run the standard tests and to install `gawk' requires
 -additional Unix-like tools, including `sh', `sed', and `cp'. In order
 -to run the tests, the `test/*.ok' files may need to be converted so
 -that they have the usual MS-DOS-style end-of-line markers.
 -Alternatively, run `make check CMP="diff -a"' to use GNU `diff' in text
 -mode instead of `cmp' to compare the resulting files.
 +     sh ./configure
  
 -   Most of the tests work properly with Stewartson's shell along with
 -the companion utilities or appropriate GNU utilities.  However, some
 -editing of `test/Makefile' is required. It is recommended that you copy
 -the file `pc/Makefile.tst' over the file `test/Makefile' as a
 -replacement. Details can be found in `README_d/README.pc' and in the
 -file `pc/Makefile.tst'.
 +   This produces a `Makefile' and `config.h' tailored to your system.
 +The `config.h' file describes various facts about your system.  You
 +might want to edit the `Makefile' to change the `CFLAGS' variable,
 +which controls the command-line options that are passed to the C
 +compiler (such as optimization levels or compiling for debugging).
  
 -   On OS/2 the `pid' test fails because `spawnl()' is used instead of
 -`fork()'/`execl()' to start child processes.  Also the `mbfw1' and
 -`mbprintf1' tests fail because the needed multibyte functionality is
 -not available.
 +   Alternatively, you can add your own values for most `make' variables
 +on the command line, such as `CC' and `CFLAGS', when running
 +`configure':
  
 -
 -File: gawk.info,  Node: PC Using,  Next: Cygwin,  Prev: PC Testing,  Up: PC 
Installation
 +     CC=cc CFLAGS=-g sh ./configure
  
 -B.3.1.4 Using `gawk' on PC Operating Systems
 -............................................
 +See the file `INSTALL' in the `gawk' distribution for all the details.
  
 -With the exception of the Cygwin environment, the `|&' operator and
 -TCP/IP networking (*note TCP/IP Networking::) are not supported for
 -MS-DOS or MS-Windows.  EMX (OS/2 only) does support at least the `|&'
 -operator.
 +   After you have run `configure' and possibly edited the `Makefile',
 +type:
  
 -   The MS-DOS and MS-Windows versions of `gawk' search for program
 -files as described in *note AWKPATH Variable::.  However, semicolons
 -(rather than colons) separate elements in the `AWKPATH' variable.  If
 -`AWKPATH' is not set or is empty, then the default search path for
 -MS-Windows and MS-DOS versions is `".;c:/lib/awk;c:/gnu/lib/awk"'.
 +     make
  
 -   The search path for OS/2 (32 bit, EMX) is determined by the prefix
 -directory (most likely `/usr' or `c:/usr') that has been specified as
 -an option of the `configure' script like it is the case for the Unix
 -versions.  If `c:/usr' is the prefix directory then the default search
 -path contains `.' and `c:/usr/share/awk'.  Additionally, to support
 -binary distributions of `gawk' for OS/2 systems whose drive `c:' might
 -not support long file names or might not exist at all, there is a
 -special environment variable.  If `UNIXROOT' specifies a drive then
 -this specific drive is also searched for program files.  E.g., if
 -`UNIXROOT' is set to `e:' the complete default search path is
 -`".;c:/usr/share/awk;e:/usr/share/awk"'.
 +Shortly thereafter, you should have an executable version of `gawk'.
 +That's all there is to it!  To verify that `gawk' is working properly,
 +run `make check'.  All of the tests should succeed.  If these steps do
 +not work, or if any of the tests fail, check the files in the
 +`README_d' directory to see if you've found a known problem.  If the
 +failure is not described there, please send in a bug report (*note
 +Bugs::).
  
 -   An `sh'-like shell (as opposed to `command.com' under MS-DOS or
 -`cmd.exe' under MS-Windows or OS/2) may be useful for `awk' programming.
 -The DJGPP collection of tools includes an MS-DOS port of Bash, and
 -several shells are available for OS/2, including `ksh'.
 +
 +File: gawk.info,  Node: Additional Configuration Options,  Next: 
Configuration Philosophy,  Prev: Quick Installation,  Up: Unix Installation
  
 -   Under MS-Windows, OS/2 and MS-DOS, `gawk' (and many other text
 -programs) silently translate end-of-line `"\r\n"' to `"\n"' on input
 -and `"\n"' to `"\r\n"' on output.  A special `BINMODE' variable
 -(c.e.)  allows control over these translations and is interpreted as
 -follows:
 +B.2.2 Additional Configuration Options
 +--------------------------------------
  
 -   * If `BINMODE' is `"r"', or one, then binary mode is set on read
 -     (i.e., no translations on reads).
 +There are several additional options you may use on the `configure'
 +command line when compiling `gawk' from scratch, including:
  
 -   * If `BINMODE' is `"w"', or two, then binary mode is set on write
 -     (i.e., no translations on writes).
 +`--disable-lint'
 +     Disable all lint checking within `gawk'.  The `--lint' and
 +     `--lint-old' options (*note Options::) are accepted, but silently
 +     do nothing.  Similarly, setting the `LINT' variable (*note
 +     User-modified::) has no effect on the running `awk' program.
  
 -   * If `BINMODE' is `"rw"' or `"wr"' or three, binary mode is set for
 -     both read and write.
 +     When used with GCC's automatic dead-code-elimination, this option
 +     cuts almost 200K bytes off the size of the `gawk' executable on
 +     GNU/Linux x86 systems.  Results on other systems and with other
 +     compilers are likely to vary.  Using this option may bring you
 +     some slight performance improvement.
  
 -   * `BINMODE=NON-NULL-STRING' is the same as `BINMODE=3' (i.e., no
 -     translations on reads or writes).  However, `gawk' issues a warning
 -     message if the string is not one of `"rw"' or `"wr"'.
 +     Using this option will cause some of the tests in the test suite
 +     to fail.  This option may be removed at a later date.
  
 -The modes for standard input and standard output are set one time only
 -(after the command line is read, but before processing any of the `awk'
 -program).  Setting `BINMODE' for standard input or standard output is
 -accomplished by using an appropriate `-v BINMODE=N' option on the
 -command line.  `BINMODE' is set at the time a file or pipe is opened
 -and cannot be changed mid-stream.
 +`--disable-nls'
 +     Disable all message-translation facilities.  This is usually not
 +     desirable, but it may bring you some slight performance
 +     improvement.
  
 -   The name `BINMODE' was chosen to match `mawk' (*note Other
 -Versions::).  `mawk' and `gawk' handle `BINMODE' similarly; however,
 -`mawk' adds a `-W BINMODE=N' option and an environment variable that
 -can set `BINMODE', `RS', and `ORS'.  The files `binmode[1-3].awk'
 -(under `gnu/lib/awk' in some of the prepared distributions) have been
 -chosen to match `mawk''s `-W BINMODE=N' option.  These can be changed
 -or discarded; in particular, the setting of `RS' giving the fewest
 -"surprises" is open to debate.  `mawk' uses `RS = "\r\n"' if binary
 -mode is set on read, which is appropriate for files with the
 -MS-DOS-style end-of-line.
 +`--with-whiny-user-strftime'
 +     Force use of the included version of the `strftime()' function for
 +     deficient systems.
  
 -   To illustrate, the following examples set binary mode on writes for
 -standard output and other files, and set `ORS' as the "usual"
 -MS-DOS-style end-of-line:
 +   Use the command `./configure --help' to see the full list of options
 +that `configure' supplies.
  
 -     gawk -v BINMODE=2 -v ORS="\r\n" ...
 +
 +File: gawk.info,  Node: Configuration Philosophy,  Prev: Additional 
Configuration Options,  Up: Unix Installation
  
 -or:
 +B.2.3 The Configuration Process
 +-------------------------------
  
 -     gawk -v BINMODE=w -f binmode2.awk ...
 +This minor node is of interest only if you know something about using
 +the C language and Unix-like operating systems.
  
 -These give the same result as the `-W BINMODE=2' option in `mawk'.  The
 -following changes the record separator to `"\r\n"' and sets binary mode
 -on reads, but does not affect the mode on standard input:
 +   The source code for `gawk' generally attempts to adhere to formal
 +standards wherever possible.  This means that `gawk' uses library
 +routines that are specified by the ISO C standard and by the POSIX
 +operating system interface standard.  The `gawk' source code requires
 +using an ISO C compiler (the 1990 standard).
  
 -     gawk -v RS="\r\n" --source "BEGIN { BINMODE = 1 }" ...
 +   Many Unix systems do not support all of either the ISO or the POSIX
 +standards.  The `missing_d' subdirectory in the `gawk' distribution
 +contains replacement versions of those functions that are most likely
 +to be missing.
  
 -or:
 +   The `config.h' file that `configure' creates contains definitions
 +that describe features of the particular operating system where you are
 +attempting to compile `gawk'.  The three things described by this file
 +are: what header files are available, so that they can be correctly
 +included, what (supposedly) standard functions are actually available
 +in your C libraries, and various miscellaneous facts about your
 +operating system.  For example, there may not be an `st_blksize'
 +element in the `stat' structure.  In this case, `HAVE_ST_BLKSIZE' is
 +undefined.
  
 -     gawk -f binmode1.awk ...
 +   It is possible for your C compiler to lie to `configure'. It may do
 +so by not exiting with an error when a library function is not
 +available.  To get around this, edit the file `custom.h'.  Use an
 +`#ifdef' that is appropriate for your system, and either `#define' any
 +constants that `configure' should have defined but didn't, or `#undef'
 +any constants that `configure' defined and should not have.  `custom.h'
 +is automatically included by `config.h'.
  
 -With proper quoting, in the first example the setting of `RS' can be
 -moved into the `BEGIN' rule.
 +   It is also possible that the `configure' program generated by
 +`autoconf' will not work on your system in some other fashion.  If you
 +do have a problem, the file `configure.ac' is the input for `autoconf'.
 +You may be able to change this file and generate a new version of
 +`configure' that works on your system (*note Bugs::, for information on
 +how to report problems in configuring `gawk').  The same mechanism may
 +be used to send in updates to `configure.ac' and/or `custom.h'.
  
  
 -File: gawk.info,  Node: Cygwin,  Next: MSYS,  Prev: PC Using,  Up: PC 
Installation
 -
 -B.3.1.5 Using `gawk' In The Cygwin Environment
 -..............................................
 +File: gawk.info,  Node: Non-Unix Installation,  Next: Bugs,  Prev: Unix 
Installation,  Up: Installation
  
 -`gawk' can be built and used "out of the box" under MS-Windows if you
 -are using the Cygwin environment (http://www.cygwin.com).  This
 -environment provides an excellent simulation of Unix, using the GNU
 -tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, and
 -other GNU programs.  Compilation and installation for Cygwin is the
 -same as for a Unix system:
 +B.3 Installation on Other Operating Systems
 +===========================================
  
 -     tar -xvpzf gawk-4.0.1.tar.gz
 -     cd gawk-4.0.1
 -     ./configure
 -     make
 +This minor node describes how to install `gawk' on various non-Unix
 +systems.
  
 -   When compared to GNU/Linux on the same system, the `configure' step
 -on Cygwin takes considerably longer.  However, it does finish, and then
 -the `make' proceeds as usual.
 +* Menu:
  
 -     NOTE: The `|&' operator and TCP/IP networking (*note TCP/IP
 -     Networking::) are fully supported in the Cygwin environment.  This
 -     is not true for any other environment on MS-Windows.
 +* PC Installation::             Installing and Compiling `gawk' on
 +                                MS-DOS and OS/2.
 +* VMS Installation::            Installing `gawk' on VMS.
  
  
 -File: gawk.info,  Node: MSYS,  Prev: Cygwin,  Up: PC Installation
 -
 -B.3.1.6 Using `gawk' In The MSYS Environment
 -............................................
 -
 -In the MSYS environment under MS-Windows, `gawk' automatically uses
 -binary mode for reading and writing files.  Thus there is no need to
 -use the `BINMODE' variable.
 -
 -   This can cause problems with other Unix-like components that have
 -been ported to MS-Windows that expect `gawk' to do automatic
 -translation of `"\r\n"', since it won't.  Caveat Emptor!
 +File: gawk.info,  Node: PC Installation,  Next: VMS Installation,  Up: 
Non-Unix Installation
  
 -
 -File: gawk.info,  Node: VMS Installation,  Prev: PC Installation,  Up: 
Non-Unix Installation
 +B.3.1 Installation on PC Operating Systems
 +------------------------------------------
  
 -B.3.2 How to Compile and Install `gawk' on VMS
 -----------------------------------------------
 +This minor node covers installation and usage of `gawk' on x86 machines
 +running MS-DOS, any version of MS-Windows, or OS/2.  In this minor
 +node, the term "Windows32" refers to any of Microsoft
 +Windows-95/98/ME/NT/2000/XP/Vista/7.
  
 -This node describes how to compile and install `gawk' under VMS.  The
 -older designation "VMS" is used throughout to refer to OpenVMS.
 +   The limitations of MS-DOS (and MS-DOS shells under Windows32 or
 +OS/2) has meant that various "DOS extenders" are often used with
 +programs such as `gawk'.  The varying capabilities of Microsoft Windows
 +3.1 and Windows32 can add to the confusion.  For an overview of the
 +considerations, please refer to `README_d/README.pc' in the
 +distribution.
  
  * Menu:
  
@@@ -28421,449 -27478,418 +28424,449 @@@ Inde
  
  Tag Table:
  Node: Top1352
 -Node: Foreword30282
 -Node: Preface34627
 -Ref: Preface-Footnote-137680
 -Ref: Preface-Footnote-237786
 -Node: History38018
 -Node: Names40409
 -Ref: Names-Footnote-141886
 -Node: This Manual41958
 -Ref: This Manual-Footnote-146905
 -Node: Conventions47005
 -Node: Manual History49139
 -Ref: Manual History-Footnote-152409
 -Ref: Manual History-Footnote-252450
 -Node: How To Contribute52524
 -Node: Acknowledgments53668
 -Node: Getting Started57999
 -Node: Running gawk60378
 -Node: One-shot61564
 -Node: Read Terminal62789
 -Ref: Read Terminal-Footnote-164439
 -Ref: Read Terminal-Footnote-264715
 -Node: Long64886
 -Node: Executable Scripts66262
 -Ref: Executable Scripts-Footnote-168131
 -Ref: Executable Scripts-Footnote-268233
 -Node: Comments68780
 -Node: Quoting71247
 -Node: DOS Quoting75870
 -Node: Sample Data Files76545
 -Node: Very Simple79577
 -Node: Two Rules84176
 -Node: More Complex86323
 -Ref: More Complex-Footnote-189253
 -Node: Statements/Lines89338
 -Ref: Statements/Lines-Footnote-193800
 -Node: Other Features94065
 -Node: When94993
 -Node: Invoking Gawk97140
 -Node: Command Line98525
 -Node: Options99308
 -Ref: Options-Footnote-1112852
 -Node: Other Arguments112877
 -Node: Naming Standard Input115535
 -Node: Environment Variables116629
 -Node: AWKPATH Variable117073
 -Ref: AWKPATH Variable-Footnote-1119670
 -Node: Other Environment Variables119930
 -Node: Exit Status122270
 -Node: Include Files122945
 -Node: Obsolete126430
 -Node: Undocumented127116
 -Node: Regexp127357
 -Node: Regexp Usage128746
 -Node: Escape Sequences130772
 -Node: Regexp Operators136535
 -Ref: Regexp Operators-Footnote-1143915
 -Ref: Regexp Operators-Footnote-2144062
 -Node: Bracket Expressions144160
 -Ref: table-char-classes146050
 -Node: GNU Regexp Operators148573
 -Node: Case-sensitivity152296
 -Ref: Case-sensitivity-Footnote-1155264
 -Ref: Case-sensitivity-Footnote-2155499
 -Node: Leftmost Longest155607
 -Node: Computed Regexps156808
 -Node: Reading Files160218
 -Node: Records162159
 -Ref: Records-Footnote-1171083
 -Node: Fields171120
 -Ref: Fields-Footnote-1174153
 -Node: Nonconstant Fields174239
 -Node: Changing Fields176441
 -Node: Field Separators182422
 -Node: Default Field Splitting185051
 -Node: Regexp Field Splitting186168
 -Node: Single Character Fields189510
 -Node: Command Line Field Separator190569
 -Node: Field Splitting Summary194010
 -Ref: Field Splitting Summary-Footnote-1197202
 -Node: Constant Size197303
 -Node: Splitting By Content201887
 -Ref: Splitting By Content-Footnote-1205613
 -Node: Multiple Line205653
 -Ref: Multiple Line-Footnote-1211500
 -Node: Getline211679
 -Node: Plain Getline213907
 -Node: Getline/Variable215996
 -Node: Getline/File217137
 -Node: Getline/Variable/File218459
 -Ref: Getline/Variable/File-Footnote-1220058
 -Node: Getline/Pipe220145
 -Node: Getline/Variable/Pipe222705
 -Node: Getline/Coprocess223812
 -Node: Getline/Variable/Coprocess225055
 -Node: Getline Notes225769
 -Node: Getline Summary228556
 -Ref: table-getline-variants228899
 -Node: Command line directories229755
 -Node: Printing230380
 -Node: Print232011
 -Node: Print Examples233348
 -Node: Output Separators236132
 -Node: OFMT237892
 -Node: Printf239250
 -Node: Basic Printf240156
 -Node: Control Letters241695
 -Node: Format Modifiers245507
 -Node: Printf Examples251516
 -Node: Redirection254231
 -Node: Special Files261215
 -Node: Special FD261748
 -Ref: Special FD-Footnote-1265373
 -Node: Special Network265447
 -Node: Special Caveats266297
 -Node: Close Files And Pipes267093
 -Ref: Close Files And Pipes-Footnote-1274116
 -Ref: Close Files And Pipes-Footnote-2274264
 -Node: Expressions274414
 -Node: Values275546
 -Node: Constants276222
 -Node: Scalar Constants276902
 -Ref: Scalar Constants-Footnote-1277761
 -Node: Nondecimal-numbers277943
 -Node: Regexp Constants281002
 -Node: Using Constant Regexps281477
 -Node: Variables284532
 -Node: Using Variables285187
 -Node: Assignment Options286911
 -Node: Conversion288783
 -Ref: table-locale-affects294159
 -Ref: Conversion-Footnote-1294783
 -Node: All Operators294892
 -Node: Arithmetic Ops295522
 -Node: Concatenation298027
 -Ref: Concatenation-Footnote-1300820
 -Node: Assignment Ops300940
 -Ref: table-assign-ops305928
 -Node: Increment Ops307336
 -Node: Truth Values and Conditions310806
 -Node: Truth Values311889
 -Node: Typing and Comparison312938
 -Node: Variable Typing313727
 -Ref: Variable Typing-Footnote-1317624
 -Node: Comparison Operators317746
 -Ref: table-relational-ops318156
 -Node: POSIX String Comparison321705
 -Ref: POSIX String Comparison-Footnote-1322661
 -Node: Boolean Ops322799
 -Ref: Boolean Ops-Footnote-1326877
 -Node: Conditional Exp326968
 -Node: Function Calls328700
 -Node: Precedence332294
 -Node: Locales335963
 -Node: Patterns and Actions337052
 -Node: Pattern Overview338106
 -Node: Regexp Patterns339775
 -Node: Expression Patterns340318
 -Node: Ranges344003
 -Node: BEGIN/END346969
 -Node: Using BEGIN/END347731
 -Ref: Using BEGIN/END-Footnote-1350462
 -Node: I/O And BEGIN/END350568
 -Node: BEGINFILE/ENDFILE352850
 -Node: Empty355743
 -Node: Using Shell Variables356059
 -Node: Action Overview358344
 -Node: Statements360701
 -Node: If Statement362555
 -Node: While Statement364054
 -Node: Do Statement366098
 -Node: For Statement367254
 -Node: Switch Statement370406
 -Node: Break Statement372503
 -Node: Continue Statement374493
 -Node: Next Statement376286
 -Node: Nextfile Statement378676
 -Node: Exit Statement381221
 -Node: Built-in Variables383637
 -Node: User-modified384732
 -Ref: User-modified-Footnote-1392758
 -Node: Auto-set392820
 -Ref: Auto-set-Footnote-1402111
 -Node: ARGC and ARGV402316
 -Node: Arrays406167
 -Node: Array Basics407672
 -Node: Array Intro408498
 -Node: Reference to Elements412816
 -Node: Assigning Elements415086
 -Node: Array Example415577
 -Node: Scanning an Array417309
 -Node: Controlling Scanning419623
 -Ref: Controlling Scanning-Footnote-1424556
 -Node: Delete424872
 -Ref: Delete-Footnote-1427307
 -Node: Numeric Array Subscripts427364
 -Node: Uninitialized Subscripts429547
 -Node: Multi-dimensional431175
 -Node: Multi-scanning434269
 -Node: Arrays of Arrays435860
 -Node: Functions440505
 -Node: Built-in441327
 -Node: Calling Built-in442405
 -Node: Numeric Functions444393
 -Ref: Numeric Functions-Footnote-1448225
 -Ref: Numeric Functions-Footnote-2448582
 -Ref: Numeric Functions-Footnote-3448630
 -Node: String Functions448899
 -Ref: String Functions-Footnote-1472396
 -Ref: String Functions-Footnote-2472525
 -Ref: String Functions-Footnote-3472773
 -Node: Gory Details472860
 -Ref: table-sub-escapes474539
 -Ref: table-sub-posix-92475893
 -Ref: table-sub-proposed477236
 -Ref: table-posix-sub478586
 -Ref: table-gensub-escapes480132
 -Ref: Gory Details-Footnote-1481339
 -Ref: Gory Details-Footnote-2481390
 -Node: I/O Functions481541
 -Ref: I/O Functions-Footnote-1488196
 -Node: Time Functions488343
 -Ref: Time Functions-Footnote-1499235
 -Ref: Time Functions-Footnote-2499303
 -Ref: Time Functions-Footnote-3499461
 -Ref: Time Functions-Footnote-4499572
 -Ref: Time Functions-Footnote-5499684
 -Ref: Time Functions-Footnote-6499911
 -Node: Bitwise Functions500177
 -Ref: table-bitwise-ops500735
 -Ref: Bitwise Functions-Footnote-1504895
 -Node: Type Functions505079
 -Node: I18N Functions505549
 -Node: User-defined507176
 -Node: Definition Syntax507980
 -Ref: Definition Syntax-Footnote-1512890
 -Node: Function Example512959
 -Node: Function Caveats515553
 -Node: Calling A Function515974
 -Node: Variable Scope517089
 -Node: Pass By Value/Reference519064
 -Node: Return Statement522504
 -Node: Dynamic Typing525485
 -Node: Indirect Calls526220
 -Node: Internationalization535905
 -Node: I18N and L10N537331
 -Node: Explaining gettext538017
 -Ref: Explaining gettext-Footnote-1543083
 -Ref: Explaining gettext-Footnote-2543267
 -Node: Programmer i18n543432
 -Node: Translator i18n547632
 -Node: String Extraction548425
 -Ref: String Extraction-Footnote-1549386
 -Node: Printf Ordering549472
 -Ref: Printf Ordering-Footnote-1552256
 -Node: I18N Portability552320
 -Ref: I18N Portability-Footnote-1554769
 -Node: I18N Example554832
 -Ref: I18N Example-Footnote-1557467
 -Node: Gawk I18N557539
 -Node: Advanced Features558156
 -Node: Nondecimal Data559669
 -Node: Array Sorting561252
 -Node: Controlling Array Traversal561949
 -Node: Array Sorting Functions570186
 -Ref: Array Sorting Functions-Footnote-1573860
 -Ref: Array Sorting Functions-Footnote-2573953
 -Node: Two-way I/O574147
 -Ref: Two-way I/O-Footnote-1579579
 -Node: TCP/IP Networking579649
 -Node: Profiling582493
 -Node: Library Functions589967
 -Ref: Library Functions-Footnote-1592974
 -Node: Library Names593145
 -Ref: Library Names-Footnote-1596616
 -Ref: Library Names-Footnote-2596836
 -Node: General Functions596922
 -Node: Strtonum Function597875
 -Node: Assert Function600805
 -Node: Round Function604131
 -Node: Cliff Random Function605674
 -Node: Ordinal Functions606690
 -Ref: Ordinal Functions-Footnote-1609760
 -Ref: Ordinal Functions-Footnote-2610012
 -Node: Join Function610221
 -Ref: Join Function-Footnote-1611992
 -Node: Gettimeofday Function612192
 -Node: Data File Management615907
 -Node: Filetrans Function616539
 -Node: Rewind Function620678
 -Node: File Checking622065
 -Node: Empty Files623159
 -Node: Ignoring Assigns625389
 -Node: Getopt Function626942
 -Ref: Getopt Function-Footnote-1638246
 -Node: Passwd Functions638449
 -Ref: Passwd Functions-Footnote-1647424
 -Node: Group Functions647512
 -Node: Walking Arrays655596
 -Node: Sample Programs657165
 -Node: Running Examples657830
 -Node: Clones658558
 -Node: Cut Program659782
 -Node: Egrep Program669627
 -Ref: Egrep Program-Footnote-1677400
 -Node: Id Program677510
 -Node: Split Program681126
 -Ref: Split Program-Footnote-1684645
 -Node: Tee Program684773
 -Node: Uniq Program687576
 -Node: Wc Program695005
 -Ref: Wc Program-Footnote-1699271
 -Ref: Wc Program-Footnote-2699471
 -Node: Miscellaneous Programs699563
 -Node: Dupword Program700751
 -Node: Alarm Program702782
 -Node: Translate Program707531
 -Ref: Translate Program-Footnote-1711918
 -Ref: Translate Program-Footnote-2712146
 -Node: Labels Program712280
 -Ref: Labels Program-Footnote-1715651
 -Node: Word Sorting715735
 -Node: History Sorting719619
 -Node: Extract Program721458
 -Ref: Extract Program-Footnote-1728941
 -Node: Simple Sed729069
 -Node: Igawk Program732131
 -Ref: Igawk Program-Footnote-1747288
 -Ref: Igawk Program-Footnote-2747489
 -Node: Anagram Program747627
 -Node: Signature Program750695
 -Node: Debugger751795
 -Node: Debugging752706
 -Node: Debugging Concepts753119
 -Node: Debugging Terms754975
 -Node: Awk Debugging757598
 -Node: Sample dgawk session758490
 -Node: dgawk invocation758982
 -Node: Finding The Bug760164
 -Node: List of Debugger Commands766650
 -Node: Breakpoint Control767961
 -Node: Dgawk Execution Control771597
 -Node: Viewing And Changing Data774948
 -Node: Dgawk Stack778285
 -Node: Dgawk Info779745
 -Node: Miscellaneous Dgawk Commands783693
 -Node: Readline Support789121
 -Node: Dgawk Limitations789959
 -Node: Language History792148
 -Node: V7/SVR3.1793660
 -Node: SVR4795981
 -Node: POSIX797423
 -Node: BTL798431
 -Node: POSIX/GNU799165
 -Node: Common Extensions804316
 -Node: Ranges and Locales805423
 -Ref: Ranges and Locales-Footnote-1810041
 -Ref: Ranges and Locales-Footnote-2810068
 -Ref: Ranges and Locales-Footnote-3810328
 -Node: Contributors810549
 -Node: Installation814811
 -Node: Gawk Distribution815705
 -Node: Getting816189
 -Node: Extracting817015
 -Node: Distribution contents818707
 -Node: Unix Installation823929
 -Node: Quick Installation824546
 -Node: Additional Configuration Options826508
 -Node: Configuration Philosophy827985
 -Node: Non-Unix Installation830327
 -Node: PC Installation830785
 -Node: PC Binary Installation832084
 -Node: PC Compiling834099
 -Node: PC Testing837043
 -Node: PC Using838219
 -Node: Cygwin842404
 -Node: MSYS843404
 -Node: VMS Installation843918
 -Node: VMS Compilation844521
 -Ref: VMS Compilation-Footnote-1845528
 -Node: VMS Installation Details845586
 -Node: VMS Running847221
 -Node: VMS Old Gawk848828
 -Node: Bugs849302
 -Node: Other Versions853154
 -Node: Notes858435
 -Node: Compatibility Mode859127
 -Node: Additions859910
 -Node: Accessing The Source860722
 -Node: Adding Code862147
 -Node: New Ports868114
 -Node: Dynamic Extensions872227
 -Node: Internals873603
 -Node: Plugin License882706
 -Node: Sample Library883340
 -Node: Internal File Description884026
 -Node: Internal File Ops887741
 -Ref: Internal File Ops-Footnote-1892522
 -Node: Using Internal File Ops892662
 -Node: Future Extensions895039
 -Node: Basic Concepts897543
 -Node: Basic High Level898300
 -Ref: Basic High Level-Footnote-1902335
 -Node: Basic Data Typing902520
 -Node: Floating Point Issues907045
 -Node: String Conversion Precision908128
 -Ref: String Conversion Precision-Footnote-1909828
 -Node: Unexpected Results909937
 -Node: POSIX Floating Point Problems911763
 -Ref: POSIX Floating Point Problems-Footnote-1915468
 -Node: Glossary915506
 -Node: Copying940482
 -Node: GNU Free Documentation License978039
 -Node: Index1003176
 +Node: Foreword31871
 +Node: Preface36216
 +Ref: Preface-Footnote-139269
 +Ref: Preface-Footnote-239375
 +Node: History39607
 +Node: Names41998
 +Ref: Names-Footnote-143475
 +Node: This Manual43547
- Ref: This Manual-Footnote-148556
- Node: Conventions48656
- Node: Manual History50790
- Ref: Manual History-Footnote-154060
- Ref: Manual History-Footnote-254101
- Node: How To Contribute54175
- Node: Acknowledgments55319
- Node: Getting Started59815
- Node: Running gawk62194
- Node: One-shot63380
- Node: Read Terminal64605
- Ref: Read Terminal-Footnote-166255
- Ref: Read Terminal-Footnote-266531
- Node: Long66702
- Node: Executable Scripts68078
- Ref: Executable Scripts-Footnote-169947
- Ref: Executable Scripts-Footnote-270049
- Node: Comments70596
- Node: Quoting73063
- Node: DOS Quoting77686
- Node: Sample Data Files78361
- Node: Very Simple81393
- Node: Two Rules85992
- Node: More Complex88139
- Ref: More Complex-Footnote-191069
- Node: Statements/Lines91154
- Ref: Statements/Lines-Footnote-195616
- Node: Other Features95881
- Node: When96809
- Node: Invoking Gawk98956
- Node: Command Line100417
- Node: Options101200
- Ref: Options-Footnote-1116598
- Node: Other Arguments116623
- Node: Naming Standard Input119281
- Node: Environment Variables120375
- Node: AWKPATH Variable120933
- Ref: AWKPATH Variable-Footnote-1123691
- Node: AWKLIBPATH Variable123951
- Node: Other Environment Variables124548
- Node: Exit Status127043
- Node: Include Files127718
- Node: Loading Shared Libraries131287
- Node: Obsolete132512
- Node: Undocumented133209
- Node: Regexp133452
- Node: Regexp Usage134841
- Node: Escape Sequences136867
- Node: Regexp Operators142630
- Ref: Regexp Operators-Footnote-1150010
- Ref: Regexp Operators-Footnote-2150157
- Node: Bracket Expressions150255
- Ref: table-char-classes152145
- Node: GNU Regexp Operators154668
- Node: Case-sensitivity158391
- Ref: Case-sensitivity-Footnote-1161359
- Ref: Case-sensitivity-Footnote-2161594
- Node: Leftmost Longest161702
- Node: Computed Regexps162903
- Node: Reading Files166313
- Node: Records168316
- Ref: Records-Footnote-1177240
- Node: Fields177277
- Ref: Fields-Footnote-1180310
- Node: Nonconstant Fields180396
- Node: Changing Fields182598
- Node: Field Separators188579
- Node: Default Field Splitting191208
- Node: Regexp Field Splitting192325
- Node: Single Character Fields195667
- Node: Command Line Field Separator196726
- Node: Field Splitting Summary200167
- Ref: Field Splitting Summary-Footnote-1203359
- Node: Constant Size203460
- Node: Splitting By Content208044
- Ref: Splitting By Content-Footnote-1211770
- Node: Multiple Line211810
- Ref: Multiple Line-Footnote-1217657
- Node: Getline217836
- Node: Plain Getline220052
- Node: Getline/Variable222141
- Node: Getline/File223282
- Node: Getline/Variable/File224604
- Ref: Getline/Variable/File-Footnote-1226203
- Node: Getline/Pipe226290
- Node: Getline/Variable/Pipe228850
- Node: Getline/Coprocess229957
- Node: Getline/Variable/Coprocess231200
- Node: Getline Notes231914
- Node: Getline Summary234701
- Ref: table-getline-variants235109
- Node: Read Timeout235965
- Ref: Read Timeout-Footnote-1239710
- Node: Command line directories239767
- Node: Printing240397
- Node: Print242028
- Node: Print Examples243365
- Node: Output Separators246149
- Node: OFMT247909
- Node: Printf249267
- Node: Basic Printf250173
- Node: Control Letters251712
- Node: Format Modifiers255524
- Node: Printf Examples261533
- Node: Redirection264248
- Node: Special Files271232
- Node: Special FD271765
- Ref: Special FD-Footnote-1275390
- Node: Special Network275464
- Node: Special Caveats276314
- Node: Close Files And Pipes277110
- Ref: Close Files And Pipes-Footnote-1284133
- Ref: Close Files And Pipes-Footnote-2284281
- Node: Expressions284431
- Node: Values285563
- Node: Constants286239
- Node: Scalar Constants286919
- Ref: Scalar Constants-Footnote-1287778
- Node: Nondecimal-numbers287960
- Node: Regexp Constants291019
- Node: Using Constant Regexps291494
- Node: Variables294549
- Node: Using Variables295204
- Node: Assignment Options296928
- Node: Conversion298800
- Ref: table-locale-affects304176
- Ref: Conversion-Footnote-1304800
- Node: All Operators304909
- Node: Arithmetic Ops305539
- Node: Concatenation308044
- Ref: Concatenation-Footnote-1310837
- Node: Assignment Ops310957
- Ref: table-assign-ops315945
- Node: Increment Ops317353
- Node: Truth Values and Conditions320823
- Node: Truth Values321906
- Node: Typing and Comparison322955
- Node: Variable Typing323744
- Ref: Variable Typing-Footnote-1327641
- Node: Comparison Operators327763
- Ref: table-relational-ops328173
- Node: POSIX String Comparison331722
- Ref: POSIX String Comparison-Footnote-1332678
- Node: Boolean Ops332816
- Ref: Boolean Ops-Footnote-1336894
- Node: Conditional Exp336985
- Node: Function Calls338717
- Node: Precedence342311
- Node: Locales345980
- Node: Patterns and Actions347069
- Node: Pattern Overview348123
- Node: Regexp Patterns349792
- Node: Expression Patterns350335
- Node: Ranges354020
- Node: BEGIN/END356986
- Node: Using BEGIN/END357748
- Ref: Using BEGIN/END-Footnote-1360479
- Node: I/O And BEGIN/END360585
- Node: BEGINFILE/ENDFILE362867
- Node: Empty365771
- Node: Using Shell Variables366087
- Node: Action Overview368372
- Node: Statements370729
- Node: If Statement372583
- Node: While Statement374082
- Node: Do Statement376126
- Node: For Statement377282
- Node: Switch Statement380434
- Node: Break Statement382531
- Node: Continue Statement384521
- Node: Next Statement386314
- Node: Nextfile Statement388704
- Node: Exit Statement391249
- Node: Built-in Variables393665
- Node: User-modified394760
- Ref: User-modified-Footnote-1403115
- Node: Auto-set403177
- Ref: Auto-set-Footnote-1413085
- Node: ARGC and ARGV413290
- Node: Arrays417141
- Node: Array Basics418646
- Node: Array Intro419472
- Node: Reference to Elements423790
- Node: Assigning Elements426060
- Node: Array Example426551
- Node: Scanning an Array428283
- Node: Controlling Scanning430597
- Ref: Controlling Scanning-Footnote-1435530
- Node: Delete435846
- Ref: Delete-Footnote-1438281
- Node: Numeric Array Subscripts438338
- Node: Uninitialized Subscripts440521
- Node: Multi-dimensional442149
- Node: Multi-scanning445243
- Node: Arrays of Arrays446834
- Node: Functions451479
- Node: Built-in452301
- Node: Calling Built-in453379
- Node: Numeric Functions455367
- Ref: Numeric Functions-Footnote-1459199
- Ref: Numeric Functions-Footnote-2459556
- Ref: Numeric Functions-Footnote-3459604
- Node: String Functions459873
- Ref: String Functions-Footnote-1483370
- Ref: String Functions-Footnote-2483499
- Ref: String Functions-Footnote-3483747
- Node: Gory Details483834
- Ref: table-sub-escapes485513
- Ref: table-sub-posix-92486867
- Ref: table-sub-proposed488210
- Ref: table-posix-sub489560
- Ref: table-gensub-escapes491106
- Ref: Gory Details-Footnote-1492313
- Ref: Gory Details-Footnote-2492364
- Node: I/O Functions492515
- Ref: I/O Functions-Footnote-1499170
- Node: Time Functions499317
- Ref: Time Functions-Footnote-1510209
- Ref: Time Functions-Footnote-2510277
- Ref: Time Functions-Footnote-3510435
- Ref: Time Functions-Footnote-4510546
- Ref: Time Functions-Footnote-5510658
- Ref: Time Functions-Footnote-6510885
- Node: Bitwise Functions511151
- Ref: table-bitwise-ops511709
- Ref: Bitwise Functions-Footnote-1515930
- Node: Type Functions516114
- Node: I18N Functions516584
- Node: User-defined518211
- Node: Definition Syntax519015
- Ref: Definition Syntax-Footnote-1523925
- Node: Function Example523994
- Node: Function Caveats526588
- Node: Calling A Function527009
- Node: Variable Scope528124
- Node: Pass By Value/Reference530099
- Node: Return Statement533539
- Node: Dynamic Typing536520
- Node: Indirect Calls537255
- Node: Internationalization546940
- Node: I18N and L10N548379
- Node: Explaining gettext549065
- Ref: Explaining gettext-Footnote-1554131
- Ref: Explaining gettext-Footnote-2554315
- Node: Programmer i18n554480
- Node: Translator i18n558680
- Node: String Extraction559473
- Ref: String Extraction-Footnote-1560434
- Node: Printf Ordering560520
- Ref: Printf Ordering-Footnote-1563304
- Node: I18N Portability563368
- Ref: I18N Portability-Footnote-1565817
- Node: I18N Example565880
- Ref: I18N Example-Footnote-1568515
- Node: Gawk I18N568587
- Node: Advanced Features569204
- Node: Nondecimal Data570727
- Node: Array Sorting572310
- Node: Controlling Array Traversal573007
- Node: Array Sorting Functions581244
- Ref: Array Sorting Functions-Footnote-1584918
- Ref: Array Sorting Functions-Footnote-2585011
- Node: Two-way I/O585205
- Ref: Two-way I/O-Footnote-1590637
- Node: TCP/IP Networking590707
- Node: Profiling593551
- Node: Library Functions601005
- Ref: Library Functions-Footnote-1604012
- Node: Library Names604183
- Ref: Library Names-Footnote-1607654
- Ref: Library Names-Footnote-2607874
- Node: General Functions607960
- Node: Strtonum Function608913
- Node: Assert Function611843
- Node: Round Function615169
- Node: Cliff Random Function616712
- Node: Ordinal Functions617728
- Ref: Ordinal Functions-Footnote-1620798
- Ref: Ordinal Functions-Footnote-2621050
- Node: Join Function621259
- Ref: Join Function-Footnote-1623030
- Node: Getlocaltime Function623230
- Node: Data File Management626945
- Node: Filetrans Function627577
- Node: Rewind Function631716
- Node: File Checking633103
- Node: Empty Files634197
- Node: Ignoring Assigns636427
- Node: Getopt Function637980
- Ref: Getopt Function-Footnote-1649284
- Node: Passwd Functions649487
- Ref: Passwd Functions-Footnote-1658462
- Node: Group Functions658550
- Node: Walking Arrays666634
- Node: Sample Programs668203
- Node: Running Examples668868
- Node: Clones669596
- Node: Cut Program670820
- Node: Egrep Program680665
- Ref: Egrep Program-Footnote-1688438
- Node: Id Program688548
- Node: Split Program692164
- Ref: Split Program-Footnote-1695683
- Node: Tee Program695811
- Node: Uniq Program698614
- Node: Wc Program706043
- Ref: Wc Program-Footnote-1710309
- Ref: Wc Program-Footnote-2710509
- Node: Miscellaneous Programs710601
- Node: Dupword Program711789
- Node: Alarm Program713820
- Node: Translate Program718569
- Ref: Translate Program-Footnote-1722956
- Ref: Translate Program-Footnote-2723184
- Node: Labels Program723318
- Ref: Labels Program-Footnote-1726689
- Node: Word Sorting726773
- Node: History Sorting730657
- Node: Extract Program732496
- Ref: Extract Program-Footnote-1739979
- Node: Simple Sed740107
- Node: Igawk Program743169
- Ref: Igawk Program-Footnote-1758326
- Ref: Igawk Program-Footnote-2758527
- Node: Anagram Program758665
- Node: Signature Program761733
- Node: Debugger762833
- Node: Debugging763787
- Node: Debugging Concepts764220
- Node: Debugging Terms766076
- Node: Awk Debugging768673
- Node: Sample Debugging Session769565
- Node: Debugger Invocation770085
- Node: Finding The Bug771414
- Node: List of Debugger Commands777902
- Node: Breakpoint Control779236
- Node: Debugger Execution Control782900
- Node: Viewing And Changing Data786260
- Node: Execution Stack789616
- Node: Debugger Info791083
- Node: Miscellaneous Debugger Commands795064
- Node: Readline Support800509
- Node: Limitations801340
- Node: Dynamic Extensions803592
- Node: Plugin License804488
- Node: Sample Library805102
- Node: Internal File Description805786
- Node: Internal File Ops809499
- Ref: Internal File Ops-Footnote-1814062
- Node: Using Internal File Ops814202
- Node: Arbitrary Precision Arithmetic816578
- Ref: Arbitrary Precision Arithmetic-Footnote-1818230
- Node: General Arithmetic818378
- Node: Floating Point Issues820098
- Node: String Conversion Precision821193
- Ref: String Conversion Precision-Footnote-1822899
- Node: Unexpected Results823008
- Node: POSIX Floating Point Problems825161
- Ref: POSIX Floating Point Problems-Footnote-1828986
- Node: Integer Programming829024
- Node: Floating-point Programming830772
- Ref: Floating-point Programming-Footnote-1837036
- Node: Floating-point Representation837300
- Node: Floating-point Context838467
- Ref: table-ieee-formats839309
- Node: Rounding Mode840693
- Ref: table-rounding-modes841172
- Ref: Rounding Mode-Footnote-1844176
- Node: Gawk and MPFR844357
- Node: Arbitrary Precision Floats845598
- Ref: Arbitrary Precision Floats-Footnote-1848020
- Node: Setting Precision848331
- Node: Setting Rounding Mode851058
- Ref: table-gawk-rounding-modes851462
- Node: Floating-point Constants852659
- Node: Changing Precision854081
- Ref: Changing Precision-Footnote-1855481
- Node: Exact Arithmetic855655
- Node: Arbitrary Precision Integers858753
- Ref: Arbitrary Precision Integers-Footnote-1861835
- Node: Language History861982
- Node: V7/SVR3.1863504
- Node: SVR4865825
- Node: POSIX867267
- Node: BTL868275
- Node: POSIX/GNU869009
- Node: Common Extensions874544
- Node: Ranges and Locales875651
- Ref: Ranges and Locales-Footnote-1880269
- Ref: Ranges and Locales-Footnote-2880296
- Ref: Ranges and Locales-Footnote-3880556
- Node: Contributors880777
- Node: Installation885073
- Node: Gawk Distribution885967
- Node: Getting886451
- Node: Extracting887277
- Node: Distribution contents888969
- Node: Unix Installation894191
- Node: Quick Installation894808
- Node: Additional Configuration Options896770
- Node: Configuration Philosophy898247
- Node: Non-Unix Installation900589
- Node: PC Installation901047
- Node: PC Binary Installation902346
- Node: PC Compiling904194
- Node: PC Testing907138
- Node: PC Using908314
- Node: Cygwin912499
- Node: MSYS913499
- Node: VMS Installation914013
- Node: VMS Compilation914616
- Ref: VMS Compilation-Footnote-1915623
- Node: VMS Installation Details915681
- Node: VMS Running917316
- Node: VMS Old Gawk918923
- Node: Bugs919397
- Node: Other Versions923249
- Node: Notes928564
- Node: Compatibility Mode929151
- Node: Additions929934
- Node: Accessing The Source930861
- Node: Adding Code932286
- Node: New Ports938294
- Node: Derived Files942429
- Ref: Derived Files-Footnote-1947733
- Ref: Derived Files-Footnote-2947767
- Ref: Derived Files-Footnote-3948367
- Node: Future Extensions948465
- Node: Basic Concepts949952
- Node: Basic High Level950633
- Ref: Basic High Level-Footnote-1954668
- Node: Basic Data Typing954853
- Node: Glossary958208
- Node: Copying983184
- Node: GNU Free Documentation License1020741
- Node: Index1045878
++Ref: This Manual-Footnote-148675
++Node: Conventions48775
++Node: Manual History50909
++Ref: Manual History-Footnote-154179
++Ref: Manual History-Footnote-254220
++Node: How To Contribute54294
++Node: Acknowledgments55438
++Node: Getting Started59934
++Node: Running gawk62313
++Node: One-shot63499
++Node: Read Terminal64724
++Ref: Read Terminal-Footnote-166374
++Ref: Read Terminal-Footnote-266650
++Node: Long66821
++Node: Executable Scripts68197
++Ref: Executable Scripts-Footnote-170066
++Ref: Executable Scripts-Footnote-270168
++Node: Comments70715
++Node: Quoting73182
++Node: DOS Quoting77805
++Node: Sample Data Files78480
++Node: Very Simple81512
++Node: Two Rules86111
++Node: More Complex88258
++Ref: More Complex-Footnote-191188
++Node: Statements/Lines91273
++Ref: Statements/Lines-Footnote-195735
++Node: Other Features96000
++Node: When96928
++Node: Invoking Gawk99075
++Node: Command Line100536
++Node: Options101319
++Ref: Options-Footnote-1116717
++Node: Other Arguments116742
++Node: Naming Standard Input119400
++Node: Environment Variables120494
++Node: AWKPATH Variable121052
++Ref: AWKPATH Variable-Footnote-1123810
++Node: AWKLIBPATH Variable124070
++Node: Other Environment Variables124667
++Node: Exit Status127162
++Node: Include Files127837
++Node: Loading Shared Libraries131406
++Node: Obsolete132631
++Node: Undocumented133328
++Node: Regexp133571
++Node: Regexp Usage134960
++Node: Escape Sequences136986
++Node: Regexp Operators142749
++Ref: Regexp Operators-Footnote-1150129
++Ref: Regexp Operators-Footnote-2150276
++Node: Bracket Expressions150374
++Ref: table-char-classes152264
++Node: GNU Regexp Operators154787
++Node: Case-sensitivity158510
++Ref: Case-sensitivity-Footnote-1161478
++Ref: Case-sensitivity-Footnote-2161713
++Node: Leftmost Longest161821
++Node: Computed Regexps163022
++Node: Reading Files166432
++Node: Records168435
++Ref: Records-Footnote-1177359
++Node: Fields177396
++Ref: Fields-Footnote-1180429
++Node: Nonconstant Fields180515
++Node: Changing Fields182717
++Node: Field Separators188698
++Node: Default Field Splitting191327
++Node: Regexp Field Splitting192444
++Node: Single Character Fields195786
++Node: Command Line Field Separator196845
++Node: Field Splitting Summary200286
++Ref: Field Splitting Summary-Footnote-1203478
++Node: Constant Size203579
++Node: Splitting By Content208163
++Ref: Splitting By Content-Footnote-1211889
++Node: Multiple Line211929
++Ref: Multiple Line-Footnote-1217776
++Node: Getline217955
++Node: Plain Getline220171
++Node: Getline/Variable222260
++Node: Getline/File223401
++Node: Getline/Variable/File224723
++Ref: Getline/Variable/File-Footnote-1226322
++Node: Getline/Pipe226409
++Node: Getline/Variable/Pipe228969
++Node: Getline/Coprocess230076
++Node: Getline/Variable/Coprocess231319
++Node: Getline Notes232033
++Node: Getline Summary234820
++Ref: table-getline-variants235228
++Node: Read Timeout236084
++Ref: Read Timeout-Footnote-1239829
++Node: Command line directories239886
++Node: Printing240516
++Node: Print242147
++Node: Print Examples243484
++Node: Output Separators246268
++Node: OFMT248028
++Node: Printf249386
++Node: Basic Printf250292
++Node: Control Letters251831
++Node: Format Modifiers255643
++Node: Printf Examples261652
++Node: Redirection264367
++Node: Special Files271351
++Node: Special FD271884
++Ref: Special FD-Footnote-1275509
++Node: Special Network275583
++Node: Special Caveats276433
++Node: Close Files And Pipes277229
++Ref: Close Files And Pipes-Footnote-1284252
++Ref: Close Files And Pipes-Footnote-2284400
++Node: Expressions284550
++Node: Values285682
++Node: Constants286358
++Node: Scalar Constants287038
++Ref: Scalar Constants-Footnote-1287897
++Node: Nondecimal-numbers288079
++Node: Regexp Constants291138
++Node: Using Constant Regexps291613
++Node: Variables294668
++Node: Using Variables295323
++Node: Assignment Options297047
++Node: Conversion298919
++Ref: table-locale-affects304295
++Ref: Conversion-Footnote-1304919
++Node: All Operators305028
++Node: Arithmetic Ops305658
++Node: Concatenation308163
++Ref: Concatenation-Footnote-1310956
++Node: Assignment Ops311076
++Ref: table-assign-ops316064
++Node: Increment Ops317472
++Node: Truth Values and Conditions320942
++Node: Truth Values322025
++Node: Typing and Comparison323074
++Node: Variable Typing323863
++Ref: Variable Typing-Footnote-1327760
++Node: Comparison Operators327882
++Ref: table-relational-ops328292
++Node: POSIX String Comparison331841
++Ref: POSIX String Comparison-Footnote-1332797
++Node: Boolean Ops332935
++Ref: Boolean Ops-Footnote-1337013
++Node: Conditional Exp337104
++Node: Function Calls338836
++Node: Precedence342430
++Node: Locales346099
++Node: Patterns and Actions347188
++Node: Pattern Overview348242
++Node: Regexp Patterns349911
++Node: Expression Patterns350454
++Node: Ranges354139
++Node: BEGIN/END357105
++Node: Using BEGIN/END357867
++Ref: Using BEGIN/END-Footnote-1360598
++Node: I/O And BEGIN/END360704
++Node: BEGINFILE/ENDFILE362986
++Node: Empty365890
++Node: Using Shell Variables366206
++Node: Action Overview368491
++Node: Statements370848
++Node: If Statement372702
++Node: While Statement374201
++Node: Do Statement376245
++Node: For Statement377401
++Node: Switch Statement380553
++Node: Break Statement382650
++Node: Continue Statement384640
++Node: Next Statement386433
++Node: Nextfile Statement388823
++Node: Exit Statement391368
++Node: Built-in Variables393784
++Node: User-modified394879
++Ref: User-modified-Footnote-1403234
++Node: Auto-set403296
++Ref: Auto-set-Footnote-1413204
++Node: ARGC and ARGV413409
++Node: Arrays417260
++Node: Array Basics418765
++Node: Array Intro419591
++Node: Reference to Elements423909
++Node: Assigning Elements426179
++Node: Array Example426670
++Node: Scanning an Array428402
++Node: Controlling Scanning430716
++Ref: Controlling Scanning-Footnote-1435649
++Node: Delete435965
++Ref: Delete-Footnote-1438400
++Node: Numeric Array Subscripts438457
++Node: Uninitialized Subscripts440640
++Node: Multi-dimensional442268
++Node: Multi-scanning445362
++Node: Arrays of Arrays446953
++Node: Functions451598
++Node: Built-in452420
++Node: Calling Built-in453498
++Node: Numeric Functions455486
++Ref: Numeric Functions-Footnote-1459318
++Ref: Numeric Functions-Footnote-2459675
++Ref: Numeric Functions-Footnote-3459723
++Node: String Functions459992
++Ref: String Functions-Footnote-1483489
++Ref: String Functions-Footnote-2483618
++Ref: String Functions-Footnote-3483866
++Node: Gory Details483953
++Ref: table-sub-escapes485632
++Ref: table-sub-posix-92486986
++Ref: table-sub-proposed488329
++Ref: table-posix-sub489679
++Ref: table-gensub-escapes491225
++Ref: Gory Details-Footnote-1492432
++Ref: Gory Details-Footnote-2492483
++Node: I/O Functions492634
++Ref: I/O Functions-Footnote-1499289
++Node: Time Functions499436
++Ref: Time Functions-Footnote-1510328
++Ref: Time Functions-Footnote-2510396
++Ref: Time Functions-Footnote-3510554
++Ref: Time Functions-Footnote-4510665
++Ref: Time Functions-Footnote-5510777
++Ref: Time Functions-Footnote-6511004
++Node: Bitwise Functions511270
++Ref: table-bitwise-ops511828
++Ref: Bitwise Functions-Footnote-1516049
++Node: Type Functions516233
++Node: I18N Functions516703
++Node: User-defined518330
++Node: Definition Syntax519134
++Ref: Definition Syntax-Footnote-1524044
++Node: Function Example524113
++Node: Function Caveats526707
++Node: Calling A Function527128
++Node: Variable Scope528243
++Node: Pass By Value/Reference530218
++Node: Return Statement533658
++Node: Dynamic Typing536639
++Node: Indirect Calls537374
++Node: Internationalization547059
++Node: I18N and L10N548485
++Node: Explaining gettext549171
++Ref: Explaining gettext-Footnote-1554237
++Ref: Explaining gettext-Footnote-2554421
++Node: Programmer i18n554586
++Node: Translator i18n558786
++Node: String Extraction559579
++Ref: String Extraction-Footnote-1560540
++Node: Printf Ordering560626
++Ref: Printf Ordering-Footnote-1563410
++Node: I18N Portability563474
++Ref: I18N Portability-Footnote-1565923
++Node: I18N Example565986
++Ref: I18N Example-Footnote-1568621
++Node: Gawk I18N568693
++Node: Advanced Features569310
++Node: Nondecimal Data570823
++Node: Array Sorting572406
++Node: Controlling Array Traversal573103
++Node: Array Sorting Functions581340
++Ref: Array Sorting Functions-Footnote-1585014
++Ref: Array Sorting Functions-Footnote-2585107
++Node: Two-way I/O585301
++Ref: Two-way I/O-Footnote-1590733
++Node: TCP/IP Networking590803
++Node: Profiling593647
++Node: Library Functions601101
++Ref: Library Functions-Footnote-1604108
++Node: Library Names604279
++Ref: Library Names-Footnote-1607750
++Ref: Library Names-Footnote-2607970
++Node: General Functions608056
++Node: Strtonum Function609009
++Node: Assert Function611939
++Node: Round Function615265
++Node: Cliff Random Function616808
++Node: Ordinal Functions617824
++Ref: Ordinal Functions-Footnote-1620894
++Ref: Ordinal Functions-Footnote-2621146
++Node: Join Function621355
++Ref: Join Function-Footnote-1623126
++Node: Getlocaltime Function623326
++Node: Data File Management627041
++Node: Filetrans Function627673
++Node: Rewind Function631812
++Node: File Checking633199
++Node: Empty Files634293
++Node: Ignoring Assigns636523
++Node: Getopt Function638076
++Ref: Getopt Function-Footnote-1649380
++Node: Passwd Functions649583
++Ref: Passwd Functions-Footnote-1658558
++Node: Group Functions658646
++Node: Walking Arrays666730
++Node: Sample Programs668299
++Node: Running Examples668964
++Node: Clones669692
++Node: Cut Program670916
++Node: Egrep Program680761
++Ref: Egrep Program-Footnote-1688534
++Node: Id Program688644
++Node: Split Program692260
++Ref: Split Program-Footnote-1695779
++Node: Tee Program695907
++Node: Uniq Program698710
++Node: Wc Program706139
++Ref: Wc Program-Footnote-1710405
++Ref: Wc Program-Footnote-2710605
++Node: Miscellaneous Programs710697
++Node: Dupword Program711885
++Node: Alarm Program713916
++Node: Translate Program718665
++Ref: Translate Program-Footnote-1723052
++Ref: Translate Program-Footnote-2723280
++Node: Labels Program723414
++Ref: Labels Program-Footnote-1726785
++Node: Word Sorting726869
++Node: History Sorting730753
++Node: Extract Program732592
++Ref: Extract Program-Footnote-1740075
++Node: Simple Sed740203
++Node: Igawk Program743265
++Ref: Igawk Program-Footnote-1758422
++Ref: Igawk Program-Footnote-2758623
++Node: Anagram Program758761
++Node: Signature Program761829
++Node: Debugger762929
++Node: Debugging763895
++Node: Debugging Concepts764328
++Node: Debugging Terms766184
++Node: Awk Debugging768781
++Node: Sample Debugging Session769673
++Node: Debugger Invocation770193
++Node: Finding The Bug771522
++Node: List of Debugger Commands778010
++Node: Breakpoint Control779344
++Node: Debugger Execution Control783008
++Node: Viewing And Changing Data786368
++Node: Execution Stack789724
++Node: Debugger Info791191
++Node: Miscellaneous Debugger Commands795172
++Node: Readline Support800617
++Node: Limitations801448
++Node: Arbitrary Precision Arithmetic803700
++Ref: Arbitrary Precision Arithmetic-Footnote-1805341
++Node: General Arithmetic805489
++Node: Floating Point Issues807209
++Node: String Conversion Precision808304
++Ref: String Conversion Precision-Footnote-1810010
++Node: Unexpected Results810119
++Node: POSIX Floating Point Problems812272
++Ref: POSIX Floating Point Problems-Footnote-1816097
++Node: Integer Programming816135
++Node: Floating-point Programming817883
++Ref: Floating-point Programming-Footnote-1824147
++Node: Floating-point Representation824411
++Node: Floating-point Context825578
++Ref: table-ieee-formats826420
++Node: Rounding Mode827804
++Ref: table-rounding-modes828283
++Ref: Rounding Mode-Footnote-1831287
++Node: Gawk and MPFR831468
++Node: Arbitrary Precision Floats832709
++Ref: Arbitrary Precision Floats-Footnote-1835131
++Node: Setting Precision835442
++Node: Setting Rounding Mode838169
++Ref: table-gawk-rounding-modes838573
++Node: Floating-point Constants839770
++Node: Changing Precision841192
++Ref: Changing Precision-Footnote-1842592
++Node: Exact Arithmetic842766
++Node: Arbitrary Precision Integers845864
++Ref: Arbitrary Precision Integers-Footnote-1848946
++Node: Dynamic Extensions849093
++Node: Plugin License850011
++Node: Sample Library850625
++Node: Internal File Description851309
++Node: Internal File Ops855022
++Ref: Internal File Ops-Footnote-1859585
++Node: Using Internal File Ops859725
++Node: Language History862101
++Node: V7/SVR3.1863623
++Node: SVR4865944
++Node: POSIX867386
++Node: BTL868394
++Node: POSIX/GNU869128
++Node: Common Extensions874663
++Node: Ranges and Locales875770
++Ref: Ranges and Locales-Footnote-1880388
++Ref: Ranges and Locales-Footnote-2880415
++Ref: Ranges and Locales-Footnote-3880675
++Node: Contributors880896
++Node: Installation885192
++Node: Gawk Distribution886086
++Node: Getting886570
++Node: Extracting887396
++Node: Distribution contents889088
++Node: Unix Installation894310
++Node: Quick Installation894927
++Node: Additional Configuration Options896889
++Node: Configuration Philosophy898366
++Node: Non-Unix Installation900708
++Node: PC Installation901166
++Node: PC Binary Installation902465
++Node: PC Compiling904313
++Node: PC Testing907257
++Node: PC Using908433
++Node: Cygwin912618
++Node: MSYS913618
++Node: VMS Installation914132
++Node: VMS Compilation914735
++Ref: VMS Compilation-Footnote-1915742
++Node: VMS Installation Details915800
++Node: VMS Running917435
++Node: VMS Old Gawk919042
++Node: Bugs919516
++Node: Other Versions923368
++Node: Notes928683
++Node: Compatibility Mode929270
++Node: Additions930053
++Node: Accessing The Source930980
++Node: Adding Code932405
++Node: New Ports938413
++Node: Derived Files942548
++Ref: Derived Files-Footnote-1947852
++Ref: Derived Files-Footnote-2947886
++Ref: Derived Files-Footnote-3948486
++Node: Future Extensions948584
++Node: Basic Concepts950071
++Node: Basic High Level950752
++Ref: Basic High Level-Footnote-1954787
++Node: Basic Data Typing954972
++Node: Glossary958327
++Node: Copying983303
++Node: GNU Free Documentation License1020860
++Node: Index1045997
  
  End Tag Table
diff --cc test/ChangeLog
index 5414bfc,f88b796..680954e
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@@ -1,121 -1,9 +1,127 @@@
+ 2012-08-26         Arnold D. Robbins     <address@hidden>
+ 
+       * Makefile.am (charasbytes): Revise test to canonicalize
+       whitespace. (For Mac OS X 10.5, at least.)
+       * charasbytes.ok: Updated.
+ 
 +2012-08-23         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (revout, revtwoway): New tests.
 +      * revout.awk, revout.ok, revtwoway.awk, revtwoway.ok: New files.
 +
 +2012-08-11         Andrew J. Schorr     <address@hidden>
 +
 +      * Makefile.am (EXTRA_DIST): Add inchello.awk and incdupe[4-7].ok.
 +      (GAWK_EXT_TESTS): Add incdupe[4-7].
 +      (incdupe[4-7]): New tests to ensure that mixing -f with include
 +      causes a fatal error.
 +      * incdupe[4-7].ok, inchello.awk: New files.
 +
 +2012-08-08         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (fts): New test.
 +      * fts.awk: New file.
 +
 +2012-07-30         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (assignconst): Use AWKPATH to get results that will
 +      be consistent no matter where the test is run.
 +      * assignconst.ok: Updated.
 +
 +2012-07-29         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (readdir): New test.
 +      * readdir0.awk, readdir.awk: New files.
 +
 +2012-07-16         Arnold D. Robbins     <address@hidden>
 +
 +      * fnmatch.awk, fnmatch.ok: Portability updates.
 +
 +2012-07-15         Arnold D. Robbins     <address@hidden>
 +
 +      * testext.ok: Update contents.
 +
 +2012-07-12         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (fnmatch): New test.
 +      * fnmatch.awk, fnmatch.ok: New files.
 +
 +      * Makefile.am (assignconst): New test.
 +      * assignconst.awk, assignconst.ok: New files.
 +
 +2012-06-28         Andrew J. Schorr     <address@hidden>
 +
 +      * time.awk: Avoid possibly throwing a spurious error by protecting
 +      a race condition that depends on the order of expression evaluation.
 +
 +2012-06-25         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (rwarray): New test.
 +      * rwarray.awk, rwarray.in, rwarray.ok: New files.
 +
 +2012-06-21         Arnold D. Robbins     <address@hidden>
 +
 +      * testext.ok: Update contents.
 +
 +2012-06-20         Arnold D. Robbins     <address@hidden>
 +
 +      * testext.ok: Update contents.
 +
 +2012-06-19         Arnold D. Robbins     <address@hidden>
 +
 +      * testext.ok: Update contents.
 +
 +2012-06-18         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (testext): New test.
 +      (EXTRA_DIST): Add new file testext.ok.
 +      (SHLIB_TESTS): Add testext.
 +      (clean): Add testext.awk to the list.
 +      * testext.ok: New file.
 +
 +2012-06-12         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (clean): Add fork.tmp.* to the list.
 +
 +2012-06-10         Andrew J. Schorr     <address@hidden>
 +
 +      * Makefile.am (EXTRA_DIST): Add new files time.awk and time.ok.
 +      (SHLIB_TESTS): Add time.
 +      * time.awk, time.ok: New files.
 +
 +2012-05-29         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (clean): Add readfile.ok to list of files to removed.
 +
 +2012-05-26         Andrew J. Schorr     <address@hidden>
 +
 +      * Makefile.am (readfile): Revert previous patch, and add comment
 +      explaining that we need to create readfile.ok on failure so that
 +      "make diffout" will work properly.
 +      (ordchr.awk, ordchr.ok): Add more tests to catch type conversion
 +      problems.
 +
 +2012-05-25         Arnold D. Robbins     <address@hidden>
 +
 +      * Makefile.am (readfile): Don't copy the Makefile over readfile.ok
 +      if there's a problem.
 +
 +2012-05-24         Andrew J. Schorr     <address@hidden>
 +
 +      * Makefile.am (fmtspcl, include2, incdupe, incdup2, incdupe3): Fix
 +      paths to work properly when built in another directory.
 +
 +2012-05-19         Andrew J. Schorr     <address@hidden>
 +
 +      * Makefile.am (EXTRA_DIST): Add new files hello.awk, inclib.awk,
 +      include.awk, include.ok, include2.ok, incdupe.ok, incdupe2.ok and
 +      incdupe3.ok.
 +      (GAWK_EXT_TESTS): Add include, include2, incdupe, incdupe2 and incdupe3.
 +      (include2, incdupe, incdupe2, incdupe3): New tests.
 +      * badargs.ok: Fix usage message to include new -i option.
 +      * hello.awk, incdupe.ok, incdupe2.ok, incdupe3.ok, inclib.awk,
 +      include.awk, include.ok, include2.ok: New files.
 +
  2012-08-12         Arnold D. Robbins     <address@hidden>
  
        * Makefile.am (regexprange): New test.

-----------------------------------------------------------------------

Summary of changes:
 NEWS                   |    4 +-
 command.c              |  405 +++----
 doc/gawk.info          | 3195 ++++++++++++++++++++++++------------------------
 extension/ChangeLog    |    8 +
 extension/configh.in   |   11 +
 extension/configure    |  202 +++
 extension/configure.ac |    1 +
 extension/filefuncs.c  |    5 +-
 extension/fnmatch.c    |    8 +-
 extension/fork.c       |    6 +-
 extension/ordchr.c     |    7 +-
 extension/readdir.c    |    7 +-
 extension/readfile.c   |    6 +-
 extension/revoutput.c  |    6 +-
 extension/revtwoway.c  |    8 +-
 extension/rwarray.c    |    4 +
 extension/rwarray0.c   |    4 +
 extension/testext.c    |    5 +-
 extension/time.c       |    6 +-
 test/ChangeLog         |    6 +
 test/Makefile.am       |    2 +-
 test/Makefile.in       |    2 +-
 test/charasbytes.ok    |    4 +-
 23 files changed, 2056 insertions(+), 1856 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]